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

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

Issue 257363002: Added addXSLStyleSheet and removeXSLStyleSheet to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 { 52 {
53 return adoptRefWillBeRefCountedGarbageCollected(new ProcessingInstruction(do cument, target, data)); 53 return adoptRefWillBeRefCountedGarbageCollected(new ProcessingInstruction(do cument, 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 m_sheet->clearOwnerNode(); 60 m_sheet->clearOwnerNode();
61 61
62 if (inDocument()) 62 if (inDocument()) {
esprehn 2014/06/06 01:32:55 This does doesn't make any sense, you can't be inD
tasak 2014/06/09 04:04:57 I would like to attach crash log when I added ASSE
63 document().styleEngine()->removeStyleSheetCandidateNode(this); 63 if (m_isCSS)
64 document().styleEngine()->removeStyleSheetCandidateNode(this);
65 else if (m_isXSL)
66 document().styleEngine()->removeXSLStyleSheet(this);
67 }
64 #endif 68 #endif
65 } 69 }
66 70
67 String ProcessingInstruction::nodeName() const 71 String ProcessingInstruction::nodeName() const
68 { 72 {
69 return m_target; 73 return m_target;
70 } 74 }
71 75
72 Node::NodeType ProcessingInstruction::nodeType() const 76 Node::NodeType ProcessingInstruction::nodeType() const
73 { 77 {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 239 }
236 240
237 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container Node* insertionPoint) 241 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container Node* insertionPoint)
238 { 242 {
239 CharacterData::insertedInto(insertionPoint); 243 CharacterData::insertedInto(insertionPoint);
240 if (!insertionPoint->inDocument()) 244 if (!insertionPoint->inDocument())
241 return InsertionDone; 245 return InsertionDone;
242 246
243 String href; 247 String href;
244 String charset; 248 String charset;
245 // To make it possible for us to see isXSL in
246 // StyleEngine::addStyleSheetCandidateNode, split checkStyleSheet
247 // into two methods, checkStyleSheet and process.
248 bool isValid = checkStyleSheet(href, charset); 249 bool isValid = checkStyleSheet(href, charset);
249 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser ); 250 if (m_isCSS)
251 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByPa rser);
252 else if (m_isXSL)
253 document().styleEngine()->addXSLStyleSheet(this, m_createdByParser);
250 if (isValid) 254 if (isValid)
251 process(href, charset); 255 process(href, charset);
252 return InsertionDone; 256 return InsertionDone;
253 } 257 }
254 258
255 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) 259 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
256 { 260 {
257 CharacterData::removedFrom(insertionPoint); 261 CharacterData::removedFrom(insertionPoint);
258 if (!insertionPoint->inDocument()) 262 if (!insertionPoint->inDocument())
259 return; 263 return;
260 264
261 document().styleEngine()->removeStyleSheetCandidateNode(this); 265 if (m_isCSS)
266 document().styleEngine()->removeStyleSheetCandidateNode(this);
267 else if (m_isXSL)
268 document().styleEngine()->removeXSLStyleSheet(this);
262 269
263 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; 270 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet;
264 271
265 if (m_sheet) { 272 if (m_sheet) {
266 ASSERT(m_sheet->ownerNode() == this); 273 ASSERT(m_sheet->ownerNode() == this);
267 m_sheet->clearOwnerNode(); 274 m_sheet->clearOwnerNode();
268 m_sheet = nullptr; 275 m_sheet = nullptr;
269 } 276 }
270 277
271 // If we're in document teardown, then we don't need to do any notification of our sheet's removal. 278 // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
272 if (document().isActive()) 279 if (document().isActive())
273 document().removedStyleSheet(removedSheet.get()); 280 document().removedStyleSheet(removedSheet.get());
274 } 281 }
275 282
276 void ProcessingInstruction::trace(Visitor* visitor) 283 void ProcessingInstruction::trace(Visitor* visitor)
277 { 284 {
278 visitor->trace(m_sheet); 285 visitor->trace(m_sheet);
279 CharacterData::trace(visitor); 286 CharacterData::trace(visitor);
280 } 287 }
281 288
282 } // namespace 289 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698