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

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

Issue 270503006: Make pseudo-classes selector queries work on DocumentFragment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address Esprehn's comments Created 6 years, 7 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 eff32607837754fcff7e2bca5a3902e7eff25b5e..53cef3949782b32e5f8a87d55202e83837a94b4a 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -607,7 +607,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
}
case CSSSelector::PseudoFirstChild:
// first-child matches the first child that is an element
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
bool result = siblingTraversalStrategy.isFirstChild(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
@@ -620,7 +620,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
break;
case CSSSelector::PseudoFirstOfType:
// first-of-type matches the first element of its type
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
bool result = siblingTraversalStrategy.isFirstOfType(element, element.tagQName());
if (m_mode == ResolvingStyle)
parent->setChildrenAffectedByForwardPositionalRules();
@@ -629,7 +629,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
break;
case CSSSelector::PseudoLastChild:
// last-child matches the last child that is an element
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
bool result = parent->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
@@ -642,7 +642,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
break;
case CSSSelector::PseudoLastOfType:
// last-of-type matches the last element of its type
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
if (m_mode == ResolvingStyle)
parent->setChildrenAffectedByBackwardPositionalRules();
if (!parent->isFinishedParsingChildren())
@@ -651,7 +651,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
}
break;
case CSSSelector::PseudoOnlyChild:
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
bool firstChild = siblingTraversalStrategy.isFirstChild(element);
bool onlyChild = firstChild && parent->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
if (m_mode == ResolvingStyle) {
@@ -668,7 +668,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
break;
case CSSSelector::PseudoOnlyOfType:
// FIXME: This selector is very slow.
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
if (m_mode == ResolvingStyle) {
parent->setChildrenAffectedByForwardPositionalRules();
parent->setChildrenAffectedByBackwardPositionalRules();
@@ -681,7 +681,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoNthChild:
if (!selector.parseNth())
break;
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
int count = 1 + siblingTraversalStrategy.countElementsBefore(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
@@ -697,7 +697,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoNthOfType:
if (!selector.parseNth())
break;
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
int count = 1 + siblingTraversalStrategy.countElementsOfTypeBefore(element, element.tagQName());
if (m_mode == ResolvingStyle)
parent->setChildrenAffectedByForwardPositionalRules();
@@ -709,7 +709,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoNthLastChild:
if (!selector.parseNth())
break;
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
if (m_mode == ResolvingStyle)
parent->setChildrenAffectedByBackwardPositionalRules();
if (!parent->isFinishedParsingChildren())
@@ -722,7 +722,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoNthLastOfType:
if (!selector.parseNth())
break;
- if (ContainerNode* parent = element.parentElementOrShadowRoot()) {
+ if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
if (m_mode == ResolvingStyle)
parent->setChildrenAffectedByBackwardPositionalRules();
if (!parent->isFinishedParsingChildren())

Powered by Google App Engine
This is Rietveld 408576698