Home | History | Annotate | Download | only in dom
      1 /*
      2  * Copyright (C) 2000 Peter Kelly (pmk (at) 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 "core/dom/Node.h"
     26 #include "core/loader/cache/ResourcePtr.h"
     27 #include "core/loader/cache/StyleSheetResourceClient.h"
     28 
     29 namespace WebCore {
     30 
     31 class StyleSheet;
     32 class CSSStyleSheet;
     33 
     34 class ProcessingInstruction FINAL : public Node, private StyleSheetResourceClient {
     35 public:
     36     static PassRefPtr<ProcessingInstruction> create(Document*, const String& target, const String& data);
     37     virtual ~ProcessingInstruction();
     38 
     39     const String& target() const { return m_target; }
     40     const String& data() const { return m_data; }
     41     void setData(const String&);
     42 
     43     void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
     44 
     45     virtual void finishParsingChildren();
     46 
     47     const String& localHref() const { return m_localHref; }
     48     StyleSheet* sheet() const { return m_sheet.get(); }
     49     void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>);
     50 
     51     bool isCSS() const { return m_isCSS; }
     52     bool isXSL() const { return m_isXSL; }
     53 
     54     bool isLoading() const;
     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&);
     63     virtual PassRefPtr<Node> cloneNode(bool deep = true);
     64     virtual bool offsetInCharacters() const;
     65     virtual int maxCharacterOffset() const;
     66 
     67     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     68     virtual void removedFrom(ContainerNode*) OVERRIDE;
     69 
     70     void checkStyleSheet();
     71     virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CSSStyleSheetResource*);
     72     virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet);
     73 
     74     virtual bool sheetLoaded();
     75 
     76     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
     77 
     78     void parseStyleSheet(const String& sheet);
     79 
     80     String m_target;
     81     String m_data;
     82     String m_localHref;
     83     String m_title;
     84     String m_media;
     85     ResourcePtr<Resource> m_resource;
     86     RefPtr<StyleSheet> m_sheet;
     87     bool m_loading;
     88     bool m_alternate;
     89     bool m_createdByParser;
     90     bool m_isCSS;
     91     bool m_isXSL;
     92 };
     93 
     94 } //namespace
     95 
     96 #endif
     97