RESOLVED FIXED Bug 77410
<style scoped>: Improve shortcut code for cases where <style scoped> isn't used
https://bugs.webkit.org/show_bug.cgi?id=77410
Summary <style scoped>: Improve shortcut code for cases where <style scoped> isn't used
Roland Steiner
Reported 2012-01-31 00:58:46 PST
When working on bug 73192 I noticed a few places where shortcut code for cases when <style scoped> isn't used at all could be improved. Esp. CSSStyleSelector::matchAuthorRules can skip a whole code block.
Attachments
Patch (5.11 KB, patch)
2012-01-31 01:02 PST, Roland Steiner
koivisto: review+
koivisto: commit-queue-
Roland Steiner
Comment 1 2012-01-31 01:02:44 PST
Created attachment 124680 [details] Patch Move shortcut out from setupScopingElementStack() to calling sites, where a larger chunk of work can be skipped.
WebKit Review Bot
Comment 2 2012-01-31 01:06:27 PST
Attachment 124680 [details] did not pass style-queue: Failed to run "['Tools/Scripts/update-webkit']" exit_code: 9 Updating OpenSource First, rewinding head to replay your work on top of it... Applying: Fix compilation errors on build-webkit --debug --no-workers on mac. Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging LayoutTests/ChangeLog CONFLICT (content): Merge conflict in LayoutTests/ChangeLog Auto-merging LayoutTests/platform/qt/Skipped CONFLICT (content): Merge conflict in LayoutTests/platform/qt/Skipped Failed to merge in the changes. Patch failed at 0001 Fix compilation errors on build-webkit --debug --no-workers on mac. When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". rebase refs/remotes/origin/master: command returned error: 1 Died at Tools/Scripts/update-webkit line 164. If any of these errors are false positives, please file a bug against check-webkit-style.
Antti Koivisto
Comment 3 2012-01-31 01:14:11 PST
Comment on attachment 124680 [details] Patch 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.
Roland Steiner
Comment 4 2012-01-31 03:04:25 PST
Note You need to log in before you can comment on or make changes to this bug.