core(font-size): use order from protocol as implicit specificity #13501
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #12001
Turns out that the order on the protocol for
CSS.getMatchedStylesForNode
is from least to most specific, so we don't need to calculate specificity ourselves. Only need to filter to the rules we care about (based on what properties they contain) and pick the last.I don't think adding various tests in the smoke to really confirm this is too useful–we should just rely on it being a given, as DevTools depends on it. To confirm it works, I am first putting up a draft PR that keeps the current implementation and asserts when the simpler approach does not match. This should pass in all the simpler cases we already support, and only fail for the complex stuff we don't yet support. I ran it on cnn.com, theverge.com, and other big sites and got no errors. The smoke tests
seo perf
also still work.