| 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 18 matching lines...) Expand all  Loading... | 
|   29 #include "wtf/PassRefPtr.h" |   29 #include "wtf/PassRefPtr.h" | 
|   30 #include <libxml/tree.h> |   30 #include <libxml/tree.h> | 
|   31 #include <libxslt/transform.h> |   31 #include <libxslt/transform.h> | 
|   32  |   32  | 
|   33 namespace blink { |   33 namespace blink { | 
|   34  |   34  | 
|   35 class XSLImportRule; |   35 class XSLImportRule; | 
|   36  |   36  | 
|   37 class XSLStyleSheet final : public StyleSheet { |   37 class XSLStyleSheet final : public StyleSheet { | 
|   38 public: |   38 public: | 
|   39     static PassRefPtrWillBeRawPtr<XSLStyleSheet> create(XSLImportRule* parentImp
     ort, const String& originalURL, const KURL& finalURL) |   39     static RawPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const Strin
     g& originalURL, const KURL& finalURL) | 
|   40     { |   40     { | 
|   41         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |   41         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 
|   42         return adoptRefWillBeNoop(new XSLStyleSheet(parentImport, originalURL, f
     inalURL)); |   42         return new XSLStyleSheet(parentImport, originalURL, finalURL); | 
|   43     } |   43     } | 
|   44     static PassRefPtrWillBeRawPtr<XSLStyleSheet> create(ProcessingInstruction* p
     arentNode, const String& originalURL, const KURL& finalURL) |   44     static RawPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, const
      String& originalURL, const KURL& finalURL) | 
|   45     { |   45     { | 
|   46         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |   46         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 
|   47         return adoptRefWillBeNoop(new XSLStyleSheet(parentNode, originalURL, fin
     alURL, false)); |   47         return new XSLStyleSheet(parentNode, originalURL, finalURL, false); | 
|   48     } |   48     } | 
|   49     static PassRefPtrWillBeRawPtr<XSLStyleSheet> createEmbedded(ProcessingInstru
     ction* parentNode, const KURL& finalURL) |   49     static RawPtr<XSLStyleSheet> createEmbedded(ProcessingInstruction* parentNod
     e, const KURL& finalURL) | 
|   50     { |   50     { | 
|   51         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |   51         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 
|   52         return adoptRefWillBeNoop(new XSLStyleSheet(parentNode, finalURL.getStri
     ng(), finalURL, true)); |   52         return new XSLStyleSheet(parentNode, finalURL.getString(), finalURL, tru
     e); | 
|   53     } |   53     } | 
|   54  |   54  | 
|   55     // Taking an arbitrary node is unsafe, because owner node pointer can become |   55     // Taking an arbitrary node is unsafe, because owner node pointer can become | 
|   56     // stale. XSLTProcessor ensures that the stylesheet doesn't outlive its |   56     // stale. XSLTProcessor ensures that the stylesheet doesn't outlive its | 
|   57     // parent, in part by not exposing it to JavaScript. |   57     // parent, in part by not exposing it to JavaScript. | 
|   58     static PassRefPtrWillBeRawPtr<XSLStyleSheet> createForXSLTProcessor(Document
     * document, Node* stylesheetRootNode, const String& originalURL, const KURL& fin
     alURL) |   58     static RawPtr<XSLStyleSheet> createForXSLTProcessor(Document* document, Node
     * stylesheetRootNode, const String& originalURL, const KURL& finalURL) | 
|   59     { |   59     { | 
|   60         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |   60         ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 
|   61         return adoptRefWillBeNoop(new XSLStyleSheet(document, stylesheetRootNode
     , originalURL, finalURL, false)); |   61         return new XSLStyleSheet(document, stylesheetRootNode, originalURL, fina
     lURL, false); | 
|   62     } |   62     } | 
|   63  |   63  | 
|   64     ~XSLStyleSheet() override; |   64     ~XSLStyleSheet() override; | 
|   65  |   65  | 
|   66     bool parseString(const String&); |   66     bool parseString(const String&); | 
|   67  |   67  | 
|   68     void checkLoaded(); |   68     void checkLoaded(); | 
|   69  |   69  | 
|   70     const KURL& finalURL() const { return m_finalURL; } |   70     const KURL& finalURL() const { return m_finalURL; } | 
|   71  |   71  | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|   96     KURL baseURL() const override { return m_finalURL; } |   96     KURL baseURL() const override { return m_finalURL; } | 
|   97     bool isLoading() const override; |   97     bool isLoading() const override; | 
|   98  |   98  | 
|   99     DECLARE_VIRTUAL_TRACE(); |   99     DECLARE_VIRTUAL_TRACE(); | 
|  100  |  100  | 
|  101 private: |  101 private: | 
|  102     XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& final
     URL, bool embedded); |  102     XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& final
     URL, bool embedded); | 
|  103     XSLStyleSheet(Document* ownerDocument, Node* styleSheetRootNode, const Strin
     g& originalURL, const KURL& finalURL, bool embedded); |  103     XSLStyleSheet(Document* ownerDocument, Node* styleSheetRootNode, const Strin
     g& originalURL, const KURL& finalURL, bool embedded); | 
|  104     XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const 
     KURL& finalURL); |  104     XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const 
     KURL& finalURL); | 
|  105  |  105  | 
|  106     RawPtrWillBeMember<Node> m_ownerNode; |  106     Member<Node> m_ownerNode; | 
|  107     String m_originalURL; |  107     String m_originalURL; | 
|  108     KURL m_finalURL; |  108     KURL m_finalURL; | 
|  109     bool m_isDisabled; |  109     bool m_isDisabled; | 
|  110  |  110  | 
|  111     PersistentHeapVectorWillBeHeapVector<Member<XSLImportRule>> m_children; |  111     HeapVector<Member<XSLImportRule>> m_children; | 
|  112  |  112  | 
|  113     bool m_embedded; |  113     bool m_embedded; | 
|  114     bool m_processed; |  114     bool m_processed; | 
|  115  |  115  | 
|  116     xmlDocPtr m_stylesheetDoc; |  116     xmlDocPtr m_stylesheetDoc; | 
|  117     bool m_stylesheetDocTaken; |  117     bool m_stylesheetDocTaken; | 
|  118     bool m_compilationFailed; |  118     bool m_compilationFailed; | 
|  119  |  119  | 
|  120     RawPtrWillBeMember<XSLStyleSheet> m_parentStyleSheet; |  120     Member<XSLStyleSheet> m_parentStyleSheet; | 
|  121     RefPtrWillBeMember<Document> m_ownerDocument; |  121     Member<Document> m_ownerDocument; | 
|  122 }; |  122 }; | 
|  123  |  123  | 
|  124 DEFINE_TYPE_CASTS(XSLStyleSheet, StyleSheet, sheet, !sheet->isCSSStyleSheet(), !
     sheet.isCSSStyleSheet()); |  124 DEFINE_TYPE_CASTS(XSLStyleSheet, StyleSheet, sheet, !sheet->isCSSStyleSheet(), !
     sheet.isCSSStyleSheet()); | 
|  125  |  125  | 
|  126 } // namespace blink |  126 } // namespace blink | 
|  127  |  127  | 
|  128 #endif // XSLStyleSheet_h |  128 #endif // XSLStyleSheet_h | 
| OLD | NEW |