• 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 #ifdef ANDROID_INSTRUMENT
60     // Overridden to resolve the ambiguous
61     void* operator new(size_t size);
62     void* operator new[](size_t size);
63     void operator delete(void* p, size_t size);
64     void operator delete[](void* p, size_t size);
65 #endif
66 
67     virtual String nodeName() const;
68     virtual NodeType nodeType() const;
69     virtual String nodeValue() const;
70     virtual void setNodeValue(const String&, ExceptionCode&);
71     virtual PassRefPtr<Node> cloneNode(bool deep);
72     virtual bool childTypeAllowed(NodeType) const;
73     virtual bool offsetInCharacters() const;
74     virtual int maxCharacterOffset() const;
75 
76     virtual void insertedIntoDocument();
77     virtual void removedFromDocument();
78 
79     void checkStyleSheet();
80     virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
81 #if ENABLE(XSLT)
82     virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet);
83 #endif
84 
85     bool isLoading() const;
86     virtual bool sheetLoaded();
87 
88     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
89 
90     void parseStyleSheet(const String& sheet);
91 
92     String m_target;
93     String m_data;
94     String m_localHref;
95     String m_title;
96     String m_media;
97     CachedResourceHandle<CachedResource> m_cachedSheet;
98     RefPtr<StyleSheet> m_sheet;
99     bool m_loading;
100     bool m_alternate;
101     bool m_createdByParser;
102     bool m_isCSS;
103 #if ENABLE(XSLT)
104     bool m_isXSL;
105 #endif
106 };
107 
108 } //namespace
109 
110 #endif
111