Bug 98027

Summary: computedstyle perspective-origin is based on the wrong boundingbox
Product: WebKit Reporter: Jussi Kukkonen (jku) <jussi.kukkonen>
Component: CSSAssignee: Jussi Kukkonen (jku) <jussi.kukkonen>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, cmarcelo, dino, macpherson, menard, simon.fraser, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Jussi Kukkonen (jku) 2012-10-01 06:42:49 PDT
CSS Transforms perspective-origin percentage values are currently translated to pixel values using the wrong bounding box (currently sizingBox() which ends up as the contentbox).

Spec says  "Percentages: refer to the size of the element's bounding box" and bounding box is defined as "bounding box for all SVG elements without an associated CSS layout box and the border box for all other elements". So we should be using border box for normal html elements. This is what transform-origin already does.

I'll provide a patch and a test case.
Comment 1 Simon Fraser (smfr) 2012-10-01 13:05:18 PDT
Similar to bug 94211.
Comment 2 Jussi Kukkonen (jku) 2012-10-02 02:21:56 PDT
Created attachment 166647 [details]
Patch

Thanks Simon, that test actually looks like a better place to test this as well
Comment 3 Jussi Kukkonen (jku) 2012-10-02 04:26:34 PDT
Hm, looks like I've missed transforms/3d/point-mapping/ tests at least. Will check and update those
Comment 4 Jussi Kukkonen (jku) 2012-10-02 06:20:01 PDT
(In reply to comment #3)
> Hm, looks like I've missed transforms/3d/point-mapping/ tests at least. 

So chromium-ews was flaky for a cycle in transforms/3d/point-mapping/. Actually those tests don't really seem to check the computedStyle (and this bug only covers that). As far as I can see all the existing tests that test perspective-origin via computedStyle happen to not use borders or pass in px values so don't hit the bug.

Just to be double sure I checked the transforms/3d/point-mapping/ results on GTK -- they are identical to results before patch.

I think this is good to go.
Comment 5 Simon Fraser (smfr) 2012-10-02 11:02:08 PDT
Was it only wrong for computed style, but correct for rendering? If so, the title of this bug, and the Changelog need to make this clearer.
Comment 6 Jussi Kukkonen (jku) 2012-10-02 13:09:39 PDT
Yes, that is correct: rendering is unchanged (and correct as far as I can tell), but computedstyle is wrong. I'll update the changelog.
Comment 7 Jussi Kukkonen (jku) 2012-10-02 13:35:23 PDT
Created attachment 166741 [details]
Patch
Comment 8 Simon Fraser (smfr) 2012-10-02 13:42:11 PDT
Comment on attachment 166741 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=166741&action=review

> Source/WebCore/ChangeLog:3
> +        getComputedStyle perspective-origin is based on the wrong boundingbox

"bounding box"
Comment 9 Jussi Kukkonen (jku) 2012-10-03 01:34:07 PDT
Created attachment 166826 [details]
Patch
Comment 10 WebKit Review Bot 2012-10-03 05:16:38 PDT
Comment on attachment 166826 [details]
Patch

Clearing flags on attachment: 166826

Committed r130277: <http://trac.webkit.org/changeset/130277>
Comment 11 WebKit Review Bot 2012-10-03 05:16:42 PDT
All reviewed patches have been landed.  Closing bug.