• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3  * Copyright (C) 2006 Apple Inc. All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  */
21 
22 #ifndef ProcessingInstruction_h
23 #define ProcessingInstruction_h
24 
25 #include "CachedResourceClient.h"
26 #include "CachedResourceHandle.h"
27 #include "ContainerNode.h"
28 
29 namespace WebCore {
30 
31 class StyleSheet;
32 class CSSStyleSheet;
33 
34 class ProcessingInstruction : public ContainerNode, private CachedResourceClient {
35 public:
36     static PassRefPtr<ProcessingInstruction> create(Document*, const String& target, const String& data);
37     virtual ~ProcessingInstruction();
38 
target()39     const String& target() const { return m_target; }
data()40     const String& data() const { return m_data; }
41     void setData(const String&, ExceptionCode&);
42 
setCreatedByParser(bool createdByParser)43     void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
44 
45     virtual void finishParsingChildren();
46 
localHref()47     const String& localHref() const { return m_localHref; }
sheet()48     StyleSheet* sheet() const { return m_sheet.get(); }
49     void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>);
50 
isCSS()51     bool isCSS() const { return m_isCSS; }
52 #if ENABLE(XSLT)
isXSL()53     bool isXSL() const { return m_isXSL; }
54 #endif
55 
56 private:
57     ProcessingInstruction(Document*, const String& target, const String& data);
58 
59     virtual String nodeName() const;
60     virtual NodeType nodeType() const;
61     virtual String nodeValue() const;
62     virtual void setNodeValue(const String&, ExceptionCode&);
63     virtual PassRefPtr<Node> cloneNode(bool deep);
64     virtual bool childTypeAllowed(NodeType) const;
65     virtual bool offsetInCharacters() const;
66     virtual int maxCharacterOffset() const;
67 
68     virtual void insertedIntoDocument();
69     virtual void removedFromDocument();
70 
71     void checkStyleSheet();
72     virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
73 #if ENABLE(XSLT)
74     virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet);
75 #endif
76 
77     bool isLoading() const;
78     virtual bool sheetLoaded();
79 
80     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
81 
82     void parseStyleSheet(const String& sheet);
83 
84     String m_target;
85     String m_data;
86     String m_localHref;
87     String m_title;
88     String m_media;
89     CachedResourceHandle<CachedResource> m_cachedSheet;
90     RefPtr<StyleSheet> m_sheet;
91     bool m_loading;
92     bool m_alternate;
93     bool m_createdByParser;
94     bool m_isCSS;
95 #if ENABLE(XSLT)
96     bool m_isXSL;
97 #endif
98 };
99 
100 } //namespace
101 
102 #endif
103