Changeset 18669 in webkit


Ignore:
Timestamp:
Jan 8, 2007 9:50:01 AM (17 years ago)
Author:
weinig
Message:

Reviewed by ap and the rubber stamp of Maciej.

Patch for http://bugs.webkit.org/show_bug.cgi?id=12164
Cleanup Tokenizers

  • Moves Tokenizer class into its own file.
  • Move XMLTokenizer declaration from XMLTokenizer.cpp to XMLTokenizer.h
  • Fixup #includes.
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Document.cpp: (WebCore::Document::createTokenizer):
  • dom/Tokenizer.h: Added. (WebCore::Tokenizer::Tokenizer): (WebCore::Tokenizer::~Tokenizer): (WebCore::Tokenizer::stopParsing): (WebCore::Tokenizer::processingData): (WebCore::Tokenizer::executingScript): (WebCore::Tokenizer::wantsRawData): (WebCore::Tokenizer::writeRawData): (WebCore::Tokenizer::inViewSourceMode): (WebCore::Tokenizer::setInViewSourceMode): (WebCore::Tokenizer::wellFormed): (WebCore::Tokenizer::lineNumber): (WebCore::Tokenizer::columnNumber):
  • dom/XMLTokenizer.cpp:
  • dom/XMLTokenizer.h: (WebCore::XMLTokenizer::): (WebCore::XMLTokenizer::setIsXHTMLDocument): (WebCore::XMLTokenizer::isXHTMLDocument): (WebCore::XMLTokenizer::wellFormed):
  • html/HTMLElement.cpp:
  • html/HTMLTokenizer.h: (WebCore::Token::reset): (WebCore::HTMLTokenizer::checkBuffer): (WebCore::HTMLTokenizer::checkScriptBuffer): (WebCore::HTMLTokenizer::State::State): (WebCore::HTMLTokenizer::State::setBit):
  • xml/XSLTProcessor.cpp:
