| Index: Source/core/css/SelectorChecker.cpp
|
| diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
|
| index 4215a911629651e770d5ffaf81192441d5013de2..cf4b0fc7cddccaa3fc42ab5392e63f17049d414d 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"
|
| @@ -280,8 +279,8 @@ SelectorChecker::Match SelectorChecker::matchForRelation(const SelectorCheckingC
|
|
|
| case CSSSelector::DirectAdjacent:
|
| if (m_mode == ResolvingStyle) {
|
| - if (Node* parent = context.element->parentElementOrShadowRoot())
|
| - SiblingRuleHelper(parent).setChildrenAffectedByDirectAdjacentRules();
|
| + if (ContainerNode* parent = context.element->parentElementOrShadowRoot())
|
| + parent->setChildrenAffectedByDirectAdjacentRules();
|
| }
|
| nextContext.element = ElementTraversal::previousSibling(*context.element);
|
| if (!nextContext.element)
|
| @@ -292,8 +291,8 @@ SelectorChecker::Match SelectorChecker::matchForRelation(const SelectorCheckingC
|
|
|
| case CSSSelector::IndirectAdjacent:
|
| if (m_mode == ResolvingStyle) {
|
| - if (Node* parent = context.element->parentElementOrShadowRoot())
|
| - SiblingRuleHelper(parent).setChildrenAffectedByIndirectAdjacentRules();
|
| + if (ContainerNode* parent = context.element->parentElementOrShadowRoot())
|
| + parent->setChildrenAffectedByIndirectAdjacentRules();
|
| }
|
| nextContext.element = ElementTraversal::previousSibling(*context.element);
|
| nextContext.isSubSelector = false;
|
| @@ -565,11 +564,11 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| }
|
| case CSSSelector::PseudoFirstChild:
|
| // first-child matches the first child that is an element
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| 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();
|
| }
|
| @@ -578,21 +577,20 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| break;
|
| case CSSSelector::PseudoFirstOfType:
|
| // first-of-type matches the first element of its type
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| + if (ContainerNode* 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);
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| + 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();
|
| }
|
| @@ -601,24 +599,22 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| break;
|
| case CSSSelector::PseudoLastOfType:
|
| // last-of-type matches the last element of its type
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| - SiblingRuleHelper helper(parent);
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| 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);
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| 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)
|
| @@ -629,13 +625,12 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| break;
|
| case CSSSelector::PseudoOnlyOfType:
|
| // FIXME: This selector is very slow.
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| - SiblingRuleHelper helper(parent);
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| 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());
|
| }
|
| @@ -643,14 +638,14 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| case CSSSelector::PseudoNthChild:
|
| if (!selector.parseNth())
|
| break;
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| int count = 1 + siblingTraversalStrategy.countElementsBefore(element);
|
| if (m_mode == ResolvingStyle) {
|
| RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
|
| element.setChildIndex(count);
|
| if (childStyle)
|
| childStyle->setUnique();
|
| - SiblingRuleHelper(parent).setChildrenAffectedByForwardPositionalRules();
|
| + parent->setChildrenAffectedByForwardPositionalRules();
|
| }
|
|
|
| if (selector.matchNth(count))
|
| @@ -660,10 +655,10 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| case CSSSelector::PseudoNthOfType:
|
| if (!selector.parseNth())
|
| break;
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| + if (ContainerNode* 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;
|
| @@ -672,11 +667,10 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| case CSSSelector::PseudoNthLastChild:
|
| if (!selector.parseNth())
|
| break;
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| - SiblingRuleHelper helper(parent);
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| 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))
|
| @@ -686,11 +680,10 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
|
| case CSSSelector::PseudoNthLastOfType:
|
| if (!selector.parseNth())
|
| break;
|
| - if (Node* parent = element.parentElementOrShadowRoot()) {
|
| - SiblingRuleHelper helper(parent);
|
| + if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
|
| if (m_mode == ResolvingStyle)
|
| - helper.setChildrenAffectedByBackwardPositionalRules();
|
| - if (!helper.isFinishedParsingChildren())
|
| + parent->setChildrenAffectedByBackwardPositionalRules();
|
| + if (!parent->isFinishedParsingChildren())
|
| return false;
|
|
|
| int count = 1 + siblingTraversalStrategy.countElementsOfTypeAfter(element, element.tagQName());
|
|
|