Skip to content

Instantly share code, notes, and snippets.

@jaredwy
Created February 26, 2013 05:16
Show Gist options
  • Save jaredwy/5036096 to your computer and use it in GitHub Desktop.
Save jaredwy/5036096 to your computer and use it in GitHub Desktop.
diff --git a/LayoutTests/fast/borders/border-radius-parsing-expected.txt b/LayoutTests/fast/borders/border-radius-parsing-expected.txt
index e4618b0..f3dac8e 100644
--- a/LayoutTests/fast/borders/border-radius-parsing-expected.txt
+++ b/LayoutTests/fast/borders/border-radius-parsing-expected.txt
@@ -1,5 +1,15 @@
Testing border-radius: 10px;
SUCCESS
+Testing border-radius: 10px 20px 30px 40px;
+SUCCESS
+Testing border-radius: 10px 20px 30px 40px 50px;
+SUCCESS
+Testing border-radius: 10px 20px;
+SUCCESS
+Testing border-radius: 10px 20px;
+SUCCESS
+Testing border-radius: 10px;
+SUCCESS
Testing border-radius: 10px 20px;
SUCCESS
Testing -webkit-border-radius: 10px 20px;
diff --git a/LayoutTests/fast/borders/border-radius-parsing.html b/LayoutTests/fast/borders/border-radius-parsing.html
index ff1d9ca..3833fb7 100644
--- a/LayoutTests/fast/borders/border-radius-parsing.html
+++ b/LayoutTests/fast/borders/border-radius-parsing.html
@@ -1,14 +1,34 @@
<pre id="console"></pre>
<script>
+
function log(message)
{
document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}
- function testBorderRadiusValue(property, value, expectedRadii)
+ function testBorderRadiusStyleProperty(property, value, expected)
{
log ("Testing " + property + ": " + value + ";");
+ var element = document.createElement("div");
+ document.body.appendChild(element);
+ element.style.setProperty(property, value);
+ var failed = false;
+ if(element.style[property] !== expected) {
+ log("FAILED style: " + property + " was " + element.style[property] + " instead of " + expected);
+ failed = true;
+ }
+
+
+ if (!failed)
+ log("SUCCESS");
+
+ document.body.removeChild(element);
+ }
+
+ function testBorderRadiusValue(property, value, expectedRadii)
+ {
+ log ("Testing " + property + ": " + value + ";");
var element = document.createElement("div");
document.body.appendChild(element);
element.style.setProperty(property, value);
@@ -22,7 +42,7 @@
continue;
failed = true;
- log("FAILED: " + properties[i] + " was " + actualRadius + " instead of " + expectedRadii[i])
+ log("FAILED: " + properties[i] + " was " + actualRadius + " instead of " + expectedRadii[i]);
}
if (!failed)
log("SUCCESS");
@@ -32,6 +52,14 @@
if (window.testRunner)
testRunner.dumpAsText();
+
+
+ testBorderRadiusStyleProperty("border-radius", "10px", "10px", "10px", "10px", "10px");
+ testBorderRadiusStyleProperty("border-radius", "10px 20px 30px 40px", "10px 20px 30px 40px");
+ testBorderRadiusStyleProperty("border-radius", "10px 20px 30px 40px 50px", "");
+ testBorderRadiusStyleProperty("border-radius", "10px 20px", "10px 20px");
+
+ testBorderRadiusValue("border-radius", "10px 20px", ["10px", "20px", "10px", "20px"]);
testBorderRadiusValue("border-radius", "10px", ["10px", "10px", "10px", "10px"]);
testBorderRadiusValue("border-radius", "10px 20px", ["10px", "20px", "10px", "20px"]);
testBorderRadiusValue("-webkit-border-radius", "10px 20px", ["10px 20px", "10px 20px", "10px 20px", "10px 20px"]);
diff --git a/Source/WebCore/css/StylePropertyShorthand.cpp b/Source/WebCore/css/StylePropertyShorthand.cpp
index b518e98..4527a60 100644
--- a/Source/WebCore/css/StylePropertyShorthand.cpp
+++ b/Source/WebCore/css/StylePropertyShorthand.cpp
@@ -125,10 +125,10 @@ const StylePropertyShorthand& borderLeftShorthand()
const StylePropertyShorthand& borderRadiusShorthand()
{
static const CSSPropertyID borderRadiusProperties[] = {
- CSSPropertyBorderTopRightRadius,
CSSPropertyBorderTopLeftRadius,
- CSSPropertyBorderBottomLeftRadius,
- CSSPropertyBorderBottomRightRadius
+ CSSPropertyBorderTopRightRadius,
+ CSSPropertyBorderBottomRightRadius,
+ CSSPropertyBorderBottomLeftRadius
};
DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderRadiusLonghands, (borderRadiusProperties, WTF_ARRAY_LENGTH(borderRadiusProperties)));
return borderRadiusLonghands;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment