Title: [92325] trunk/Source/WebCore
Revision
92325
Author
[email protected]
Date
2011-08-03 16:18:42 -0700 (Wed, 03 Aug 2011)

Log Message

Make atomic XML token
https://bugs.webkit.org/show_bug.cgi?id=65639

Reviewed by Adam Barth.

Create a shared AtomicMarkupTokenBase that is shared by AtomicHTMLToken and the new AtomicXMLToken

* html/parser/HTMLToken.h:
(WebCore::HTMLToken::setForceQuirks):
(WebCore::AtomicHTMLToken::AtomicHTMLToken):
(WebCore::AtomicHTMLToken::forceQuirks):
* html/parser/HTMLTokenizer.cpp:
(WebCore::::nameForAttribute):
(WebCore::::usesName):
(WebCore::::usesAttributes):
* xml/parser/MarkupTokenBase.h:
(WebCore::AtomicMarkupTokenBase::AtomicMarkupTokenBase):
(WebCore::AtomicMarkupTokenBase::type):
(WebCore::AtomicMarkupTokenBase::name):
(WebCore::AtomicMarkupTokenBase::setName):
(WebCore::AtomicMarkupTokenBase::selfClosing):
(WebCore::AtomicMarkupTokenBase::getAttributeItem):
(WebCore::AtomicMarkupTokenBase::attributes):
(WebCore::AtomicMarkupTokenBase::takeAtributes):
(WebCore::AtomicMarkupTokenBase::characters):
(WebCore::AtomicMarkupTokenBase::comment):
(WebCore::AtomicMarkupTokenBase::publicIdentifier):
(WebCore::AtomicMarkupTokenBase::systemIdentifier):
(WebCore::::initializeAttributes):
* xml/parser/XMLToken.h:
(WebCore::AtomicXMLToken::AtomicXMLToken):
(WebCore::AtomicXMLToken::prefix):
(WebCore::AtomicXMLToken::target):
(WebCore::AtomicXMLToken::data):
(WebCore::AtomicXMLToken::xmlVersion):
(WebCore::AtomicXMLToken::xmlStandalone):
* xml/parser/XMLTokenizer.cpp:
(WebCore::::nameForAttribute):
(WebCore::::usesName):
(WebCore::::usesAttributes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92324 => 92325)


--- trunk/Source/WebCore/ChangeLog	2011-08-03 23:03:32 UTC (rev 92324)
+++ trunk/Source/WebCore/ChangeLog	2011-08-03 23:18:42 UTC (rev 92325)
@@ -1,3 +1,46 @@
+2011-08-03  Jeffrey Pfau  <[email protected]>
+
+        Make atomic XML token
+        https://bugs.webkit.org/show_bug.cgi?id=65639
+
+        Reviewed by Adam Barth.
+
+        Create a shared AtomicMarkupTokenBase that is shared by AtomicHTMLToken and the new AtomicXMLToken
+
+        * html/parser/HTMLToken.h:
+        (WebCore::HTMLToken::setForceQuirks):
+        (WebCore::AtomicHTMLToken::AtomicHTMLToken):
+        (WebCore::AtomicHTMLToken::forceQuirks):
+        * html/parser/HTMLTokenizer.cpp:
+        (WebCore::::nameForAttribute):
+        (WebCore::::usesName):
+        (WebCore::::usesAttributes):
+        * xml/parser/MarkupTokenBase.h:
+        (WebCore::AtomicMarkupTokenBase::AtomicMarkupTokenBase):
+        (WebCore::AtomicMarkupTokenBase::type):
+        (WebCore::AtomicMarkupTokenBase::name):
+        (WebCore::AtomicMarkupTokenBase::setName):
+        (WebCore::AtomicMarkupTokenBase::selfClosing):
+        (WebCore::AtomicMarkupTokenBase::getAttributeItem):
+        (WebCore::AtomicMarkupTokenBase::attributes):
+        (WebCore::AtomicMarkupTokenBase::takeAtributes):
+        (WebCore::AtomicMarkupTokenBase::characters):
+        (WebCore::AtomicMarkupTokenBase::comment):
+        (WebCore::AtomicMarkupTokenBase::publicIdentifier):
+        (WebCore::AtomicMarkupTokenBase::systemIdentifier):
+        (WebCore::::initializeAttributes):
+        * xml/parser/XMLToken.h:
+        (WebCore::AtomicXMLToken::AtomicXMLToken):
+        (WebCore::AtomicXMLToken::prefix):
+        (WebCore::AtomicXMLToken::target):
+        (WebCore::AtomicXMLToken::data):
+        (WebCore::AtomicXMLToken::xmlVersion):
+        (WebCore::AtomicXMLToken::xmlStandalone):
+        * xml/parser/XMLTokenizer.cpp:
+        (WebCore::::nameForAttribute):
+        (WebCore::::usesName):
+        (WebCore::::usesAttributes):
+
 2011-08-03  Mark Pilgrim  <[email protected]>
 
         Remove LegacyDefaultOptionalArguments flag from geolocation IDL files

