haikuwebkit/LayoutTests/svg/transforms/transform-origin-css-proper...

46 lines
1.6 KiB
HTML
Raw Permalink Normal View History

SVG should support transform-origin and relative values https://bugs.webkit.org/show_bug.cgi?id=79068 Patch by Hans Muller <hmuller@adobe.com> on 2012-03-12 Reviewed by Dirk Schulze. Source/WebCore: Added SVG support for the CSS 'transform-origin' property and for percentage values in the transform translate function. The changes conform to http://dev.w3.org/csswg/css3-transforms/. Tests: svg/transforms/percent-transform-values.xhtml svg/transforms/transform-origin-css-property.xhtml * css/svg.css: (*): (html|* > svg): Default transform-origin for SVG elements is 0 0. * platform/Length.h: (WebCore::Length::calcFloatValue): Added a calcFloatValue overload whose max parameter (for percent lengths) is a float. The original version will be obsolete when the sub-pixel layout support is completed. * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore): (WebCore::requireTransformOrigin): Transforms that only include translations don't depend on the transform-origin. (WebCore::RenderStyle::applyTransform): SVG elements interpret non-percentage/keyword transform-origin values relative to their viewport, unlike HTML which interprets all transform-origin values relative to the element's origin. The new FloatRect applyTransform() function handles SVG semantics. Similarly, SVG elements interpret percentage/keyword transform-origin values relative to the origin of their objectBoundingBox(), HTML uses the borderBox. All this per http://dev.w3.org/csswg/css3-transforms/. * svg/SVGStyledTransformableElement.cpp: (WebCore::SVGStyledTransformableElement::animatedLocalTransform): LayoutTests: Added tests for SVG CSS transform-origin property support and for CSS translations specified with percentages and applied to an SVG element. * svg/transforms/change-transform-origin-css-expected.xhtml: Added. * svg/transforms/change-transform-origin-css.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute-expected.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute.xhtml: Added. * svg/transforms/percent-transform-values-expected.txt: Added. * svg/transforms/percent-transform-values.xhtml: Added. * svg/transforms/transform-origin-css-property-expected.xhtml: Added. * svg/transforms/transform-origin-css-property.xhtml: Added. Canonical link: https://commits.webkit.org/98109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-13 02:45:38 +00:00
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
#transformOriginDiv {
position: absolute;
width: 30px;
height: 30px;
background: green;
transform: rotate(90deg);
SVG should support transform-origin and relative values https://bugs.webkit.org/show_bug.cgi?id=79068 Patch by Hans Muller <hmuller@adobe.com> on 2012-03-12 Reviewed by Dirk Schulze. Source/WebCore: Added SVG support for the CSS 'transform-origin' property and for percentage values in the transform translate function. The changes conform to http://dev.w3.org/csswg/css3-transforms/. Tests: svg/transforms/percent-transform-values.xhtml svg/transforms/transform-origin-css-property.xhtml * css/svg.css: (*): (html|* > svg): Default transform-origin for SVG elements is 0 0. * platform/Length.h: (WebCore::Length::calcFloatValue): Added a calcFloatValue overload whose max parameter (for percent lengths) is a float. The original version will be obsolete when the sub-pixel layout support is completed. * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore): (WebCore::requireTransformOrigin): Transforms that only include translations don't depend on the transform-origin. (WebCore::RenderStyle::applyTransform): SVG elements interpret non-percentage/keyword transform-origin values relative to their viewport, unlike HTML which interprets all transform-origin values relative to the element's origin. The new FloatRect applyTransform() function handles SVG semantics. Similarly, SVG elements interpret percentage/keyword transform-origin values relative to the origin of their objectBoundingBox(), HTML uses the borderBox. All this per http://dev.w3.org/csswg/css3-transforms/. * svg/SVGStyledTransformableElement.cpp: (WebCore::SVGStyledTransformableElement::animatedLocalTransform): LayoutTests: Added tests for SVG CSS transform-origin property support and for CSS translations specified with percentages and applied to an SVG element. * svg/transforms/change-transform-origin-css-expected.xhtml: Added. * svg/transforms/change-transform-origin-css.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute-expected.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute.xhtml: Added. * svg/transforms/percent-transform-values-expected.txt: Added. * svg/transforms/percent-transform-values.xhtml: Added. * svg/transforms/transform-origin-css-property-expected.xhtml: Added. * svg/transforms/transform-origin-css-property.xhtml: Added. Canonical link: https://commits.webkit.org/98109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-13 02:45:38 +00:00
}
</style>
<body>
<div id="divRoot"></div>
<script><![CDATA[
function addTransformOriginDiv(x, y, transformOrigin)
{
var div = document.createElement("div");
div.setAttribute("id", "transformOriginDiv");
div.setAttribute("style", "top: " + y + "px; left: "+ x + "px; transform-origin: " + transformOrigin + ";");
SVG should support transform-origin and relative values https://bugs.webkit.org/show_bug.cgi?id=79068 Patch by Hans Muller <hmuller@adobe.com> on 2012-03-12 Reviewed by Dirk Schulze. Source/WebCore: Added SVG support for the CSS 'transform-origin' property and for percentage values in the transform translate function. The changes conform to http://dev.w3.org/csswg/css3-transforms/. Tests: svg/transforms/percent-transform-values.xhtml svg/transforms/transform-origin-css-property.xhtml * css/svg.css: (*): (html|* > svg): Default transform-origin for SVG elements is 0 0. * platform/Length.h: (WebCore::Length::calcFloatValue): Added a calcFloatValue overload whose max parameter (for percent lengths) is a float. The original version will be obsolete when the sub-pixel layout support is completed. * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore): (WebCore::requireTransformOrigin): Transforms that only include translations don't depend on the transform-origin. (WebCore::RenderStyle::applyTransform): SVG elements interpret non-percentage/keyword transform-origin values relative to their viewport, unlike HTML which interprets all transform-origin values relative to the element's origin. The new FloatRect applyTransform() function handles SVG semantics. Similarly, SVG elements interpret percentage/keyword transform-origin values relative to the origin of their objectBoundingBox(), HTML uses the borderBox. All this per http://dev.w3.org/csswg/css3-transforms/. * svg/SVGStyledTransformableElement.cpp: (WebCore::SVGStyledTransformableElement::animatedLocalTransform): LayoutTests: Added tests for SVG CSS transform-origin property support and for CSS translations specified with percentages and applied to an SVG element. * svg/transforms/change-transform-origin-css-expected.xhtml: Added. * svg/transforms/change-transform-origin-css.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute-expected.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute.xhtml: Added. * svg/transforms/percent-transform-values-expected.txt: Added. * svg/transforms/percent-transform-values.xhtml: Added. * svg/transforms/transform-origin-css-property-expected.xhtml: Added. * svg/transforms/transform-origin-css-property.xhtml: Added. Canonical link: https://commits.webkit.org/98109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-13 02:45:38 +00:00
document.getElementById("divRoot").appendChild(div);
}
var equivalentTransformOrigins = [
["50% 50%", "center 50%", "50% center", "center", "center center"],
["0% 0%", "left 0%", "0% top", "left top", "top left"],
["0% 50%", "left 50%", "0% center", "left", "left center", "center left"],
["100% 0%", "right 0%", "100% top", "right top", "top right"],
["0% 50%", "left 50%", "0% center", "left center", "center left"],
["100% 50%", "right 50%", "100% center", "right center", "center right"],
["0% 100%", "left 100%", "0% bottom", "left bottom", "left bottom"],
["50% 100%", "center 100%", "50% bottom", "bottom", "center bottom", "bottom center"],
["100% 100%", "right 100%", "100% bottom", "right bottom", "bottom right"]
SVG should support transform-origin and relative values https://bugs.webkit.org/show_bug.cgi?id=79068 Patch by Hans Muller <hmuller@adobe.com> on 2012-03-12 Reviewed by Dirk Schulze. Source/WebCore: Added SVG support for the CSS 'transform-origin' property and for percentage values in the transform translate function. The changes conform to http://dev.w3.org/csswg/css3-transforms/. Tests: svg/transforms/percent-transform-values.xhtml svg/transforms/transform-origin-css-property.xhtml * css/svg.css: (*): (html|* > svg): Default transform-origin for SVG elements is 0 0. * platform/Length.h: (WebCore::Length::calcFloatValue): Added a calcFloatValue overload whose max parameter (for percent lengths) is a float. The original version will be obsolete when the sub-pixel layout support is completed. * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore): (WebCore::requireTransformOrigin): Transforms that only include translations don't depend on the transform-origin. (WebCore::RenderStyle::applyTransform): SVG elements interpret non-percentage/keyword transform-origin values relative to their viewport, unlike HTML which interprets all transform-origin values relative to the element's origin. The new FloatRect applyTransform() function handles SVG semantics. Similarly, SVG elements interpret percentage/keyword transform-origin values relative to the origin of their objectBoundingBox(), HTML uses the borderBox. All this per http://dev.w3.org/csswg/css3-transforms/. * svg/SVGStyledTransformableElement.cpp: (WebCore::SVGStyledTransformableElement::animatedLocalTransform): LayoutTests: Added tests for SVG CSS transform-origin property support and for CSS translations specified with percentages and applied to an SVG element. * svg/transforms/change-transform-origin-css-expected.xhtml: Added. * svg/transforms/change-transform-origin-css.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute-expected.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute.xhtml: Added. * svg/transforms/percent-transform-values-expected.txt: Added. * svg/transforms/percent-transform-values.xhtml: Added. * svg/transforms/transform-origin-css-property-expected.xhtml: Added. * svg/transforms/transform-origin-css-property.xhtml: Added. Canonical link: https://commits.webkit.org/98109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-13 02:45:38 +00:00
];
for (var i = 0; i < equivalentTransformOrigins.length; i++) {
SVG should support transform-origin and relative values https://bugs.webkit.org/show_bug.cgi?id=79068 Patch by Hans Muller <hmuller@adobe.com> on 2012-03-12 Reviewed by Dirk Schulze. Source/WebCore: Added SVG support for the CSS 'transform-origin' property and for percentage values in the transform translate function. The changes conform to http://dev.w3.org/csswg/css3-transforms/. Tests: svg/transforms/percent-transform-values.xhtml svg/transforms/transform-origin-css-property.xhtml * css/svg.css: (*): (html|* > svg): Default transform-origin for SVG elements is 0 0. * platform/Length.h: (WebCore::Length::calcFloatValue): Added a calcFloatValue overload whose max parameter (for percent lengths) is a float. The original version will be obsolete when the sub-pixel layout support is completed. * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore): (WebCore::requireTransformOrigin): Transforms that only include translations don't depend on the transform-origin. (WebCore::RenderStyle::applyTransform): SVG elements interpret non-percentage/keyword transform-origin values relative to their viewport, unlike HTML which interprets all transform-origin values relative to the element's origin. The new FloatRect applyTransform() function handles SVG semantics. Similarly, SVG elements interpret percentage/keyword transform-origin values relative to the origin of their objectBoundingBox(), HTML uses the borderBox. All this per http://dev.w3.org/csswg/css3-transforms/. * svg/SVGStyledTransformableElement.cpp: (WebCore::SVGStyledTransformableElement::animatedLocalTransform): LayoutTests: Added tests for SVG CSS transform-origin property support and for CSS translations specified with percentages and applied to an SVG element. * svg/transforms/change-transform-origin-css-expected.xhtml: Added. * svg/transforms/change-transform-origin-css.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute-expected.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute.xhtml: Added. * svg/transforms/percent-transform-values-expected.txt: Added. * svg/transforms/percent-transform-values.xhtml: Added. * svg/transforms/transform-origin-css-property-expected.xhtml: Added. * svg/transforms/transform-origin-css-property.xhtml: Added. Canonical link: https://commits.webkit.org/98109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-13 02:45:38 +00:00
var x = 60 + (i % 4) * 60;
var y = 60 + Math.floor(i / 4) * 60;
equivalentTransformOrigins[i].map( function(s) { addTransformOriginDiv(x, y, s); } );
SVG should support transform-origin and relative values https://bugs.webkit.org/show_bug.cgi?id=79068 Patch by Hans Muller <hmuller@adobe.com> on 2012-03-12 Reviewed by Dirk Schulze. Source/WebCore: Added SVG support for the CSS 'transform-origin' property and for percentage values in the transform translate function. The changes conform to http://dev.w3.org/csswg/css3-transforms/. Tests: svg/transforms/percent-transform-values.xhtml svg/transforms/transform-origin-css-property.xhtml * css/svg.css: (*): (html|* > svg): Default transform-origin for SVG elements is 0 0. * platform/Length.h: (WebCore::Length::calcFloatValue): Added a calcFloatValue overload whose max parameter (for percent lengths) is a float. The original version will be obsolete when the sub-pixel layout support is completed. * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: (WebCore): (WebCore::requireTransformOrigin): Transforms that only include translations don't depend on the transform-origin. (WebCore::RenderStyle::applyTransform): SVG elements interpret non-percentage/keyword transform-origin values relative to their viewport, unlike HTML which interprets all transform-origin values relative to the element's origin. The new FloatRect applyTransform() function handles SVG semantics. Similarly, SVG elements interpret percentage/keyword transform-origin values relative to the origin of their objectBoundingBox(), HTML uses the borderBox. All this per http://dev.w3.org/csswg/css3-transforms/. * svg/SVGStyledTransformableElement.cpp: (WebCore::SVGStyledTransformableElement::animatedLocalTransform): LayoutTests: Added tests for SVG CSS transform-origin property support and for CSS translations specified with percentages and applied to an SVG element. * svg/transforms/change-transform-origin-css-expected.xhtml: Added. * svg/transforms/change-transform-origin-css.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute-expected.xhtml: Added. * svg/transforms/change-transform-origin-presentation-attribute.xhtml: Added. * svg/transforms/percent-transform-values-expected.txt: Added. * svg/transforms/percent-transform-values.xhtml: Added. * svg/transforms/transform-origin-css-property-expected.xhtml: Added. * svg/transforms/transform-origin-css-property.xhtml: Added. Canonical link: https://commits.webkit.org/98109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-13 02:45:38 +00:00
}
]]></script>
</body>
</html>