- Revision
- 109916
- Author
- [email protected]
- Date
- 2012-03-06 07:05:34 -0800 (Tue, 06 Mar 2012)
Log Message
SVG transform-origin presentation attribute
https://bugs.webkit.org/show_bug.cgi?id=79678
Patch by Hans Muller <[email protected]> on 2012-03-06
Reviewed by Nikolas Zimmermann.
Source/WebCore:
Added the SVG transform-origin presentation attribute. Currently WebCore::mapAttributeToCSSProperty()
just maps it to -webkit-transform-origin. When the transform-origin CSS property is supported, this
part of the change can be removed.
Test: svg/transforms/transform-origin-presentation-attribute.xhtml
* svg/SVGStyledElement.cpp:
(WebCore::mapAttributeToCSSProperty):
(WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName):
* svg/svgattrs.in:
LayoutTests:
Test case just verifies that the transform-origin presentation attribute
changes an SVG element's getComputedStyle() as expected.
* svg/transforms/transform-origin-presentation-attribute-expected.txt: Added.
* svg/transforms/transform-origin-presentation-attribute.xhtml: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (109915 => 109916)
--- trunk/LayoutTests/ChangeLog 2012-03-06 15:02:46 UTC (rev 109915)
+++ trunk/LayoutTests/ChangeLog 2012-03-06 15:05:34 UTC (rev 109916)
@@ -1,3 +1,16 @@
+2012-03-06 Hans Muller <[email protected]>
+
+ SVG transform-origin presentation attribute
+ https://bugs.webkit.org/show_bug.cgi?id=79678
+
+ Reviewed by Nikolas Zimmermann.
+
+ Test case just verifies that the transform-origin presentation attribute
+ changes an SVG element's getComputedStyle() as expected.
+
+ * svg/transforms/transform-origin-presentation-attribute-expected.txt: Added.
+ * svg/transforms/transform-origin-presentation-attribute.xhtml: Added.
+
2012-03-06 Pavel Podivilov <[email protected]>
Web Inspector: prepare for extracting ScriptMapping implementation from DebuggerPresentationModel.
Added: trunk/LayoutTests/svg/transforms/transform-origin-presentation-attribute-expected.txt (0 => 109916)
--- trunk/LayoutTests/svg/transforms/transform-origin-presentation-attribute-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/transforms/transform-origin-presentation-attribute-expected.txt 2012-03-06 15:05:34 UTC (rev 109916)
@@ -0,0 +1,7 @@
+Test for bug 79678 - SVG transform-origin presentation attribute. Verify that getComputedStyle() reflects an SVG element's transform-origin.
+
+On success, you will see a series of "PASS" messages
+
+PASS rect1 transformOrigin, expected "50px 100px" actual "50px 100px"
+PASS rect2 transformOrigin, expected "0px 0px" actual "0px 0px"
+
Added: trunk/LayoutTests/svg/transforms/transform-origin-presentation-attribute.xhtml (0 => 109916)
--- trunk/LayoutTests/svg/transforms/transform-origin-presentation-attribute.xhtml (rev 0)
+++ trunk/LayoutTests/svg/transforms/transform-origin-presentation-attribute.xhtml 2012-03-06 15:05:34 UTC (rev 109916)
@@ -0,0 +1,30 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <body>
+ <p>Test for bug 79678 - SVG transform-origin presentation attribute. Verify that getComputedStyle() reflects an SVG element's transform-origin.</p>
+ <p>On success, you will see a series of "PASS" messages</p>
+ <pre id="console"></pre>
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect id="rect1" transform-origin="50 100" width="100" height="100" />
+ <rect id="rect2" width="100" height="100" fill="red" />
+ </svg>
+ <script><![CDATA[
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var resultString = "";
+
+ function checkTransformOrigin(eltID, expectedValue) {
+ var rect = document.getElementById(eltID);
+ var cssValue = window.getComputedStyle(rect, null).getPropertyCSSValue("-webkit-transform-origin");
+ var actualValue = (cssValue) ? cssValue.cssText : "<no value>";
+ resultString += (actualValue == expectedValue) ? "PASS " : "FAIL ";
+ resultString += eltID + " transformOrigin, expected \"" + expectedValue + "\" actual \"" + actualValue + "\"\n";
+ }
+
+ checkTransformOrigin("rect1", "50px 100px");
+ checkTransformOrigin("rect2", "0px 0px");
+
+ document.getElementById("console").innerHTML = resultString;
+ ]]></script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (109915 => 109916)
--- trunk/Source/WebCore/ChangeLog 2012-03-06 15:02:46 UTC (rev 109915)
+++ trunk/Source/WebCore/ChangeLog 2012-03-06 15:05:34 UTC (rev 109916)
@@ -1,3 +1,21 @@
+2012-03-06 Hans Muller <[email protected]>
+
+ SVG transform-origin presentation attribute
+ https://bugs.webkit.org/show_bug.cgi?id=79678
+
+ Reviewed by Nikolas Zimmermann.
+
+ Added the SVG transform-origin presentation attribute. Currently WebCore::mapAttributeToCSSProperty()
+ just maps it to -webkit-transform-origin. When the transform-origin CSS property is supported, this
+ part of the change can be removed.
+
+ Test: svg/transforms/transform-origin-presentation-attribute.xhtml
+
+ * svg/SVGStyledElement.cpp:
+ (WebCore::mapAttributeToCSSProperty):
+ (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName):
+ * svg/svgattrs.in:
+
2012-01-26 Philippe Normand <[email protected]>
[GStreamer] disable GStreamerGWorld when building against 0.11
Modified: trunk/Source/WebCore/svg/SVGStyledElement.cpp (109915 => 109916)
--- trunk/Source/WebCore/svg/SVGStyledElement.cpp 2012-03-06 15:02:46 UTC (rev 109915)
+++ trunk/Source/WebCore/svg/SVGStyledElement.cpp 2012-03-06 15:05:34 UTC (rev 109916)
@@ -59,7 +59,10 @@
void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName)
{
+ // FIXME: when CSS supports "transform-origin" the special case for transform_originAttr can be removed.
int propertyId = cssPropertyID(attrName.localName());
+ if (!propertyId && attrName == transform_originAttr)
+ propertyId = CSSPropertyWebkitTransformOrigin; // cssPropertyID("-webkit-transform-origin")
ASSERT(propertyId > 0);
propertyNameToIdMap->set(attrName.localName().impl(), propertyId);
}
@@ -188,6 +191,7 @@
mapAttributeToCSSProperty(propertyNameToIdMap, text_anchorAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr);
+ mapAttributeToCSSProperty(propertyNameToIdMap, transform_originAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr);
Modified: trunk/Source/WebCore/svg/svgattrs.in (109915 => 109916)
--- trunk/Source/WebCore/svg/svgattrs.in 2012-03-06 15:02:46 UTC (rev 109915)
+++ trunk/Source/WebCore/svg/svgattrs.in 2012-03-06 15:05:34 UTC (rev 109916)
@@ -209,6 +209,7 @@
title
to
transform
+transform-origin
type
u1
u2