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

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

Issue 208933003: Remove SiblingRuleHelper (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 4215a911629651e770d5ffaf81192441d5013de2..fc8f926a40c82d23365bf752d78e5003b8788d6f 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -35,7 +35,6 @@
#include "core/dom/ElementTraversal.h"
#include "core/dom/FullscreenElementStack.h"
#include "core/dom/NodeRenderStyle.h"
-#include "core/dom/SiblingRuleHelper.h"
#include "core/dom/Text.h"
#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRoot.h"
@@ -281,7 +280,7 @@ SelectorChecker::Match SelectorChecker::matchForRelation(const SelectorCheckingC
case CSSSelector::DirectAdjacent:
if (m_mode == ResolvingStyle) {
if (Node* parent = context.element->parentElementOrShadowRoot())
- SiblingRuleHelper(parent).setChildrenAffectedByDirectAdjacentRules();
+ parent->setChildrenAffectedByDirectAdjacentRules();
}
nextContext.element = ElementTraversal::previousSibling(*context.element);
if (!nextContext.element)
@@ -293,7 +292,7 @@ SelectorChecker::Match SelectorChecker::matchForRelation(const SelectorCheckingC
case CSSSelector::IndirectAdjacent:
if (m_mode == ResolvingStyle) {
if (Node* parent = context.element->parentElementOrShadowRoot())
- SiblingRuleHelper(parent).setChildrenAffectedByIndirectAdjacentRules();
+ parent->setChildrenAffectedByIndirectAdjacentRules();
}
nextContext.element = ElementTraversal::previousSibling(*context.element);
nextContext.isSubSelector = false;
@@ -569,7 +568,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
bool result = siblingTraversalStrategy.isFirstChild(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
- SiblingRuleHelper(parent).setChildrenAffectedByFirstChildRules();
+ parent->setChildrenAffectedByFirstChildRules();
if (result && childStyle)
childStyle->setFirstChildState();
}
@@ -581,18 +580,17 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
if (Node* parent = element.parentElementOrShadowRoot()) {
bool result = siblingTraversalStrategy.isFirstOfType(element, element.tagQName());
if (m_mode == ResolvingStyle)
- SiblingRuleHelper(parent).setChildrenAffectedByForwardPositionalRules();
+ parent->setChildrenAffectedByForwardPositionalRules();
return result;
}
break;
case CSSSelector::PseudoLastChild:
// last-child matches the last child that is an element
if (Node* parent = element.parentElementOrShadowRoot()) {
- SiblingRuleHelper helper(parent);
- bool result = helper.isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
+ bool result = parent->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
- helper.setChildrenAffectedByLastChildRules();
+ parent->setChildrenAffectedByLastChildRules();
if (result && childStyle)
childStyle->setLastChildState();
}
@@ -602,23 +600,21 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoLastOfType:
// last-of-type matches the last element of its type
if (Node* parent = element.parentElementOrShadowRoot()) {
- SiblingRuleHelper helper(parent);
if (m_mode == ResolvingStyle)
- helper.setChildrenAffectedByBackwardPositionalRules();
- if (!helper.isFinishedParsingChildren())
+ parent->setChildrenAffectedByBackwardPositionalRules();
+ if (!parent->isFinishedParsingChildren())
return false;
return siblingTraversalStrategy.isLastOfType(element, element.tagQName());
}
break;
case CSSSelector::PseudoOnlyChild:
if (Node* parent = element.parentElementOrShadowRoot()) {
- SiblingRuleHelper helper(parent);
bool firstChild = siblingTraversalStrategy.isFirstChild(element);
- bool onlyChild = firstChild && helper.isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
+ bool onlyChild = firstChild && parent->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
- helper.setChildrenAffectedByFirstChildRules();
- helper.setChildrenAffectedByLastChildRules();
+ parent->setChildrenAffectedByFirstChildRules();
+ parent->setChildrenAffectedByLastChildRules();
if (firstChild && childStyle)
childStyle->setFirstChildState();
if (onlyChild && childStyle)
@@ -630,12 +626,11 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoOnlyOfType:
// FIXME: This selector is very slow.
if (Node* parent = element.parentElementOrShadowRoot()) {
- SiblingRuleHelper helper(parent);
if (m_mode == ResolvingStyle) {
- helper.setChildrenAffectedByForwardPositionalRules();
- helper.setChildrenAffectedByBackwardPositionalRules();
+ parent->setChildrenAffectedByForwardPositionalRules();
+ parent->setChildrenAffectedByBackwardPositionalRules();
}
- if (!helper.isFinishedParsingChildren())
+ if (!parent->isFinishedParsingChildren())
return false;
return siblingTraversalStrategy.isFirstOfType(element, element.tagQName()) && siblingTraversalStrategy.isLastOfType(element, element.tagQName());
}
@@ -650,7 +645,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
element.setChildIndex(count);
if (childStyle)
childStyle->setUnique();
- SiblingRuleHelper(parent).setChildrenAffectedByForwardPositionalRules();
+ parent->setChildrenAffectedByForwardPositionalRules();
}
if (selector.matchNth(count))
@@ -663,7 +658,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
if (Node* parent = element.parentElementOrShadowRoot()) {
int count = 1 + siblingTraversalStrategy.countElementsOfTypeBefore(element, element.tagQName());
if (m_mode == ResolvingStyle)
- SiblingRuleHelper(parent).setChildrenAffectedByForwardPositionalRules();
+ parent->setChildrenAffectedByForwardPositionalRules();
if (selector.matchNth(count))
return true;
@@ -673,10 +668,9 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
if (!selector.parseNth())
break;
if (Node* parent = element.parentElementOrShadowRoot()) {
- SiblingRuleHelper helper(parent);
if (m_mode == ResolvingStyle)
- helper.setChildrenAffectedByBackwardPositionalRules();
- if (!helper.isFinishedParsingChildren())
+ parent->setChildrenAffectedByBackwardPositionalRules();
+ if (!parent->isFinishedParsingChildren())
return false;
int count = 1 + siblingTraversalStrategy.countElementsAfter(element);
if (selector.matchNth(count))
@@ -687,10 +681,9 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
if (!selector.parseNth())
break;
if (Node* parent = element.parentElementOrShadowRoot()) {
- SiblingRuleHelper helper(parent);
if (m_mode == ResolvingStyle)
- helper.setChildrenAffectedByBackwardPositionalRules();
- if (!helper.isFinishedParsingChildren())
+ parent->setChildrenAffectedByBackwardPositionalRules();
+ if (!parent->isFinishedParsingChildren())
return false;
int count = 1 + siblingTraversalStrategy.countElementsOfTypeAfter(element, element.tagQName());

Powered by Google App Engine
This is Rietveld 408576698