OLD | NEW |
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 Loading... |
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 // FIXME: ProcessingInstruction should not be in document here. |
63 document().styleEngine()->removeStyleSheetCandidateNode(this); | 63 // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml |
| 64 // crashes. We need to investigate ProcessingInstruction lifetime. |
| 65 if (inDocument()) { |
| 66 if (m_isCSS) |
| 67 document().styleEngine()->removeStyleSheetCandidateNode(this); |
| 68 else if (m_isXSL) |
| 69 document().styleEngine()->removeXSLStyleSheet(this); |
| 70 } |
64 #endif | 71 #endif |
65 } | 72 } |
66 | 73 |
67 String ProcessingInstruction::nodeName() const | 74 String ProcessingInstruction::nodeName() const |
68 { | 75 { |
69 return m_target; | 76 return m_target; |
70 } | 77 } |
71 | 78 |
72 Node::NodeType ProcessingInstruction::nodeType() const | 79 Node::NodeType ProcessingInstruction::nodeType() const |
73 { | 80 { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 242 } |
236 | 243 |
237 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node* insertionPoint) | 244 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node* insertionPoint) |
238 { | 245 { |
239 CharacterData::insertedInto(insertionPoint); | 246 CharacterData::insertedInto(insertionPoint); |
240 if (!insertionPoint->inDocument()) | 247 if (!insertionPoint->inDocument()) |
241 return InsertionDone; | 248 return InsertionDone; |
242 | 249 |
243 String href; | 250 String href; |
244 String charset; | 251 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); | 252 bool isValid = checkStyleSheet(href, charset); |
249 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser
); | 253 if (m_isCSS) |
| 254 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByPa
rser); |
| 255 else if (m_isXSL) |
| 256 document().styleEngine()->addXSLStyleSheet(this, m_createdByParser); |
250 if (isValid) | 257 if (isValid) |
251 process(href, charset); | 258 process(href, charset); |
252 return InsertionDone; | 259 return InsertionDone; |
253 } | 260 } |
254 | 261 |
255 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) | 262 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) |
256 { | 263 { |
257 CharacterData::removedFrom(insertionPoint); | 264 CharacterData::removedFrom(insertionPoint); |
258 if (!insertionPoint->inDocument()) | 265 if (!insertionPoint->inDocument()) |
259 return; | 266 return; |
260 | 267 |
261 document().styleEngine()->removeStyleSheetCandidateNode(this); | 268 if (m_isCSS) |
| 269 document().styleEngine()->removeStyleSheetCandidateNode(this); |
| 270 else if (m_isXSL) |
| 271 document().styleEngine()->removeXSLStyleSheet(this); |
262 | 272 |
263 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; | 273 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; |
264 | 274 |
265 if (m_sheet) { | 275 if (m_sheet) { |
266 ASSERT(m_sheet->ownerNode() == this); | 276 ASSERT(m_sheet->ownerNode() == this); |
267 m_sheet->clearOwnerNode(); | 277 m_sheet->clearOwnerNode(); |
268 m_sheet = nullptr; | 278 m_sheet = nullptr; |
269 } | 279 } |
270 | 280 |
271 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. | 281 // If we're in document teardown, then we don't need to do any notification
of our sheet's removal. |
272 if (document().isActive()) | 282 if (document().isActive()) |
273 document().removedStyleSheet(removedSheet.get()); | 283 document().removedStyleSheet(removedSheet.get()); |
274 } | 284 } |
275 | 285 |
276 void ProcessingInstruction::trace(Visitor* visitor) | 286 void ProcessingInstruction::trace(Visitor* visitor) |
277 { | 287 { |
278 visitor->trace(m_sheet); | 288 visitor->trace(m_sheet); |
279 CharacterData::trace(visitor); | 289 CharacterData::trace(visitor); |
280 } | 290 } |
281 | 291 |
282 } // namespace | 292 } // namespace |
OLD | NEW |