Limit length of @counter-style padding#60542
Conversation
|
EWS run on previous version of this PR (hash 0d94c8c) Details
|
0d94c8c to
933ac20
Compare
|
EWS run on current version of this PR (hash 933ac20) Details
|
| result.append(text); | ||
| text = result.toString(); |
There was a problem hiding this comment.
This could use a refactoring where we pass around StringBuilder& instead of a String&
There was a problem hiding this comment.
Hm, I would presume that almost all callers to this function early exit out at the first line since counter style padding seems like it's relatively rare. The initial representation of the counter passed in to this function is a String (and changing that seems like probably not a good idea but that's just based on my local scanning of the code). So at first glance it seems like probably a good idea to leave the function signature alone.
I mostly changed the String repeat building here since I'm already mucking with this function, and it seems easy to reason about, and it seems like all the other similar functions in this file are already using a StringBuilder to build up counter-related strings.
https://bugs.webkit.org/show_bug.cgi?id=309875 rdar://172044856 Reviewed by Antti Koivisto. We should limit the length of padding in a @counter-style rule. CSS Counter Styles Level 3 explicitly allows this, and Chrome and Firefox already apply a length limit of 120 and 150 respectively. This patch applies a limit of 150 to match Firefox. Test: fast/css/counters/counter-style-pad-length-limit.html * LayoutTests/fast/css/counters/counter-style-pad-length-limit-expected.txt: Added. * LayoutTests/fast/css/counters/counter-style-pad-length-limit.html: Added. * Source/WebCore/css/CSSCounterStyle.cpp: (WebCore::CSSCounterStyle::text): (WebCore::CSSCounterStyle::applyPadSymbols const): * Source/WebCore/css/CSSCounterStyle.h: Canonical link: https://commits.webkit.org/309228@main
933ac20 to
1e7932e
Compare
|
Committed 309228@main (1e7932e): https://commits.webkit.org/309228@main Reviewed commits have been landed. Closing PR #60542 and removing active labels. |
1e7932e
933ac20
🛠 ios-safer-cpp