Modified: trunk/Source/WebCore/html/parser/HTMLToken.h (92324 => 92325)


--- trunk/Source/WebCore/html/parser/HTMLToken.h	2011-08-03 23:03:32 UTC (rev 92324)
+++ trunk/Source/WebCore/html/parser/HTMLToken.h	2011-08-03 23:18:42 UTC (rev 92325)
@@ -80,191 +80,25 @@
         ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
         m_doctypeData->m_forceQuirks = true;
     }
-
 };
 
-// FIXME: This class should eventually be named HTMLToken once we move the
-// exiting HTMLToken to be internal to the HTMLTokenizer.
-class AtomicHTMLToken {
+class AtomicHTMLToken : public AtomicMarkupTokenBase<HTMLToken> {
     WTF_MAKE_NONCOPYABLE(AtomicHTMLToken);
 public:
-    AtomicHTMLToken(HTMLToken& token)
-        : m_type(token.type())
-    {
-        switch (m_type) {
-        case HTMLTokenTypes::Uninitialized:
-            ASSERT_NOT_REACHED();
-            break;
-        case HTMLTokenTypes::DOCTYPE:
-            m_name = AtomicString(token.name().data(), token.name().size());
-            m_doctypeData = token.m_doctypeData.release();
-            break;
-        case HTMLTokenTypes::EndOfFile:
-            break;
-        case HTMLTokenTypes::StartTag:
-        case HTMLTokenTypes::EndTag: {
-            m_selfClosing = token.selfClosing();
-            m_name = AtomicString(token.name().data(), token.name().size());
-            initializeAttributes(token.attributes());
-            break;
-        }
-        case HTMLTokenTypes::Comment:
-            m_data = String(token.comment().data(), token.comment().size());
-            break;
-        case HTMLTokenTypes::Character:
-            m_externalCharacters = &token.characters();
-            break;
-        default:
-            break;
-        }
-    }
+    AtomicHTMLToken(HTMLToken& token) : AtomicMarkupTokenBase<HTMLToken>(&token) { }
 
     AtomicHTMLToken(HTMLTokenTypes::Type type, AtomicString name, PassRefPtr<NamedNodeMap> attributes = 0)
-        : m_type(type)
-        , m_name(name)
-        , m_attributes(attributes)
+        : AtomicMarkupTokenBase<HTMLToken>(type, name, attributes)
     {
-        ASSERT(usesName());
     }
 
-    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());
-        if (!m_attributes)
-            return 0;
-        return m_attributes->getAttributeItem(attributeName);
-    }
-
-    NamedNodeMap* attributes() const
-    {
-        ASSERT(usesAttributes());
-        return m_attributes.get();
-    }
-
-    PassRefPtr<NamedNodeMap> takeAtributes()
-    {
-        ASSERT(usesAttributes());
-        return m_attributes.release();
-    }
-
-    const HTMLToken::DataVector& characters() const
-    {
-        ASSERT(m_type == HTMLTokenTypes::Character);
-        return *m_externalCharacters;
-    }
-
-    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;
-    }
-
     bool forceQuirks() const
     {
         ASSERT(m_type == HTMLTokenTypes::DOCTYPE);
         return m_doctypeData->m_forceQuirks;
     }
-
-private:
-    HTMLTokenTypes::Type m_type;
-
-    void initializeAttributes(const HTMLToken::AttributeList& attributes);
-    
-    bool usesName() const
-    {
-        return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE;
-    }
-
-    bool usesAttributes() const
-    {
-        return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag;
-    }
-
-    // "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 HTMLToken, so we
-    // keep a pointer to its buffer instead.  This buffer is owned by the
-    // HTMLToken and causes a lifetime dependence between these objects.
-    //
-    // FIXME: Add a mechanism for "internalizing" the characters when the
-    //        HTMLToken is destructed.
-    const HTMLToken::DataVector* m_externalCharacters;
-
-    // For DOCTYPE
-    OwnPtr<HTMLTokenTypes::DoctypeData> m_doctypeData;
-
-    // For StartTag and EndTag
-    bool m_selfClosing;
-
-    RefPtr<NamedNodeMap> m_attributes;
 };
 
