Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Unified Diff: Source/core/css/TreeBoundaryCrossingRules.cpp

Issue 323423008: Revert r174436 (Reduce the cost of the n^2 loop in collectTreeBoundaryCrossingRules) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a layout test Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css/content-distributed-nodes-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/TreeBoundaryCrossingRules.cpp
diff --git a/Source/core/css/TreeBoundaryCrossingRules.cpp b/Source/core/css/TreeBoundaryCrossingRules.cpp
index e45aa3f8d1546a1beb9e5b3603d14e9dbfd2c914..503eb839a9988fed48b940fa82369c9ba1b8dc06 100644
--- a/Source/core/css/TreeBoundaryCrossingRules.cpp
+++ b/Source/core/css/TreeBoundaryCrossingRules.cpp
@@ -32,7 +32,6 @@
#include "core/css/ElementRuleCollector.h"
#include "core/css/RuleFeature.h"
#include "core/dom/StyleEngine.h"
-#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRoot.h"
namespace WebCore {
@@ -74,8 +73,6 @@ void TreeBoundaryCrossingRules::collectTreeBoundaryCrossingRules(Element* elemen
// When comparing rules declared in inner treescopes, inner's rules win.
CascadeOrder innerCascadeOrder = size();
- // FIXME: This is n^2 across the number of scoping nodes in the entire document! We need to walk the
- // ancestors of |element| instead.
for (DocumentOrderedList::iterator it = m_scopingNodes.begin(); it != m_scopingNodes.end(); ++it) {
const ContainerNode* scopingNode = toContainerNode(*it);
CSSStyleSheetRuleSubSet* ruleSubSet = m_treeBoundaryCrossingRuleSetMap.get(scopingNode);
@@ -89,24 +86,12 @@ void TreeBoundaryCrossingRules::collectTreeBoundaryCrossingRules(Element* elemen
scopingNode = toShadowRoot(scopingNode)->host();
}
- // FIXME: This is a terrible hack to avoid doing most of the work in this n^2 loop.
- // Instead we should just fix the loop to collect the proper scopes up the tree instead
- // of iterating all possible scopes.
- const InsertionPoint* insertionPoint = resolveReprojection(element);
- if ((insertionPoint && !scopingNode->containsIncludingShadowDOM(insertionPoint))
- || (!insertionPoint && !scopingNode->containsIncludingShadowDOM(element))) {
- ++innerCascadeOrder;
- --outerCascadeOrder;
- continue;
- }
-
CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outerCascadeOrder;
for (CSSStyleSheetRuleSubSet::iterator it = ruleSubSet->begin(); it != ruleSubSet->end(); ++it) {
CSSStyleSheet* parentStyleSheet = it->first;
RuleSet* ruleSet = it->second.get();
collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, scopingNode, parentStyleSheet), ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(boundaryBehavior), ignoreCascadeScope, cascadeOrder);
}
-
++innerCascadeOrder;
--outerCascadeOrder;
}
« no previous file with comments | « LayoutTests/fast/css/content-distributed-nodes-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698