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