RESOLVED FIXED232874
Refactor consumeWillChange()
https://bugs.webkit.org/show_bug.cgi?id=232874
Summary Refactor consumeWillChange()
Tim Nguyen (:ntim)
Reported 2021-11-09 03:05:39 PST
Attachments
Patch (3.47 KB, patch)
2021-11-09 03:14 PST, Tim Nguyen (:ntim)
no flags
Patch (3.80 KB, patch)
2021-11-09 03:21 PST, Tim Nguyen (:ntim)
koivisto: review+
Tim Nguyen (:ntim)
Comment 1 2021-11-09 03:14:53 PST
Tim Nguyen (:ntim)
Comment 2 2021-11-09 03:21:38 PST
Antti Koivisto
Comment 3 2021-11-09 04:06:09 PST
Comment on attachment 443672 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=443672&action=review > Source/WebCore/css/parser/CSSPropertyParser.cpp:-502 > // Every comma-separated list of identifiers is a valid will-change value, > // unless the list includes an explicitly disallowed identifier. > - while (true) { > - if (range.peek().type() != IdentToken) > + while (!range.atEnd()) { > + switch (range.peek().id()) { > + case CSSValueNone: > + case CSSValueAll: > + case CSSValueAuto: > return nullptr; > - CSSPropertyID propertyID = cssPropertyID(range.peek().value()); > - if (propertyID != CSSPropertyInvalid) { > - // Now "all" is used by both CSSValue and CSSPropertyValue. > - // Need to return nullptr when currentValue is CSSPropertyAll. > - if (propertyID == CSSPropertyWillChange || propertyID == CSSPropertyAll) > - return nullptr; > - values->append(CSSValuePool::singleton().createIdentifierValue(propertyID)); > - range.consumeIncludingWhitespace(); > - } else { It is not clear to me how this is better. The primary purpose of this loop is to consume property identifiers which the old code made clear. After your change the loop looks like it is about CSSValues and property IDs are a buried special case.
Tim Nguyen (:ntim)
Comment 4 2021-11-09 04:51:47 PST
(In reply to Antti Koivisto from comment #3) > Comment on attachment 443672 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=443672&action=review > > > Source/WebCore/css/parser/CSSPropertyParser.cpp:-502 > > // Every comma-separated list of identifiers is a valid will-change value, > > // unless the list includes an explicitly disallowed identifier. > > - while (true) { > > - if (range.peek().type() != IdentToken) > > + while (!range.atEnd()) { > > + switch (range.peek().id()) { > > + case CSSValueNone: > > + case CSSValueAll: > > + case CSSValueAuto: > > return nullptr; > > - CSSPropertyID propertyID = cssPropertyID(range.peek().value()); > > - if (propertyID != CSSPropertyInvalid) { > > - // Now "all" is used by both CSSValue and CSSPropertyValue. > > - // Need to return nullptr when currentValue is CSSPropertyAll. > > - if (propertyID == CSSPropertyWillChange || propertyID == CSSPropertyAll) > > - return nullptr; > > - values->append(CSSValuePool::singleton().createIdentifierValue(propertyID)); > > - range.consumeIncludingWhitespace(); > > - } else { > > It is not clear to me how this is better. The primary purpose of this loop > is to consume property identifiers which the old code made clear. > > After your change the loop looks like it is about CSSValues and property IDs > are a buried special case. This is how the spec defines things, defines values first, and property IDs are just a special cases of <custom-ident>, so to me this is actually easier to read.
Antti Koivisto
Comment 5 2021-11-09 04:57:27 PST
Comment on attachment 443672 [details] Patch Ok then!
Tim Nguyen (:ntim)
Comment 6 2021-11-09 05:08:29 PST
Radar WebKit Bug Importer
Comment 7 2021-11-09 05:09:21 PST
Note You need to log in before you can comment on or make changes to this bug.