-inline void AtomicHTMLToken::initializeAttributes(const HTMLToken::AttributeList& attributes)
-{
-    size_t size = attributes.size();
-    if (!size)
-        return;
-
-    m_attributes = NamedNodeMap::create();
-    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);
-
-        String name(attribute.m_name.data(), attribute.m_name.size());
-        String value(attribute.m_value.data(), attribute.m_value.size());
-        m_attributes->insertAttribute(Attribute::createMapped(name, value), false);
-    }
 }
 
-}
-
 #endif

Modified: trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp (92324 => 92325)


--- trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp	2011-08-03 23:03:32 UTC (rev 92324)
+++ trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp	2011-08-03 23:18:42 UTC (rev 92325)
@@ -47,6 +47,26 @@
 
 using namespace HTMLNames;
 
+// This has to go in a .cpp file, as the linker doesn't like it being included more than once.
+// We don't have an HTMLToken.cpp though, so this is the next best place.
+template<>
+QualifiedName AtomicMarkupTokenBase<HTMLToken>::nameForAttribute(const AttributeBase& attribute) const
+{
+    return QualifiedName(nullAtom, AtomicString(attribute.m_name.data(), attribute.m_name.size()), nullAtom);
+}
+
+template<>
+bool AtomicMarkupTokenBase<HTMLToken>::usesName() const
+{
+    return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag || m_type == HTMLTokenTypes::DOCTYPE;
+}
+
+template<>
+bool AtomicMarkupTokenBase<HTMLToken>::usesAttributes() const
+{
+    return m_type == HTMLTokenTypes::StartTag || m_type == HTMLTokenTypes::EndTag;
+}
+
 namespace {
 
 inline UChar toLowerCase(UChar cc)

Modified: trunk/Source/WebCore/xml/parser/MarkupTokenBase.h (92324 => 92325)


--- trunk/Source/WebCore/xml/parser/MarkupTokenBase.h	2011-08-03 23:03:32 UTC (rev 92324)
+++ trunk/Source/WebCore/xml/parser/MarkupTokenBase.h	2011-08-03 23:18:42 UTC (rev 92325)
@@ -66,13 +66,14 @@
     WTF::Vector<UChar, 32> m_value;
 };
 
-template<typename TypeSet, typename DoctypeData = DoctypeDataBase, typename AttributeType = AttributeBase>
+template<typename TypeSet, typename DoctypeDataType = DoctypeDataBase, typename AttributeType = AttributeBase>
 class MarkupTokenBase {
     WTF_MAKE_NONCOPYABLE(MarkupTokenBase);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     typedef TypeSet Type;
     typedef AttributeType Attribute;
+    typedef DoctypeDataType DoctypeData;
 
     typedef WTF::Vector<Attribute, 10> AttributeList;
     typedef WTF::Vector<UChar, 1024> DataVector;
@@ -350,10 +351,11 @@
         return m_data;
     }
 
-    // FIXME: I'm not sure what the final relationship between HTMLToken and
-    // AtomicHTMLToken will be. I'm marking this a friend for now, but we'll
+    // FIXME: I'm not sure what the final relationship between MarkupTokenBase and
+    // AtomicMarkupTokenBase will be. I'm marking this a friend for now, but we'll
     // want to end up with a cleaner interface between the two classes.
-    friend class AtomicHTMLToken;
+    template<typename Token>
+    friend class AtomicMarkupTokenBase;
 
     typename Type::Type m_type;
     typename Attribute::Range m_range; // Always starts at zero.
@@ -371,6 +373,178 @@
     Attribute* m_currentAttribute;
 };
 
