LayoutTests:
Reviewed by Oliver.
Test for http://bugs.webkit.org/show_bug.cgi?id=14646
WebKit border radius properties are unavailable via JavaScript
* fast/dom/getComputedStyle-borderRadius-expected.txt: Added.
* fast/dom/getComputedStyle-borderRadius.html: Added.
WebCore:
Reviewed by Oliver.
Fix for http://bugs.webkit.org/show_bug.cgi?id=14646
WebKit border radius properties are unavailable via JavaScript
Test: fast/dom/getComputedStyle-borderRadius.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::getBorderRadiusCornerValue): Helper function that returns a single value if
width and the height of the corner radius are equal, and otherwise a pair.
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 744776a..1ae5f19 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2007-07-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Test for http://bugs.webkit.org/show_bug.cgi?id=14646
+ WebKit border radius properties are unavailable via JavaScript
+
+ * fast/dom/getComputedStyle-borderRadius-expected.txt: Added.
+ * fast/dom/getComputedStyle-borderRadius.html: Added.
+
2007-07-18 Adam Roben <aroben@apple.com>
Disable SSL tests on Windows
diff --git a/LayoutTests/fast/dom/getComputedStyle-borderRadius-expected.txt b/LayoutTests/fast/dom/getComputedStyle-borderRadius-expected.txt
new file mode 100644
index 0000000..8318817
--- /dev/null
+++ b/LayoutTests/fast/dom/getComputedStyle-borderRadius-expected.txt
@@ -0,0 +1,14 @@
+Test calling getPropertyValue on computed styles for border radius properties.
+
+-webkit-border-top-right-radius: 10px 20px
+-webkit-border-top-right-radius: 10px
+-webkit-border-top-left-radius: 10px 20px
+-webkit-border-top-left-radius: 10px
+-webkit-border-bottom-right-radius: 10px 20px
+-webkit-border-bottom-right-radius: 10px
+-webkit-border-bottom-left-radius: 10px 20px
+-webkit-border-bottom-left-radius: 10px
+
+Test getting 0px value border radius.
+-webkit-border-top-right-radius: 0px
+
diff --git a/LayoutTests/fast/dom/getComputedStyle-borderRadius.html b/LayoutTests/fast/dom/getComputedStyle-borderRadius.html
new file mode 100644
index 0000000..d85b72d
--- /dev/null
+++ b/LayoutTests/fast/dom/getComputedStyle-borderRadius.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .test { float: left; width: 50px; height: 50px; border: 1px solid black; }
+ #topRightDiff { -webkit-border-top-right-radius: 10px 20px; }
+ #topRightSame {-webkit-border-top-right-radius: 10px; }
+ #topLeftDiff { -webkit-border-top-left-radius: 10px 20px; }
+ #topLeftSame { -webkit-border-top-left-radius: 10px; }
+ #bottomRightDiff { -webkit-border-bottom-right-radius: 10px 20px; }
+ #bottomRightSame { -webkit-border-bottom-right-radius: 10px; }
+ #bottomLeftDiff { -webkit-border-bottom-left-radius: 10px 20px; }
+ #bottomLeftSame { -webkit-border-bottom-left-radius: 10px; }
+ </style>
+ <script type="text/javascript">
+ function log(msg)
+ {
+ document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
+ }
+
+ function runTests()
+ {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var ob = document.getElementById('topRightDiff');
+ log('-webkit-border-top-right-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-top-right-radius'));
+ ob = document.getElementById('topRightSame');
+ log('-webkit-border-top-right-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-top-right-radius'));
+ ob = document.getElementById('topLeftDiff');
+ log('-webkit-border-top-left-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-top-left-radius'));
+ ob = document.getElementById('topLeftSame');
+ log('-webkit-border-top-left-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-top-left-radius'));
+ ob = document.getElementById('bottomRightDiff');
+ log('-webkit-border-bottom-right-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-bottom-right-radius'));
+ ob = document.getElementById('bottomRightSame');
+ log('-webkit-border-bottom-right-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-bottom-right-radius'));
+ ob = document.getElementById('bottomLeftDiff');
+ log('-webkit-border-bottom-left-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-bottom-left-radius'));
+ ob = document.getElementById('bottomLeftSame');
+ log('-webkit-border-bottom-left-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-bottom-left-radius'));
+
+ log('');
+
+ log('Test getting 0px value border radius.')
+ ob = document.getElementById('topRightDiff');
+ log('-webkit-border-top-right-radius: ' + document.defaultView.getComputedStyle(ob, null).getPropertyValue('-webkit-border-top-left-radius'));
+ }
+ </script>
+</head>
+<body onload="runTests();">
+ <p>Test calling getPropertyValue on computed styles for border radius properties.</p>
+ <pre id="console"></pre>
+
+ <div class="test" id="topRightDiff"></div>
+ <div class="test" id="topRightSame"></div>
+ <div class="test" id="topLeftDiff"></div>
+ <div class="test" id="topLeftSame"></div>
+ <div class="test" id="bottomRightDiff"></div>
+ <div class="test" id="bottomRightSame"></div>
+ <div class="test" id="bottomLeftDiff"></div>
+ <div class="test" id="bottomLeftSame"></div>
+ <script>
+ </script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 31d0d43..43a1e79 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2007-07-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Oliver.
+
+ Fix for http://bugs.webkit.org/show_bug.cgi?id=14646
+ WebKit border radius properties are unavailable via JavaScript
+
+ Test: fast/dom/getComputedStyle-borderRadius.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::getBorderRadiusCornerValue): Helper function that returns a single value if
+ width and the height of the corner radius are equal, and otherwise a pair.
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
2007-07-18 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 3314243..da93802 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -403,6 +403,15 @@
return new CSSPrimitiveValue(color.rgb());
}
+static PassRefPtr<CSSPrimitiveValue> getBorderRadiusCornerValue(IntSize radius)
+{
+ if (radius.width() == radius.height())
+ return new CSSPrimitiveValue(radius.width(), CSSPrimitiveValue::CSS_PX);
+
+ return new CSSPrimitiveValue(new Pair(new CSSPrimitiveValue(radius.width(), CSSPrimitiveValue::CSS_PX),
+ new CSSPrimitiveValue(radius.height(), CSSPrimitiveValue::CSS_PX)));
+}
+
CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n)
: m_node(n)
{
@@ -1557,6 +1566,14 @@
return new CSSPrimitiveValue(CSS_VAL_IGNORE);
}
break;
+ case CSS_PROP__WEBKIT_BORDER_BOTTOM_LEFT_RADIUS:
+ return getBorderRadiusCornerValue(style->borderBottomLeftRadius());
+ case CSS_PROP__WEBKIT_BORDER_BOTTOM_RIGHT_RADIUS:
+ return getBorderRadiusCornerValue(style->borderBottomRightRadius());
+ case CSS_PROP__WEBKIT_BORDER_TOP_LEFT_RADIUS:
+ return getBorderRadiusCornerValue(style->borderTopLeftRadius());
+ case CSS_PROP__WEBKIT_BORDER_TOP_RIGHT_RADIUS:
+ return getBorderRadiusCornerValue(style->borderTopRightRadius());
case CSS_PROP_BACKGROUND:
case CSS_PROP_BORDER:
case CSS_PROP_BORDER_BOTTOM:
@@ -1603,12 +1620,8 @@
case CSS_PROP_TEXT_UNDERLINE_MODE:
case CSS_PROP_TEXT_UNDERLINE_STYLE:
case CSS_PROP_TEXT_UNDERLINE_WIDTH:
- case CSS_PROP__WEBKIT_BORDER_BOTTOM_LEFT_RADIUS:
- case CSS_PROP__WEBKIT_BORDER_BOTTOM_RIGHT_RADIUS:
case CSS_PROP__WEBKIT_BORDER_IMAGE:
case CSS_PROP__WEBKIT_BORDER_RADIUS:
- case CSS_PROP__WEBKIT_BORDER_TOP_LEFT_RADIUS:
- case CSS_PROP__WEBKIT_BORDER_TOP_RIGHT_RADIUS:
case CSS_PROP__WEBKIT_COLUMNS:
case CSS_PROP__WEBKIT_COLUMN_RULE:
case CSS_PROP__WEBKIT_MARGIN_COLLAPSE: