Use streaming tokenizer for CSS declarations
I think this is the lowest level where we can use the streaming tokenizer directly without severe complications. A CSS value can contain a custom property reference at any point, which necessitates switching from parsing using the property's grammar, to parsing as an unresolved value. That means either we have to buffer tokens at some point, or we have to rewind the stream back to the start of the value and repeat tokenization. I'm aiming towards the former because it's more compatible with existing code and less likely to cause perf regression. With that in mind, this CL also introduces CSSTokenizedValue to hold the token range plus a view on the original string, for consumption by the custom property handler in an upcoming CL. I've added a test to ensure the string is captured correctly in the presence of !important. Bug: 661854 Change-Id: Ic3bb882e0b766fc09d0c64e0dbee10690c475c75 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2332374 Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com> Reviewed-by:Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#798337}
Showing
Please register or sign in to comment