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

Side by Side Diff: Source/core/html/HTMLStyleElement.cpp

Issue 16425002: Moved StyleElement::insertedIntoDocument into didNotifySubtreeInsertions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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/html/HTMLStyleElement.h ('k') | Source/core/svg/SVGStyleElement.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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved.
6 * (C) 2007 Rob Buis (buis@kde.org) 6 * (C) 2007 Rob Buis (buis@kde.org)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 m_scopedStyleRegistrationState = NotRegistered; 168 m_scopedStyleRegistrationState = NotRegistered;
169 } 169 }
170 170
171 Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(ContainerNode* insertionPoint) 171 Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(ContainerNode* insertionPoint)
172 { 172 {
173 HTMLElement::insertedInto(insertionPoint); 173 HTMLElement::insertedInto(insertionPoint);
174 if (insertionPoint->inDocument()) { 174 if (insertionPoint->inDocument()) {
175 if (m_scopedStyleRegistrationState == NotRegistered && (scoped() || isIn ShadowTree())) 175 if (m_scopedStyleRegistrationState == NotRegistered && (scoped() || isIn ShadowTree()))
176 registerWithScopingNode(scoped()); 176 registerWithScopingNode(scoped());
177 StyleElement::insertedIntoDocument(document(), this); 177 return InsertionShouldCallDidNotifySubtreeInsertions;
178 } 178 }
179 179
180 return InsertionDone; 180 return InsertionDone;
181 } 181 }
182 182
183 void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) 183 void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint)
184 { 184 {
185 HTMLElement::removedFrom(insertionPoint); 185 HTMLElement::removedFrom(insertionPoint);
186 186
187 // In the current implementation, <style scoped> is only registered if the n ode is in the document. 187 // In the current implementation, <style scoped> is only registered if the n ode is in the document.
188 // That is, because willRemove() is also called if an ancestor is removed fr om the document. 188 // That is, because willRemove() is also called if an ancestor is removed fr om the document.
189 // Now, if we want to register <style scoped> even if it's not inDocument, 189 // Now, if we want to register <style scoped> even if it's not inDocument,
190 // we'd need to find a way to discern whether that is the case, or whether < style scoped> itself is about to be removed. 190 // we'd need to find a way to discern whether that is the case, or whether < style scoped> itself is about to be removed.
191 if (m_scopedStyleRegistrationState != NotRegistered) { 191 if (m_scopedStyleRegistrationState != NotRegistered) {
192 ContainerNode* scope; 192 ContainerNode* scope;
193 if (m_scopedStyleRegistrationState == RegisteredInShadowRoot) { 193 if (m_scopedStyleRegistrationState == RegisteredInShadowRoot) {
194 scope = containingShadowRoot(); 194 scope = containingShadowRoot();
195 if (!scope) 195 if (!scope)
196 scope = insertionPoint->containingShadowRoot(); 196 scope = insertionPoint->containingShadowRoot();
197 } else 197 } else
198 scope = parentNode() ? parentNode() : insertionPoint; 198 scope = parentNode() ? parentNode() : insertionPoint;
199 unregisterWithScopingNode(scope); 199 unregisterWithScopingNode(scope);
200 } 200 }
201 201
202 if (insertionPoint->inDocument()) 202 if (insertionPoint->inDocument())
203 StyleElement::removedFromDocument(document(), this); 203 StyleElement::removedFromDocument(document(), this);
204 } 204 }
205 205
206 void HTMLStyleElement::didNotifySubtreeInsertions(ContainerNode* insertionPoint)
207 {
208 StyleElement::processStyleSheet(document(), this);
209 }
210
206 void HTMLStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) 211 void HTMLStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
207 { 212 {
208 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi ldCountDelta); 213 HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, chi ldCountDelta);
209 StyleElement::childrenChanged(this); 214 StyleElement::childrenChanged(this);
210 } 215 }
211 216
212 const AtomicString& HTMLStyleElement::media() const 217 const AtomicString& HTMLStyleElement::media() const
213 { 218 {
214 return getAttribute(mediaAttr); 219 return getAttribute(mediaAttr);
215 } 220 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return m_sheet->disabled(); 288 return m_sheet->disabled();
284 } 289 }
285 290
286 void HTMLStyleElement::setDisabled(bool setDisabled) 291 void HTMLStyleElement::setDisabled(bool setDisabled)
287 { 292 {
288 if (CSSStyleSheet* styleSheet = sheet()) 293 if (CSSStyleSheet* styleSheet = sheet())
289 styleSheet->setDisabled(setDisabled); 294 styleSheet->setDisabled(setDisabled);
290 } 295 }
291 296
292 } 297 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLStyleElement.h ('k') | Source/core/svg/SVGStyleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698