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

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

Issue 23567016: Have ScopedStyleResolver deal with ContainerNode references, not pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/shadow/ShadowRoot.h ('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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return false; 156 return false;
157 } 157 }
158 } 158 }
159 159
160 void ShadowRoot::recalcStyle(StyleChange change) 160 void ShadowRoot::recalcStyle(StyleChange change)
161 { 161 {
162 // ShadowRoot doesn't support custom callbacks. 162 // ShadowRoot doesn't support custom callbacks.
163 ASSERT(!hasCustomStyleCallbacks()); 163 ASSERT(!hasCustomStyleCallbacks());
164 164
165 StyleResolver* styleResolver = document().styleResolver(); 165 StyleResolver* styleResolver = document().styleResolver();
166 styleResolver->pushParentShadowRoot(this); 166 styleResolver->pushParentShadowRoot(*this);
167 167
168 if (!attached()) { 168 if (!attached()) {
169 attach(); 169 attach();
170 return; 170 return;
171 } 171 }
172 172
173 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne ed 173 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne ed
174 // to promote the change to a Force for all our descendants so they get a 174 // to promote the change to a Force for all our descendants so they get a
175 // recalc and will attach. 175 // recalc and will attach.
176 if (styleChangeType() >= SubtreeStyleChange) 176 if (styleChangeType() >= SubtreeStyleChange)
(...skipping 12 matching lines...) Expand all
189 child->reattach(); 189 child->reattach();
190 else 190 else
191 didReattach = toText(child)->recalcTextStyle(change); 191 didReattach = toText(child)->recalcTextStyle(change);
192 } else if (child->isElementNode() && shouldRecalcStyle(change, child)) { 192 } else if (child->isElementNode() && shouldRecalcStyle(change, child)) {
193 didReattach = toElement(child)->recalcStyle(change); 193 didReattach = toElement(child)->recalcStyle(change);
194 } 194 }
195 195
196 forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyW hitespaceSibling; 196 forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyW hitespaceSibling;
197 } 197 }
198 198
199 styleResolver->popParentShadowRoot(this); 199 styleResolver->popParentShadowRoot(*this);
200 clearNeedsStyleRecalc(); 200 clearNeedsStyleRecalc();
201 clearChildNeedsStyleRecalc(); 201 clearChildNeedsStyleRecalc();
202 } 202 }
203 203
204 bool ShadowRoot::isActive() const 204 bool ShadowRoot::isActive() const
205 { 205 {
206 for (ShadowRoot* shadowRoot = youngerShadowRoot(); shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot()) 206 for (ShadowRoot* shadowRoot = youngerShadowRoot(); shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot())
207 if (!shadowRoot->containsShadowElements()) 207 if (!shadowRoot->containsShadowElements())
208 return false; 208 return false;
209 return true; 209 return true;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 m_resetStyleInheritance = value; 246 m_resetStyleInheritance = value;
247 if (!isActive()) 247 if (!isActive())
248 return; 248 return;
249 249
250 setNeedsStyleRecalc(); 250 setNeedsStyleRecalc();
251 } 251 }
252 252
253 void ShadowRoot::attach(const AttachContext& context) 253 void ShadowRoot::attach(const AttachContext& context)
254 { 254 {
255 StyleResolver* styleResolver = document().styleResolver(); 255 StyleResolver* styleResolver = document().styleResolver();
256 styleResolver->pushParentShadowRoot(this); 256 styleResolver->pushParentShadowRoot(*this);
257 DocumentFragment::attach(context); 257 DocumentFragment::attach(context);
258 styleResolver->popParentShadowRoot(this); 258 styleResolver->popParentShadowRoot(*this);
259 } 259 }
260 260
261 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser tionPoint) 261 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser tionPoint)
262 { 262 {
263 DocumentFragment::insertedInto(insertionPoint); 263 DocumentFragment::insertedInto(insertionPoint);
264 264
265 if (!insertionPoint->inDocument() || !isOldest()) 265 if (!insertionPoint->inDocument() || !isOldest())
266 return InsertionDone; 266 return InsertionDone;
267 267
268 // FIXME: When parsing <video controls>, insertedInto() is called many times without invoking removedFrom. 268 // FIXME: When parsing <video controls>, insertedInto() is called many times without invoking removedFrom.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (element->isInsertionPoint()) 404 if (element->isInsertionPoint())
405 insertionPoints.append(toInsertionPoint(element)); 405 insertionPoints.append(toInsertionPoint(element));
406 } 406 }
407 407
408 ensureShadowRootRareData()->setChildInsertionPoints(insertionPoints); 408 ensureShadowRootRareData()->setChildInsertionPoints(insertionPoints);
409 409
410 return m_shadowRootRareData->childInsertionPoints(); 410 return m_shadowRootRareData->childInsertionPoints();
411 } 411 }
412 412
413 } 413 }
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/ShadowRoot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698