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

Side by Side Diff: Source/core/dom/shadow/ShadowRoot.cpp

Issue 548693002: Share recalcChildStyle between Element and ShadowRoot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add back parent scope for ShadowRoot. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void ShadowRoot::recalcStyle(StyleRecalcChange change) 133 void ShadowRoot::recalcStyle(StyleRecalcChange change)
134 { 134 {
135 // ShadowRoot doesn't support custom callbacks. 135 // ShadowRoot doesn't support custom callbacks.
136 ASSERT(!hasCustomStyleCallbacks()); 136 ASSERT(!hasCustomStyleCallbacks());
137 137
138 StyleResolverParentScope parentScope(*this); 138 StyleResolverParentScope parentScope(*this);
139 139
140 if (styleChangeType() >= SubtreeStyleChange) 140 if (styleChangeType() >= SubtreeStyleChange)
141 change = Force; 141 change = Force;
142 142
143 if (change < Force && hasRareData() && childNeedsStyleRecalc())
144 checkForChildrenAdjacentRuleChanges();
145
146 // There's no style to update so just calling recalcStyle means we're update d. 143 // There's no style to update so just calling recalcStyle means we're update d.
147 clearNeedsStyleRecalc(); 144 clearNeedsStyleRecalc();
148 145
149 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl e does. 146 recalcChildStyle(change);
150 Text* lastTextNode = 0;
151 for (Node* child = lastChild(); child; child = child->previousSibling()) {
152 if (child->isTextNode()) {
153 toText(child)->recalcTextStyle(change, lastTextNode);
154 lastTextNode = toText(child);
155 } else if (child->isElementNode()) {
156 if (child->shouldCallRecalcStyle(change))
157 toElement(child)->recalcStyle(change, lastTextNode);
158 if (child->renderer())
159 lastTextNode = 0;
160 }
161 }
162
163 clearChildNeedsStyleRecalc(); 147 clearChildNeedsStyleRecalc();
164 } 148 }
165 149
166 void ShadowRoot::attach(const AttachContext& context) 150 void ShadowRoot::attach(const AttachContext& context)
167 { 151 {
168 StyleResolverParentScope parentScope(*this); 152 StyleResolverParentScope parentScope(*this);
169 DocumentFragment::attach(context); 153 DocumentFragment::attach(context);
170 } 154 }
171 155
172 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser tionPoint) 156 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser tionPoint)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 void ShadowRoot::trace(Visitor* visitor) 320 void ShadowRoot::trace(Visitor* visitor)
337 { 321 {
338 visitor->trace(m_prev); 322 visitor->trace(m_prev);
339 visitor->trace(m_next); 323 visitor->trace(m_next);
340 visitor->trace(m_shadowRootRareData); 324 visitor->trace(m_shadowRootRareData);
341 TreeScope::trace(visitor); 325 TreeScope::trace(visitor);
342 DocumentFragment::trace(visitor); 326 DocumentFragment::trace(visitor);
343 } 327 }
344 328
345 } 329 }
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698