Commit 2800ee6f authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

getComputedStyle perspective-origin is based on the wrong bounding box

https://bugs.webkit.org/show_bug.cgi?id=98027

Patch by Jussi Kukkonen <jussi.kukkonen@intel.com> on 2012-10-03
Reviewed by Simon Fraser.

Source/WebCore:

perspective-origin for ComputedStyleDeclaration is currently calculated using the
wrong bounding box (sizingBox() which ends up as the contentbox).

Start using borderbox for ComputedStyleDeclaration perspective-origin, similar to
what transform-origin already does.

Test: fast/css/getComputedStyle/getComputedStyle-origin-percentage.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

LayoutTests:

Add test for perspective-origin calculation into existing transform-origin test.

* transforms/2d/computed-style-origin-expected.txt:
* transforms/2d/computed-style-origin.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 80d26492
2012-10-03 Jussi Kukkonen <jussi.kukkonen@intel.com>
getComputedStyle perspective-origin is based on the wrong bounding box
https://bugs.webkit.org/show_bug.cgi?id=98027
Reviewed by Simon Fraser.
Add test for perspective-origin calculation into existing transform-origin test.
* transforms/2d/computed-style-origin-expected.txt:
* transforms/2d/computed-style-origin.html:
2012-10-03 Andrey Kosyakov <caseq@chromium.org>
Unreviewed test rebaseline.
......
This tests computed style values for transform origin.
This tests computed style values for transform-origin and perspective-origin.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......@@ -8,6 +8,11 @@ PASS test2Style.webkitTransformOrigin is '10px 10px'
PASS test3Style.webkitTransformOrigin is '0px 20px'
PASS test4Style.webkitTransformOrigin is '5px 7px'
PASS test5Style.webkitTransformOrigin is '15px 15px'
PASS test1Style.webkitPerspectiveOrigin is '10px 10px'
PASS test2Style.webkitPerspectiveOrigin is '10px 10px'
PASS test3Style.webkitPerspectiveOrigin is '0px 20px'
PASS test4Style.webkitPerspectiveOrigin is '5px 7px'
PASS test5Style.webkitPerspectiveOrigin is '15px 15px'
PASS successfullyParsed is true
......
......@@ -7,7 +7,7 @@
background-color: blue;
position: relative;
-webkit-transform: translate(0);
// default transform origin
// default transform and perspective origin
}
#test2 {
width: 20px;
......@@ -16,6 +16,7 @@
position: relative;
-webkit-transform: translate(0);
-webkit-transform-origin: 50% 50%;
-webkit-perspective-origin: 50% 50%;
}
#test3 {
width: 20px;
......@@ -24,6 +25,7 @@
position: relative;
-webkit-transform: translate(0);
-webkit-transform-origin: 0% 100%;
-webkit-perspective-origin: 0% 100%;
}
#test4 {
width: 20px;
......@@ -32,6 +34,7 @@
position: relative;
-webkit-transform: translate(0);
-webkit-transform-origin: 5px 7px;
-webkit-perspective-origin: 5px 7px;
}
#test5 {
width: 10px;
......@@ -43,6 +46,7 @@
position: relative;
-webkit-transform: translate(0);
-webkit-transform-origin: 50% 50%;
-webkit-perspective-origin: 50% 50%;
}
</style>
......@@ -58,7 +62,7 @@
<div id="console"></div>
<script>
description("This tests computed style values for transform origin.");
description("This tests computed style values for transform-origin and perspective-origin.");
var test1 = document.getElementById("test1");
var test2 = document.getElementById("test2");
......@@ -78,6 +82,12 @@ shouldBe("test3Style.webkitTransformOrigin", "'0px 20px'");
shouldBe("test4Style.webkitTransformOrigin", "'5px 7px'");
shouldBe("test5Style.webkitTransformOrigin", "'15px 15px'");
shouldBe("test1Style.webkitPerspectiveOrigin", "'10px 10px'");
shouldBe("test2Style.webkitPerspectiveOrigin", "'10px 10px'");
shouldBe("test3Style.webkitPerspectiveOrigin", "'0px 20px'");
shouldBe("test4Style.webkitPerspectiveOrigin", "'5px 7px'");
shouldBe("test5Style.webkitPerspectiveOrigin", "'15px 15px'");
debug("");
</script>
......
2012-10-03 Jussi Kukkonen <jussi.kukkonen@intel.com>
getComputedStyle perspective-origin is based on the wrong bounding box
https://bugs.webkit.org/show_bug.cgi?id=98027
Reviewed by Simon Fraser.
perspective-origin for ComputedStyleDeclaration is currently calculated using the
wrong bounding box (sizingBox() which ends up as the contentbox).
Start using borderbox for ComputedStyleDeclaration perspective-origin, similar to
what transform-origin already does.
Test: fast/css/getComputedStyle/getComputedStyle-origin-percentage.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
2012-10-03 Patrick Gansterer <paroga@webkit.org>
Build fix for WinCE after r130160.
......
......@@ -2344,7 +2344,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitPerspectiveOrigin: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
LayoutRect box = sizingBox(renderer);
LayoutRect box;
if (renderer->isBox())
box = toRenderBox(renderer)->borderBoxRect();
RenderView* renderView = m_node->document()->renderView();
list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginX(), box.width(), renderView), style.get()));
list->append(zoomAdjustedPixelValue(minimumValueForLength(style->perspectiveOriginY(), box.height(), renderView), style.get()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment