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 20 matching lines...) Expand all Loading... | |
31 #include <libxml/tree.h> | 31 #include <libxml/tree.h> |
32 #include <libxslt/transform.h> | 32 #include <libxslt/transform.h> |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 class ResourceFetcher; | 36 class ResourceFetcher; |
37 class XSLImportRule; | 37 class XSLImportRule; |
38 | 38 |
39 class XSLStyleSheet FINAL : public StyleSheet { | 39 class XSLStyleSheet FINAL : public StyleSheet { |
40 public: | 40 public: |
41 static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const S tring& originalURL, const KURL& finalURL) | 41 static PassRefPtrWillBeRawPtr<XSLStyleSheet> create(XSLImportRule* parentImp ort, const String& originalURL, const KURL& finalURL) |
42 { | 42 { |
43 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 43 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
44 return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL)); | 44 return adoptRefWillBeRefCountedGarbageCollected(new XSLStyleSheet(parent Import, originalURL, finalURL)); |
45 } | 45 } |
46 static PassRefPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, c onst String& originalURL, const KURL& finalURL) | 46 static PassRefPtrWillBeRawPtr<XSLStyleSheet> create(ProcessingInstruction* p arentNode, const String& originalURL, const KURL& finalURL) |
47 { | 47 { |
48 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 48 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
49 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, fal se)); | 49 return adoptRefWillBeRefCountedGarbageCollected(new XSLStyleSheet(parent Node, originalURL, finalURL, false)); |
50 } | 50 } |
51 static PassRefPtr<XSLStyleSheet> createEmbedded(ProcessingInstruction* paren tNode, const KURL& finalURL) | 51 static PassRefPtrWillBeRawPtr<XSLStyleSheet> createEmbedded(ProcessingInstru ction* parentNode, const KURL& finalURL) |
52 { | 52 { |
53 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 53 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
54 return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalUR L, true)); | 54 return adoptRefWillBeRefCountedGarbageCollected(new XSLStyleSheet(parent Node, finalURL.string(), finalURL, true)); |
55 } | 55 } |
56 | 56 |
57 // 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. |
58 // 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. |
59 static PassRefPtr<XSLStyleSheet> createForXSLTProcessor(Node* parentNode, co nst String& originalURL, const KURL& finalURL) | 59 static PassRefPtrWillBeRawPtr<XSLStyleSheet> createForXSLTProcessor(Node* pa rentNode, const String& originalURL, const KURL& finalURL) |
60 { | 60 { |
61 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 61 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
62 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, fal se)); | 62 return adoptRefWillBeRefCountedGarbageCollected(new XSLStyleSheet(parent Node, 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 19 matching lines...) Expand all Loading... | |
92 virtual bool disabled() const OVERRIDE { return m_isDisabled; } | 92 virtual bool disabled() const OVERRIDE { return m_isDisabled; } |
93 virtual void setDisabled(bool b) OVERRIDE { m_isDisabled = b; } | 93 virtual void setDisabled(bool b) OVERRIDE { m_isDisabled = b; } |
94 virtual Node* ownerNode() const OVERRIDE { return m_ownerNode; } | 94 virtual Node* ownerNode() const OVERRIDE { return m_ownerNode; } |
95 virtual String href() const OVERRIDE { return m_originalURL; } | 95 virtual String href() const OVERRIDE { return m_originalURL; } |
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 = 0; } | 98 virtual void clearOwnerNode() OVERRIDE { m_ownerNode = 0; } |
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; | |
103 | |
102 private: | 104 private: |
103 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); |
104 XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL); | 106 XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL); |
105 | 107 |
106 Node* m_ownerNode; | 108 Node* m_ownerNode; |
107 String m_originalURL; | 109 String m_originalURL; |
108 KURL m_finalURL; | 110 KURL m_finalURL; |
109 bool m_isDisabled; | 111 bool m_isDisabled; |
110 | 112 |
111 Vector<OwnPtr<XSLImportRule> > m_children; | 113 Vector<OwnPtr<XSLImportRule> > m_children; |
112 | 114 |
113 bool m_embedded; | 115 bool m_embedded; |
114 bool m_processed; | 116 bool m_processed; |
115 | 117 |
116 xmlDocPtr m_stylesheetDoc; | 118 xmlDocPtr m_stylesheetDoc; |
117 bool m_stylesheetDocTaken; | 119 bool m_stylesheetDocTaken; |
118 bool m_compilationFailed; | 120 bool m_compilationFailed; |
119 | 121 |
120 XSLStyleSheet* m_parentStyleSheet; | 122 XSLStyleSheet* m_parentStyleSheet; |
haraken
2014/03/05 14:21:22
Shouldn't we use RawPtrWillBeMember<XSLStyleSheet>
Mads Ager (chromium)
2014/03/05 14:51:16
Yes, in one of the next changes. When I remove the
| |
121 }; | 123 }; |
122 | 124 |
123 DEFINE_TYPE_CASTS(XSLStyleSheet, StyleSheet, sheet, !sheet->isCSSStyleSheet(), ! sheet.isCSSStyleSheet()); | 125 DEFINE_TYPE_CASTS(XSLStyleSheet, StyleSheet, sheet, !sheet->isCSSStyleSheet(), ! sheet.isCSSStyleSheet()); |
124 | 126 |
125 } // namespace WebCore | 127 } // namespace WebCore |
126 | 128 |
127 #endif // XSLStyleSheet_h | 129 #endif // XSLStyleSheet_h |
OLD | NEW |