Bug 100120

Summary: -webkit-image-set should support resolution units other than 'x'
Product: WebKit Reporter: Rick Byers <rbyers>
Component: CSSAssignee: Noam Rosenthal <noam>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, darin, esprehn+autocc, ews-feeder, ews-watchlist, glenn, gyuyoung.kim, macpherson, menard, noam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
darin: review+
Patch
none
Patch
none
Patch
none
Patch for landing none

Rick Byers
Reported 2012-10-23 07:06:19 PDT
-webkit-image-set takes a scale factor with the unit 'x' which is equivalent to the standard 'dppx' unit. This parsing of 'x' is hard-coded into CSSParser::parseImageSet. Currently the draft spec (http://dev.w3.org/csswg/css4-images/#image-set-notation) says that this can be any valid resolution. We should support parsing any resolution here, and perhaps just make 'x' a synonym for 'dppx' units. This is probably pretty low priority in my opinion.
Attachments
Patch (34.02 KB, patch)
2020-01-23 03:10 PST, Noam Rosenthal
darin: review+
Patch (34.13 KB, patch)
2020-01-26 22:54 PST, Noam Rosenthal
no flags
Patch (34.13 KB, patch)
2020-01-26 22:57 PST, Noam Rosenthal
no flags
Patch (34.13 KB, patch)
2020-01-26 23:51 PST, Noam Rosenthal
no flags
Patch for landing (35.45 KB, patch)
2020-01-27 23:12 PST, Noam Rosenthal
no flags
Noam Rosenthal
Comment 1 2020-01-23 03:10:12 PST
Noam Rosenthal
Comment 2 2020-01-23 03:24:17 PST
Regarding computed style - the decision to use dppx instead of x as a computed value is a matter of choosing between backwards compatibility and spec correctness. I chose to go with correctness here because computed values for image-set are probably not a big thing backwards-compatibility-wise. But it's a possible alternative to keep "x" values for backwards compatibility. Thoughts about that welcome.
Darin Adler
Comment 3 2020-01-26 21:49:26 PST
Comment on attachment 388531 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388531&action=review > Source/WebCore/css/CSSImageSetValue.cpp:53 > + for (size_t i = 0; i < length - 1; i += 2) { This does the wrong thing for length of 0. I suggest i + 1 < length instead, which handles the case correctly. > Source/WebCore/css/CSSImageSetValue.cpp:133 > + for (size_t i = 0; i < length - 1; i += 2) { This does the wrong thing for length of 0. I suggest i + 1 < length instead, which handles the case correctly. > Source/WebCore/css/CSSImageSetValue.cpp:139 > + result.append(item(i + 1)->cssText()); Write this as a single line for better efficiency: result.append(item(i)->cssText(), ' ', item(i + 1)->cssText()); > Source/WebCore/css/parser/CSSPropertyParserHelpers.h:63 > +enum class AllowXResolutionUnit { > + Allow, > + Forbid > +}; My style opinion: This enum and the one above it should just be defined on a single line.
Noam Rosenthal
Comment 4 2020-01-26 22:54:39 PST
Noam Rosenthal
Comment 5 2020-01-26 22:57:25 PST
Noam Rosenthal
Comment 6 2020-01-26 23:51:55 PST
EWS
Comment 7 2020-01-27 14:55:46 PST
Comment on attachment 388834 [details] Patch Rejecting attachment 388834 [details] from commit-queue. noam@webkit.org does not have committer permissions according to https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
Darin Adler
Comment 8 2020-01-27 16:54:36 PST
Comment on attachment 388834 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=388834&action=review > LayoutTests/fast/css/image-set-parsing-expected.txt:59 > -PASS subRule.cssText is '3' > +FAIL subRule.cssText should be 3. Was 3dppx. Let's not introduce this failure. > LayoutTests/fast/css/image-set-parsing.html:102 > + ["c", "3", "b", "2dppx", "a", "1dppx"]); This should be "3dppx" not "3". > Source/WebCore/css/CSSImageSetValue.cpp:61 > + m_imagesInSet.append({imageValue, scaleFactor}); WebKit coding style puts spaces inside the braces. (Not sure why, but I’ve tried to stay consistent.)
Noam Rosenthal
Comment 9 2020-01-27 23:12:01 PST
Created attachment 388972 [details] Patch for landing
WebKit Commit Bot
Comment 10 2020-01-27 23:54:53 PST
Comment on attachment 388972 [details] Patch for landing Clearing flags on attachment: 388972 Committed r255228: <https://trac.webkit.org/changeset/255228>
WebKit Commit Bot
Comment 11 2020-01-27 23:54:55 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12 2020-01-27 23:55:27 PST
Sam Sneddon [:gsnedders]
Comment 13 2021-09-07 03:02:21 PDT
*** Bug 206142 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.