Location:
trunk/WebCore
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r18666 r18669  
     12007-01-08  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by ap and the rubber stamp of Maciej.
     4
     5        Patch for http://bugs.webkit.org/show_bug.cgi?id=12164
     6        Cleanup Tokenizers
     7
     8        - Moves Tokenizer class into its own file.
     9        - Move XMLTokenizer declaration from XMLTokenizer.cpp to XMLTokenizer.h
     10        - Fixup #includes.
     11
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * dom/Document.cpp:
     14        (WebCore::Document::createTokenizer):
     15        * dom/Tokenizer.h: Added.
     16        (WebCore::Tokenizer::Tokenizer):
     17        (WebCore::Tokenizer::~Tokenizer):
     18        (WebCore::Tokenizer::stopParsing):
     19        (WebCore::Tokenizer::processingData):
     20        (WebCore::Tokenizer::executingScript):
     21        (WebCore::Tokenizer::wantsRawData):
     22        (WebCore::Tokenizer::writeRawData):
     23        (WebCore::Tokenizer::inViewSourceMode):
     24        (WebCore::Tokenizer::setInViewSourceMode):
     25        (WebCore::Tokenizer::wellFormed):
     26        (WebCore::Tokenizer::lineNumber):
     27        (WebCore::Tokenizer::columnNumber):
     28        * dom/XMLTokenizer.cpp:
     29        * dom/XMLTokenizer.h:
     30        (WebCore::XMLTokenizer::):
     31        (WebCore::XMLTokenizer::setIsXHTMLDocument):
     32        (WebCore::XMLTokenizer::isXHTMLDocument):
     33        (WebCore::XMLTokenizer::wellFormed):
     34        * html/HTMLElement.cpp:
     35        * html/HTMLTokenizer.h:
     36        (WebCore::Token::reset):
     37        (WebCore::HTMLTokenizer::checkBuffer):
     38        (WebCore::HTMLTokenizer::checkScriptBuffer):
     39        (WebCore::HTMLTokenizer::State::State):
     40        (WebCore::HTMLTokenizer::State::setBit):
     41        * xml/XSLTProcessor.cpp:
     42
    1432007-01-08  Sam Weinig  <sam@webkit.org>
    244
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r18659 r18669  
    27322732                BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; };
    27332733                BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; };
     2734                BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */; };
    27342735                BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */; };
    27352736                BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */; };
     
    58555856                BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; };
    58565857                BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; };
     5858                BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; };
    58575859                BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSComputedStyleDeclaration.cpp; sourceTree = "<group>"; };
    58585860                BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSComputedStyleDeclaration.h; sourceTree = "<group>"; };
     
    93529354                        isa = PBXGroup;
    93539355                        children = (
    9354                                 AA4C3A740B2B1679002334A2 /* StyleElement.cpp */,
    9355                                 AA4C3A750B2B1679002334A2 /* StyleElement.h */,
    93569356                                BC3B364705C9D5E200E42902 /* AtomicStringList.h */,
    93579357                                A8C4A7FC09D563270003AC8D /* Attr.cpp */,
     
    94159415                                939885C108B7E3D100E707C4 /* EventNames.cpp */,
    94169416                                939885C208B7E3D100E707C4 /* EventNames.h */,
     9417                                E12EDBE90B308E0B002704B6 /* EventTarget.cpp */,
     9418                                E12EDB7A0B308A78002704B6 /* EventTarget.h */,
    94179419                                85AFA7420AAF298400E84305 /* EventTarget.idl */,
    9418                                 E12EDB7A0B308A78002704B6 /* EventTarget.h */,
    9419                                 E12EDBE90B308E0B002704B6 /* EventTarget.cpp */,
    94209420                                14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */,
    94219421                                14EC267D09CA07E000E1EEEC /* EventTargetNode.h */,
     
    94799479                                A8C4A7EC09D563270003AC8D /* StyledElement.cpp */,
    94809480                                A8C4A7EB09D563270003AC8D /* StyledElement.h */,
     9481                                AA4C3A740B2B1679002334A2 /* StyleElement.cpp */,
     9482                                AA4C3A750B2B1679002334A2 /* StyleElement.h */,
    94819483                                6550B69B099DF0270090D781 /* Text.cpp */,
    94829484                                6550B69C099DF0270090D781 /* Text.h */,
    94839485                                93EEC1F609C2877700C515D1 /* Text.idl */,
     9486                                BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */,
    94849487                                854FE72C0A2297BE0058D7AD /* Traversal.cpp */,
    94859488                                854FE72D0A2297BE0058D7AD /* Traversal.h */,
     
    94899492                                85031B370A44EFC700F992E0 /* UIEvent.cpp */,
    94909493                                85031B380A44EFC700F992E0 /* UIEvent.h */,
     9494                                141B94EE09EC425A000E9413 /* UIEvent.idl */,
    94919495                                93354A3B0B24F8C9003F6DEA /* UIEventWithKeyState.cpp */,
    94929496                                85031B390A44EFC700F992E0 /* UIEventWithKeyState.h */,
    9493                                 141B94EE09EC425A000E9413 /* UIEvent.idl */,
    94949497                                85031B3A0A44EFC700F992E0 /* WheelEvent.cpp */,
    94959498                                85031B3B0A44EFC700F992E0 /* WheelEvent.h */,
     
    1095610959                                062287840B4DB322000C34DF /* FocusDirection.h in Headers */,
    1095710960                                1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
     10961                                BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */,
    1095810962                                AA882B300B4EF5EB006D26D1 /* PointerEventsHitRules.h in Headers */,
    1095910963                        );
  • trunk/WebCore/dom/Document.cpp

    r18610 r18669  
    12121212}
    12131213
    1214 Tokenizer *Document::createTokenizer()
    1215 {
    1216     return newXMLTokenizer(this, m_view);
     1214Tokenizer* Document::createTokenizer()
     1215{
     1216    return new XMLTokenizer(this, m_view);
    12171217}
    12181218
  • trunk/WebCore/dom/Tokenizer.h

    r18665 r18669  
    44 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
    55 * Copyright (C) 2005, 2006 Apple Computer, Inc.
     6 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    2223 */
    2324
    24 #ifndef XML_Tokenizer_h_
    25 #define XML_Tokenizer_h_
    26 
    27 #include "StringHash.h"
    28 #include <wtf/HashMap.h>
     25#ifndef Tokenizer_h
     26#define Tokenizer_h
    2927
    3028namespace WebCore {
    3129
    32 class DocLoader;
    33 class DocumentFragment;
    34 class Document;
    35 class Element;
    36 class FrameView;
    37 class SegmentedString;
     30    class SegmentedString;
    3831
    39 class Tokenizer
    40 {
    41 public:
    42     Tokenizer(bool viewSourceMode = false)
    43     : m_parserStopped(false)
    44     , m_inViewSourceMode(viewSourceMode)
    45     {}
    46    
    47     virtual ~Tokenizer() {}
     32    class Tokenizer {
     33    public:
     34        Tokenizer(bool viewSourceMode = false)
     35            : m_parserStopped(false)
     36            , m_inViewSourceMode(viewSourceMode)
     37        {
     38        }
    4839
    49     // Script output must be prepended, while new data
    50     // received during executing a script must be appended, hence the
    51     // extra bool to be able to distinguish between both cases.
    52     // document.write() always uses false, while the loader uses true.
    53     virtual bool write(const SegmentedString&, bool appendData) = 0;
    54     virtual void finish() = 0;
    55     virtual bool isWaitingForScripts() const = 0;
    56     virtual void stopParsing() { m_parserStopped = true; }
    57     virtual bool processingData() const { return false; }
    58     virtual int executingScript() const { return 0; }
     40        virtual ~Tokenizer() { }
    5941
    60     virtual bool wantsRawData() const { return false; }
    61     virtual bool writeRawData(const char* data, int len) { return false; }
    62    
    63     bool inViewSourceMode() const { return m_inViewSourceMode; }
    64     void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; }
     42        // Script output must be prepended, while new data
     43        // received during executing a script must be appended, hence the
     44        // extra bool to be able to distinguish between both cases.
     45        // document.write() always uses false, while the loader uses true.
     46        virtual bool write(const SegmentedString&, bool appendData) = 0;
     47        virtual void finish() = 0;
     48        virtual bool isWaitingForScripts() const = 0;
     49        virtual void stopParsing() { m_parserStopped = true; }
     50        virtual bool processingData() const { return false; }
     51        virtual int executingScript() const { return 0; }
    6552
    66     virtual bool wellFormed() const { return true; }
     53        virtual bool wantsRawData() const { return false; }
     54        virtual bool writeRawData(const char* data, int len) { return false; }
    6755
    68     virtual int lineNumber() const { return -1; }
    69     virtual int columnNumber() const { return -1; }
     56        bool inViewSourceMode() const { return m_inViewSourceMode; }
     57        void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; }
    7058
    71 protected:
    72     // The tokenizer has buffers, so parsing may continue even after
    73     // it stops receiving data. We use m_parserStopped to stop the tokenizer
    74     // even when it has buffered data.
    75     bool m_parserStopped;
    76    
    77     bool m_inViewSourceMode;
    78 };
     59        virtual bool wellFormed() const { return true; }
    7960
    80 Tokenizer* newXMLTokenizer(Document*, FrameView* = 0);
    81 #if XSLT_SUPPORT
    82 void* xmlDocPtrForString(DocLoader*, const String& source, const DeprecatedString& URL);
    83 void setLoaderForLibXMLCallbacks(DocLoader*);
    84 #endif
    85 HashMap<String, String> parseAttributes(const String&, bool& attrsOK);
    86 bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0);
     61        virtual int lineNumber() const { return -1; }
     62        virtual int columnNumber() const { return -1; }
    8763
    88 }
     64    protected:
     65        // The tokenizer has buffers, so parsing may continue even after
     66        // it stops receiving data. We use m_parserStopped to stop the tokenizer
     67        // even when it has buffered data.
     68        bool m_parserStopped;
     69        bool m_inViewSourceMode;
     70    };
    8971
    90 #endif
     72} // namespace WebCore
     73
     74#endif // Tokenizer_h
  • trunk/WebCore/dom/XMLTokenizer.cpp

    r18652 r18669  
    55 * Copyright (C) 2005, 2006 Apple Computer, Inc.
    66 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
     7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    7071const int maxErrors = 25;
    7172
    72 typedef HashMap<StringImpl*, StringImpl*> PrefixForNamespaceMap;
    73 
    74 class PendingCallbacks;
    75 
    76 class XMLTokenizer : public Tokenizer, public CachedResourceClient {
    77 public:
    78     XMLTokenizer(Document*, FrameView* = 0);
    79     XMLTokenizer(DocumentFragment*, Element*);
    80     ~XMLTokenizer();
    81 
    82     enum ErrorType { warning, nonFatal, fatal };
    83 
    84     // from Tokenizer
    85     virtual bool write(const SegmentedString& str, bool);
    86     virtual void finish();
    87     virtual bool isWaitingForScripts() const;
    88     virtual void stopParsing();
    89 
    90     void end();
    91 
    92     void pauseParsing();
    93     void resumeParsing();
    94    
    95     void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; }
    96     bool isXHTMLDocument() const { return m_isXHTMLDocument; }
    97 
    98     // from CachedResourceClient
    99     virtual void notifyFinished(CachedResource* finishedObj);
    100 
    101     // callbacks from parser SAX
    102     void error(ErrorType, const char* message, va_list args);
    103     void startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes);
    104     void endElementNs();
    105     void characters(const xmlChar* s, int len);
    106     void processingInstruction(const xmlChar* target, const xmlChar* data);
    107     void cdataBlock(const xmlChar* s, int len);
    108     void comment(const xmlChar* s);
    109     void startDocument(const xmlChar* version, const xmlChar* encoding, int standalone);
    110     void internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID);
    111 
    112     void handleError(ErrorType type, const char* m, int lineNumber, int columnNumber);
    113 
    114     virtual bool wellFormed() const { return !m_sawError; }
    115 
    116     int lineNumber() const;
    117     int columnNumber() const;
    118 
    119 private:
    120     void initializeParserContext();
    121     void setCurrentNode(Node*);
    122 
    123     void insertErrorMessageBlock();
    124 
    125     bool enterText();
    126     void exitText();
    127 
    128     Document* m_doc;
    129     FrameView* m_view;
    130    
    131     String m_originalSourceForTransform;
    132 
    133     xmlParserCtxtPtr m_context;
    134     Node* m_currentNode;
    135     bool m_currentNodeIsReferenced;
    136 
    137     bool m_sawError;
    138     bool m_sawXSLTransform;
    139     bool m_sawFirstElement;
    140     bool m_isXHTMLDocument;
    141    
    142     bool m_parserPaused;
    143     bool m_requestingScript;
    144     bool m_finishCalled;
    145    
    146     int m_errorCount;
    147     int m_lastErrorLine;
    148     int m_lastErrorColumn;
    149     String m_errorMessages;
    150 
    151     CachedScript* m_pendingScript;
    152     RefPtr<Element> m_scriptElement;
    153     int m_scriptStartLine;
    154    
    155     bool m_parsingFragment;
    156     String m_defaultNamespaceURI;
    157     PrefixForNamespaceMap m_prefixToNamespaceMap;
    158    
    159     PendingCallbacks* m_pendingCallbacks;
    160     SegmentedString m_pendingSrc;
    161 };
    162 
    16373class PendingCallbacks {
    16474public:
     
    14111321#endif
    14121322
    1413 Tokenizer* newXMLTokenizer(Document* d, FrameView* v)
    1414 {
    1415     return new XMLTokenizer(d, v);
    1416 }
    1417 
    14181323int XMLTokenizer::lineNumber() const
    14191324{
  • trunk/WebCore/dom/XMLTokenizer.h

    r18652 r18669  
    44 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
    55 * Copyright (C) 2005, 2006 Apple Computer, Inc.
     6 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    2223 */
    2324
    24 #ifndef XML_Tokenizer_h_
    25 #define XML_Tokenizer_h_
     25#ifndef XMLTokenizer_h
     26#define XMLTokenizer_h
    2627
     28#include "CachedResourceClient.h"
     29#include "SegmentedString.h"
    2730#include "StringHash.h"
     31#include "Tokenizer.h"
     32#include <libxml/tree.h>
     33#include <libxml/xmlstring.h>
    2834#include <wtf/HashMap.h>
    2935
    3036namespace WebCore {
    3137
    32 class DocLoader;
    33 class DocumentFragment;
    34 class Document;
    35 class Element;
    36 class FrameView;
    37 class SegmentedString;
     38    class Node;
     39    class CachedScript;
     40    class DocLoader;
     41    class DocumentFragment;
     42    class Document;
     43    class Element;
     44    class FrameView;
     45    class PendingCallbacks;
    3846
    39 class Tokenizer
    40 {
    41 public:
    42     Tokenizer(bool viewSourceMode = false)
    43     : m_parserStopped(false)
    44     , m_inViewSourceMode(viewSourceMode)
    45     {}
    46    
    47     virtual ~Tokenizer() {}
     47    class XMLTokenizer : public Tokenizer, public CachedResourceClient {
     48    public:
     49        XMLTokenizer(Document*, FrameView* = 0);
     50        XMLTokenizer(DocumentFragment*, Element*);
     51        ~XMLTokenizer();
    4852
    49     // Script output must be prepended, while new data
    50     // received during executing a script must be appended, hence the
    51     // extra bool to be able to distinguish between both cases.
    52     // document.write() always uses false, while the loader uses true.
    53     virtual bool write(const SegmentedString&, bool appendData) = 0;
    54     virtual void finish() = 0;
    55     virtual bool isWaitingForScripts() const = 0;
    56     virtual void stopParsing() { m_parserStopped = true; }
    57     virtual bool processingData() const { return false; }
    58     virtual int executingScript() const { return 0; }
     53        enum ErrorType { warning, nonFatal, fatal };
    5954
    60     virtual bool wantsRawData() const { return false; }
    61     virtual bool writeRawData(const char* data, int len) { return false; }
    62    
    63     bool inViewSourceMode() const { return m_inViewSourceMode; }
    64     void setInViewSourceMode(bool mode) { m_inViewSourceMode = mode; }
     55        // from Tokenizer
     56        virtual bool write(const SegmentedString&, bool appendData);
     57        virtual void finish();
     58        virtual bool isWaitingForScripts() const;
     59        virtual void stopParsing();
    6560
    66     virtual bool wellFormed() const { return true; }
     61        void end();
    6762
    68     virtual int lineNumber() const { return -1; }
    69     virtual int columnNumber() const { return -1; }
     63        void pauseParsing();
     64        void resumeParsing();
    7065
    71 protected:
    72     // The tokenizer has buffers, so parsing may continue even after
    73     // it stops receiving data. We use m_parserStopped to stop the tokenizer
    74     // even when it has buffered data.
    75     bool m_parserStopped;
    76    
    77     bool m_inViewSourceMode;
    78 };
     66        void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; }
     67        bool isXHTMLDocument() const { return m_isXHTMLDocument; }
    7968
    80 Tokenizer* newXMLTokenizer(Document*, FrameView* = 0);
     69        // from CachedResourceClient
     70        virtual void notifyFinished(CachedResource* finishedObj);
     71
     72        // callbacks from parser SAX
     73        void error(ErrorType, const char* message, va_list args);
     74        void startElementNs(const xmlChar* xmlLocalName, const xmlChar* xmlPrefix, const xmlChar* xmlURI, int nb_namespaces, const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes);
     75        void endElementNs();
     76        void characters(const xmlChar* s, int len);
     77        void processingInstruction(const xmlChar* target, const xmlChar* data);
     78        void cdataBlock(const xmlChar* s, int len);
     79        void comment(const xmlChar* s);
     80        void startDocument(const xmlChar* version, const xmlChar* encoding, int standalone);
     81        void internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID);
     82
     83        void handleError(ErrorType type, const char* m, int lineNumber, int columnNumber);
     84
     85        virtual bool wellFormed() const { return !m_sawError; }
     86
     87        int lineNumber() const;
     88        int columnNumber() const;
     89
     90    private:
     91        void initializeParserContext();
     92        void setCurrentNode(Node*);
     93
     94        void insertErrorMessageBlock();
     95
     96        bool enterText();
     97        void exitText();
     98
     99        Document* m_doc;
     100        FrameView* m_view;
     101
     102        String m_originalSourceForTransform;
     103
     104        xmlParserCtxtPtr m_context;
     105        Node* m_currentNode;
     106        bool m_currentNodeIsReferenced;
     107
     108        bool m_sawError;
     109        bool m_sawXSLTransform;
     110        bool m_sawFirstElement;
     111        bool m_isXHTMLDocument;
     112
     113        bool m_parserPaused;
     114        bool m_requestingScript;
     115        bool m_finishCalled;
     116
     117        int m_errorCount;
     118        int m_lastErrorLine;
     119        int m_lastErrorColumn;
     120        String m_errorMessages;
     121
     122        CachedScript* m_pendingScript;
     123        RefPtr<Element> m_scriptElement;
     124        int m_scriptStartLine;
     125
     126        bool m_parsingFragment;
     127        String m_defaultNamespaceURI;
     128
     129        typedef HashMap<StringImpl*, StringImpl*> PrefixForNamespaceMap;
     130        PrefixForNamespaceMap m_prefixToNamespaceMap;
     131
     132        PendingCallbacks* m_pendingCallbacks;
     133        SegmentedString m_pendingSrc;
     134    };
     135
    81136#if XSLT_SUPPORT
    82137void* xmlDocPtrForString(DocLoader*, const String& source, const DeprecatedString& URL);
    83138void setLoaderForLibXMLCallbacks(DocLoader*);
    84139#endif
     140
    85141HashMap<String, String> parseAttributes(const String&, bool& attrsOK);
    86142bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent = 0);
    87143
    88 }
     144} // namespace WebCore
    89145
    90 #endif
     146#endif // XMLTokenizer_h
  • trunk/WebCore/html/HTMLElement.cpp

    r18610 r18669  
    4040#include "HTMLTokenizer.h"
    4141#include "TextIterator.h"
     42#include "XMLTokenizer.h"
    4243#include "markup.h"
    4344
  • trunk/WebCore/html/HTMLTokenizer.h

    r18652 r18669  
    2424*/
    2525
    26 #ifndef HTMLTOKENIZER_H
    27 #define HTMLTOKENIZER_H
     26#ifndef HTMLTokenizer_h
     27#define HTMLTokenizer_h
    2828
    2929#include "DeprecatedPtrQueue.h"
     
    3131#include "SegmentedString.h"
    3232#include "Timer.h"
    33 #include "XMLTokenizer.h"
     33#include "Tokenizer.h"
    3434#include "CachedResourceClient.h"
    3535
     
    5151 * text contains the text.
    5252 */
    53 class Token
    54 {
     53class Token {
    5554public:
    5655    Token() : beginTag(true), flat(false) { }
     
    6463    {
    6564        attrs = 0;
    66         text = 0;       
     65        text = 0;
    6766        tagName = nullAtom;
    6867        beginTag = true;
     
    7978//-----------------------------------------------------------------------------
    8079
    81 class HTMLTokenizer : public Tokenizer, public CachedResourceClient
    82 {
     80class HTMLTokenizer : public Tokenizer, public CachedResourceClient {
    8381public:
    8482    HTMLTokenizer(HTMLDocument*);
     
    124122    inline void checkBuffer(int len = 10)
    125123    {
    126         if ( (dest - buffer) > size-len )
     124        if ((dest - buffer) > size - len)
    127125            enlargeBuffer(len);
    128126    }
     127
    129128    inline void checkScriptBuffer(int len = 10)
    130129    {
    131         if ( scriptCodeSize + len >= scriptCodeMaxSize )
     130        if (scriptCodeSize + len >= scriptCodeMaxSize)
    132131            enlargeScriptBuffer(len);
    133132    }
     
    184183    class State {
    185184    public:
    186         State() : m_bits(0) {}
     185        State() : m_bits(0) { }
    187186
    188187        TagState tagState() const { return static_cast<TagState>(m_bits & TagMask); }
     
    255254            ForceSynchronous = 1 << 23
    256255        };
    257    
    258         void setBit(StateBits bit, bool value) 
    259         { 
    260             if (value) 
    261                 m_bits |= bit; 
    262             else 
     256
     257        void setBit(StateBits bit, bool value)
     258        {
     259            if (value)
     260                m_bits |= bit;
     261            else
    263262                m_bits &= ~bit;
    264263        }
     
    274273    // Name of an attribute that we just scanned.
    275274    AtomicString attrName;
    276    
     275
    277276    // Used to store the code of a srcipting sequence
    278277    UChar* scriptCode;
     
    332331// we'll just make it large enough to handle all imaginable cases.
    333332#define CBUFLEN 1024
    334     char cBuffer[CBUFLEN+2];
     333    char cBuffer[CBUFLEN + 2];
    335334    unsigned int m_cBufferPos;
    336    
     335
    337336    SegmentedString src;
    338337    Document* m_doc;
     
    346345UChar decodeNamedEntity(const char*);
    347346
    348 }
    349 
    350 #endif
     347} // namespace WebCore
     348
     349#endif // HTMLTokenizer_h
  • trunk/WebCore/xml/XSLTProcessor.cpp

    r18644 r18669  
    2727#include "XSLTProcessor.h"
    2828
     29#include "CString.h"
    2930#include "Cache.h"
    30 #include "CString.h"
    3131#include "DOMImplementation.h"
    32 #include "TextResourceDecoder.h"
    3332#include "DocLoader.h"
    3433#include "DocumentFragment.h"
     
    4342#include "ResourceResponse.h"
    4443#include "Text.h"
     44#include "TextResourceDecoder.h"
     45#include "XMLTokenizer.h"
    4546#include "loader.h"
    4647#include "markup.h"
Note: See TracChangeset for help on using the changeset viewer.