Remove HTMLTokenTypes header (and split out AtomicHTMLToken.h from HTMLToken.h)
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 18:43:15 +0000 (18:43 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 18:43:15 +0000 (18:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109525

Reviewed by Adam Barth.

We no longer need a separate HTMLTokenTypes class now that NEW_XML is gone.
However, to remove HTMLTokenTypes, I had to split AtomicHTMLToken.h from
HTMLToken.h (to fix a circular dependancy).

* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addSource):
* html/parser/AtomicHTMLToken.h: Added.
(WebCore):
(AtomicHTMLToken):
(WebCore::AtomicHTMLToken::create):
(WebCore::AtomicHTMLToken::forceQuirks):
(WebCore::AtomicHTMLToken::type):
(WebCore::AtomicHTMLToken::name):
(WebCore::AtomicHTMLToken::setName):
(WebCore::AtomicHTMLToken::selfClosing):
(WebCore::AtomicHTMLToken::getAttributeItem):
(WebCore::AtomicHTMLToken::attributes):
(WebCore::AtomicHTMLToken::characters):
(WebCore::AtomicHTMLToken::charactersLength):
(WebCore::AtomicHTMLToken::isAll8BitData):
(WebCore::AtomicHTMLToken::comment):
(WebCore::AtomicHTMLToken::publicIdentifier):
(WebCore::AtomicHTMLToken::systemIdentifier):
(WebCore::AtomicHTMLToken::clearExternalCharacters):
(WebCore::AtomicHTMLToken::AtomicHTMLToken):
(WebCore::AtomicHTMLToken::initializeAttributes):
* html/parser/BackgroundHTMLParser.cpp:
(WebCore::BackgroundHTMLParser::simulateTreeBuilder):
* html/parser/CompactHTMLToken.cpp:
(WebCore::CompactHTMLToken::CompactHTMLToken):
* html/parser/CompactHTMLToken.h:
(WebCore::CompactHTMLToken::type):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertDoctype):
(WebCore::HTMLConstructionSite::insertComment):
(WebCore::HTMLConstructionSite::insertCommentOnDocument):
(WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement):
(WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
(WebCore::HTMLConstructionSite::insertForeignElement):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser):
(WebCore::HTMLDocumentParser::constructTreeFromHTMLToken):
* html/parser/HTMLDocumentParser.h:
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::checkForMetaCharset):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::isStartTag):
(WebCore::isStartOrEndTag):
(WebCore::HTMLPreloadScanner::processToken):
* html/parser/HTMLSourceTracker.cpp:
(WebCore::HTMLSourceTracker::start):
(WebCore::HTMLSourceTracker::sourceForToken):
* html/parser/HTMLStackItem.h:
(WebCore::HTMLStackItem::HTMLStackItem):
* html/parser/HTMLToken.h:
(WebCore::HTMLToken::clear):
(WebCore::HTMLToken::isUninitialized):
(WebCore::HTMLToken::type):
(WebCore::HTMLToken::makeEndOfFile):
(WebCore::HTMLToken::data):
(WebCore::HTMLToken::name):
(WebCore::HTMLToken::appendToName):
(WebCore::HTMLToken::forceQuirks):
(WebCore::HTMLToken::setForceQuirks):
(WebCore::HTMLToken::beginDOCTYPE):
(WebCore::HTMLToken::publicIdentifier):
(WebCore::HTMLToken::systemIdentifier):
(WebCore::HTMLToken::setPublicIdentifierToEmptyString):
(WebCore::HTMLToken::setSystemIdentifierToEmptyString):
(WebCore::HTMLToken::appendToPublicIdentifier):
(WebCore::HTMLToken::appendToSystemIdentifier):
(WebCore::HTMLToken::selfClosing):
(WebCore::HTMLToken::setSelfClosing):
(WebCore::HTMLToken::beginStartTag):
(WebCore::HTMLToken::beginEndTag):
(WebCore::HTMLToken::addNewAttribute):
(WebCore::HTMLToken::appendToAttributeName):
(WebCore::HTMLToken::appendToAttributeValue):
(WebCore::HTMLToken::attributes):
(WebCore::HTMLToken::eraseValueOfAttribute):
(WebCore::HTMLToken::ensureIsCharacterToken):
(WebCore::HTMLToken::characters):
(WebCore::HTMLToken::appendToCharacter):
(WebCore::HTMLToken::comment):
(WebCore::HTMLToken::beginComment):
(WebCore::HTMLToken::appendToComment):
(WebCore::HTMLToken::eraseCharacters):
(HTMLToken):
* html/parser/HTMLTokenTypes.h: Removed.
* html/parser/HTMLTokenizer.cpp:
(WebCore::AtomicHTMLToken::usesName):
(WebCore::AtomicHTMLToken::usesAttributes):
(WebCore::HTMLTokenizer::flushBufferedEndTag):
(WebCore::HTMLTokenizer::nextToken):
* html/parser/HTMLTokenizer.h:
(WebCore::HTMLTokenizer::saveEndTagNameIfNeeded):
(WebCore::HTMLTokenizer::haveBufferedCharacterToken):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processToken):
(WebCore::HTMLTreeBuilder::processDoctypeToken):
(WebCore::HTMLTreeBuilder::processFakeStartTag):
(WebCore::HTMLTreeBuilder::processFakeEndTag):
(WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
(WebCore::HTMLTreeBuilder::processIsindexStartTagForInBody):
(WebCore):
(WebCore::HTMLTreeBuilder::processStartTagForInBody):
(WebCore::HTMLTreeBuilder::processStartTagForInTable):
(WebCore::HTMLTreeBuilder::processStartTag):
(WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
(WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody):
(WebCore::HTMLTreeBuilder::processEndTagForInTableBody):
(WebCore::HTMLTreeBuilder::processEndTagForInRow):
(WebCore::HTMLTreeBuilder::processEndTagForInCell):
(WebCore::HTMLTreeBuilder::processEndTagForInBody):
(WebCore::HTMLTreeBuilder::processEndTagForInTable):
(WebCore::HTMLTreeBuilder::processEndTag):
(WebCore::HTMLTreeBuilder::processComment):
(WebCore::HTMLTreeBuilder::processCharacter):
(WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
(WebCore::HTMLTreeBuilder::defaultForBeforeHead):
(WebCore::HTMLTreeBuilder::defaultForInHead):
(WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
(WebCore::HTMLTreeBuilder::defaultForAfterHead):
(WebCore::HTMLTreeBuilder::processStartTagForInHead):
(WebCore::HTMLTreeBuilder::processGenericRCDATAStartTag):
(WebCore::HTMLTreeBuilder::processGenericRawTextStartTag):
(WebCore::HTMLTreeBuilder::processScriptStartTag):
(WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent):
(WebCore::HTMLTreeBuilder::processTokenInForeignContent):
* html/parser/HTMLViewSourceParser.cpp:
(WebCore::HTMLViewSourceParser::updateTokenizerState):
* html/parser/TextDocumentParser.cpp:
(WebCore::TextDocumentParser::insertFakePreElement):
* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::filterToken):
(WebCore::XSSAuditor::filterScriptToken):
(WebCore::XSSAuditor::filterObjectToken):
(WebCore::XSSAuditor::filterParamToken):
(WebCore::XSSAuditor::filterEmbedToken):
(WebCore::XSSAuditor::filterAppletToken):
(WebCore::XSSAuditor::filterIframeToken):
(WebCore::XSSAuditor::filterMetaToken):
(WebCore::XSSAuditor::filterBaseToken):
(WebCore::XSSAuditor::filterFormToken):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142641 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLViewSourceDocument.cpp
Source/WebCore/html/parser/AtomicHTMLToken.h [new file with mode: 0644]
Source/WebCore/html/parser/BackgroundHTMLParser.cpp
Source/WebCore/html/parser/CompactHTMLToken.cpp
Source/WebCore/html/parser/CompactHTMLToken.h
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/html/parser/HTMLDocumentParser.cpp
Source/WebCore/html/parser/HTMLDocumentParser.h
Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebCore/html/parser/HTMLSourceTracker.cpp
Source/WebCore/html/parser/HTMLStackItem.h
Source/WebCore/html/parser/HTMLToken.h
Source/WebCore/html/parser/HTMLTokenTypes.h [deleted file]
Source/WebCore/html/parser/HTMLTokenizer.cpp
Source/WebCore/html/parser/HTMLTokenizer.h
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/parser/HTMLViewSourceParser.cpp
Source/WebCore/html/parser/TextDocumentParser.cpp
Source/WebCore/html/parser/XSSAuditor.cpp

index e65d750..dee0547 100644 (file)
@@ -1,3 +1,162 @@
+2013-02-12  Eric Seidel  <eric@webkit.org>
+
+        Remove HTMLTokenTypes header (and split out AtomicHTMLToken.h from HTMLToken.h)
+        https://bugs.webkit.org/show_bug.cgi?id=109525
+
+        Reviewed by Adam Barth.
+
+        We no longer need a separate HTMLTokenTypes class now that NEW_XML is gone.
+        However, to remove HTMLTokenTypes, I had to split AtomicHTMLToken.h from
+        HTMLToken.h (to fix a circular dependancy).
+
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLViewSourceDocument.cpp:
+        (WebCore::HTMLViewSourceDocument::addSource):
+        * html/parser/AtomicHTMLToken.h: Added.
+        (WebCore):
+        (AtomicHTMLToken):
+        (WebCore::AtomicHTMLToken::create):
+        (WebCore::AtomicHTMLToken::forceQuirks):
+        (WebCore::AtomicHTMLToken::type):
+        (WebCore::AtomicHTMLToken::name):
+        (WebCore::AtomicHTMLToken::setName):
+        (WebCore::AtomicHTMLToken::selfClosing):
+        (WebCore::AtomicHTMLToken::getAttributeItem):
+        (WebCore::AtomicHTMLToken::attributes):
+        (WebCore::AtomicHTMLToken::characters):
+        (WebCore::AtomicHTMLToken::charactersLength):
+        (WebCore::AtomicHTMLToken::isAll8BitData):
+        (WebCore::AtomicHTMLToken::comment):
+        (WebCore::AtomicHTMLToken::publicIdentifier):
+        (WebCore::AtomicHTMLToken::systemIdentifier):
+        (WebCore::AtomicHTMLToken::clearExternalCharacters):
+        (WebCore::AtomicHTMLToken::AtomicHTMLToken):
+        (WebCore::AtomicHTMLToken::initializeAttributes):
+        * html/parser/BackgroundHTMLParser.cpp:
+        (WebCore::BackgroundHTMLParser::simulateTreeBuilder):
+        * html/parser/CompactHTMLToken.cpp:
+        (WebCore::CompactHTMLToken::CompactHTMLToken):
+        * html/parser/CompactHTMLToken.h:
+        (WebCore::CompactHTMLToken::type):
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::insertDoctype):
+        (WebCore::HTMLConstructionSite::insertComment):
+        (WebCore::HTMLConstructionSite::insertCommentOnDocument):
+        (WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement):
+        (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
+        (WebCore::HTMLConstructionSite::insertForeignElement):
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser):
+        (WebCore::HTMLDocumentParser::constructTreeFromHTMLToken):
+        * html/parser/HTMLDocumentParser.h:
+        * html/parser/HTMLMetaCharsetParser.cpp:
+        (WebCore::HTMLMetaCharsetParser::checkForMetaCharset):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::isStartTag):
+        (WebCore::isStartOrEndTag):
+        (WebCore::HTMLPreloadScanner::processToken):
+        * html/parser/HTMLSourceTracker.cpp:
+        (WebCore::HTMLSourceTracker::start):
+        (WebCore::HTMLSourceTracker::sourceForToken):
+        * html/parser/HTMLStackItem.h:
+        (WebCore::HTMLStackItem::HTMLStackItem):
+        * html/parser/HTMLToken.h:
+        (WebCore::HTMLToken::clear):
+        (WebCore::HTMLToken::isUninitialized):
+        (WebCore::HTMLToken::type):
+        (WebCore::HTMLToken::makeEndOfFile):
+        (WebCore::HTMLToken::data):
+        (WebCore::HTMLToken::name):
+        (WebCore::HTMLToken::appendToName):
+        (WebCore::HTMLToken::forceQuirks):
+        (WebCore::HTMLToken::setForceQuirks):
+        (WebCore::HTMLToken::beginDOCTYPE):
+        (WebCore::HTMLToken::publicIdentifier):
+        (WebCore::HTMLToken::systemIdentifier):
+        (WebCore::HTMLToken::setPublicIdentifierToEmptyString):
+        (WebCore::HTMLToken::setSystemIdentifierToEmptyString):
+        (WebCore::HTMLToken::appendToPublicIdentifier):
+        (WebCore::HTMLToken::appendToSystemIdentifier):
+        (WebCore::HTMLToken::selfClosing):
+        (WebCore::HTMLToken::setSelfClosing):
+        (WebCore::HTMLToken::beginStartTag):
+        (WebCore::HTMLToken::beginEndTag):
+        (WebCore::HTMLToken::addNewAttribute):
+        (WebCore::HTMLToken::appendToAttributeName):
+        (WebCore::HTMLToken::appendToAttributeValue):
+        (WebCore::HTMLToken::attributes):
+        (WebCore::HTMLToken::eraseValueOfAttribute):
+        (WebCore::HTMLToken::ensureIsCharacterToken):
+        (WebCore::HTMLToken::characters):
+        (WebCore::HTMLToken::appendToCharacter):
+        (WebCore::HTMLToken::comment):
+        (WebCore::HTMLToken::beginComment):
+        (WebCore::HTMLToken::appendToComment):
+        (WebCore::HTMLToken::eraseCharacters):
+        (HTMLToken):
+        * html/parser/HTMLTokenTypes.h: Removed.
+        * html/parser/HTMLTokenizer.cpp:
+        (WebCore::AtomicHTMLToken::usesName):
+        (WebCore::AtomicHTMLToken::usesAttributes):
+        (WebCore::HTMLTokenizer::flushBufferedEndTag):
+        (WebCore::HTMLTokenizer::nextToken):
+        * html/parser/HTMLTokenizer.h:
+        (WebCore::HTMLTokenizer::saveEndTagNameIfNeeded):
+        (WebCore::HTMLTokenizer::haveBufferedCharacterToken):
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processToken):
+        (WebCore::HTMLTreeBuilder::processDoctypeToken):
+        (WebCore::HTMLTreeBuilder::processFakeStartTag):
+        (WebCore::HTMLTreeBuilder::processFakeEndTag):
+        (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
+        (WebCore::HTMLTreeBuilder::processIsindexStartTagForInBody):
+        (WebCore):
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
+        (WebCore::HTMLTreeBuilder::processStartTagForInTable):
+        (WebCore::HTMLTreeBuilder::processStartTag):
+        (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
+        (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody):
+        (WebCore::HTMLTreeBuilder::processEndTagForInTableBody):
+        (WebCore::HTMLTreeBuilder::processEndTagForInRow):
+        (WebCore::HTMLTreeBuilder::processEndTagForInCell):
+        (WebCore::HTMLTreeBuilder::processEndTagForInBody):
+        (WebCore::HTMLTreeBuilder::processEndTagForInTable):
+        (WebCore::HTMLTreeBuilder::processEndTag):
+        (WebCore::HTMLTreeBuilder::processComment):
+        (WebCore::HTMLTreeBuilder::processCharacter):
+        (WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
+        (WebCore::HTMLTreeBuilder::defaultForBeforeHead):
+        (WebCore::HTMLTreeBuilder::defaultForInHead):
+        (WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
+        (WebCore::HTMLTreeBuilder::defaultForAfterHead):
+        (WebCore::HTMLTreeBuilder::processStartTagForInHead):
+        (WebCore::HTMLTreeBuilder::processGenericRCDATAStartTag):
+        (WebCore::HTMLTreeBuilder::processGenericRawTextStartTag):
+        (WebCore::HTMLTreeBuilder::processScriptStartTag):
+        (WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent):
+        (WebCore::HTMLTreeBuilder::processTokenInForeignContent):
+        * html/parser/HTMLViewSourceParser.cpp:
+        (WebCore::HTMLViewSourceParser::updateTokenizerState):
+        * html/parser/TextDocumentParser.cpp:
+        (WebCore::TextDocumentParser::insertFakePreElement):
+        * html/parser/XSSAuditor.cpp:
+        (WebCore::XSSAuditor::filterToken):
+        (WebCore::XSSAuditor::filterScriptToken):
+        (WebCore::XSSAuditor::filterObjectToken):
+        (WebCore::XSSAuditor::filterParamToken):
+        (WebCore::XSSAuditor::filterEmbedToken):
+        (WebCore::XSSAuditor::filterAppletToken):
+        (WebCore::XSSAuditor::filterIframeToken):
+        (WebCore::XSSAuditor::filterMetaToken):
+        (WebCore::XSSAuditor::filterBaseToken):
+        (WebCore::XSSAuditor::filterFormToken):
+
 2013-02-12  Pablo Flouret  <pablof@motorola.com>
 
         Handle error recovery in @supports
index f700189..c5eda5b 100644 (file)
@@ -3570,6 +3570,7 @@ webcore_sources += \
        Source/WebCore/html/MonthInputType.h \
        Source/WebCore/html/NumberInputType.cpp \
        Source/WebCore/html/NumberInputType.h \
+       Source/WebCore/html/parser/AtomicHTMLToken.h \
        Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp \
        Source/WebCore/html/parser/BackgroundHTMLInputStream.h \
        Source/WebCore/html/parser/BackgroundHTMLParser.cpp \
@@ -3613,7 +3614,6 @@ webcore_sources += \
        Source/WebCore/html/parser/HTMLSourceTracker.h \
        Source/WebCore/html/parser/HTMLStackItem.h \
        Source/WebCore/html/parser/HTMLToken.h \
-       Source/WebCore/html/parser/HTMLTokenTypes.h \
        Source/WebCore/html/parser/HTMLTokenizer.cpp \
        Source/WebCore/html/parser/HTMLTokenizer.h \
        Source/WebCore/html/parser/HTMLTreeBuilder.cpp \
index eaa5c5a..9435688 100644 (file)
@@ -1917,6 +1917,7 @@ HEADERS += \
     html/TimeRanges.h \
     html/TypeAhead.h \
     html/ValidityState.h \
+    html/parser/AtomicHTMLToken.h \
     html/parser/CSSPreloadScanner.h \
     html/parser/CompactHTMLToken.h \
     html/parser/HTMLConstructionSite.h \
@@ -1932,7 +1933,6 @@ HEADERS += \
     html/parser/HTMLScriptRunner.h \
     html/parser/HTMLScriptRunnerHost.h \
     html/parser/HTMLToken.h \
-    html/parser/HTMLTokenTypes.h \
     html/parser/HTMLTokenizer.h \
     html/parser/HTMLTreeBuilder.h \
     html/parser/HTMLViewSourceParser.h \
index 49a802c..060543c 100644 (file)
             'html/canvas/WebGLUniformLocation.h',
             'html/canvas/WebGLVertexArrayObjectOES.cpp',
             'html/canvas/WebGLVertexArrayObjectOES.h',
+            'html/parser/AtomicHTMLToken.h',
             'html/parser/BackgroundHTMLParser.cpp',
             'html/parser/BackgroundHTMLParser.h',
             'html/parser/BackgroundHTMLInputStream.cpp',
             'html/parser/HTMLSourceTracker.h',
             'html/parser/HTMLStackItem.h',
             'html/parser/HTMLToken.h',
-            'html/parser/HTMLTokenTypes.h',
             'html/parser/HTMLTokenizer.cpp',
             'html/parser/HTMLTokenizer.h',
             'html/parser/HTMLTreeBuilder.cpp',
index 01b0920..5f244f5 100755 (executable)
                                Name="parser"
                                >
                                <File
+                                       RelativePath="..\html\parser\AtomicHTMLToken.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\html\parser\BackgroundHTMLInputStream.cpp"
                                        >
                                </File>
                                        >
                                </File>
                                <File
-                                       RelativePath="..\html\parser\HTMLTokenTypes.h"
-                                       >
-                               </File>
-                               <File
                                        RelativePath="..\html\parser\HTMLTreeBuilder.cpp"
                                        >
                                </File>
index 2141232..5d03788 100644 (file)
     <ClInclude Include="..\html\ValidityState.h" />
     <ClInclude Include="..\html\VoidCallback.h" />
     <ClInclude Include="..\html\WeekInputType.h" />
+    <ClInclude Include="..\html\parser\AtomicHTMLToken.h" />
     <ClInclude Include="..\html\parser\BackgroundHTMLParser.h" />
     <ClInclude Include="..\html\parser\CompactHTMLToken.h" />
     <ClInclude Include="..\html\parser\CSSPreloadScanner.h" />
     <ClInclude Include="..\html\parser\HTMLStackItem.h" />
     <ClInclude Include="..\html\parser\HTMLToken.h" />
     <ClInclude Include="..\html\parser\HTMLTokenizer.h" />
-    <ClInclude Include="..\html\parser\HTMLTokenTypes.h" />
     <ClInclude Include="..\html\parser\HTMLTreeBuilder.h" />
     <ClInclude Include="..\html\parser\HTMLViewSourceParser.h" />
     <ClInclude Include="..\html\parser\InputStreamPreprocessor.h" />
index b672c7c..9679658 100644 (file)
     <ClInclude Include="..\html\WeekInputType.h">
       <Filter>html</Filter>
     </ClInclude>
+    <ClInclude Include="..\html\parser\AtomicHTMLToken.h">
+      <Filter>html\parser</Filter>
+    </ClInclude>
     <ClInclude Include="..\html\parser\BackgroundHTMLParser.h">
       <Filter>html\parser</Filter>
     </ClInclude>
     <ClInclude Include="..\html\parser\HTMLTokenizer.h">
       <Filter>html\parser</Filter>
     </ClInclude>
-    <ClInclude Include="..\html\parser\HTMLTokenTypes.h">
-      <Filter>html\parser</Filter>
-    </ClInclude>
     <ClInclude Include="..\html\parser\HTMLTreeBuilder.h">
       <Filter>html\parser</Filter>
     </ClInclude>
index 2aae977..f158166 100644 (file)
                97C0784F1165D5BE003A32EF /* SuffixTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuffixTree.h; sourceTree = "<group>"; };
                97C1F552122855CB00EDE615 /* HTMLStackItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLStackItem.h; path = parser/HTMLStackItem.h; sourceTree = "<group>"; };
                97C1F552122855CB00EDE616 /* HTMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLToken.h; path = parser/HTMLToken.h; sourceTree = "<group>"; };
-               97C1F552122855CB00EDE617 /* HTMLTokenTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLTokenTypes.h; path = parser/HTMLTokenTypes.h; sourceTree = "<group>"; };
+               97C1F552122855CB00EDE617 /* AtomicHTMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicHTMLToken.h; path = parser/AtomicHTMLToken.h; sourceTree = "<group>"; };
                97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; };
                97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSecurityPolicy.h; sourceTree = "<group>"; };
                97C740121603F7A10011FF2D /* FeatureObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FeatureObserver.cpp; sourceTree = "<group>"; };
                                97C1F552122855CB00EDE616 /* HTMLToken.h */,
                                977B385E122883E900B81FF8 /* HTMLTokenizer.cpp */,
                                977B385F122883E900B81FF8 /* HTMLTokenizer.h */,
-                               97C1F552122855CB00EDE617 /* HTMLTokenTypes.h */,
+                               97C1F552122855CB00EDE617 /* AtomicHTMLToken.h */,
                                977B37211228721700B81FF8 /* HTMLTreeBuilder.cpp */,
                                977B37221228721700B81FF8 /* HTMLTreeBuilder.h */,
                                977B3860122883E900B81FF8 /* HTMLViewSourceParser.cpp */,
index abf2438..b7fdb36 100644 (file)
@@ -99,24 +99,24 @@ void HTMLViewSourceDocument::addSource(const String& source, HTMLToken& token)
         createContainingTable();
 
     switch (token.type()) {
-    case HTMLTokenTypes::Uninitialized:
+    case HTMLToken::Uninitialized:
         ASSERT_NOT_REACHED();
         break;
-    case HTMLTokenTypes::DOCTYPE:
+    case HTMLToken::DOCTYPE:
         processDoctypeToken(source, token);
         break;
-    case HTMLTokenTypes::EndOfFile:
+    case HTMLToken::EndOfFile:
         if (!m_tbody->hasChildNodes())
             addLine(String());
         break;
-    case HTMLTokenTypes::StartTag:
-    case HTMLTokenTypes::EndTag:
+    case HTMLToken::StartTag:
+    case HTMLToken::EndTag:
         processTagToken(source, token);
         break;
-    case HTMLTokenTypes::Comment:
+    case HTMLToken::Comment:
         processCommentToken(source, token);
         break;
-    case HTMLTokenTypes::Character:
+    case HTMLToken::Character:
         processCharacterToken(source, token);
         break;
     }
diff --git a/Source/WebCore/html/parser/AtomicHTMLToken.h b/Source/WebCore/html/parser/AtomicHTMLToken.h
new file mode 100644 (file)
index 0000000..6d03721
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2013 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef AtomicHTMLToken_h
+#define AtomicHTMLToken_h
+
+#include "Attribute.h"
+#include "CompactHTMLToken.h"
+#include "HTMLToken.h"
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class AtomicHTMLToken : public RefCounted<AtomicHTMLToken> {
+    WTF_MAKE_NONCOPYABLE(AtomicHTMLToken);
+public:
+    static PassRefPtr<AtomicHTMLToken> create(HTMLToken& token)
+    {
+        return adoptRef(new AtomicHTMLToken(token));
+    }
+
+#if ENABLE(THREADED_HTML_PARSER)
+
+    static PassRefPtr<AtomicHTMLToken> create(const CompactHTMLToken& token)
+    {
+        return adoptRef(new AtomicHTMLToken(token));
+    }
+
+#endif
+
+    static PassRefPtr<AtomicHTMLToken> create(HTMLToken::Type type, const AtomicString& name, const Vector<Attribute>& attributes = Vector<Attribute>())
+    {
+        return adoptRef(new AtomicHTMLToken(type, name, attributes));
+    }
+
+    bool forceQuirks() const
+    {
+        ASSERT(m_type == HTMLToken::DOCTYPE);
+        return m_doctypeData->m_forceQuirks;
+    }
+
+    HTMLToken::Type type() const { return m_type; }
+
+    const AtomicString& name() const
+    {
+        ASSERT(usesName());
+        return m_name;
+    }
+
+    void setName(const AtomicString& name)
+    {
+        ASSERT(usesName());
+        m_name = name;
+    }
+
+    bool selfClosing() const
+    {
+        ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag);
+        return m_selfClosing;
+    }
+
+    Attribute* getAttributeItem(const QualifiedName& attributeName)
+    {
+        ASSERT(usesAttributes());
+        return findAttributeInVector(m_attributes, attributeName);
+    }
+
+    Vector<Attribute>& attributes()
+    {
+        ASSERT(usesAttributes());
+        return m_attributes;
+    }
+
+    const Vector<Attribute>& attributes() const
+    {
+        ASSERT(usesAttributes());
+        return m_attributes;
+    }
+
+    const UChar* characters() const
+    {
+        ASSERT(m_type == HTMLToken::Character);
+        return m_externalCharacters;
+    }
+
+    size_t charactersLength() const
+    {
+        ASSERT(m_type == HTMLToken::Character);
+        return m_externalCharactersLength;
+    }
+
+    bool isAll8BitData() const
+    {
+        return m_isAll8BitData;
+    }
+
+    const String& comment() const
+    {
+        ASSERT(m_type == HTMLToken::Comment);
+        return m_data;
+    }
+
+    // FIXME: Distinguish between a missing public identifer and an empty one.
+    WTF::Vector<UChar>& publicIdentifier() const
+    {
+        ASSERT(m_type == HTMLToken::DOCTYPE);
+        return m_doctypeData->m_publicIdentifier;
+    }
+
+    // FIXME: Distinguish between a missing system identifer and an empty one.
+    WTF::Vector<UChar>& systemIdentifier() const
+    {
+        ASSERT(m_type == HTMLToken::DOCTYPE);
+        return m_doctypeData->m_systemIdentifier;
+    }
+
+    void clearExternalCharacters()
+    {
+        m_externalCharacters = 0;
+        m_externalCharactersLength = 0;
+        m_isAll8BitData = false;
+    }
+
+private:
+    explicit AtomicHTMLToken(HTMLToken& token)
+        : m_type(token.type())
+    {
+        switch (m_type) {
+        case HTMLToken::Uninitialized:
+            ASSERT_NOT_REACHED();
+            break;
+        case HTMLToken::DOCTYPE:
+            m_name = AtomicString(token.nameString());
+            m_doctypeData = token.releaseDoctypeData();
+            break;
+        case HTMLToken::EndOfFile:
+            break;
+        case HTMLToken::StartTag:
+        case HTMLToken::EndTag: {
+            m_selfClosing = token.selfClosing();
+            m_name = AtomicString(token.nameString());
+            initializeAttributes(token.attributes());
+            break;
+        }
+        case HTMLToken::Comment:
+            if (token.isAll8BitData())
+                m_data = String::make8BitFrom16BitSource(token.comment().data(), token.comment().size());
+            else
+                m_data = String(token.comment().data(), token.comment().size());
+            break;
+        case HTMLToken::Character:
+            m_externalCharacters = token.characters().data();
+            m_externalCharactersLength = token.characters().size();
+            m_isAll8BitData = token.isAll8BitData();
+            break;
+        }
+    }
+
+#if ENABLE(THREADED_HTML_PARSER)
+
+    explicit AtomicHTMLToken(const CompactHTMLToken& token)
+        : m_type(token.type())
+    {
+        switch (m_type) {
+        case HTMLToken::Uninitialized:
+            ASSERT_NOT_REACHED();
+            break;
+        case HTMLToken::DOCTYPE:
+            m_name = token.data();
+            m_doctypeData = adoptPtr(new DoctypeData());
+            m_doctypeData->m_hasPublicIdentifier = true;
+            m_doctypeData->m_publicIdentifier.append(token.publicIdentifier().characters(), token.publicIdentifier().length());
+            m_doctypeData->m_hasSystemIdentifier = true;
+            m_doctypeData->m_systemIdentifier.append(token.systemIdentifier().characters(), token.systemIdentifier().length());
+            m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks();
+            break;
+        case HTMLToken::EndOfFile:
+            break;
+        case HTMLToken::StartTag:
+            m_attributes.reserveInitialCapacity(token.attributes().size());
+            for (Vector<CompactAttribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it)
+                m_attributes.append(Attribute(QualifiedName(nullAtom, it->name(), nullAtom), it->value()));
+            // Fall through!
+        case HTMLToken::EndTag:
+            m_selfClosing = token.selfClosing();
+            m_name = AtomicString(token.data());
+            break;
+        case HTMLToken::Comment:
+            m_data = token.data();
+            break;
+        case HTMLToken::Character:
+            m_externalCharacters = token.data().characters();
+            m_externalCharactersLength = token.data().length();
+            m_isAll8BitData = token.isAll8BitData();
+            break;
+        }
+    }
+
+#endif
+
+    explicit AtomicHTMLToken(HTMLToken::Type type)
+        : m_type(type)
+        , m_externalCharacters(0)
+        , m_externalCharactersLength(0)
+        , m_isAll8BitData(false)
+        , m_selfClosing(false)
+    {
+    }
+
+    AtomicHTMLToken(HTMLToken::Type type, const AtomicString& name, const Vector<Attribute>& attributes = Vector<Attribute>())
+        : m_type(type)
+        , m_name(name)
+        , m_externalCharacters(0)
+        , m_externalCharactersLength(0)
+        , m_isAll8BitData(false)
+        , m_selfClosing(false)
+        , m_attributes(attributes)
+    {
+        ASSERT(usesName());
+    }
+
+    HTMLToken::Type m_type;
+
+    void initializeAttributes(const HTMLToken::AttributeList& attributes);
+    QualifiedName nameForAttribute(const HTMLToken::Attribute&) const;
+
+    bool usesName() const;
+
+    bool usesAttributes() const;
+
+    // "name" for DOCTYPE, StartTag, and EndTag
+    AtomicString m_name;
+
+    // "data" for Comment
+    String m_data;
+
+    // "characters" for Character
+    //
+    // We don't want to copy the the characters out of the Token, so we
+    // keep a pointer to its buffer instead. This buffer is owned by the
+    // Token and causes a lifetime dependence between these objects.
+    //
+    // FIXME: Add a mechanism for "internalizing" the characters when the
+    //        HTMLToken is destructed.
+    const UChar* m_externalCharacters;
+    size_t m_externalCharactersLength;
+    bool m_isAll8BitData;
+
+    // For DOCTYPE
+    OwnPtr<DoctypeData> m_doctypeData;
+
+    // For StartTag and EndTag
+    bool m_selfClosing;
+
+    Vector<Attribute> m_attributes;
+};
+
+inline void AtomicHTMLToken::initializeAttributes(const HTMLToken::AttributeList& attributes)
+{
+    size_t size = attributes.size();
+    if (!size)
+        return;
+
+    m_attributes.clear();
+    m_attributes.reserveInitialCapacity(size);
+    for (size_t i = 0; i < size; ++i) {
+        const HTMLToken::Attribute& attribute = attributes[i];
+        if (attribute.m_name.isEmpty())
+            continue;
+
+        // FIXME: We should be able to add the following ASSERT once we fix
+        // https://bugs.webkit.org/show_bug.cgi?id=62971
+        //   ASSERT(attribute.m_nameRange.m_start);
+        ASSERT(attribute.m_nameRange.m_end);
+        ASSERT(attribute.m_valueRange.m_start);
+        ASSERT(attribute.m_valueRange.m_end);
+
+        AtomicString value(attribute.m_value.data(), attribute.m_value.size());
+        const QualifiedName& name = nameForAttribute(attribute);
+        if (!findAttributeInVector(m_attributes, name))
+            m_attributes.append(Attribute(name, value));
+    }
+}
+
+}
+
+#endif
index 8675db0..5781a38 100644 (file)
@@ -113,7 +113,7 @@ void BackgroundHTMLParser::markEndOfFile()
 
 bool BackgroundHTMLParser::simulateTreeBuilder(const CompactHTMLToken& token)
 {
-    if (token.type() == HTMLTokenTypes::StartTag) {
+    if (token.type() == HTMLToken::StartTag) {
         const String& tagName = token.data();
         if (threadSafeMatch(tagName, SVGNames::svgTag)
             || threadSafeMatch(tagName, MathMLNames::mathTag))
@@ -135,7 +135,7 @@ bool BackgroundHTMLParser::simulateTreeBuilder(const CompactHTMLToken& token)
             m_tokenizer->setState(HTMLTokenizer::RAWTEXTState);
     }
 
-    if (token.type() == HTMLTokenTypes::EndTag) {
+    if (token.type() == HTMLToken::EndTag) {
         const String& tagName = token.data();
         if (threadSafeMatch(tagName, SVGNames::svgTag) || threadSafeMatch(tagName, MathMLNames::mathTag))
             m_inForeignContent = false;
index 92e6134..1689132 100644 (file)
@@ -51,10 +51,10 @@ CompactHTMLToken::CompactHTMLToken(const HTMLToken* token, const TextPosition& t
     , m_textPosition(textPosition)
 {
     switch (m_type) {
-    case HTMLTokenTypes::Uninitialized:
+    case HTMLToken::Uninitialized:
         ASSERT_NOT_REACHED();
         break;
-    case HTMLTokenTypes::DOCTYPE: {
+    case HTMLToken::DOCTYPE: {
         m_data = String(token->name().data(), token->name().size());
         // There is only 1 DOCTYPE token per document, so to avoid increasing the
         // size of CompactHTMLToken, we just use the m_attributes vector.
@@ -64,18 +64,18 @@ CompactHTMLToken::CompactHTMLToken(const HTMLToken* token, const TextPosition& t
         m_doctypeForcesQuirks = token->forceQuirks();
         break;
     }
-    case HTMLTokenTypes::EndOfFile:
+    case HTMLToken::EndOfFile:
         break;
-    case HTMLTokenTypes::StartTag:
+    case HTMLToken::StartTag:
         m_attributes.reserveInitialCapacity(token->attributes().size());
         for (Vector<HTMLToken::Attribute>::const_iterator it = token->attributes().begin(); it != token->attributes().end(); ++it)
             m_attributes.append(CompactAttribute(String(it->m_name.data(), it->m_name.size()), String(it->m_value.data(), it->m_value.size())));
         // Fall through!
-    case HTMLTokenTypes::EndTag:
+    case HTMLToken::EndTag:
         m_selfClosing = token->selfClosing();
         // Fall through!
-    case HTMLTokenTypes::Comment:
-    case HTMLTokenTypes::Character:
+    case HTMLToken::Comment:
+    case HTMLToken::Character:
         if (token->isAll8BitData()) {
             m_data = String::make8BitFrom16BitSource(token->data().data(), token->data().size());
             m_isAll8BitData = true;
index 6c95f6a..b7c8569 100644 (file)
@@ -28,7 +28,7 @@
 
 #if ENABLE(THREADED_HTML_PARSER)
 
-#include "HTMLTokenTypes.h"
+#include "HTMLToken.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
@@ -39,7 +39,6 @@
 
 namespace WebCore {
 
-class HTMLToken;
 class XSSInfo;
 
 class CompactAttribute {
@@ -65,7 +64,7 @@ public:
 
     bool isSafeToSendToAnotherThread() const;
 
-    HTMLTokenTypes::Type type() const { return static_cast<HTMLTokenTypes::Type>(m_type); }
+    HTMLToken::Type type() const { return static_cast<HTMLToken::Type>(m_type); }
     const String& data() const { return m_data; }
     bool selfClosing() const { return m_selfClosing; }
     bool isAll8BitData() const { return m_isAll8BitData; }
index 51ed32e..be1c535 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "HTMLTreeBuilder.h"
 
+#include "AtomicHTMLToken.h"
 #include "Comment.h"
 #include "DocumentFragment.h"
 #include "DocumentType.h"
@@ -340,7 +341,7 @@ void HTMLConstructionSite::finishedParsing()
 
 void HTMLConstructionSite::insertDoctype(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::DOCTYPE);
+    ASSERT(token->type() == HTMLToken::DOCTYPE);
 
     const String& publicId = String::adopt(token->publicIdentifier());
     const String& systemId = String::adopt(token->systemIdentifier());
@@ -365,19 +366,19 @@ void HTMLConstructionSite::insertDoctype(AtomicHTMLToken* token)
 
 void HTMLConstructionSite::insertComment(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::Comment);
+    ASSERT(token->type() == HTMLToken::Comment);
     attachLater(currentNode(), Comment::create(ownerDocumentForCurrentNode(), token->comment()));
 }
 
 void HTMLConstructionSite::insertCommentOnDocument(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::Comment);
+    ASSERT(token->type() == HTMLToken::Comment);
     attachLater(m_attachmentRoot, Comment::create(m_document, token->comment()));
 }
 
 void HTMLConstructionSite::insertCommentOnHTMLHtmlElement(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::Comment);
+    ASSERT(token->type() == HTMLToken::Comment);
     ContainerNode* parent = m_openElements.rootNode();
     attachLater(parent, Comment::create(parent->document(), token->comment()));
 }
@@ -419,7 +420,7 @@ void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token)
 
 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     // Normally HTMLElementStack is responsible for calling finishParsingChildren,
     // but self-closing elements are never in the element stack so the stack
     // doesn't get a chance to tell them that we're done parsing their children.
@@ -455,7 +456,7 @@ void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token)
 
 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const AtomicString& namespaceURI)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     notImplemented(); // parseError when xmlns or xmlns:xlink are wrong.
 
     RefPtr<Element> element = createElement(token, namespaceURI);
index 098548e..64850cd 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "HTMLDocumentParser.h"
 
+#include "AtomicHTMLToken.h"
 #include "BackgroundHTMLParser.h"
 #include "CompactHTMLToken.h"
 #include "ContentSecurityPolicy.h"
@@ -348,7 +349,7 @@ void HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Parse
             break;
         }
 
-        if (it->type() == HTMLTokenTypes::EndOfFile) {
+        if (it->type() == HTMLToken::EndOfFile) {
             ASSERT(it + 1 == tokens->end()); // The EOF is assumed to be the last token of this bunch.
             prepareToStopParsing();
             break;
@@ -463,7 +464,7 @@ void HTMLDocumentParser::constructTreeFromHTMLToken(HTMLToken& rawToken)
     // FIXME: Stop clearing the rawToken once we start running the parser off
     // the main thread or once we stop allowing synchronous JavaScript
     // execution from parseAttribute.
-    if (rawToken.type() != HTMLTokenTypes::Character)
+    if (rawToken.type() != HTMLToken::Character)
         rawToken.clear();
 
     m_treeBuilder->constructTree(token.get());
@@ -475,7 +476,7 @@ void HTMLDocumentParser::constructTreeFromHTMLToken(HTMLToken& rawToken)
     token->clearExternalCharacters();
 
     if (!rawToken.isUninitialized()) {
-        ASSERT(rawToken.type() == HTMLTokenTypes::Character);
+        ASSERT(rawToken.type() == HTMLToken::Character);
         rawToken.clear();
     }
 }
index 0207cc9..74289bb 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "BackgroundHTMLInputStream.h"
 #include "CachedResourceClient.h"
+#include "CompactHTMLToken.h"
 #include "FragmentScriptingPermission.h"
 #include "HTMLInputStream.h"
 #include "HTMLParserOptions.h"
index 586ffa9..70ccd58 100644 (file)
@@ -176,8 +176,8 @@ bool HTMLMetaCharsetParser::checkForMetaCharset(const char* data, size_t length)
     m_input.append(SegmentedString(m_assumedCodec->decode(data, length)));
 
     while (m_tokenizer->nextToken(m_input, m_token)) {
-        bool end = m_token.type() == HTMLTokenTypes::EndTag;
-        if (end || m_token.type() == HTMLTokenTypes::StartTag) {
+        bool end = m_token.type() == HTMLToken::EndTag;
+        if (end || m_token.type() == HTMLToken::StartTag) {
             AtomicString tagName(m_token.name().data(), m_token.name().size());
             if (!end) {
                 m_tokenizer->updateStateFor(tagName);
index 3d78889..0c7ca33 100644 (file)
@@ -45,12 +45,12 @@ using namespace HTMLNames;
 
 static bool isStartTag(const HTMLToken& token)
 {
-    return token.type() == HTMLTokenTypes::StartTag;
+    return token.type() == HTMLToken::StartTag;
 }
 
 static bool isStartOrEndTag(const HTMLToken& token)
 {
-    return token.type() == HTMLTokenTypes::EndTag || isStartTag(token);
+    return token.type() == HTMLToken::EndTag || isStartTag(token);
 }
 
 class StartTagScanner {
@@ -279,7 +279,7 @@ void HTMLPreloadScanner::processToken(const HTMLToken& token, Vector<OwnPtr<Prel
 {
     // <style> is the only place we search for urls in non-start/end-tag tokens.
     if (m_inStyle) {
-        if (token.type() != HTMLTokenTypes::Character)
+        if (token.type() != HTMLToken::Character)
             return;
         return m_cssScanner.scan(token, requests);
     }
index 89885c3..bf1a8c4 100644 (file)
@@ -36,7 +36,7 @@ HTMLSourceTracker::HTMLSourceTracker()
 
 void HTMLSourceTracker::start(SegmentedString& currentInput, HTMLTokenizer* tokenizer, HTMLToken& token)
 {
-    if (token.type() == HTMLTokenTypes::Uninitialized) {
+    if (token.type() == HTMLToken::Uninitialized) {
         m_previousSource.clear();
         if (tokenizer->numberOfBufferedCharacters())
             m_previousSource = tokenizer->bufferedCharacters();
@@ -57,7 +57,7 @@ void HTMLSourceTracker::end(SegmentedString& currentInput, HTMLTokenizer* tokeni
 
 String HTMLSourceTracker::sourceForToken(const HTMLToken& token)
 {
-    if (token.type() == HTMLTokenTypes::EndOfFile)
+    if (token.type() == HTMLToken::EndOfFile)
         return String(); // Hides the null character we use to mark the end of file.
 
     if (!m_cachedSourceForToken.isEmpty())
index 8a19cd3..1c2eb49 100644 (file)
@@ -26,9 +26,9 @@
 #ifndef HTMLStackItem_h
 #define HTMLStackItem_h
 
+#include "AtomicHTMLToken.h"
 #include "Element.h"
 #include "HTMLNames.h"
-#include "HTMLToken.h"
 #include "MathMLNames.h"
 #include "SVGNames.h"
 
@@ -208,12 +208,12 @@ private:
             // Create a fake token for a document fragment node. This looks ugly but required for performance
             // because we want to use m_token->name() in localName(), hasLocalName() and hasTagName() without
             // checking m_isDocumentFragmentNode flag.
-            m_token = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, nullAtom);
+            m_token = AtomicHTMLToken::create(HTMLToken::StartTag, nullAtom);
             m_isDocumentFragmentNode = true;
             break;
         case ItemForContextElement:
             // Create a fake token for a context element for the same reason as above.
-            m_token = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, m_node->localName());
+            m_token = AtomicHTMLToken::create(HTMLToken::StartTag, m_node->localName());
             m_namespaceURI = m_node->namespaceURI();
             m_isDocumentFragmentNode = false;
             break;
index bfbde20..ce514a1 100644 (file)
@@ -27,8 +27,7 @@
 #define HTMLToken_h
 
 #include "Attribute.h"
-#include "CompactHTMLToken.h"
-#include "HTMLTokenTypes.h"
+#include "HTMLToken.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
@@ -65,7 +64,15 @@ class HTMLToken {
     WTF_MAKE_NONCOPYABLE(HTMLToken);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    typedef HTMLTokenTypes Type;
+    enum Type {
+        Uninitialized,
+        DOCTYPE,
+        StartTag,
+        EndTag,
+        Comment,
+        Character,
+        EndOfFile,
+    };
 
     class Attribute {
     public:
@@ -88,7 +95,7 @@ public:
 
     void clear()
     {
-        m_type = Type::Uninitialized;
+        m_type = Uninitialized;
         m_range.m_start = 0;
         m_range.m_end = 0;
         m_baseOffset = 0;
@@ -96,13 +103,13 @@ public:
         m_orAllData = 0;
     }
 
-    bool isUninitialized() { return m_type == HTMLTokenTypes::Uninitialized; }
-    HTMLTokenTypes::Type type() const { return m_type; }
+    bool isUninitialized() { return m_type == Uninitialized; }
+    Type type() const { return m_type; }
 
     void makeEndOfFile()
     {
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized);
-        m_type = HTMLTokenTypes::EndOfFile;
+        ASSERT(m_type == Uninitialized);
+        m_type = EndOfFile;
     }
 
     /* Range and offset methods exposed for HTMLSourceTracker and HTMLViewSourceParser */
@@ -121,7 +128,7 @@ public:
 
     const DataVector& data() const
     {
-        ASSERT(m_type == HTMLTokenTypes::Character || m_type == HTMLTokenTypes::Comment || m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == Character || m_type == Comment || m_type == StartTag || m_type == EndTag);
         return m_data;
     }
 
@@ -132,13 +139,13 @@ public:
 
     const DataVector& name() const
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
         return m_data;
     }
 
     void appendToName(UChar character)
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
         ASSERT(character);
         m_data.append(character);
         m_orAllData |= character;
@@ -158,20 +165,20 @@ public:
 
     bool forceQuirks() const
     {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         return m_doctypeData->m_forceQuirks;
     }
 
     void setForceQuirks()
     {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         m_doctypeData->m_forceQuirks = true;
     }
 
     void beginDOCTYPE()
     {
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized);
-        m_type = HTMLTokenTypes::DOCTYPE;
+        ASSERT(m_type == Uninitialized);
+        m_type = DOCTYPE;
         m_doctypeData = adoptPtr(new DoctypeData);
     }
 
@@ -186,27 +193,27 @@ public:
     // FIXME: Distinguish between a missing public identifer and an empty one.
     const WTF::Vector<UChar>& publicIdentifier() const
     {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         return m_doctypeData->m_publicIdentifier;
     }
 
     // FIXME: Distinguish between a missing system identifer and an empty one.
     const WTF::Vector<UChar>& systemIdentifier() const
     {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         return m_doctypeData->m_systemIdentifier;
     }
 
     void setPublicIdentifierToEmptyString()
     {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         m_doctypeData->m_hasPublicIdentifier = true;
         m_doctypeData->m_publicIdentifier.clear();
     }
 
     void setSystemIdentifierToEmptyString()
     {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         m_doctypeData->m_hasSystemIdentifier = true;
         m_doctypeData->m_systemIdentifier.clear();
     }
@@ -214,7 +221,7 @@ public:
     void appendToPublicIdentifier(UChar character)
     {
         ASSERT(character);
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         ASSERT(m_doctypeData->m_hasPublicIdentifier);
         m_doctypeData->m_publicIdentifier.append(character);
     }
@@ -222,7 +229,7 @@ public:
     void appendToSystemIdentifier(UChar character)
     {
         ASSERT(character);
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
+        ASSERT(m_type == DOCTYPE);
         ASSERT(m_doctypeData->m_hasSystemIdentifier);
         m_doctypeData->m_systemIdentifier.append(character);
     }
@@ -236,21 +243,21 @@ public:
 
     bool selfClosing() const
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         return m_selfClosing;
     }
 
     void setSelfClosing()
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         m_selfClosing = true;
     }
 
     void beginStartTag(UChar character)
     {
         ASSERT(character);
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized);
-        m_type = HTMLTokenTypes::StartTag;
+        ASSERT(m_type == Uninitialized);
+        m_type = StartTag;
         m_selfClosing = false;
         m_currentAttribute = 0;
         m_attributes.clear();
@@ -261,8 +268,8 @@ public:
 
     void beginEndTag(LChar character)
     {
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized);
-        m_type = HTMLTokenTypes::EndTag;
+        ASSERT(m_type == Uninitialized);
+        m_type = EndTag;
         m_selfClosing = false;
         m_currentAttribute = 0;
         m_attributes.clear();
@@ -272,8 +279,8 @@ public:
 
     void beginEndTag(const Vector<LChar, 32>& characters)
     {
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized);
-        m_type = HTMLTokenTypes::EndTag;
+        ASSERT(m_type == Uninitialized);
+        m_type = EndTag;
         m_selfClosing = false;
         m_currentAttribute = 0;
         m_attributes.clear();
@@ -283,7 +290,7 @@ public:
 
     void addNewAttribute()
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         m_attributes.grow(m_attributes.size() + 1);
         m_currentAttribute = &m_attributes.last();
 #ifndef NDEBUG
@@ -323,7 +330,7 @@ public:
     void appendToAttributeName(UChar character)
     {
         ASSERT(character);
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         // FIXME: We should be able to add the following ASSERT once we fix
         // https://bugs.webkit.org/show_bug.cgi?id=62971
         //   ASSERT(m_currentAttribute->m_nameRange.m_start);
@@ -333,7 +340,7 @@ public:
     void appendToAttributeValue(UChar character)
     {
         ASSERT(character);
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         ASSERT(m_currentAttribute->m_valueRange.m_start);
         m_currentAttribute->m_value.append(character);
     }
@@ -341,20 +348,20 @@ public:
     void appendToAttributeValue(size_t i, const String& value)
     {
         ASSERT(!value.isEmpty());
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         m_attributes[i].m_value.append(value.characters(), value.length());
     }
 
     const AttributeList& attributes() const
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         return m_attributes;
     }
 
     // Used by the XSSAuditor to nuke XSS-laden attributes.
     void eraseValueOfAttribute(size_t i)
     {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
+        ASSERT(m_type == StartTag || m_type == EndTag);
         m_attributes[i].m_value.clear();
     }
 
@@ -364,32 +371,32 @@ public:
     // other types of tokens because we want to save a per-character branch.
     void ensureIsCharacterToken()
     {
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized || m_type == HTMLTokenTypes::Character);
-        m_type = HTMLTokenTypes::Character;
+        ASSERT(m_type == Uninitialized || m_type == Character);
+        m_type = Character;
     }
 
     const DataVector& characters() const
     {
-        ASSERT(m_type == HTMLTokenTypes::Character);
+        ASSERT(m_type == Character);
         return m_data;
     }
 
     void appendToCharacter(char character)
     {
-        ASSERT(m_type == HTMLTokenTypes::Character);
+        ASSERT(m_type == Character);
         m_data.append(character);
     }
 
     void appendToCharacter(UChar character)
     {
-        ASSERT(m_type == HTMLTokenTypes::Character);
+        ASSERT(m_type == Character);
         m_data.append(character);
         m_orAllData |= character;
     }
 
     void appendToCharacter(const Vector<LChar, 32>& characters)
     {
-        ASSERT(m_type == HTMLTokenTypes::Character);
+        ASSERT(m_type == Character);
         m_data.appendVector(characters);
     }
 
@@ -397,33 +404,33 @@ public:
 
     const DataVector& comment() const
     {
-        ASSERT(m_type == HTMLTokenTypes::Comment);
+        ASSERT(m_type == Comment);
         return m_data;
     }
 
     void beginComment()
     {
-        ASSERT(m_type == HTMLTokenTypes::Uninitialized);
-        m_type = HTMLTokenTypes::Comment;
+        ASSERT(m_type == Uninitialized);
+        m_type = Comment;
     }
 
     void appendToComment(UChar character)
     {
         ASSERT(character);
-        ASSERT(m_type == HTMLTokenTypes::Comment);
+        ASSERT(m_type == Comment);
         m_data.append(character);
         m_orAllData |= character;
     }
 
     void eraseCharacters()
     {
-        ASSERT(m_type == HTMLTokenTypes::Character);
+        ASSERT(m_type == Character);
         m_data.clear();
         m_orAllData = 0;
     }
 
 private:
-    HTMLTokenTypes::Type m_type;
+    Type m_type;
     Attribute::Range m_range; // Always starts at zero.
     int m_baseOffset;
     DataVector m_data;
@@ -440,281 +447,6 @@ private:
     OwnPtr<DoctypeData> m_doctypeData;
 };
 
-class AtomicHTMLToken : public RefCounted<AtomicHTMLToken> {
-    WTF_MAKE_NONCOPYABLE(AtomicHTMLToken);
-public:
-    static PassRefPtr<AtomicHTMLToken> create(HTMLToken& token)
-    {
-        return adoptRef(new AtomicHTMLToken(token));
-    }
-
-#if ENABLE(THREADED_HTML_PARSER)
-
-    static PassRefPtr<AtomicHTMLToken> create(const CompactHTMLToken& token)
-    {
-        return adoptRef(new AtomicHTMLToken(token));
-    }
-
-#endif
-
-    static PassRefPtr<AtomicHTMLToken> create(HTMLTokenTypes::Type type, const AtomicString& name, const Vector<Attribute>& attributes = Vector<Attribute>())
-    {
-        return adoptRef(new AtomicHTMLToken(type, name, attributes));
-    }
-
-    bool forceQuirks() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
-        return m_doctypeData->m_forceQuirks;
-    }
-
-    HTMLTokenTypes::Type type() const { return m_type; }
-
-    const AtomicString& name() const
-    {
-        ASSERT(usesName());
-        return m_name;
-    }
-
-    void setName(const AtomicString& name)
-    {
-        ASSERT(usesName());
-        m_name = name;
-    }
-
-    bool selfClosing() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag);
-        return m_selfClosing;
-    }
-
-    Attribute* getAttributeItem(const QualifiedName& attributeName)
-    {
-        ASSERT(usesAttributes());
-        return findAttributeInVector(m_attributes, attributeName);
-    }
-
-    Vector<Attribute>& attributes()
-    {
-        ASSERT(usesAttributes());
-        return m_attributes;
-    }
-
-    const Vector<Attribute>& attributes() const
-    {
-        ASSERT(usesAttributes());
-        return m_attributes;
-    }
-
-    const UChar* characters() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::Character);
-        return m_externalCharacters;
-    }
-
-    size_t charactersLength() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::Character);
-        return m_externalCharactersLength;
-    }
-
-    bool isAll8BitData() const
-    {
-        return m_isAll8BitData;
-    }
-
-    const String& comment() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::Comment);
-        return m_data;
-    }
-
-    // FIXME: Distinguish between a missing public identifer and an empty one.
-    WTF::Vector<UChar>& publicIdentifier() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
-        return m_doctypeData->m_publicIdentifier;
-    }
-
-    // FIXME: Distinguish between a missing system identifer and an empty one.
-    WTF::Vector<UChar>& systemIdentifier() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
-        return m_doctypeData->m_systemIdentifier;
-    }
-
-    void clearExternalCharacters()
-    {
-        m_externalCharacters = 0;
-        m_externalCharactersLength = 0;
-        m_isAll8BitData = false;
-    }
-
-private:
-    explicit AtomicHTMLToken(HTMLToken& token)
-        : m_type(token.type())
-    {
-        switch (m_type) {
-        case HTMLTokenTypes::Uninitialized:
-            ASSERT_NOT_REACHED();
-            break;
-        case HTMLTokenTypes::DOCTYPE:
-            m_name = AtomicString(token.nameString());
-            m_doctypeData = token.releaseDoctypeData();
-            break;
-        case HTMLTokenTypes::EndOfFile:
-            break;
-        case HTMLTokenTypes::StartTag:
-        case HTMLTokenTypes::EndTag: {
-            m_selfClosing = token.selfClosing();
-            m_name = AtomicString(token.nameString());
-            initializeAttributes(token.attributes());
-            break;
-        }
-        case HTMLTokenTypes::Comment:
-            if (token.isAll8BitData())
-                m_data = String::make8BitFrom16BitSource(token.comment().data(), token.comment().size());
-            else
-                m_data = String(token.comment().data(), token.comment().size());
-            break;
-        case HTMLTokenTypes::Character:
-            m_externalCharacters = token.characters().data();
-            m_externalCharactersLength = token.characters().size();
-            m_isAll8BitData = token.isAll8BitData();
-            break;
-        default:
-            break;
-        }
-    }
-
-#if ENABLE(THREADED_HTML_PARSER)
-
-    explicit AtomicHTMLToken(const CompactHTMLToken& token)
-        : m_type(token.type())
-    {
-        switch (m_type) {
-        case HTMLTokenTypes::Uninitialized:
-            ASSERT_NOT_REACHED();
-            break;
-        case HTMLTokenTypes::DOCTYPE:
-            m_name = token.data();
-            m_doctypeData = adoptPtr(new DoctypeData());
-            m_doctypeData->m_hasPublicIdentifier = true;
-            m_doctypeData->m_publicIdentifier.append(token.publicIdentifier().characters(), token.publicIdentifier().length());
-            m_doctypeData->m_hasSystemIdentifier = true;
-            m_doctypeData->m_systemIdentifier.append(token.systemIdentifier().characters(), token.systemIdentifier().length());
-            m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks();
-            break;
-        case HTMLTokenTypes::EndOfFile:
-            break;
-        case HTMLTokenTypes::StartTag:
-            m_attributes.reserveInitialCapacity(token.attributes().size());
-            for (Vector<CompactAttribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it)
-                m_attributes.append(Attribute(QualifiedName(nullAtom, it->name(), nullAtom), it->value()));
-            // Fall through!
-        case HTMLTokenTypes::EndTag:
-            m_selfClosing = token.selfClosing();
-            m_name = AtomicString(token.data());
-            break;
-        case HTMLTokenTypes::Comment:
-            m_data = token.data();
-            break;
-        case HTMLTokenTypes::Character:
-            m_externalCharacters = token.data().characters();
-            m_externalCharactersLength = token.data().length();
-            m_isAll8BitData = token.isAll8BitData();
-            break;
-        default:
-            break;
-        }
-    }
-
-#endif
-
-    explicit AtomicHTMLToken(HTMLTokenTypes::Type type)
-        : m_type(type)
-        , m_externalCharacters(0)
-        , m_externalCharactersLength(0)
-        , m_isAll8BitData(false)
-        , m_selfClosing(false)
-    {
-    }
-
-    AtomicHTMLToken(HTMLTokenTypes::Type type, const AtomicString& name, const Vector<Attribute>& attributes = Vector<Attribute>())
-        : m_type(type)
-        , m_name(name)
-        , m_externalCharacters(0)
-        , m_externalCharactersLength(0)
-        , m_isAll8BitData(false)
-        , m_selfClosing(false)
-        , m_attributes(attributes)
-    {
-        ASSERT(usesName());
-    }
-
-    HTMLTokenTypes::Type m_type;
-
-    void initializeAttributes(const HTMLToken::AttributeList& attributes);
-    QualifiedName nameForAttribute(const HTMLToken::Attribute&) const;
-
-    bool usesName() const;
-
-    bool usesAttributes() const;
-
-    // "name" for DOCTYPE, StartTag, and EndTag
-    AtomicString m_name;
-
-    // "data" for Comment
-    String m_data;
-
-    // "characters" for Character
-    //
-    // We don't want to copy the the characters out of the Token, so we
-    // keep a pointer to its buffer instead. This buffer is owned by the
-    // Token and causes a lifetime dependence between these objects.
-    //
-    // FIXME: Add a mechanism for "internalizing" the characters when the
-    //        HTMLToken is destructed.
-    const UChar* m_externalCharacters;
-    size_t m_externalCharactersLength;
-    bool m_isAll8BitData;
-
-    // For DOCTYPE
-    OwnPtr<DoctypeData> m_doctypeData;
-
-    // For StartTag and EndTag
-    bool m_selfClosing;
-
-    Vector<Attribute> m_attributes;
-};
-
-inline void AtomicHTMLToken::initializeAttributes(const HTMLToken::AttributeList& attributes)
-{
-    size_t size = attributes.size();
-    if (!size)
-        return;
-
-    m_attributes.clear();
-    m_attributes.reserveInitialCapacity(size);
-    for (size_t i = 0; i < size; ++i) {
-        const HTMLToken::Attribute& attribute = attributes[i];
-        if (attribute.m_name.isEmpty())
-            continue;
-
-        // FIXME: We should be able to add the following ASSERT once we fix
-        // https://bugs.webkit.org/show_bug.cgi?id=62971
-        //   ASSERT(attribute.m_nameRange.m_start);
-        ASSERT(attribute.m_nameRange.m_end);
-        ASSERT(attribute.m_valueRange.m_start);
-        ASSERT(attribute.m_valueRange.m_end);
-
-        AtomicString value(attribute.m_value.data(), attribute.m_value.size());
-        const QualifiedName& name = nameForAttribute(attribute);
-        if (!findAttributeInVector(m_attributes, name))
-            m_attributes.append(Attribute(name, value));
-    }
-}
-
 }
 
 #endif
diff --git a/Source/WebCore/html/parser/HTMLTokenTypes.h b/Source/WebCore/html/parser/HTMLTokenTypes.h
deleted file mode 100644 (file)
index 40b2435..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 Google, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef HTMLTokenTypes_h
-#define HTMLTokenTypes_h
-
-namespace WebCore {
-
-class HTMLTokenTypes {
-public:
-    enum Type {
-        Uninitialized,
-        DOCTYPE,
-        StartTag,
-        EndTag,
-        Comment,
-        Character,
-        EndOfFile,
-    };
-};
-
-}
-
-#endif
index 109389d..f0adfe3 100644 (file)
@@ -56,12 +56,12 @@ QualifiedName AtomicHTMLToken::nameForAttribute(const HTMLToken::Attribute& attr
 
 bool AtomicHTMLToken::usesName() const
 {
-    return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE;
+    return m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag || m_type == HTMLToken::DOCTYPE;
 }
 
 bool AtomicHTMLToken::usesAttributes() const
 {
-    return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag;
+    return m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag;
 }
 
 static inline UChar toLowerCase(UChar cc)
@@ -178,9 +178,9 @@ inline bool HTMLTokenizer::processEntity(SegmentedString& source)
 
 bool HTMLTokenizer::flushBufferedEndTag(SegmentedString& source)
 {
-    ASSERT(m_token->type() == HTMLTokenTypes::Character || m_token->type() == HTMLTokenTypes::Uninitialized);
+    ASSERT(m_token->type() == HTMLToken::Character || m_token->type() == HTMLToken::Uninitialized);
     source.advanceAndUpdateLineNumber();
-    if (m_token->type() == HTMLTokenTypes::Character)
+    if (m_token->type() == HTMLToken::Character)
         return true;
     m_token->beginEndTag(m_bufferedEndTagName);
     m_bufferedEndTagName.clear();
@@ -212,7 +212,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
 {
     // If we have a token in progress, then we're supposed to be called back
     // with the same token so we can finish it.
-    ASSERT(!m_token || m_token == &token || token.type() == HTMLTokenTypes::Uninitialized);
+    ASSERT(!m_token || m_token == &token || token.type() == HTMLToken::Uninitialized);
     m_token = &token;
 
     if (!m_bufferedEndTagName.isEmpty() && !isEndTagBufferingState(m_state)) {
@@ -238,7 +238,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
         if (cc == '&')
             HTML_ADVANCE_TO(CharacterReferenceInDataState);
         else if (cc == '<') {
-            if (m_token->type() == HTMLTokenTypes::Character) {
+            if (m_token->type() == HTMLToken::Character) {
                 // We have a bunch of character tokens queued up that we
                 // are emitting lazily here.
                 return true;
index 33f3859..8a43d60 100644 (file)
@@ -253,8 +253,8 @@ private:
 
     inline void saveEndTagNameIfNeeded()
     {
-        ASSERT(m_token->type() != HTMLTokenTypes::Uninitialized);
-        if (m_token->type() == HTMLTokenTypes::StartTag)
+        ASSERT(m_token->type() != HTMLToken::Uninitialized);
+        if (m_token->type() == HTMLToken::StartTag)
             m_appropriateEndTagName = m_token->name();
     }
     inline bool isAppropriateEndTag();
@@ -262,7 +262,7 @@ private:
 
     inline bool haveBufferedCharacterToken()
     {
-        return m_token->type() == HTMLToken::Type::Character;
+        return m_token->type() == HTMLToken::Character;
     }
 
     State m_state;
index 1b5183d..798f05e 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "HTMLTreeBuilder.h"
 
+#include "AtomicHTMLToken.h"
 #include "DocumentFragment.h"
 #include "HTMLDocument.h"
 #include "HTMLDocumentParser.h"
@@ -384,29 +385,29 @@ void HTMLTreeBuilder::constructTree(AtomicHTMLToken* token)
 void HTMLTreeBuilder::processToken(AtomicHTMLToken* token)
 {
     switch (token->type()) {
-    case HTMLTokenTypes::Uninitialized:
+    case HTMLToken::Uninitialized:
         ASSERT_NOT_REACHED();
         break;
-    case HTMLTokenTypes::DOCTYPE:
+    case HTMLToken::DOCTYPE:
         m_shouldSkipLeadingNewline = false;
         processDoctypeToken(token);
         break;
-    case HTMLTokenTypes::StartTag:
+    case HTMLToken::StartTag:
         m_shouldSkipLeadingNewline = false;
         processStartTag(token);
         break;
-    case HTMLTokenTypes::EndTag:
+    case HTMLToken::EndTag:
         m_shouldSkipLeadingNewline = false;
         processEndTag(token);
         break;
-    case HTMLTokenTypes::Comment:
+    case HTMLToken::Comment:
         m_shouldSkipLeadingNewline = false;
         processComment(token);
         return;
-    case HTMLTokenTypes::Character:
+    case HTMLToken::Character:
         processCharacter(token);
         break;
-    case HTMLTokenTypes::EndOfFile:
+    case HTMLToken::EndOfFile:
         m_shouldSkipLeadingNewline = false;
         processEndOfFile(token);
         break;
@@ -415,7 +416,7 @@ void HTMLTreeBuilder::processToken(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processDoctypeToken(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::DOCTYPE);
+    ASSERT(token->type() == HTMLToken::DOCTYPE);
     if (m_insertionMode == InitialMode) {
         m_tree.insertDoctype(token);
         setInsertionMode(BeforeHTMLMode);
@@ -432,13 +433,13 @@ void HTMLTreeBuilder::processDoctypeToken(AtomicHTMLToken* token)
 void HTMLTreeBuilder::processFakeStartTag(const QualifiedName& tagName, const Vector<Attribute>& attributes)
 {
     // FIXME: We'll need a fancier conversion than just "localName" for SVG/MathML tags.
-    RefPtr<AtomicHTMLToken> fakeToken = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, tagName.localName(), attributes);
+    RefPtr<AtomicHTMLToken> fakeToken = AtomicHTMLToken::create(HTMLToken::StartTag, tagName.localName(), attributes);
     processStartTag(fakeToken.get());
 }
 
 void HTMLTreeBuilder::processFakeEndTag(const AtomicString& tagName)
 {
-    RefPtr<AtomicHTMLToken> fakeToken = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, tagName);
+    RefPtr<AtomicHTMLToken> fakeToken = AtomicHTMLToken::create(HTMLToken::EndTag, tagName);
     processEndTag(fakeToken.get());
 }
 
@@ -459,7 +460,7 @@ void HTMLTreeBuilder::processFakePEndTagIfPInButtonScope()
 {
     if (!m_tree.openElements()->inButtonScope(pTag.localName()))
         return;
-    RefPtr<AtomicHTMLToken> endP = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, pTag.localName());
+    RefPtr<AtomicHTMLToken> endP = AtomicHTMLToken::create(HTMLToken::EndTag, pTag.localName());
     processEndTag(endP.get());
 }
 
@@ -478,7 +479,7 @@ Vector<Attribute> HTMLTreeBuilder::attributesForIsindexInput(AtomicHTMLToken* to
 
 void HTMLTreeBuilder::processIsindexStartTagForInBody(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     ASSERT(token->name() == isindexTag);
     parseError(token);
     if (m_tree.form())
@@ -630,7 +631,7 @@ static void adjustForeignAttributes(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     if (token->name() == htmlTag) {
         processHtmlStartTagForInBody(token);
         return;
@@ -897,7 +898,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
     }
     if (token->name() == optgroupTag || token->name() == optionTag) {
         if (m_tree.currentStackItem()->hasTagName(optionTag)) {
-            RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optionTag.localName());
+            RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLToken::EndTag, optionTag.localName());
             processEndTag(endOption.get());
         }
         m_tree.reconstructTheActiveFormattingElements();
@@ -1021,7 +1022,7 @@ void HTMLTreeBuilder::closeTheCell()
 
 void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     if (token->name() == captionTag) {
         m_tree.openElements()->popUntilTableScopeMarker();
         m_tree.activeFormattingElements()->appendMarker();
@@ -1097,7 +1098,7 @@ void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     switch (insertionMode()) {
     case InitialMode:
         ASSERT(insertionMode() == InitialMode);
@@ -1366,7 +1367,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
             || token->name() == trTag
             || isTableCellContextTag(token->name())) {
             parseError(token);
-            RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, selectTag.localName());
+            RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLToken::EndTag, selectTag.localName());
             processEndTag(endSelect.get());
             processStartTag(token);
             return;
@@ -1380,7 +1381,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
         }
         if (token->name() == optionTag) {
             if (m_tree.currentStackItem()->hasTagName(optionTag)) {
-                RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optionTag.localName());
+                RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLToken::EndTag, optionTag.localName());
                 processEndTag(endOption.get());
             }
             m_tree.insertHTMLElement(token);
@@ -1388,11 +1389,11 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
         }
         if (token->name() == optgroupTag) {
             if (m_tree.currentStackItem()->hasTagName(optionTag)) {
-                RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optionTag.localName());
+                RefPtr<AtomicHTMLToken> endOption = AtomicHTMLToken::create(HTMLToken::EndTag, optionTag.localName());
                 processEndTag(endOption.get());
             }
             if (m_tree.currentStackItem()->hasTagName(optgroupTag)) {
-                RefPtr<AtomicHTMLToken> endOptgroup = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, optgroupTag.localName());
+                RefPtr<AtomicHTMLToken> endOptgroup = AtomicHTMLToken::create(HTMLToken::EndTag, optgroupTag.localName());
                 processEndTag(endOptgroup.get());
             }
             m_tree.insertHTMLElement(token);
@@ -1400,7 +1401,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
         }
         if (token->name() == selectTag) {
             parseError(token);
-            RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, selectTag.localName());
+            RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLToken::EndTag, selectTag.localName());
             processEndTag(endSelect.get());
             return;
         }
@@ -1412,7 +1413,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
                 ASSERT(isParsingFragment());
                 return;
             }
-            RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, selectTag.localName());
+            RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLToken::EndTag, selectTag.localName());
             processEndTag(endSelect.get());
             processStartTag(token);
             return;
@@ -1492,7 +1493,7 @@ void HTMLTreeBuilder::processHtmlStartTagForInBody(AtomicHTMLToken* token)
 
 bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     ASSERT(token->name() == bodyTag);
     if (!m_tree.openElements()->inScope(bodyTag.localName())) {
         parseError(token);
@@ -1505,7 +1506,7 @@ bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     HTMLElementStack::ElementRecord* record = m_tree.openElements()->topRecord();
     while (1) {
         RefPtr<HTMLStackItem> item = record->stackItem();
@@ -1709,7 +1710,7 @@ void HTMLTreeBuilder::resetInsertionModeAppropriately()
 
 void HTMLTreeBuilder::processEndTagForInTableBody(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     if (isTableBodyContextTag(token->name())) {
         if (!m_tree.openElements()->inTableScope(token->name())) {
             parseError(token);
@@ -1746,7 +1747,7 @@ void HTMLTreeBuilder::processEndTagForInTableBody(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processEndTagForInRow(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     if (token->name() == trTag) {
         processTrEndTagForInRow();
         return;
@@ -1782,7 +1783,7 @@ void HTMLTreeBuilder::processEndTagForInRow(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processEndTagForInCell(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     if (isTableCellContextTag(token->name())) {
         if (!m_tree.openElements()->inTableScope(token->name())) {
             parseError(token);
@@ -1823,13 +1824,13 @@ void HTMLTreeBuilder::processEndTagForInCell(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     if (token->name() == bodyTag) {
         processBodyEndTagForInBody(token);
         return;
     }
     if (token->name() == htmlTag) {
-        RefPtr<AtomicHTMLToken> endBody = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, bodyTag.localName());
+        RefPtr<AtomicHTMLToken> endBody = AtomicHTMLToken::create(HTMLToken::EndTag, bodyTag.localName());
         if (processBodyEndTagForInBody(endBody.get()))
             processEndTag(token);
         return;
@@ -2003,7 +2004,7 @@ bool HTMLTreeBuilder::processTableEndTagForInTable()
 
 void HTMLTreeBuilder::processEndTagForInTable(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     if (token->name() == tableTag) {
         processTableEndTagForInTable();
         return;
@@ -2025,7 +2026,7 @@ void HTMLTreeBuilder::processEndTagForInTable(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndTag);
+    ASSERT(token->type() == HTMLToken::EndTag);
     switch (insertionMode()) {
     case InitialMode:
         ASSERT(insertionMode() == InitialMode);
@@ -2246,7 +2247,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token)
             || isTableCellContextTag(token->name())) {
             parseError(token);
             if (m_tree.openElements()->inTableScope(token->name())) {
-                RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, selectTag.localName());
+                RefPtr<AtomicHTMLToken> endSelect = AtomicHTMLToken::create(HTMLToken::EndTag, selectTag.localName());
                 processEndTag(endSelect.get());
                 processEndTag(token);
             }
@@ -2311,7 +2312,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processComment(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::Comment);
+    ASSERT(token->type() == HTMLToken::Comment);
     if (m_insertionMode == InitialMode
         || m_insertionMode == BeforeHTMLMode
         || m_insertionMode == AfterAfterBodyMode
@@ -2333,7 +2334,7 @@ void HTMLTreeBuilder::processComment(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processCharacter(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::Character);
+    ASSERT(token->type() == HTMLToken::Character);
     ExternalCharacterTokenBuffer buffer(token);
     processCharacterBuffer(buffer);
 }
@@ -2522,7 +2523,7 @@ void HTMLTreeBuilder::processCharacterBufferForInBody(ExternalCharacterTokenBuff
 
 void HTMLTreeBuilder::processEndOfFile(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::EndOfFile);
+    ASSERT(token->type() == HTMLToken::EndOfFile);
     switch (insertionMode()) {
     case InitialMode:
         ASSERT(insertionMode() == InitialMode);
@@ -2642,32 +2643,32 @@ void HTMLTreeBuilder::defaultForInitial()
 
 void HTMLTreeBuilder::defaultForBeforeHTML()
 {
-    RefPtr<AtomicHTMLToken> startHTML = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, htmlTag.localName());
+    RefPtr<AtomicHTMLToken> startHTML = AtomicHTMLToken::create(HTMLToken::StartTag, htmlTag.localName());
     m_tree.insertHTMLHtmlStartTagBeforeHTML(startHTML.get());
     setInsertionMode(BeforeHeadMode);
 }
 
 void HTMLTreeBuilder::defaultForBeforeHead()
 {
-    RefPtr<AtomicHTMLToken> startHead = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, headTag.localName());
+    RefPtr<AtomicHTMLToken> startHead = AtomicHTMLToken::create(HTMLToken::StartTag, headTag.localName());
     processStartTag(startHead.get());
 }
 
 void HTMLTreeBuilder::defaultForInHead()
 {
-    RefPtr<AtomicHTMLToken> endHead = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, headTag.localName());
+    RefPtr<AtomicHTMLToken> endHead = AtomicHTMLToken::create(HTMLToken::EndTag, headTag.localName());
     processEndTag(endHead.get());
 }
 
 void HTMLTreeBuilder::defaultForInHeadNoscript()
 {
-    RefPtr<AtomicHTMLToken> endNoscript = AtomicHTMLToken::create(HTMLTokenTypes::EndTag, noscriptTag.localName());
+    RefPtr<AtomicHTMLToken> endNoscript = AtomicHTMLToken::create(HTMLToken::EndTag, noscriptTag.localName());
     processEndTag(endNoscript.get());
 }
 
 void HTMLTreeBuilder::defaultForAfterHead()
 {
-    RefPtr<AtomicHTMLToken> startBody = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, bodyTag.localName());
+    RefPtr<AtomicHTMLToken> startBody = AtomicHTMLToken::create(HTMLToken::StartTag, bodyTag.localName());
     processStartTag(startBody.get());
     m_framesetOk = true;
 }
@@ -2691,7 +2692,7 @@ void HTMLTreeBuilder::defaultForInTableText()
 
 bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     if (token->name() == htmlTag) {
         processHtmlStartTagForInBody(token);
         return true;
@@ -2744,7 +2745,7 @@ bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processGenericRCDATAStartTag(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     m_tree.insertHTMLElement(token);
     if (m_parser->tokenizer())
         m_parser->tokenizer()->setState(HTMLTokenizer::RCDATAState);
@@ -2754,7 +2755,7 @@ void HTMLTreeBuilder::processGenericRCDATAStartTag(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processGenericRawTextStartTag(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     m_tree.insertHTMLElement(token);
     if (m_parser->tokenizer())
         m_parser->tokenizer()->setState(HTMLTokenizer::RAWTEXTState);
@@ -2764,7 +2765,7 @@ void HTMLTreeBuilder::processGenericRawTextStartTag(AtomicHTMLToken* token)
 
 void HTMLTreeBuilder::processScriptStartTag(AtomicHTMLToken* token)
 {
-    ASSERT(token->type() == HTMLTokenTypes::StartTag);
+    ASSERT(token->type() == HTMLToken::StartTag);
     m_tree.insertScriptElement(token);
     if (m_parser->tokenizer())
         m_parser->tokenizer()->setState(HTMLTokenizer::ScriptDataState);
@@ -2786,24 +2787,24 @@ bool HTMLTreeBuilder::shouldProcessTokenInForeignContent(AtomicHTMLToken* token)
     if (item->isInHTMLNamespace())
         return false;
     if (HTMLElementStack::isMathMLTextIntegrationPoint(item)) {
-        if (token->type() == HTMLTokenTypes::StartTag
+        if (token->type() == HTMLToken::StartTag
             && token->name() != MathMLNames::mglyphTag
             && token->name() != MathMLNames::malignmarkTag)
             return false;
-        if (token->type() == HTMLTokenTypes::Character)
+        if (token->type() == HTMLToken::Character)
             return false;
     }
     if (item->hasTagName(MathMLNames::annotation_xmlTag)
-        && token->type() == HTMLTokenTypes::StartTag
+        && token->type() == HTMLToken::StartTag
         && token->name() == SVGNames::svgTag)
         return false;
     if (HTMLElementStack::isHTMLIntegrationPoint(item)) {
-        if (token->type() == HTMLTokenTypes::StartTag)
+        if (token->type() == HTMLToken::StartTag)
             return false;
-        if (token->type() == HTMLTokenTypes::Character)
+        if (token->type() == HTMLToken::Character)
             return false;
     }
-    if (token->type() == HTMLTokenTypes::EndOfFile)
+    if (token->type() == HTMLToken::EndOfFile)
         return false;
     return true;
 }
@@ -2811,13 +2812,13 @@ bool HTMLTreeBuilder::shouldProcessTokenInForeignContent(AtomicHTMLToken* token)
 void HTMLTreeBuilder::processTokenInForeignContent(AtomicHTMLToken* token)
 {
     switch (token->type()) {
-    case HTMLTokenTypes::Uninitialized:
+    case HTMLToken::Uninitialized:
         ASSERT_NOT_REACHED();
         break;
-    case HTMLTokenTypes::DOCTYPE:
+    case HTMLToken::DOCTYPE:
         parseError(token);
         break;
-    case HTMLTokenTypes::StartTag: {
+    case HTMLToken::StartTag: {
         if (token->name() == bTag
             || token->name() == bigTag
             || token->name() == blockquoteTag
@@ -2874,7 +2875,7 @@ void HTMLTreeBuilder::processTokenInForeignContent(AtomicHTMLToken* token)
         m_tree.insertForeignElement(token, currentNamespace);
         break;
     }
-    case HTMLTokenTypes::EndTag: {
+    case HTMLToken::EndTag: {
         if (m_tree.currentStackItem()->namespaceURI() == SVGNames::svgNamespaceURI)
             adjustSVGTagNameCase(token);
 
@@ -2903,17 +2904,17 @@ void HTMLTreeBuilder::processTokenInForeignContent(AtomicHTMLToken* token)
         processEndTag(token);
         break;
     }
-    case HTMLTokenTypes::Comment:
+    case HTMLToken::Comment:
         m_tree.insertComment(token);
         return;
-    case HTMLTokenTypes::Character: {
+    case HTMLToken::Character: {
         String characters = String(token->characters(), token->charactersLength());
         m_tree.insertTextNode(characters);
         if (m_framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
             m_framesetOk = false;
         break;
     }
-    case HTMLTokenTypes::EndOfFile:
+    case HTMLToken::EndOfFile:
         ASSERT_NOT_REACHED();
         break;
     }
index 106be31..a5f47f0 100644 (file)
@@ -76,7 +76,7 @@ String HTMLViewSourceParser::sourceForToken()
 void HTMLViewSourceParser::updateTokenizerState()
 {
     // FIXME: The tokenizer should do this work for us.
-    if (m_token.type() != HTMLTokenTypes::StartTag)
+    if (m_token.type() != HTMLToken::StartTag)
         return;
 
     AtomicString tagName(m_token.name().data(), m_token.name().size());
index fd102cb..391fcac 100644 (file)
@@ -60,7 +60,7 @@ void TextDocumentParser::insertFakePreElement()
     // distrubing the line/column number calculations.
     Vector<Attribute> attributes;
     attributes.append(Attribute(styleAttr, "word-wrap: break-word; white-space: pre-wrap;"));
-    RefPtr<AtomicHTMLToken> fakePre = AtomicHTMLToken::create(HTMLTokenTypes::StartTag, preTag.localName(), attributes);
+    RefPtr<AtomicHTMLToken> fakePre = AtomicHTMLToken::create(HTMLToken::StartTag, preTag.localName(), attributes);
     treeBuilder()->constructTree(fakePre.get());
 
     // Normally we would skip the first \n after a <pre> element, but we don't
index 9dcc8b5..de54d22 100644 (file)
@@ -284,12 +284,12 @@ PassOwnPtr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request)
         return nullptr;
 
     bool didBlockScript = false;
-    if (request.token.type() == HTMLTokenTypes::StartTag)
+    if (request.token.type() == HTMLToken::StartTag)
         didBlockScript = filterStartToken(request);
     else if (m_scriptTagNestingLevel) {
-        if (request.token.type() == HTMLTokenTypes::Character)
+        if (request.token.type() == HTMLToken::Character)
             didBlockScript = filterCharacterToken(request);
-        else if (request.token.type() == HTMLTokenTypes::EndTag)
+        else if (request.token.type() == HTMLToken::EndTag)
             filterEndToken(request);
     }
 
@@ -356,7 +356,7 @@ bool XSSAuditor::filterCharacterToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterScriptToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, scriptTag));
 
     m_cachedDecodedSnippet = decodedSnippetForName(request);
@@ -372,7 +372,7 @@ bool XSSAuditor::filterScriptToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterObjectToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, objectTag));
 
     bool didBlockScript = false;
@@ -386,7 +386,7 @@ bool XSSAuditor::filterObjectToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterParamToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, paramTag));
 
     size_t indexOfNameAttribute;
@@ -404,7 +404,7 @@ bool XSSAuditor::filterParamToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterEmbedToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, embedTag));
 
     bool didBlockScript = false;
@@ -418,7 +418,7 @@ bool XSSAuditor::filterEmbedToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterAppletToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, appletTag));
 
     bool didBlockScript = false;
@@ -431,7 +431,7 @@ bool XSSAuditor::filterAppletToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterIframeToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, iframeTag));
 
     bool didBlockScript = false;
@@ -444,7 +444,7 @@ bool XSSAuditor::filterIframeToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterMetaToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, metaTag));
 
     return eraseAttributeIfInjected(request, http_equivAttr);
@@ -452,7 +452,7 @@ bool XSSAuditor::filterMetaToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterBaseToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, baseTag));
 
     return eraseAttributeIfInjected(request, hrefAttr);
@@ -460,7 +460,7 @@ bool XSSAuditor::filterBaseToken(const FilterTokenRequest& request)
 
 bool XSSAuditor::filterFormToken(const FilterTokenRequest& request)
 {
-    ASSERT(request.token.type() == HTMLTokenTypes::StartTag);
+    ASSERT(request.token.type() == HTMLToken::StartTag);
     ASSERT(hasName(request.token, formTag));
 
     return eraseAttributeIfInjected(request, actionAttr, blankURL().string());