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, 2006, 2008, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 static PassRefPtrWillBeRawPtr<XSLStyleSheet> createEmbedded(ProcessingInstru
ction* parentNode, const KURL& finalURL) | 50 static PassRefPtrWillBeRawPtr<XSLStyleSheet> createEmbedded(ProcessingInstru
ction* parentNode, const KURL& finalURL) |
51 { | 51 { |
52 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 52 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
53 return adoptRefWillBeNoop(new XSLStyleSheet(parentNode, finalURL.string(
), finalURL, true)); | 53 return adoptRefWillBeNoop(new XSLStyleSheet(parentNode, finalURL.string(
), finalURL, true)); |
54 } | 54 } |
55 | 55 |
56 // Taking an arbitrary node is unsafe, because owner node pointer can become | 56 // Taking an arbitrary node is unsafe, because owner node pointer can become |
57 // stale. XSLTProcessor ensures that the stylesheet doesn't outlive its | 57 // stale. XSLTProcessor ensures that the stylesheet doesn't outlive its |
58 // parent, in part by not exposing it to JavaScript. | 58 // parent, in part by not exposing it to JavaScript. |
59 static PassRefPtrWillBeRawPtr<XSLStyleSheet> createForXSLTProcessor(Node* pa
rentNode, const String& originalURL, const KURL& finalURL) | 59 static PassRefPtrWillBeRawPtr<XSLStyleSheet> createForXSLTProcessor(Document
* document, Node* stylesheetRootNode, const String& originalURL, const KURL& fin
alURL) |
60 { | 60 { |
61 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 61 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
62 return adoptRefWillBeNoop(new XSLStyleSheet(parentNode, originalURL, fin
alURL, false)); | 62 return adoptRefWillBeNoop(new XSLStyleSheet(document, stylesheetRootNode
, originalURL, finalURL, false)); |
63 } | 63 } |
64 | 64 |
65 virtual ~XSLStyleSheet(); | 65 virtual ~XSLStyleSheet(); |
66 | 66 |
67 bool parseString(const String&); | 67 bool parseString(const String&); |
68 | 68 |
69 void checkLoaded(); | 69 void checkLoaded(); |
70 | 70 |
71 const KURL& finalURL() const { return m_finalURL; } | 71 const KURL& finalURL() const { return m_finalURL; } |
72 | 72 |
(...skipping 23 matching lines...) Expand all Loading... |
96 virtual String title() const OVERRIDE { return emptyString(); } | 96 virtual String title() const OVERRIDE { return emptyString(); } |
97 | 97 |
98 virtual void clearOwnerNode() OVERRIDE { m_ownerNode = nullptr; } | 98 virtual void clearOwnerNode() OVERRIDE { m_ownerNode = nullptr; } |
99 virtual KURL baseURL() const OVERRIDE { return m_finalURL; } | 99 virtual KURL baseURL() const OVERRIDE { return m_finalURL; } |
100 virtual bool isLoading() const OVERRIDE; | 100 virtual bool isLoading() const OVERRIDE; |
101 | 101 |
102 virtual void trace(Visitor*) OVERRIDE; | 102 virtual void trace(Visitor*) OVERRIDE; |
103 | 103 |
104 private: | 104 private: |
105 XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& final
URL, bool embedded); | 105 XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& final
URL, bool embedded); |
| 106 XSLStyleSheet(Document* ownerDocument, Node* styleSheetRootNode, const Strin
g& originalURL, const KURL& finalURL, bool embedded); |
106 XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const
KURL& finalURL); | 107 XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const
KURL& finalURL); |
107 | 108 |
108 RawPtrWillBeMember<Node> m_ownerNode; | 109 RawPtrWillBeMember<Node> m_ownerNode; |
109 String m_originalURL; | 110 String m_originalURL; |
110 KURL m_finalURL; | 111 KURL m_finalURL; |
111 bool m_isDisabled; | 112 bool m_isDisabled; |
112 | 113 |
113 WillBeHeapVector<OwnPtrWillBeMember<XSLImportRule> > m_children; | 114 WillBeHeapVector<OwnPtrWillBeMember<XSLImportRule> > m_children; |
114 | 115 |
115 bool m_embedded; | 116 bool m_embedded; |
116 bool m_processed; | 117 bool m_processed; |
117 | 118 |
118 xmlDocPtr m_stylesheetDoc; | 119 xmlDocPtr m_stylesheetDoc; |
119 bool m_stylesheetDocTaken; | 120 bool m_stylesheetDocTaken; |
120 bool m_compilationFailed; | 121 bool m_compilationFailed; |
121 | 122 |
122 RawPtrWillBeMember<XSLStyleSheet> m_parentStyleSheet; | 123 RawPtrWillBeMember<XSLStyleSheet> m_parentStyleSheet; |
| 124 RefPtrWillBeMember<Document> m_ownerDocument; |
123 }; | 125 }; |
124 | 126 |
125 DEFINE_TYPE_CASTS(XSLStyleSheet, StyleSheet, sheet, !sheet->isCSSStyleSheet(), !
sheet.isCSSStyleSheet()); | 127 DEFINE_TYPE_CASTS(XSLStyleSheet, StyleSheet, sheet, !sheet->isCSSStyleSheet(), !
sheet.isCSSStyleSheet()); |
126 | 128 |
127 } // namespace blink | 129 } // namespace blink |
128 | 130 |
129 #endif // XSLStyleSheet_h | 131 #endif // XSLStyleSheet_h |
OLD | NEW |