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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef XSLStyleSheet_h | 23 #ifndef XSLStyleSheet_h |
24 #define XSLStyleSheet_h | 24 #define XSLStyleSheet_h |
25 | 25 |
26 #include <libxml/tree.h> | 26 #include "RuntimeEnabledFeatures.h" |
27 #include <libxslt/transform.h> | |
28 #include "core/css/StyleSheet.h" | 27 #include "core/css/StyleSheet.h" |
29 #include "core/dom/ProcessingInstruction.h" | 28 #include "core/dom/ProcessingInstruction.h" |
30 #include "wtf/PassRefPtr.h" | 29 #include "wtf/PassRefPtr.h" |
31 | 30 |
| 31 #include <libxml/tree.h> |
| 32 #include <libxslt/transform.h> |
| 33 |
32 namespace WebCore { | 34 namespace WebCore { |
33 | 35 |
34 class ResourceFetcher; | 36 class ResourceFetcher; |
35 class XSLImportRule; | 37 class XSLImportRule; |
36 | 38 |
37 class XSLStyleSheet : public StyleSheet { | 39 class XSLStyleSheet : public StyleSheet { |
38 public: | 40 public: |
39 static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const S
tring& originalURL, const KURL& finalURL) | 41 static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const S
tring& originalURL, const KURL& finalURL) |
40 { | 42 { |
| 43 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
41 return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL)); | 44 return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL)); |
42 } | 45 } |
43 static PassRefPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, c
onst String& originalURL, const KURL& finalURL) | 46 static PassRefPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, c
onst String& originalURL, const KURL& finalURL) |
44 { | 47 { |
| 48 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
45 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, fal
se)); | 49 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, fal
se)); |
46 } | 50 } |
47 static PassRefPtr<XSLStyleSheet> createEmbedded(ProcessingInstruction* paren
tNode, const KURL& finalURL) | 51 static PassRefPtr<XSLStyleSheet> createEmbedded(ProcessingInstruction* paren
tNode, const KURL& finalURL) |
48 { | 52 { |
| 53 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
49 return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalUR
L, true)); | 54 return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalUR
L, true)); |
50 } | 55 } |
51 | 56 |
52 // Taking an arbitrary node is unsafe, because owner node pointer can become
stale. | 57 // Taking an arbitrary node is unsafe, because owner node pointer can become
stale. |
53 // XSLTProcessor ensures that the stylesheet doesn't outlive its parent, in
part by not exposing it to JavaScript. | 58 // XSLTProcessor ensures that the stylesheet doesn't outlive its parent, in
part by not exposing it to JavaScript. |
54 static PassRefPtr<XSLStyleSheet> createForXSLTProcessor(Node* parentNode, co
nst String& originalURL, const KURL& finalURL) | 59 static PassRefPtr<XSLStyleSheet> createForXSLTProcessor(Node* parentNode, co
nst String& originalURL, const KURL& finalURL) |
55 { | 60 { |
| 61 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
56 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, fal
se)); | 62 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, fal
se)); |
57 } | 63 } |
58 | 64 |
59 virtual ~XSLStyleSheet(); | 65 virtual ~XSLStyleSheet(); |
60 | 66 |
61 bool parseString(const String&); | 67 bool parseString(const String&); |
62 | 68 |
63 void checkLoaded(); | 69 void checkLoaded(); |
64 | 70 |
65 const KURL& finalURL() const { return m_finalURL; } | 71 const KURL& finalURL() const { return m_finalURL; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 xmlDocPtr m_stylesheetDoc; | 116 xmlDocPtr m_stylesheetDoc; |
111 bool m_stylesheetDocTaken; | 117 bool m_stylesheetDocTaken; |
112 bool m_compilationFailed; | 118 bool m_compilationFailed; |
113 | 119 |
114 XSLStyleSheet* m_parentStyleSheet; | 120 XSLStyleSheet* m_parentStyleSheet; |
115 }; | 121 }; |
116 | 122 |
117 } // namespace WebCore | 123 } // namespace WebCore |
118 | 124 |
119 #endif // XSLStyleSheet_h | 125 #endif // XSLStyleSheet_h |
OLD | NEW |