+template<typename Token>
+class AtomicMarkupTokenBase {
+    WTF_MAKE_NONCOPYABLE(AtomicMarkupTokenBase);
+public:
+    AtomicMarkupTokenBase(Token* token)
+        : m_type(token->type())
+    {
+        ASSERT(token);
+
+        switch (m_type) {
+        case Token::Type::Uninitialized:
+            ASSERT_NOT_REACHED();
+            break;
+        case Token::Type::DOCTYPE:
+            m_name = AtomicString(token->name().data(), token->name().size());
+            m_doctypeData = token->m_doctypeData.release();
+            break;
+        case Token::Type::EndOfFile:
+            break;
+        case Token::Type::StartTag:
+        case Token::Type::EndTag: {
+            m_selfClosing = token->selfClosing();
+            m_name = AtomicString(token->name().data(), token->name().size());
+            initializeAttributes(token->attributes());
+            break;
+        }
+        case Token::Type::Comment:
+            m_data = String(token->comment().data(), token->comment().size());
+            break;
+        case Token::Type::Character:
+            m_externalCharacters = &token->characters();
+            break;
+        default:
+            break;
+        }
+    }
+
+    AtomicMarkupTokenBase(typename Token::Type::Type type, AtomicString name, PassRefPtr<NamedNodeMap> attributes = 0)
+        : m_type(type)
+        , m_name(name)
+        , m_attributes(attributes)
+    {
+        ASSERT(usesName());
+    }
+
+    typename Token::Type::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 == Token::Type::StartTag || m_type == Token::Type::EndTag);
+        return m_selfClosing;
+    }
+
+    Attribute* getAttributeItem(const QualifiedName& attributeName)
+    {
+        ASSERT(usesAttributes());
+        if (!m_attributes)
+            return 0;
+        return m_attributes->getAttributeItem(attributeName);
+    }
+
+    NamedNodeMap* attributes() const
+    {
+        ASSERT(usesAttributes());
+        return m_attributes.get();
+    }
+
+    PassRefPtr<NamedNodeMap> takeAtributes()
+    {
+        ASSERT(usesAttributes());
+        return m_attributes.release();
+    }
+
+    const typename Token::DataVector& characters() const
+    {
+        ASSERT(m_type == Token::Type::Character);
+        return *m_externalCharacters;
+    }
+
+    const String& comment() const
+    {
+        ASSERT(m_type == Token::Type::Comment);
+        return m_data;
+    }
+
+    // FIXME: Distinguish between a missing public identifer and an empty one.
+    WTF::Vector<UChar>& publicIdentifier() const
+    {
+        ASSERT(m_type == Token::Type::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 == Token::Type::DOCTYPE);
+        return m_doctypeData->m_systemIdentifier;
+    }
+
+protected:
+    typename Token::Type::Type m_type;
+
+    void initializeAttributes(const typename Token::AttributeList& attributes);
+    QualifiedName nameForAttribute(const typename Token::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 typename Token::DataVector* m_externalCharacters;
+
+    // For DOCTYPE
+    OwnPtr<typename Token::DoctypeData> m_doctypeData;
+
+    // For StartTag and EndTag
+    bool m_selfClosing;
+
+    RefPtr<NamedNodeMap> m_attributes;
+};
+
+template<typename Token>
+inline void AtomicMarkupTokenBase<Token>::initializeAttributes(const typename Token::AttributeList& attributes)
+{
+    size_t size = attributes.size();
+    if (!size)
+        return;
+
+    m_attributes = NamedNodeMap::create();
+    m_attributes->reserveInitialCapacity(size);
+    for (size_t i = 0; i < size; ++i) {
+        const typename Token::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);
+
+        String value(attribute.m_value.data(), attribute.m_value.size());
+        m_attributes->insertAttribute(Attribute::createMapped(nameForAttribute(attribute), value), false);
+    }
 }
 
+}
+
 #endif // MarkupTokenBase_h

Modified: trunk/Source/WebCore/xml/parser/XMLToken.h (92324 => 92325)


--- trunk/Source/WebCore/xml/parser/XMLToken.h	2011-08-03 23:03:32 UTC (rev 92324)
+++ trunk/Source/WebCore/xml/parser/XMLToken.h	2011-08-03 23:18:42 UTC (rev 92325)
@@ -137,7 +137,7 @@
         m_type = XMLTokenTypes::XMLDeclaration;
         m_xmlDeclarationData = adoptPtr(new XMLDeclarationData());
     }
-    
+
     void appendToXMLVersion(UChar character)
     {
         ASSERT(character);
@@ -388,9 +388,10 @@
 #endif // NDEBUG
 
 private:
+    // AtomicXMLToken needs to steal some of our pointers from us
+    // FIXME: add take* functions
+    friend class AtomicXMLToken;
 
-    typedef DoctypeDataBase DoctypeData;
-
     // "target" for ProcessingInstruction, "prefix" for StartTag and EndTag
     DataVector m_target;
 
@@ -398,6 +399,81 @@
     OwnPtr<XMLDeclarationData> m_xmlDeclarationData;
 };
 
