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

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

Issue 758523002: Store :last/first-child state as restyle flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed assert Created 6 years, 1 month 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 b461ea062ef79cabda5eec1694b49b42c0f81521..099a94cd6a4073d6787053d246c48cf3df6305a2 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -618,10 +618,8 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, c
if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
bool result = siblingTraversalStrategy.isFirstChild(element);
if (m_mode == ResolvingStyle) {
- RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
parent->setChildrenAffectedByFirstChildRules();
- if (result && childStyle)
- childStyle->setFirstChildState();
+ element.setAffectedByFirstChildRules();
}
return result;
}
@@ -640,10 +638,8 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, c
if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
bool result = parent->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
if (m_mode == ResolvingStyle) {
- RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
parent->setChildrenAffectedByLastChildRules();
- if (result && childStyle)
- childStyle->setLastChildState();
+ element.setAffectedByLastChildRules();
}
return result;
}
@@ -663,13 +659,10 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, c
bool firstChild = siblingTraversalStrategy.isFirstChild(element);
bool onlyChild = firstChild && parent->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
if (m_mode == ResolvingStyle) {
- RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element.renderStyle();
parent->setChildrenAffectedByFirstChildRules();
parent->setChildrenAffectedByLastChildRules();
- if (firstChild && childStyle)
- childStyle->setFirstChildState();
- if (onlyChild && childStyle)
- childStyle->setLastChildState();
+ element.setAffectedByFirstChildRules();
+ element.setAffectedByLastChildRules();
}
return onlyChild;
}

Powered by Google App Engine
This is Rietveld 408576698