Bug 94211

Summary: getComputedStyle returns wrong value for CSS3 2D transformations
Product: WebKit Reporter: Alexander Shalamov <alexander.shalamov>
Component: CSSAssignee: Alexander Shalamov <alexander.shalamov>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, dglazkov, macpherson, menard, simon.fraser, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test
none
Patch
webkit.review.bot: commit-queue-
Archive of layout-test-results from gce-cr-linux-03
none
Patch
none
Patch
simon.fraser: review-, simon.fraser: commit-queue-
Patch
webkit.review.bot: commit-queue-
Patch
simon.fraser: review-, webkit.review.bot: commit-queue-
Archive of layout-test-results from gce-cr-linux-01
none
Patch
simon.fraser: review+, webkit.review.bot: commit-queue-
Archive of layout-test-results from gce-cr-linux-06
none
Patch none

Description Alexander Shalamov 2012-08-16 03:19:13 PDT
Created attachment 158763 [details]
Test

When 2D transformation is applied, "borderBoxRect" is used to calculate transformation values.
However, when style values are computed using getComputedStyle, content box size is used to calculate transformation value.

In attached test, div element is moved down (y) by 60 pixels, while getComputedStyle reports that it was moved by 50px.
Comment 1 Alexander Shalamov 2012-08-16 05:12:50 PDT
Created attachment 158782 [details]
Patch

Fix for style calculation and for layout test.
Comment 2 WebKit Review Bot 2012-08-16 06:01:14 PDT
Comment on attachment 158782 [details]
Patch

Attachment 158782 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13513558

New failing tests:
fast/css/getComputedStyle/getComputedStyle-transform.html
Comment 3 WebKit Review Bot 2012-08-16 06:01:18 PDT
Created attachment 158789 [details]
Archive of layout-test-results from gce-cr-linux-03

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-03  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 4 Alexander Shalamov 2012-08-16 06:09:31 PDT
Created attachment 158793 [details]
Patch

Fixed typos in changelog.
Comment 5 WebKit Review Bot 2012-08-16 06:15:51 PDT
Attachment 158793 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files']" exit_code: 1
Total errors found: 0 in 0 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Alexander Shalamov 2012-08-16 06:23:17 PDT
looks like upload failed. Will re-upload patch.
Comment 7 Alexander Shalamov 2012-08-16 06:30:49 PDT
Created attachment 158798 [details]
Patch

Re-uploading patch
Comment 8 Simon Fraser (smfr) 2012-08-20 10:52:11 PDT
Comment on attachment 158798 [details]
Patch

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

> LayoutTests/fast/css/getComputedStyle/getComputedStyle-transform.html:47
> +      for(i=1; i < 7; i++) {

Spaces around the = please. Also need 'var i'.

> LayoutTests/fast/css/getComputedStyle/getComputedStyle-transform.html:49
> +         if ( !(Math.abs(parsedComputed[i] - parsedExpected[i]) < 0.05) )

No space before the !.
Comment 9 Simon Fraser (smfr) 2012-08-20 11:00:57 PDT
Comment on attachment 158798 [details]
Patch

Alexander is going to do a bit more work here.
Comment 10 Alexander Shalamov 2012-08-21 04:53:12 PDT
Created attachment 159658 [details]
Patch

- Applied fixes according to comments
- Added check if renderer has transform
- Added test for non-box element
- Rebased to master
Comment 11 WebKit Review Bot 2012-08-21 05:07:01 PDT
Comment on attachment 159658 [details]
Patch

Attachment 159658 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13549320
Comment 12 Early Warning System Bot 2012-08-21 05:20:53 PDT
Comment on attachment 159658 [details]
Patch

Attachment 159658 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/13555040
Comment 13 Early Warning System Bot 2012-08-21 05:33:00 PDT
Comment on attachment 159658 [details]
Patch

Attachment 159658 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/13543742
Comment 14 Alexander Shalamov 2012-08-21 05:40:04 PDT
Created attachment 159667 [details]
Patch

newly added pixelSnappedSizingBox is not required - removed
Comment 15 WebKit Review Bot 2012-08-21 10:17:08 PDT
Comment on attachment 159667 [details]
Patch

Attachment 159667 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13544837

New failing tests:
fast/css/getComputedStyle/getComputedStyle-transform.html
Comment 16 WebKit Review Bot 2012-08-21 10:17:13 PDT
Created attachment 159714 [details]
Archive of layout-test-results from gce-cr-linux-01

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-01  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 17 Simon Fraser (smfr) 2012-08-21 10:39:38 PDT
Comment on attachment 159667 [details]
Patch

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

I thought you were going to fix transform-origin too?

> LayoutTests/ChangeLog:8
> +        This change will fix getComputedStyle-transform.html test.

s/will fix/fixes.

> LayoutTests/ChangeLog:12
> +        Currently, the test doesn't do anything. When new transformation
> +        value is set, it immediately read back as an old value, thus
> +        computed style is equal to an old style. Moreover, expected
> +        result is never checked.

Using 'currently' in a changelog is ambiguous. Does it refer to the state before or after the change? I'd say "before this change, the test didn't do anything".
Comment 18 Alexander Shalamov 2012-08-22 10:31:27 PDT
Created attachment 159960 [details]
Patch

- Fixed transform-origin computation
- Added two cases to transforms/2d/computed-style-origin.html
Comment 19 Alexander Shalamov 2012-08-22 10:33:28 PDT
(In reply to comment #17)
> I thought you were going to fix transform-origin too?

Fixed, and added two test cases to transforms/2d/computed-style-origin.html

> > LayoutTests/ChangeLog:8
> > +        This change will fix getComputedStyle-transform.html test.
> 
> s/will fix/fixes.

Fixed

> 
> > LayoutTests/ChangeLog:12
> Using 'currently' in a changelog is ambiguous. Does it refer to the state before or after the change? I'd say "before this change, the test didn't do anything".

Fixed
Comment 20 WebKit Review Bot 2012-08-22 11:11:02 PDT
Comment on attachment 159960 [details]
Patch

Attachment 159960 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13564349

New failing tests:
fast/css/getComputedStyle/getComputedStyle-zoom-and-background-size.html
svg/transforms/transform-origin-presentation-attribute.xhtml
transitions/shorthand-transitions.html
svg/css/getComputedStyle-basic.xhtml
fast/css/getComputedStyle/getComputedStyle-length-unit.html
fast/css/getComputedStyle/computed-style.html
fast/css/getComputedStyle/computed-style-with-zoom.html
transforms/2d/computed-style-origin.html
Comment 21 WebKit Review Bot 2012-08-22 11:11:06 PDT
Created attachment 159968 [details]
Archive of layout-test-results from gce-cr-linux-06

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-06  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 22 Alexander Shalamov 2012-08-23 00:32:20 PDT
Created attachment 160102 [details]
Patch

Fixed chromium bot failures
Comment 23 WebKit Review Bot 2012-08-23 10:22:58 PDT
Comment on attachment 160102 [details]
Patch

Clearing flags on attachment: 160102

Committed r126443: <http://trac.webkit.org/changeset/126443>
Comment 24 WebKit Review Bot 2012-08-23 10:23:03 PDT
All reviewed patches have been landed.  Closing bug.