+class AtomicXMLToken : public AtomicMarkupTokenBase<XMLToken> {
+    WTF_MAKE_NONCOPYABLE(AtomicXMLToken);
+public:
+    AtomicXMLToken(XMLToken& token)
+        : AtomicMarkupTokenBase<XMLToken>(&token)
+    {
+        switch (m_type) {
+        case XMLTokenTypes::ProcessingInstruction:
+            m_name = AtomicString(token.target().data(), token.target().size());
+            m_data = String(token.data().data(), token.data().size());
+            break;
+        case XMLTokenTypes::XMLDeclaration:
+            m_xmlDeclarationData = token.m_xmlDeclarationData.release();
+            break;
+        case XMLTokenTypes::StartTag:
+        case XMLTokenTypes::EndTag: {
+            if (token.prefix().size())
+                m_prefix = AtomicString(token.prefix().data(), token.prefix().size());
+            initializeAttributes(token.attributes());
+            break;
+        }
+        case XMLTokenTypes::CDATA:
+            m_data = String(token.data().data(), token.data().size());
+            break;
+        case XMLTokenTypes::Entity:
+            m_name = AtomicString(token.name().data(), token.name().size());
+            break;
+        default:
+            break;
+        }
+    }
+
+    AtomicXMLToken(XMLTokenTypes::Type type, AtomicString name, PassRefPtr<NamedNodeMap> attributes = 0)
+        : AtomicMarkupTokenBase<XMLToken>(type, name, attributes)
+    {
+    }
+
+    const AtomicString& prefix() const
+    {
+        ASSERT(m_type == XMLTokenTypes::StartTag || m_type == XMLTokenTypes::EndTag);
+        return m_prefix;
+    }
+
+    const AtomicString& target() const
+    {
+        ASSERT(m_type == XMLTokenTypes::ProcessingInstruction);
+        return m_name;
+    }
+
+    const String& data() const
+    {
+        ASSERT(m_type == XMLTokenTypes::CDATA || m_type == XMLTokenTypes::ProcessingInstruction);
+        return m_data;
+    }
+
+    WTF::Vector<UChar>& xmlVersion() const
+    {
+        ASSERT(m_type == XMLTokenTypes::XMLDeclaration);
+        return m_xmlDeclarationData->m_version;
+    }
+
+    bool xmlStandalone() const
+    {
+        ASSERT(m_type == XMLTokenTypes::XMLDeclaration);
+        return m_xmlDeclarationData->m_hasStandalone && m_xmlDeclarationData->m_standalone;
+    }
+
+private:
+    // "prefix" for StartTag, EndTag
+    AtomicString m_prefix;
+
+    // For XML declaration
+    OwnPtr<XMLToken::XMLDeclarationData> m_xmlDeclarationData;
+};
+
 }
 
 #endif

Modified: trunk/Source/WebCore/xml/parser/XMLTokenizer.cpp (92324 => 92325)


--- trunk/Source/WebCore/xml/parser/XMLTokenizer.cpp	2011-08-03 23:03:32 UTC (rev 92324)
+++ trunk/Source/WebCore/xml/parser/XMLTokenizer.cpp	2011-08-03 23:18:42 UTC (rev 92325)
@@ -42,6 +42,26 @@
 
 namespace WebCore {
 
+// This has to go in a .cpp file, as the linker doesn't like it being included more than once.
+// We don't have an XMLToken.cpp though, so this is the next best place.
+template<>
+QualifiedName AtomicMarkupTokenBase<XMLToken>::nameForAttribute(const XMLToken::Attribute& attribute) const
+{
+    return QualifiedName(attribute.m_prefix.isEmpty() ? nullAtom : AtomicString(attribute.m_prefix.data(), attribute.m_prefix.size()), AtomicString(attribute.m_name.data(), attribute.m_name.size()), nullAtom);
+}
+
+template<>
+bool AtomicMarkupTokenBase<XMLToken>::usesName() const
+{
+    return m_type == XMLTokenTypes::StartTag || m_type == XMLTokenTypes::EndTag || m_type == XMLTokenTypes::DOCTYPE || m_type == XMLTokenTypes::Entity;
+}
+
+template<>
+bool AtomicMarkupTokenBase<XMLToken>::usesAttributes() const
+{
+    return m_type == XMLTokenTypes::StartTag || m_type == XMLTokenTypes::EndTag;
+}
+
 namespace {
 
 inline bool isValidNameStart(UChar cc)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to