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

Side by Side Diff: third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/Range.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) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return new ProcessingInstruction(document, target, data); 53 return new ProcessingInstruction(document, target, data);
54 } 54 }
55 55
56 ProcessingInstruction::~ProcessingInstruction() 56 ProcessingInstruction::~ProcessingInstruction()
57 { 57 {
58 #if !ENABLE(OILPAN) 58 #if !ENABLE(OILPAN)
59 if (m_sheet) 59 if (m_sheet)
60 clearSheet(); 60 clearSheet();
61 61
62 // FIXME: ProcessingInstruction should not be in document here. 62 // FIXME: ProcessingInstruction should not be in document here.
63 // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml 63 // However, if we add ASSERT(!inShadowIncludingDocument()), fast/xsl/xslt-en tity.xml
64 // crashes. We need to investigate ProcessingInstruction lifetime. 64 // crashes. We need to investigate ProcessingInstruction lifetime.
65 if (inDocument() && m_isCSS) 65 if (inShadowIncludingDocument() && m_isCSS)
66 document().styleEngine().removeStyleSheetCandidateNode(this); 66 document().styleEngine().removeStyleSheetCandidateNode(this);
67 clearEventListenerForXSLT(); 67 clearEventListenerForXSLT();
68 #endif 68 #endif
69 } 69 }
70 70
71 EventListener* ProcessingInstruction::eventListenerForXSLT() 71 EventListener* ProcessingInstruction::eventListenerForXSLT()
72 { 72 {
73 if (!m_listenerForXSLT) 73 if (!m_listenerForXSLT)
74 return 0; 74 return 0;
75 75
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (!isLoading()) { 196 if (!isLoading()) {
197 if (!DocumentXSLT::sheetLoaded(document(), this)) 197 if (!DocumentXSLT::sheetLoaded(document(), this))
198 document().styleEngine().removePendingSheet(this); 198 document().styleEngine().removePendingSheet(this);
199 return true; 199 return true;
200 } 200 }
201 return false; 201 return false;
202 } 202 }
203 203
204 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas eURL, const String& charset, const CSSStyleSheetResource* sheet) 204 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas eURL, const String& charset, const CSSStyleSheetResource* sheet)
205 { 205 {
206 if (!inDocument()) { 206 if (!inShadowIncludingDocument()) {
207 ASSERT(!m_sheet); 207 ASSERT(!m_sheet);
208 return; 208 return;
209 } 209 }
210 210
211 ASSERT(m_isCSS); 211 ASSERT(m_isCSS);
212 CSSParserContext parserContext(document(), 0, baseURL, charset); 212 CSSParserContext parserContext(document(), 0, baseURL, charset);
213 213
214 RawPtr<StyleSheetContents> newSheet = StyleSheetContents::create(href, parse rContext); 214 RawPtr<StyleSheetContents> newSheet = StyleSheetContents::create(href, parse rContext);
215 215
216 RawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet, this); 216 RawPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(newSheet, this);
217 cssSheet->setDisabled(m_alternate); 217 cssSheet->setDisabled(m_alternate);
218 cssSheet->setTitle(m_title); 218 cssSheet->setTitle(m_title);
219 cssSheet->setMediaQueries(MediaQuerySet::create(m_media)); 219 cssSheet->setMediaQueries(MediaQuerySet::create(m_media));
220 220
221 m_sheet = cssSheet.release(); 221 m_sheet = cssSheet.release();
222 222
223 // We don't need the cross-origin security check here because we are 223 // We don't need the cross-origin security check here because we are
224 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME 224 // getting the sheet text in "strict" mode. This enforces a valid CSS MIME
225 // type. 225 // type.
226 parseStyleSheet(sheet->sheetText()); 226 parseStyleSheet(sheet->sheetText());
227 } 227 }
228 228
229 void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& bas eURL, const String& sheet) 229 void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& bas eURL, const String& sheet)
230 { 230 {
231 if (!inDocument()) { 231 if (!inShadowIncludingDocument()) {
232 ASSERT(!m_sheet); 232 ASSERT(!m_sheet);
233 return; 233 return;
234 } 234 }
235 235
236 ASSERT(m_isXSL); 236 ASSERT(m_isXSL);
237 m_sheet = XSLStyleSheet::create(this, href, baseURL); 237 m_sheet = XSLStyleSheet::create(this, href, baseURL);
238 RawPtr<Document> protect(&document()); 238 RawPtr<Document> protect(&document());
239 OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::c reate(document()); 239 OwnPtr<IncrementLoadEventDelayCount> delay = IncrementLoadEventDelayCount::c reate(document());
240 parseStyleSheet(sheet); 240 parseStyleSheet(sheet);
241 } 241 }
(...skipping 10 matching lines...) Expand all
252 252
253 if (m_isCSS) 253 if (m_isCSS)
254 toCSSStyleSheet(m_sheet.get())->contents()->checkLoaded(); 254 toCSSStyleSheet(m_sheet.get())->contents()->checkLoaded();
255 else if (m_isXSL) 255 else if (m_isXSL)
256 toXSLStyleSheet(m_sheet.get())->checkLoaded(); 256 toXSLStyleSheet(m_sheet.get())->checkLoaded();
257 } 257 }
258 258
259 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container Node* insertionPoint) 259 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container Node* insertionPoint)
260 { 260 {
261 CharacterData::insertedInto(insertionPoint); 261 CharacterData::insertedInto(insertionPoint);
262 if (!insertionPoint->inDocument()) 262 if (!insertionPoint->inShadowIncludingDocument())
263 return InsertionDone; 263 return InsertionDone;
264 264
265 String href; 265 String href;
266 String charset; 266 String charset;
267 bool isValid = checkStyleSheet(href, charset); 267 bool isValid = checkStyleSheet(href, charset);
268 if (!DocumentXSLT::processingInstructionInsertedIntoDocument(document(), thi s)) 268 if (!DocumentXSLT::processingInstructionInsertedIntoDocument(document(), thi s))
269 document().styleEngine().addStyleSheetCandidateNode(this); 269 document().styleEngine().addStyleSheetCandidateNode(this);
270 if (isValid) 270 if (isValid)
271 process(href, charset); 271 process(href, charset);
272 return InsertionDone; 272 return InsertionDone;
273 } 273 }
274 274
275 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) 275 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
276 { 276 {
277 CharacterData::removedFrom(insertionPoint); 277 CharacterData::removedFrom(insertionPoint);
278 if (!insertionPoint->inDocument()) 278 if (!insertionPoint->inShadowIncludingDocument())
279 return; 279 return;
280 280
281 // No need to remove XSLStyleSheet from StyleEngine. 281 // No need to remove XSLStyleSheet from StyleEngine.
282 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this )) 282 if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this ))
283 document().styleEngine().removeStyleSheetCandidateNode(this); 283 document().styleEngine().removeStyleSheetCandidateNode(this);
284 284
285 RawPtr<StyleSheet> removedSheet = m_sheet; 285 RawPtr<StyleSheet> removedSheet = m_sheet;
286 if (m_sheet) { 286 if (m_sheet) {
287 ASSERT(m_sheet->ownerNode() == this); 287 ASSERT(m_sheet->ownerNode() == this);
288 clearSheet(); 288 clearSheet();
(...skipping 17 matching lines...) Expand all
306 306
307 DEFINE_TRACE(ProcessingInstruction) 307 DEFINE_TRACE(ProcessingInstruction)
308 { 308 {
309 visitor->trace(m_sheet); 309 visitor->trace(m_sheet);
310 visitor->trace(m_listenerForXSLT); 310 visitor->trace(m_listenerForXSLT);
311 CharacterData::trace(visitor); 311 CharacterData::trace(visitor);
312 ResourceOwner<StyleSheetResource>::trace(visitor); 312 ResourceOwner<StyleSheetResource>::trace(visitor);
313 } 313 }
314 314
315 } // namespace blink 315 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/Range.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698