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

Side by Side Diff: Source/core/dom/SiblingRuleHelper.cpp

Issue 198783003: Recalc sibling styles for forward positional rules on mutations only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review issue. 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/SiblingRuleHelper.h ('k') | Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/dom/SiblingRuleHelper.h" 6 #include "core/dom/SiblingRuleHelper.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/StyleEngine.h" 10 #include "core/dom/StyleEngine.h"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 void SiblingRuleHelper::setChildrenAffectedByDirectAdjacentRules() 23 void SiblingRuleHelper::setChildrenAffectedByDirectAdjacentRules()
24 { 24 {
25 if (m_node->isElementNode()) 25 if (m_node->isElementNode())
26 toElement(m_node)->setChildrenAffectedByDirectAdjacentRules(); 26 toElement(m_node)->setChildrenAffectedByDirectAdjacentRules();
27 else 27 else
28 toShadowRoot(m_node)->setChildrenAffectedByDirectAdjacentRules(); 28 toShadowRoot(m_node)->setChildrenAffectedByDirectAdjacentRules();
29 } 29 }
30 30
31 void SiblingRuleHelper::setChildrenAffectedByIndirectAdjacentRules()
32 {
33 if (m_node->isElementNode())
34 toElement(m_node)->setChildrenAffectedByIndirectAdjacentRules();
35 else
36 toShadowRoot(m_node)->setChildrenAffectedByIndirectAdjacentRules();
37 }
38
31 void SiblingRuleHelper::setChildrenAffectedByForwardPositionalRules() 39 void SiblingRuleHelper::setChildrenAffectedByForwardPositionalRules()
32 { 40 {
33 if (m_node->isElementNode()) 41 if (m_node->isElementNode())
34 toElement(m_node)->setChildrenAffectedByForwardPositionalRules(); 42 toElement(m_node)->setChildrenAffectedByForwardPositionalRules();
35 else 43 else
36 toShadowRoot(m_node)->setChildrenAffectedByForwardPositionalRules(); 44 toShadowRoot(m_node)->setChildrenAffectedByForwardPositionalRules();
37 } 45 }
38 46
39 void SiblingRuleHelper::setChildrenAffectedByBackwardPositionalRules() 47 void SiblingRuleHelper::setChildrenAffectedByBackwardPositionalRules()
40 { 48 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool SiblingRuleHelper::childrenAffectedByLastChildRules() const 81 bool SiblingRuleHelper::childrenAffectedByLastChildRules() const
74 { 82 {
75 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByLastCh ildRules() : toShadowRoot(m_node)->childrenAffectedByLastChildRules(); 83 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByLastCh ildRules() : toShadowRoot(m_node)->childrenAffectedByLastChildRules();
76 } 84 }
77 85
78 bool SiblingRuleHelper::childrenAffectedByDirectAdjacentRules() const 86 bool SiblingRuleHelper::childrenAffectedByDirectAdjacentRules() const
79 { 87 {
80 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByDirect AdjacentRules() : toShadowRoot(m_node)->childrenAffectedByDirectAdjacentRules(); 88 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByDirect AdjacentRules() : toShadowRoot(m_node)->childrenAffectedByDirectAdjacentRules();
81 } 89 }
82 90
91 bool SiblingRuleHelper::childrenAffectedByIndirectAdjacentRules() const
92 {
93 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByIndire ctAdjacentRules() : toShadowRoot(m_node)->childrenAffectedByIndirectAdjacentRule s();
94 }
95
83 bool SiblingRuleHelper::childrenAffectedByForwardPositionalRules() const 96 bool SiblingRuleHelper::childrenAffectedByForwardPositionalRules() const
84 { 97 {
85 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByForwar dPositionalRules() : toShadowRoot(m_node)->childrenAffectedByForwardPositionalRu les(); 98 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByForwar dPositionalRules() : toShadowRoot(m_node)->childrenAffectedByForwardPositionalRu les();
86 } 99 }
87 100
88 bool SiblingRuleHelper::childrenAffectedByBackwardPositionalRules() const 101 bool SiblingRuleHelper::childrenAffectedByBackwardPositionalRules() const
89 { 102 {
90 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByBackwa rdPositionalRules() : toShadowRoot(m_node)->childrenAffectedByBackwardPositional Rules(); 103 return m_node->isElementNode() ? toElement(m_node)->childrenAffectedByBackwa rdPositionalRules() : toShadowRoot(m_node)->childrenAffectedByBackwardPositional Rules();
91 } 104 }
92 105
93 void SiblingRuleHelper::checkForChildrenAdjacentRuleChanges() 106 void SiblingRuleHelper::checkForChildrenAdjacentRuleChanges()
94 { 107 {
95 bool hasDirectAdjacentRules = childrenAffectedByDirectAdjacentRules(); 108 bool hasDirectAdjacentRules = childrenAffectedByDirectAdjacentRules();
96 bool hasIndirectAdjacentRules = childrenAffectedByForwardPositionalRules(); 109 bool hasIndirectAdjacentRules = childrenAffectedByIndirectAdjacentRules();
97 110
98 if (!hasDirectAdjacentRules && !hasIndirectAdjacentRules) 111 if (!hasDirectAdjacentRules && !hasIndirectAdjacentRules)
99 return; 112 return;
100 113
101 unsigned forceCheckOfNextElementCount = 0; 114 unsigned forceCheckOfNextElementCount = 0;
102 bool forceCheckOfAnyElementSibling = false; 115 bool forceCheckOfAnyElementSibling = false;
103 Document& document = m_node->document(); 116 Document& document = m_node->document();
104 117
105 for (Node* child = m_node->firstChild(); child; child = child->nextSibling() ) { 118 for (Node* child = m_node->firstChild(); child; child = child->nextSibling() ) {
106 if (!child->isElementNode()) 119 if (!child->isElementNode())
(...skipping 14 matching lines...) Expand all
121 } 134 }
122 } 135 }
123 136
124 bool SiblingRuleHelper::childrenSupportStyleSharing() 137 bool SiblingRuleHelper::childrenSupportStyleSharing()
125 { 138 {
126 return m_node->isElementNode() ? toElement(m_node)->childrenSupportStyleShar ing() : toShadowRoot(m_node)->childrenSupportStyleSharing(); 139 return m_node->isElementNode() ? toElement(m_node)->childrenSupportStyleShar ing() : toShadowRoot(m_node)->childrenSupportStyleSharing();
127 } 140 }
128 141
129 } // namespace WebCore 142 } // namespace WebCore
130 143
OLDNEW
« no previous file with comments | « Source/core/dom/SiblingRuleHelper.h ('k') | Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698