Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Style sharing: Allow sharing between elements with classes not refere…
…nced by any selectors. <http://webkit.org/b/103925> Reviewed by Antti Koivisto. When looking for elements that can share style, instead of blindly rejecting candidates with a different "class" attribute, check if it's actually referenced by any of the tracked style rules. It's surprisingly common for web pages to have elements with classes to which no rules apply, mediawiki content is especially good at this. ~2100 new sharing "hits" on <https://en.wikipedia.org/wiki/Steve_Jobs>. * css/StyleResolver.cpp: (WebCore::StyleResolver::canShareStyleWithElement): Don't bail early if the two elements have different return values for hasClass(). (WebCore::StyleResolver::classNamesAffectedByRules): Helper function that returns whether a SpaceSplitString contains a class name referenced by any style rules. (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): Make this a member function since we need access to m_features.classesInRules. * css/StyleResolver.h: (StyleResolver): * css/StyleResolver.cpp: (WebCore::StyleResolver::locateSharedStyle): Cache whether the element we're resolving style for has a "class" attribute referenced by style rules. Canonical link: https://commits.webkit.org/122197@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
73 additions
and 17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters