OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the XSL implementation. | 2 * This file is part of the XSL implementation. |
3 * | 3 * |
4 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 , m_finalURL(finalURL) | 43 , m_finalURL(finalURL) |
44 , m_isDisabled(false) | 44 , m_isDisabled(false) |
45 , m_embedded(false) | 45 , m_embedded(false) |
46 // Child sheets get marked as processed when the libxslt engine has finally | 46 // Child sheets get marked as processed when the libxslt engine has finally |
47 // seen them. | 47 // seen them. |
48 , m_processed(false) | 48 , m_processed(false) |
49 , m_stylesheetDoc(0) | 49 , m_stylesheetDoc(0) |
50 , m_stylesheetDocTaken(false) | 50 , m_stylesheetDocTaken(false) |
51 , m_compilationFailed(false) | 51 , m_compilationFailed(false) |
52 , m_parentStyleSheet(parentRule ? parentRule->parentStyleSheet() : 0) | 52 , m_parentStyleSheet(parentRule ? parentRule->parentStyleSheet() : 0) |
| 53 , m_ownerDocument(nullptr) |
53 { | 54 { |
54 } | 55 } |
55 | 56 |
56 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const
KURL& finalURL, bool embedded) | 57 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const
KURL& finalURL, bool embedded) |
57 : m_ownerNode(parentNode) | 58 : m_ownerNode(parentNode) |
58 , m_originalURL(originalURL) | 59 , m_originalURL(originalURL) |
59 , m_finalURL(finalURL) | 60 , m_finalURL(finalURL) |
60 , m_isDisabled(false) | 61 , m_isDisabled(false) |
61 , m_embedded(embedded) | 62 , m_embedded(embedded) |
62 , m_processed(true) // The root sheet starts off processed. | 63 , m_processed(true) // The root sheet starts off processed. |
63 , m_stylesheetDoc(0) | 64 , m_stylesheetDoc(0) |
64 , m_stylesheetDocTaken(false) | 65 , m_stylesheetDocTaken(false) |
65 , m_compilationFailed(false) | 66 , m_compilationFailed(false) |
66 , m_parentStyleSheet(nullptr) | 67 , m_parentStyleSheet(nullptr) |
| 68 , m_ownerDocument(nullptr) |
67 { | 69 { |
68 } | 70 } |
69 | 71 |
| 72 XSLStyleSheet::XSLStyleSheet(Document* ownerDocument, Node* styleSheetRootNode,
const String& originalURL, const KURL& finalURL, bool embedded) |
| 73 : m_ownerNode(styleSheetRootNode) |
| 74 , m_originalURL(originalURL) |
| 75 , m_finalURL(finalURL) |
| 76 , m_isDisabled(false) |
| 77 , m_embedded(embedded) |
| 78 , m_processed(true) // The root sheet starts off processed. |
| 79 , m_stylesheetDoc(0) |
| 80 , m_stylesheetDocTaken(false) |
| 81 , m_compilationFailed(false) |
| 82 , m_parentStyleSheet(nullptr) |
| 83 , m_ownerDocument(ownerDocument) |
| 84 { |
| 85 } |
| 86 |
70 XSLStyleSheet::~XSLStyleSheet() | 87 XSLStyleSheet::~XSLStyleSheet() |
71 { | 88 { |
72 if (!m_stylesheetDocTaken) | 89 if (!m_stylesheetDocTaken) |
73 xmlFreeDoc(m_stylesheetDoc); | 90 xmlFreeDoc(m_stylesheetDoc); |
74 #if !ENABLE(OILPAN) | 91 #if !ENABLE(OILPAN) |
75 for (unsigned i = 0; i < m_children.size(); ++i) { | 92 for (unsigned i = 0; i < m_children.size(); ++i) { |
76 ASSERT(m_children.at(i)->parentStyleSheet() == this); | 93 ASSERT(m_children.at(i)->parentStyleSheet() == this); |
77 m_children.at(i)->setParentStyleSheet(0); | 94 m_children.at(i)->setParentStyleSheet(0); |
78 } | 95 } |
79 #endif | 96 #endif |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 264 } |
248 | 265 |
249 void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent) | 266 void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent) |
250 { | 267 { |
251 m_parentStyleSheet = parent; | 268 m_parentStyleSheet = parent; |
252 } | 269 } |
253 | 270 |
254 Document* XSLStyleSheet::ownerDocument() | 271 Document* XSLStyleSheet::ownerDocument() |
255 { | 272 { |
256 for (XSLStyleSheet* styleSheet = this; styleSheet; styleSheet = styleSheet->
parentStyleSheet()) { | 273 for (XSLStyleSheet* styleSheet = this; styleSheet; styleSheet = styleSheet->
parentStyleSheet()) { |
| 274 if (styleSheet->m_ownerDocument) |
| 275 return styleSheet->m_ownerDocument.get(); |
257 Node* node = styleSheet->ownerNode(); | 276 Node* node = styleSheet->ownerNode(); |
258 if (node) | 277 if (node) |
259 return &node->document(); | 278 return &node->document(); |
260 } | 279 } |
261 return 0; | 280 return 0; |
262 } | 281 } |
263 | 282 |
264 xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const
xmlChar* uri) | 283 xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const
xmlChar* uri) |
265 { | 284 { |
266 bool matchedParent = (parentDoc == document()); | 285 bool matchedParent = (parentDoc == document()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 326 |
308 void XSLStyleSheet::trace(Visitor* visitor) | 327 void XSLStyleSheet::trace(Visitor* visitor) |
309 { | 328 { |
310 visitor->trace(m_ownerNode); | 329 visitor->trace(m_ownerNode); |
311 visitor->trace(m_children); | 330 visitor->trace(m_children); |
312 visitor->trace(m_parentStyleSheet); | 331 visitor->trace(m_parentStyleSheet); |
313 StyleSheet::trace(visitor); | 332 StyleSheet::trace(visitor); |
314 } | 333 } |
315 | 334 |
316 } // namespace blink | 335 } // namespace blink |
OLD | NEW |