RESOLVED FIXED 86152
The order of CSS properties is wrong in background shorthand
https://bugs.webkit.org/show_bug.cgi?id=86152
Summary The order of CSS properties is wrong in background shorthand
Joe Thomas
Reported 2012-05-10 15:49:23 PDT
As per the specification http://www.w3.org/TR/css3-background/#background, "If one <box> value is present then it sets both ‘background-origin’ and ‘background-clip’ to that value. If two values are present, then the first sets ‘background-origin’ and the second ‘background-clip’." The parsing of these values are done correctly in CSSParser, but the order of these properties returned in StylePropertySet::getPropertyValue for background shorthand property is wrong.
Attachments
simple test case (311 bytes, text/html)
2012-05-10 15:55 PDT, Joe Thomas
no flags
Patch (9.92 KB, patch)
2012-05-10 16:14 PDT, Joe Thomas
webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-01 (988.78 KB, application/zip)
2012-05-10 22:48 PDT, WebKit Review Bot
no flags
patch (9.92 KB, patch)
2012-05-11 11:42 PDT, Joe Thomas
no flags
Patch-Updated (9.77 KB, patch)
2012-05-14 06:37 PDT, Joe Thomas
rniwa: review+
Patch (14.64 KB, patch)
2012-05-18 17:20 PDT, Joe Thomas
webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-02 (607.28 KB, application/zip)
2012-05-18 20:56 PDT, WebKit Review Bot
no flags
Patch-fixes-layout-test (16.81 KB, patch)
2012-05-19 06:24 PDT, Joe Thomas
no flags
Joe Thomas
Comment 1 2012-05-10 15:55:54 PDT
Created attachment 141284 [details] simple test case The order of "border-box padding-box" in the alert message is different from what we set.
Joe Thomas
Comment 2 2012-05-10 16:14:02 PDT
Eric Seidel (no email)
Comment 3 2012-05-10 16:21:27 PDT
It seems we could test for this generic class of bugs by feeding the output of getPropertyValue into the cssText and validating that the same result came back out. :)
Eric Seidel (no email)
Comment 4 2012-05-10 16:21:27 PDT
It seems we could test for this generic class of bugs by feeding the output of getPropertyValue into the cssText and validating that the same result came back out. :)
Joe Thomas
Comment 5 2012-05-10 16:42:45 PDT
(In reply to comment #4) > It seems we could test for this generic class of bugs by feeding the output of getPropertyValue into the cssText and validating that the same result came back out. :) getPropertyValue for background shorthand property does not return background-orgin and background-clip. Bug 86155 is created to address this.
Eric Seidel (no email)
Comment 6 2012-05-10 16:47:00 PDT
Oh, I was not suggesting you needed to change your testing here. I was only mentioning that we could ensure more generally that we don't have any other bugs like this with a separate more generic effort.
Joe Thomas
Comment 7 2012-05-10 16:50:58 PDT
(In reply to comment #6) > Oh, I was not suggesting you needed to change your testing here. I was only mentioning that we could ensure more generally that we don't have any other bugs like this with a separate more generic effort. OK :)
WebKit Review Bot
Comment 8 2012-05-10 22:48:11 PDT
Comment on attachment 141287 [details] Patch Attachment 141287 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12664577 New failing tests: plugins/embed-attributes-style.html
WebKit Review Bot
Comment 9 2012-05-10 22:48:17 PDT
Created attachment 141330 [details] Archive of layout-test-results from ec2-cr-linux-01 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-01 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Joe Thomas
Comment 10 2012-05-10 23:29:54 PDT
(In reply to comment #8) > (From update of attachment 141287 [details]) > Attachment 141287 [details] did not pass chromium-ews (chromium-xvfb): > Output: http://queues.webkit.org/results/12664577 > > New failing tests: > plugins/embed-attributes-style.html Not related to the patch. This testcase is failing on Chromium bot also. (http://build.webkit.org/builders/Chromium%20Linux%20Release%20%28Tests%29/builds/32397/steps/layout-test/logs/stdio)
Joe Thomas
Comment 11 2012-05-11 00:24:53 PDT
(In reply to comment #10) > (In reply to comment #8) > > (From update of attachment 141287 [details] [details]) > > Attachment 141287 [details] [details] did not pass chromium-ews (chromium-xvfb): > > Output: http://queues.webkit.org/results/12664577 > > > > New failing tests: > > plugins/embed-attributes-style.html > > Not related to the patch. > > This testcase is failing on Chromium bot also. (http://build.webkit.org/builders/Chromium%20Linux%20Release%20%28Tests%29/builds/32397/steps/layout-test/logs/stdio) Bug 86170.
Joe Thomas
Comment 12 2012-05-11 11:42:49 PDT
Created attachment 141461 [details] patch Re-posting the patch to make Chromium build green.
Alexis Menard (darktears)
Comment 13 2012-05-14 04:48:23 PDT
(In reply to comment #4) > It seems we could test for this generic class of bugs by feeding the output of getPropertyValue into the cssText and validating that the same result came back out. :) fast/css/getComputedStyle/getComputedStyle-border-radius-shorthand.html has a checkComputedStyleValue() which is almost what you describe. I think we should generalize this pattern. Whatever output we produce it should be valid output that you can set back somewhere else.
Alexis Menard (darktears)
Comment 14 2012-05-14 04:49:35 PDT
Comment on attachment 141461 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=141461&action=review > LayoutTests/ChangeLog:9 > + "If one <box> value is present then it sets both âbackground-originâ and âbackground-clipâ to that value. Some weird characters here : âbackground-originâ and âbackground-clipâ > LayoutTests/fast/backgrounds/background-clip-background-origin-order.html:10 > + layoutTestController.dumpAsText(); Do you need that?
Joe Thomas
Comment 15 2012-05-14 06:37:16 PDT
Created attachment 141717 [details] Patch-Updated With review comments incorporated.
Joe Thomas
Comment 16 2012-05-14 06:39:04 PDT
(In reply to comment #14) > (From update of attachment 141461 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=141461&action=review > > > LayoutTests/ChangeLog:9 > > + "If one <box> value is present then it sets both âbackground-originâ and âbackground-clipâ to that value. > > Some weird characters here : âbackground-originâ and âbackground-clipâ > Removed. > > LayoutTests/fast/backgrounds/background-clip-background-origin-order.html:10 > > + layoutTestController.dumpAsText(); > > Do you need that? Not required. Removed.
Tony Chang
Comment 17 2012-05-16 15:45:13 PDT
Comment on attachment 141717 [details] Patch-Updated It would be nice to have a roundtrip test. That is, you should verify something like: var originalStyle = foo.style.background; foo.style.background = foo.style.background; shouldBe(foo.style.background, originalStyle);
Ryosuke Niwa
Comment 18 2012-05-18 12:05:11 PDT
Comment on attachment 141717 [details] Patch-Updated View in context: https://bugs.webkit.org/attachment.cgi?id=141717&action=review This looks landable. As for round-trip tests, we should probably create a generic one that tests all CSS properties (in a separate bug/patch of course). > LayoutTests/fast/backgrounds/background-clip-background-origin-order.html:9 > + description("Bug 86152 - The order of background-origin and background-clip is wrong in background shorthand"); We don't normally use one-space indentation. Please outdent or use 4-spaces.
Joe Thomas
Comment 19 2012-05-18 12:19:53 PDT
(In reply to comment #18) > (From update of attachment 141717 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=141717&action=review > > This looks landable. As for round-trip tests, we should probably create a generic one that tests all CSS properties (in a separate bug/patch of course). > I already created round-trip test for background shorthand property in Bug 86782. I will update this patch soon. Also we are planning to change the order of properties to match the spec. Please see https://bugs.webkit.org/show_bug.cgi?id=86155#c6 > > LayoutTests/fast/backgrounds/background-clip-background-origin-order.html:9 > > + description("Bug 86152 - The order of background-origin and background-clip is wrong in background shorthand"); > > We don't normally use one-space indentation. Please outdent or use 4-spaces. Sure. I will change it.
Joe Thomas
Comment 20 2012-05-18 17:20:58 PDT
Created attachment 142827 [details] Patch The new order of properties will be CSSPropertyBackgroundImage CSSPropertyBackgroundPosition CSSPropertyBackgroundSize CSSPropertyBackgroundRepeat CSSPropertyBackgroundAttachment CSSPropertyBackgroundOrigin CSSPropertyBackgroundClip CSSPropertyBackgroundColor
WebKit Review Bot
Comment 21 2012-05-18 20:55:56 PDT
Comment on attachment 142827 [details] Patch Attachment 142827 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12726640 New failing tests: fast/dom/background-shorthand-csstext.html
WebKit Review Bot
Comment 22 2012-05-18 20:56:01 PDT
Created attachment 142846 [details] Archive of layout-test-results from ec2-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Joe Thomas
Comment 23 2012-05-19 06:24:48 PDT
Created attachment 142865 [details] Patch-fixes-layout-test
Ryosuke Niwa
Comment 24 2012-05-19 10:49:32 PDT
Comment on attachment 142865 [details] Patch-fixes-layout-test View in context: https://bugs.webkit.org/attachment.cgi?id=142865&action=review > Source/WebCore/css/StylePropertyShorthand.cpp:39 > CSSPropertyBackgroundOrigin, > - CSSPropertyBackgroundPositionX, > - CSSPropertyBackgroundPositionY, > - CSSPropertyBackgroundSize > + CSSPropertyBackgroundClip, The said specification doesn't seem to say anything about origin and clip.
Joe Thomas
Comment 25 2012-05-19 10:56:30 PDT
(In reply to comment #24) > (From update of attachment 142865 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=142865&action=review > > > Source/WebCore/css/StylePropertyShorthand.cpp:39 > > CSSPropertyBackgroundOrigin, > > - CSSPropertyBackgroundPositionX, > > - CSSPropertyBackgroundPositionY, > > - CSSPropertyBackgroundSize > > + CSSPropertyBackgroundClip, > > The said specification doesn't seem to say anything about origin and clip. Paraphrasing from the spec http://www.w3.org/TR/css3-background/#background: If one <box> value is present then it sets both ‘background-origin’ and ‘background-clip’ to that value. If two values are present, then the first sets ‘background-origin’ and the second ‘background-clip’.
Ryosuke Niwa
Comment 26 2012-05-19 11:03:39 PDT
Comment on attachment 142865 [details] Patch-fixes-layout-test View in context: https://bugs.webkit.org/attachment.cgi?id=142865&action=review >>> Source/WebCore/css/StylePropertyShorthand.cpp:39 >>> + CSSPropertyBackgroundClip, >> >> The said specification doesn't seem to say anything about origin and clip. > > Paraphrasing from the spec http://www.w3.org/TR/css3-background/#background: > > If one <box> value is present then it sets both ‘background-origin’ and ‘background-clip’ to that value. If two values are present, then the first sets ‘background-origin’ and the second ‘background-clip’. Ok.
Ryosuke Niwa
Comment 27 2012-05-19 11:06:06 PDT
Comment on attachment 142865 [details] Patch-fixes-layout-test hang on, where did fast/backgrounds/background-clip-background-origin-order.html go?
Joe Thomas
Comment 28 2012-05-19 11:10:52 PDT
(In reply to comment #27) > (From update of attachment 142865 [details]) > hang on, where did fast/backgrounds/background-clip-background-origin-order.html go? The order of the CSS properties are very well tested with the existing test case LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html after I added round-trip testing to this with bug 86782. So I thought there is no need to introduce one more test case.
Ryosuke Niwa
Comment 29 2012-05-19 11:15:58 PDT
Comment on attachment 142865 [details] Patch-fixes-layout-test (In reply to comment #28) > (In reply to comment #27) > > (From update of attachment 142865 [details] [details]) > > hang on, where did fast/backgrounds/background-clip-background-origin-order.html go? > > The order of the CSS properties are very well tested with the existing test case LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html after I added round-trip testing to this with bug 86782. So I thought there is no need to introduce one more test case. Okay. Fair enough.
WebKit Review Bot
Comment 30 2012-05-19 11:24:50 PDT
Comment on attachment 142865 [details] Patch-fixes-layout-test Clearing flags on attachment: 142865 Committed r117694: <http://trac.webkit.org/changeset/117694>
WebKit Review Bot
Comment 31 2012-05-19 11:24:57 PDT
All reviewed patches have been landed. Closing bug.
Joe Thomas
Comment 32 2012-05-19 11:35:41 PDT
Thanks for the review !
Note You need to log in before you can comment on or make changes to this bug.