Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / xml / XSLImportRule.h
1 /*
2  * This file is part of the XSL implementation.
3  *
4  * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
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
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22
23 #ifndef XSLImportRule_h
24 #define XSLImportRule_h
25
26 #include "RuntimeEnabledFeatures.h"
27 #include "core/fetch/ResourcePtr.h"
28 #include "core/fetch/StyleSheetResourceClient.h"
29 #include "core/xml/XSLStyleSheet.h"
30 #include "wtf/PassOwnPtr.h"
31
32 namespace WebCore {
33
34 class XSLStyleSheetResource;
35
36 class XSLImportRule FINAL : private StyleSheetResourceClient {
37     WTF_MAKE_FAST_ALLOCATED;
38 public:
39     static PassOwnPtr<XSLImportRule> create(XSLStyleSheet* parentSheet, const String& href)
40     {
41         ASSERT(RuntimeEnabledFeatures::xsltEnabled());
42         return adoptPtr(new XSLImportRule(parentSheet, href));
43     }
44
45     virtual ~XSLImportRule();
46
47     const String& href() const { return m_strHref; }
48     XSLStyleSheet* styleSheet() const { return m_styleSheet.get(); }
49
50     XSLStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; }
51     void setParentStyleSheet(XSLStyleSheet* styleSheet) { m_parentStyleSheet = styleSheet; }
52
53     bool isLoading();
54     void loadSheet();
55
56 private:
57     XSLImportRule(XSLStyleSheet* parentSheet, const String& href);
58
59     virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet) OVERRIDE;
60
61     // FIXME: Oilpan: This raw pointer is safe and has to be kept raw at this
62     // point to avoid cycles. When XSLImportRule is moved to the oilpan heap
63     // it should be a Member and be traced.
64     XSLStyleSheet* m_parentStyleSheet;
65     String m_strHref;
66     RefPtrWillBePersistent<XSLStyleSheet> m_styleSheet;
67     ResourcePtr<XSLStyleSheetResource> m_resource;
68     bool m_loading;
69 };
70
71 } // namespace WebCore
72
73 #endif // XSLImportRule_h