[webkit-reviews] review granted: [Bug 77410] <style scoped>: Improve shortcut code for cases where <style scoped> isn't used : [Attachment 124680] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 31 01:14:11 PST 2012


Antti Koivisto <koivisto at iki.fi> has granted Roland Steiner
<rolandsteiner at chromium.org>'s request for review:
Bug 77410: <style scoped>: Improve shortcut code for cases where <style scoped>
isn't used
https://bugs.webkit.org/show_bug.cgi?id=77410

Attachment 124680: Patch
https://bugs.webkit.org/attachment.cgi?id=124680&action=review

------- Additional Comments from Antti Koivisto <koivisto at iki.fi>
View in context: https://bugs.webkit.org/attachment.cgi?id=124680&action=review


> Source/WebCore/css/CSSStyleSelector.cpp:858
> +    if (!m_scopedAuthorStyles.isEmpty()) {
> +	   // Match scoped author rules by traversing the scoped element stack
(rebuild it if it got inconsistent).
> +	   const Element* parent = m_element->parentOrHostElement();
> +	   if (!scopingElementStackIsConsistent(parent))
> +	       setupScopingElementStack(parent);
> +	   for (size_t i = m_scopingElementStack.size(); i; --i) {
> +	       collectMatchingRules(m_scopingElementStack[i - 1].m_ruleSet,
firstRuleIndex, lastRuleIndex, includeEmptyRules);
> +	       collectMatchingRulesForRegion(m_scopingElementStack[i -
1].m_ruleSet, firstRuleIndex, lastRuleIndex, includeEmptyRules);
> +	   }
> +	   // Also include the current element.
> +	   RuleSet* ruleSet = scopedRuleSetForElement(m_element);
> +	   if (ruleSet) {
> +	       collectMatchingRules(ruleSet, firstRuleIndex, lastRuleIndex,
includeEmptyRules);
> +	       collectMatchingRulesForRegion(ruleSet, firstRuleIndex,
lastRuleIndex, includeEmptyRules);
> +	   }
>      }

The code inside if (!m_scopedAuthorStyles.isEmpty())  could be factored into a
function, matchScopedAuthorRules() or something.


More information about the webkit-reviews mailing list