Diff
Modified: trunk/Source/WTF/wtf/text/StringView.h (295267 => 295268)
--- trunk/Source/WTF/wtf/text/StringView.h 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WTF/wtf/text/StringView.h 2022-06-04 20:59:23 UTC (rev 295268)
@@ -68,6 +68,8 @@
StringView(const UChar*, unsigned length);
StringView(const char*, unsigned length);
StringView(ASCIILiteral);
+ ALWAYS_INLINE StringView(Span<const LChar> characters) : StringView(characters.data(), characters.size()) { }
+ ALWAYS_INLINE StringView(Span<const UChar> characters) : StringView(characters.data(), characters.size()) { }
ALWAYS_INLINE static StringView fromLatin1(const char* characters) { return StringView { characters }; }
Modified: trunk/Source/WTF/wtf/text/WTFString.h (295267 => 295268)
--- trunk/Source/WTF/wtf/text/WTFString.h 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2022-06-04 20:59:23 UTC (rev 295268)
@@ -61,6 +61,7 @@
// Construct a string with UTF-16 data.
WTF_EXPORT_PRIVATE String(const UChar* characters, unsigned length);
+ ALWAYS_INLINE String(Span<const UChar> characters) : String(characters.data(), characters.size()) { }
// Construct a string by copying the contents of a vector. To avoid
// copying, consider using String::adopt instead.
@@ -76,6 +77,7 @@
// Construct a string with Latin-1 data.
WTF_EXPORT_PRIVATE String(const LChar* characters, unsigned length);
WTF_EXPORT_PRIVATE String(const char* characters, unsigned length);
+ ALWAYS_INLINE String(Span<const LChar> characters) : String(characters.data(), characters.size()) { }
ALWAYS_INLINE static String fromLatin1(const char* characters) { return String { characters }; }
// Construct a string referencing an existing StringImpl.
Modified: trunk/Source/WebCore/html/parser/AtomHTMLToken.h (295267 => 295268)
--- trunk/Source/WebCore/html/parser/AtomHTMLToken.h 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/AtomHTMLToken.h 2022-06-04 20:59:23 UTC (rev 295268)
@@ -34,17 +34,17 @@
namespace WebCore {
-enum class HasDuplicateAttribute : bool { No, Yes };
-
class AtomHTMLToken {
public:
+ using Type = HTMLToken::Type;
+
explicit AtomHTMLToken(HTMLToken&);
- AtomHTMLToken(HTMLToken::Type, const AtomString& name, Vector<Attribute>&& = { }); // Only StartTag or EndTag.
+ AtomHTMLToken(Type, const AtomString& name, Vector<Attribute>&& = { }); // Only StartTag or EndTag.
AtomHTMLToken(const AtomHTMLToken&) = delete;
AtomHTMLToken(AtomHTMLToken&&) = default;
- HTMLToken::Type type() const;
+ Type type() const;
// StartTag, EndTag, DOCTYPE.
@@ -67,8 +67,7 @@
// Characters
- const UChar* characters() const;
- unsigned charactersLength() const;
+ Span<const UChar> characters() const;
bool charactersIsAll8BitData() const;
// Comment
@@ -76,36 +75,31 @@
const String& comment() const;
String& comment();
- HasDuplicateAttribute hasDuplicateAttribute() const { return m_hasDuplicateAttribute; };
+ bool hasDuplicateAttribute() const { return m_hasDuplicateAttribute; }
private:
- HTMLToken::Type m_type;
-
void initializeAttributes(const HTMLToken::AttributeList& attributes);
AtomString m_name; // StartTag, EndTag, DOCTYPE.
-
String m_data; // Comment
+ std::unique_ptr<DoctypeData> m_doctypeData; // DOCTYPE.
+ Vector<Attribute> m_attributes; // StartTag, EndTag.
// We don't want to copy 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 destroyed.
- const UChar* m_externalCharacters; // Character
- unsigned m_externalCharactersLength; // Character
+ Span<const UChar> m_externalCharacters; // Character
+
+ Type m_type;
bool m_externalCharactersIsAll8BitData; // Character
-
- std::unique_ptr<DoctypeData> m_doctypeData; // DOCTYPE.
-
- bool m_selfClosing; // StartTag, EndTag.
- Vector<Attribute> m_attributes; // StartTag, EndTag.
-
- HasDuplicateAttribute m_hasDuplicateAttribute { HasDuplicateAttribute::No };
+ bool m_selfClosing { false }; // StartTag, EndTag.
+ bool m_hasDuplicateAttribute { false };
};
const Attribute* findAttribute(const Vector<Attribute>&, const QualifiedName&);
bool hasAttribute(const Vector<Attribute>&, const AtomString& localName);
-inline HTMLToken::Type AtomHTMLToken::type() const
+inline auto AtomHTMLToken::type() const -> Type
{
return m_type;
}
@@ -112,72 +106,67 @@
inline const AtomString& AtomHTMLToken::name() const
{
- ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag || m_type == HTMLToken::DOCTYPE);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag || m_type == Type::DOCTYPE);
return m_name;
}
inline void AtomHTMLToken::setName(const AtomString& name)
{
- ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag || m_type == HTMLToken::DOCTYPE);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag || m_type == Type::DOCTYPE);
m_name = name;
}
inline bool AtomHTMLToken::selfClosing() const
{
- ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
return m_selfClosing;
}
inline Vector<Attribute>& AtomHTMLToken::attributes()
{
- ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
return m_attributes;
}
inline const Vector<Attribute>& AtomHTMLToken::attributes() const
{
- ASSERT(m_type == HTMLToken::StartTag || m_type == HTMLToken::EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
return m_attributes;
}
-inline const UChar* AtomHTMLToken::characters() const
+inline Span<const UChar> AtomHTMLToken::characters() const
{
- ASSERT(m_type == HTMLToken::Character);
+ ASSERT(m_type == Type::Character);
return m_externalCharacters;
}
-inline unsigned AtomHTMLToken::charactersLength() const
-{
- ASSERT(m_type == HTMLToken::Character);
- return m_externalCharactersLength;
-}
-
inline bool AtomHTMLToken::charactersIsAll8BitData() const
{
+ ASSERT(m_type == Type::Character);
return m_externalCharactersIsAll8BitData;
}
inline const String& AtomHTMLToken::comment() const
{
- ASSERT(m_type == HTMLToken::Comment);
+ ASSERT(m_type == Type::Comment);
return m_data;
}
inline String& AtomHTMLToken::comment()
{
- ASSERT(m_type == HTMLToken::Comment);
+ ASSERT(m_type == Type::Comment);
return m_data;
}
inline bool AtomHTMLToken::forceQuirks() const
{
- ASSERT(m_type == HTMLToken::DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
return m_doctypeData->forceQuirks;
}
inline String AtomHTMLToken::publicIdentifier() const
{
- ASSERT(m_type == HTMLToken::DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
if (!m_doctypeData->hasPublicIdentifier)
return String();
return StringImpl::create8BitIfPossible(m_doctypeData->publicIdentifier);
@@ -226,7 +215,7 @@
if (addedAttributes.add(qualifiedName.localName()).isNewEntry)
m_attributes.uncheckedAppend(Attribute(WTFMove(qualifiedName), HTMLNameCache::makeAttributeValue(attribute.value)));
else
- m_hasDuplicateAttribute = HasDuplicateAttribute::Yes;
+ m_hasDuplicateAttribute = true;
}
}
@@ -234,10 +223,10 @@
: m_type(token.type())
{
switch (m_type) {
- case HTMLToken::Uninitialized:
+ case Type::Uninitialized:
ASSERT_NOT_REACHED();
return;
- case HTMLToken::DOCTYPE:
+ case Type::DOCTYPE:
if (LIKELY(token.name().size() == 4 && equal(HTMLNames::htmlTag->localName().impl(), token.name().data(), 4)))
m_name = HTMLNames::htmlTag->localName();
else
@@ -244,10 +233,10 @@
m_name = AtomString(token.name().data(), token.name().size());
m_doctypeData = token.releaseDoctypeData();
return;
- case HTMLToken::EndOfFile:
+ case Type::EndOfFile:
return;
- case HTMLToken::StartTag:
- case HTMLToken::EndTag:
+ case Type::StartTag:
+ case Type::EndTag:
m_selfClosing = token.selfClosing();
m_name = HTMLNames::findHTMLTag(token.name());
if (UNLIKELY(m_name.isNull()))
@@ -254,15 +243,14 @@
m_name = AtomString(token.name().data(), token.name().size());
initializeAttributes(token.attributes());
return;
- case HTMLToken::Comment:
+ case Type::Comment:
if (token.commentIsAll8BitData())
m_data = String::make8BitFrom16BitSource(token.comment());
else
m_data = String(token.comment());
return;
- case HTMLToken::Character:
- m_externalCharacters = token.characters().data();
- m_externalCharactersLength = token.characters().size();
+ case Type::Character:
+ m_externalCharacters = token.characters().span();
m_externalCharactersIsAll8BitData = token.charactersIsAll8BitData();
return;
}
@@ -270,12 +258,11 @@
}
inline AtomHTMLToken::AtomHTMLToken(HTMLToken::Type type, const AtomString& name, Vector<Attribute>&& attributes)
- : m_type(type)
- , m_name(name)
- , m_selfClosing(false)
+ : m_name(name)
, m_attributes(WTFMove(attributes))
+ , m_type(type)
{
- ASSERT(type == HTMLToken::StartTag || type == HTMLToken::EndTag);
+ ASSERT(type == Type::StartTag || type == Type::EndTag);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -56,6 +56,7 @@
using namespace HTMLNames;
+enum class HasDuplicateAttribute : bool { No, Yes };
static inline void setAttributes(Element& element, Vector<Attribute>& attributes, HasDuplicateAttribute hasDuplicateAttribute, ParserContentPolicy parserContentPolicy)
{
if (!scriptingContentIsAllowed(parserContentPolicy))
@@ -66,7 +67,7 @@
static inline void setAttributes(Element& element, AtomHTMLToken& token, ParserContentPolicy parserContentPolicy)
{
- setAttributes(element, token.attributes(), token.hasDuplicateAttribute(), parserContentPolicy);
+ setAttributes(element, token.attributes(), token.hasDuplicateAttribute() ? HasDuplicateAttribute::Yes : HasDuplicateAttribute::No, parserContentPolicy);
}
static bool hasImpliedEndTag(const HTMLStackItem& item)
@@ -428,7 +429,7 @@
void HTMLConstructionSite::insertDoctype(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::DOCTYPE);
+ ASSERT(token.type() == HTMLToken::Type::DOCTYPE);
String publicId = token.publicIdentifier();
String systemId = token.systemIdentifier();
@@ -452,19 +453,19 @@
void HTMLConstructionSite::insertComment(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::Comment);
+ ASSERT(token.type() == HTMLToken::Type::Comment);
attachLater(currentNode(), Comment::create(ownerDocumentForCurrentNode(), WTFMove(token.comment())));
}
void HTMLConstructionSite::insertCommentOnDocument(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::Comment);
+ ASSERT(token.type() == HTMLToken::Type::Comment);
attachLater(m_attachmentRoot, Comment::create(m_document, WTFMove(token.comment())));
}
void HTMLConstructionSite::insertCommentOnHTMLHtmlElement(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::Comment);
+ ASSERT(token.type() == HTMLToken::Type::Comment);
ContainerNode& parent = m_openElements.rootNode();
attachLater(parent, Comment::create(parent.document(), WTFMove(token.comment())));
}
@@ -526,7 +527,7 @@
void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::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.
@@ -563,7 +564,7 @@
void HTMLConstructionSite::insertForeignElement(AtomHTMLToken&& token, const AtomString& namespaceURI)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
notImplemented(); // parseError when xmlns or xmlns:xlink are wrong.
auto element = createElement(token, namespaceURI);
@@ -721,7 +722,7 @@
HTMLStackItem HTMLConstructionSite::createElementFromSavedToken(const HTMLStackItem& item)
{
// NOTE: Moving from item -> token -> item copies the Attribute vector twice!
- AtomHTMLToken fakeToken(HTMLToken::StartTag, item.localName(), Vector<Attribute>(item.attributes()));
+ AtomHTMLToken fakeToken(HTMLToken::Type::StartTag, item.localName(), Vector<Attribute>(item.attributes()));
ASSERT(item.namespaceURI() == HTMLNames::xhtmlNamespaceURI);
ASSERT(isFormattingTag(item.localName()));
return HTMLStackItem(createHTMLElement(fakeToken), WTFMove(fakeToken), item.namespaceURI());
Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -346,7 +346,7 @@
// 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() != HTMLToken::Character) {
+ if (rawToken->type() != HTMLToken::Type::Character) {
// Clearing the TokenPtr makes sure we don't clear the HTMLToken a second time
// later when the TokenPtr is destroyed.
rawToken.clear();
Modified: trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -155,8 +155,8 @@
m_input.append(m_codec->decode(data, length, false, false, ignoredSawErrorFlag));
while (auto token = m_tokenizer.nextToken(m_input)) {
- bool isEnd = token->type() == HTMLToken::EndTag;
- if (isEnd || token->type() == HTMLToken::StartTag) {
+ bool isEnd = token->type() == HTMLToken::Type::EndTag;
+ if (isEnd || token->type() == HTMLToken::Type::StartTag) {
AtomString tagName(token->name());
if (!isEnd) {
m_tokenizer.updateStateFor(tagName);
Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -416,13 +416,13 @@
void TokenPreloadScanner::scan(const HTMLToken& token, Vector<std::unique_ptr<PreloadRequest>>& requests, Document& document)
{
switch (token.type()) {
- case HTMLToken::Character:
+ case HTMLToken::Type::Character:
if (!m_inStyle)
return;
m_cssScanner.scan(token.characters(), requests);
return;
- case HTMLToken::EndTag: {
+ case HTMLToken::Type::EndTag: {
TagId tagId = tagIdFor(token.name());
if (tagId == TagId::Template) {
if (m_templateCount)
@@ -439,7 +439,7 @@
return;
}
- case HTMLToken::StartTag: {
+ case HTMLToken::Type::StartTag: {
if (m_templateCount)
return;
TagId tagId = tagIdFor(token.name());
@@ -511,7 +511,7 @@
PreloadRequestStream requests;
while (auto token = m_tokenizer.nextToken(m_source)) {
- if (token->type() == HTMLToken::StartTag)
+ if (token->type() == HTMLToken::Type::StartTag)
m_tokenizer.updateStateFor(AtomString(token->name()));
m_scanner.scan(*token, requests, document);
}
Modified: trunk/Source/WebCore/html/parser/HTMLToken.h (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLToken.h 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLToken.h 2022-06-04 20:59:23 UTC (rev 295268)
@@ -33,10 +33,10 @@
struct DoctypeData {
WTF_MAKE_FAST_ALLOCATED;
public:
+ Vector<UChar> publicIdentifier;
+ Vector<UChar> systemIdentifier;
bool hasPublicIdentifier { false };
bool hasSystemIdentifier { false };
- Vector<UChar> publicIdentifier;
- Vector<UChar> systemIdentifier;
bool forceQuirks { false };
};
@@ -43,7 +43,7 @@
class HTMLToken {
WTF_MAKE_FAST_ALLOCATED;
public:
- enum Type {
+ enum class Type : uint8_t {
Uninitialized,
DOCTYPE,
StartTag,
@@ -61,7 +61,7 @@
typedef Vector<Attribute, 10> AttributeList;
typedef Vector<UChar, 256> DataVector;
- HTMLToken();
+ HTMLToken() = default;
void clear();
@@ -136,10 +136,9 @@
void appendToComment(UChar);
private:
- Type m_type;
-
DataVector m_data;
- UChar m_data8BitCheck;
+ UChar m_data8BitCheck { 0 };
+ Type m_type { Type::Uninitialized };
// For StartTag and EndTag
bool m_selfClosing;
@@ -152,15 +151,9 @@
const HTMLToken::Attribute* findAttribute(const Vector<HTMLToken::Attribute>&, StringView name);
-inline HTMLToken::HTMLToken()
- : m_type(Uninitialized)
- , m_data8BitCheck(0)
-{
-}
-
inline void HTMLToken::clear()
{
- m_type = Uninitialized;
+ m_type = Type::Uninitialized;
m_data.clear();
m_data8BitCheck = 0;
}
@@ -172,19 +165,19 @@
inline void HTMLToken::makeEndOfFile()
{
- ASSERT(m_type == Uninitialized);
- m_type = EndOfFile;
+ ASSERT(m_type == Type::Uninitialized);
+ m_type = Type::EndOfFile;
}
inline const HTMLToken::DataVector& HTMLToken::name() const
{
- ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag || m_type == Type::DOCTYPE);
return m_data;
}
inline void HTMLToken::appendToName(UChar character)
{
- ASSERT(m_type == StartTag || m_type == EndTag || m_type == DOCTYPE);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag || m_type == Type::DOCTYPE);
ASSERT(character);
m_data.append(character);
m_data8BitCheck |= character;
@@ -192,14 +185,14 @@
inline void HTMLToken::setForceQuirks()
{
- ASSERT(m_type == DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
m_doctypeData->forceQuirks = true;
}
inline void HTMLToken::beginDOCTYPE()
{
- ASSERT(m_type == Uninitialized);
- m_type = DOCTYPE;
+ ASSERT(m_type == Type::Uninitialized);
+ m_type = Type::DOCTYPE;
m_doctypeData = makeUnique<DoctypeData>();
}
@@ -213,7 +206,7 @@
inline void HTMLToken::setPublicIdentifierToEmptyString()
{
- ASSERT(m_type == DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
m_doctypeData->hasPublicIdentifier = true;
m_doctypeData->publicIdentifier.clear();
}
@@ -220,7 +213,7 @@
inline void HTMLToken::setSystemIdentifierToEmptyString()
{
- ASSERT(m_type == DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
m_doctypeData->hasSystemIdentifier = true;
m_doctypeData->systemIdentifier.clear();
}
@@ -228,7 +221,7 @@
inline void HTMLToken::appendToPublicIdentifier(UChar character)
{
ASSERT(character);
- ASSERT(m_type == DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
ASSERT(m_doctypeData->hasPublicIdentifier);
m_doctypeData->publicIdentifier.append(character);
}
@@ -236,7 +229,7 @@
inline void HTMLToken::appendToSystemIdentifier(UChar character)
{
ASSERT(character);
- ASSERT(m_type == DOCTYPE);
+ ASSERT(m_type == Type::DOCTYPE);
ASSERT(m_doctypeData->hasSystemIdentifier);
m_doctypeData->systemIdentifier.append(character);
}
@@ -248,13 +241,13 @@
inline bool HTMLToken::selfClosing() const
{
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
return m_selfClosing;
}
inline void HTMLToken::setSelfClosing()
{
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
m_selfClosing = true;
}
@@ -261,8 +254,8 @@
inline void HTMLToken::beginStartTag(LChar character)
{
ASSERT(character);
- ASSERT(m_type == Uninitialized);
- m_type = StartTag;
+ ASSERT(m_type == Type::Uninitialized);
+ m_type = Type::StartTag;
m_selfClosing = false;
m_attributes.clear();
@@ -275,8 +268,8 @@
inline void HTMLToken::beginEndTag(LChar character)
{
- ASSERT(m_type == Uninitialized);
- m_type = EndTag;
+ ASSERT(m_type == Type::Uninitialized);
+ m_type = Type::EndTag;
m_selfClosing = false;
m_attributes.clear();
@@ -289,8 +282,8 @@
inline void HTMLToken::beginEndTag(const Vector<LChar, 32>& characters)
{
- ASSERT(m_type == Uninitialized);
- m_type = EndTag;
+ ASSERT(m_type == Type::Uninitialized);
+ m_type = Type::EndTag;
m_selfClosing = false;
m_attributes.clear();
@@ -303,7 +296,7 @@
inline void HTMLToken::beginAttribute()
{
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
m_attributes.grow(m_attributes.size() + 1);
m_currentAttribute = &m_attributes.last();
}
@@ -319,7 +312,7 @@
inline void HTMLToken::appendToAttributeName(UChar character)
{
ASSERT(character);
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
ASSERT(m_currentAttribute);
m_currentAttribute->name.append(character);
}
@@ -327,7 +320,7 @@
inline void HTMLToken::appendToAttributeValue(UChar character)
{
ASSERT(character);
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
ASSERT(m_currentAttribute);
m_currentAttribute->value.append(character);
}
@@ -335,7 +328,7 @@
template<typename CharacterType>
inline void HTMLToken::appendToAttributeValue(Span<const CharacterType> characters)
{
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
ASSERT(m_currentAttribute);
m_currentAttribute->value.append(characters);
}
@@ -343,39 +336,39 @@
inline void HTMLToken::appendToAttributeValue(unsigned i, StringView value)
{
ASSERT(!value.isEmpty());
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
append(m_attributes[i].value, value);
}
inline const HTMLToken::AttributeList& HTMLToken::attributes() const
{
- ASSERT(m_type == StartTag || m_type == EndTag);
+ ASSERT(m_type == Type::StartTag || m_type == Type::EndTag);
return m_attributes;
}
inline const HTMLToken::DataVector& HTMLToken::characters() const
{
- ASSERT(m_type == Character);
+ ASSERT(m_type == Type::Character);
return m_data;
}
inline bool HTMLToken::charactersIsAll8BitData() const
{
- ASSERT(m_type == Character);
+ ASSERT(m_type == Type::Character);
return m_data8BitCheck <= 0xFF;
}
inline void HTMLToken::appendToCharacter(LChar character)
{
- ASSERT(m_type == Uninitialized || m_type == Character);
- m_type = Character;
+ ASSERT(m_type == Type::Uninitialized || m_type == Type::Character);
+ m_type = Type::Character;
m_data.append(character);
}
inline void HTMLToken::appendToCharacter(UChar character)
{
- ASSERT(m_type == Uninitialized || m_type == Character);
- m_type = Character;
+ ASSERT(m_type == Type::Uninitialized || m_type == Type::Character);
+ m_type = Type::Character;
m_data.append(character);
m_data8BitCheck |= character;
}
@@ -382,8 +375,8 @@
inline void HTMLToken::appendToCharacter(const Vector<LChar, 32>& characters)
{
- ASSERT(m_type == Uninitialized || m_type == Character);
- m_type = Character;
+ ASSERT(m_type == Type::Uninitialized || m_type == Type::Character);
+ m_type = Type::Character;
m_data.appendVector(characters);
}
@@ -390,7 +383,7 @@
template<typename CharacterType>
inline void HTMLToken::appendToCharacter(Span<const CharacterType> characters)
{
- m_type = Character;
+ m_type = Type::Character;
m_data.append(characters);
if constexpr (std::is_same_v<CharacterType, UChar>) {
if (!charactersIsAll8BitData())
@@ -402,32 +395,32 @@
inline const HTMLToken::DataVector& HTMLToken::comment() const
{
- ASSERT(m_type == Comment);
+ ASSERT(m_type == Type::Comment);
return m_data;
}
inline bool HTMLToken::commentIsAll8BitData() const
{
- ASSERT(m_type == Comment);
+ ASSERT(m_type == Type::Comment);
return m_data8BitCheck <= 0xFF;
}
inline void HTMLToken::beginComment()
{
- ASSERT(m_type == Uninitialized);
- m_type = Comment;
+ ASSERT(m_type == Type::Uninitialized);
+ m_type = Type::Comment;
}
inline void HTMLToken::appendToComment(char character)
{
ASSERT(character);
- ASSERT(m_type == Comment);
+ ASSERT(m_type == Type::Comment);
m_data.append(character);
}
inline void HTMLToken::appendToComment(ASCIILiteral literal)
{
- ASSERT(m_type == Comment);
+ ASSERT(m_type == Type::Comment);
m_data.append(literal.characters8(), literal.length());
}
@@ -434,7 +427,7 @@
inline void HTMLToken::appendToComment(UChar character)
{
ASSERT(character);
- ASSERT(m_type == Comment);
+ ASSERT(m_type == Type::Comment);
m_data.append(character);
m_data8BitCheck |= character;
}
Modified: trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -119,14 +119,14 @@
inline void HTMLTokenizer::saveEndTagNameIfNeeded()
{
- ASSERT(m_token.type() != HTMLToken::Uninitialized);
- if (m_token.type() == HTMLToken::StartTag)
+ ASSERT(m_token.type() != HTMLToken::Type::Uninitialized);
+ if (m_token.type() == HTMLToken::Type::StartTag)
m_appropriateEndTagName = m_token.name();
}
inline bool HTMLTokenizer::haveBufferedCharacterToken() const
{
- return m_token.type() == HTMLToken::Character;
+ return m_token.type() == HTMLToken::Type::Character;
}
inline bool HTMLTokenizer::processEntity(SegmentedString& source)
Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -147,7 +147,7 @@
class HTMLTreeBuilder::ExternalCharacterTokenBuffer {
public:
explicit ExternalCharacterTokenBuffer(AtomHTMLToken& token)
- : m_text(token.characters(), token.charactersLength())
+ : m_text(token.characters())
, m_isAll8BitData(token.charactersIsAll8BitData())
{
ASSERT(!isEmpty());
@@ -371,29 +371,29 @@
void HTMLTreeBuilder::processToken(AtomHTMLToken&& token)
{
switch (token.type()) {
- case HTMLToken::Uninitialized:
+ case HTMLToken::Type::Uninitialized:
ASSERT_NOT_REACHED();
break;
- case HTMLToken::DOCTYPE:
+ case HTMLToken::Type::DOCTYPE:
m_shouldSkipLeadingNewline = false;
processDoctypeToken(WTFMove(token));
break;
- case HTMLToken::StartTag:
+ case HTMLToken::Type::StartTag:
m_shouldSkipLeadingNewline = false;
processStartTag(WTFMove(token));
break;
- case HTMLToken::EndTag:
+ case HTMLToken::Type::EndTag:
m_shouldSkipLeadingNewline = false;
processEndTag(WTFMove(token));
break;
- case HTMLToken::Comment:
+ case HTMLToken::Type::Comment:
m_shouldSkipLeadingNewline = false;
processComment(WTFMove(token));
return;
- case HTMLToken::Character:
+ case HTMLToken::Type::Character:
processCharacter(WTFMove(token));
break;
- case HTMLToken::EndOfFile:
+ case HTMLToken::Type::EndOfFile:
m_shouldSkipLeadingNewline = false;
processEndOfFile(WTFMove(token));
break;
@@ -402,7 +402,7 @@
void HTMLTreeBuilder::processDoctypeToken(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::DOCTYPE);
+ ASSERT(token.type() == HTMLToken::Type::DOCTYPE);
if (m_insertionMode == InsertionMode::Initial) {
m_tree.insertDoctype(WTFMove(token));
m_insertionMode = InsertionMode::BeforeHTML;
@@ -419,13 +419,13 @@
void HTMLTreeBuilder::processFakeStartTag(const QualifiedName& tagName, Vector<Attribute>&& attributes)
{
// FIXME: We'll need a fancier conversion than just "localName" for SVG/MathML tags.
- AtomHTMLToken fakeToken(HTMLToken::StartTag, tagName.localName(), WTFMove(attributes));
+ AtomHTMLToken fakeToken(HTMLToken::Type::StartTag, tagName.localName(), WTFMove(attributes));
processStartTag(WTFMove(fakeToken));
}
void HTMLTreeBuilder::processFakeEndTag(const AtomString& tagName)
{
- AtomHTMLToken fakeToken(HTMLToken::EndTag, tagName);
+ AtomHTMLToken fakeToken(HTMLToken::Type::EndTag, tagName);
processEndTag(WTFMove(fakeToken));
}
@@ -446,7 +446,7 @@
{
if (!m_tree.openElements().inButtonScope(pTag->localName()))
return;
- AtomHTMLToken endP(HTMLToken::EndTag, pTag->localName());
+ AtomHTMLToken endP(HTMLToken::Type::EndTag, pTag->localName());
processEndTag(WTFMove(endP));
}
@@ -558,7 +558,7 @@
void HTMLTreeBuilder::processStartTagForInBody(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
if (token.name() == htmlTag) {
processHtmlStartTagForInBody(WTFMove(token));
return;
@@ -815,7 +815,7 @@
}
if (token.name() == optgroupTag || token.name() == optionTag) {
if (is<HTMLOptionElement>(m_tree.currentStackItem().node())) {
- AtomHTMLToken endOption(HTMLToken::EndTag, optionTag->localName());
+ AtomHTMLToken endOption(HTMLToken::Type::EndTag, optionTag->localName());
processEndTag(WTFMove(endOption));
}
m_tree.reconstructTheActiveFormattingElements();
@@ -910,7 +910,7 @@
bool HTMLTreeBuilder::processEndOfFileForInTemplateContents(AtomHTMLToken&& token)
{
- AtomHTMLToken endTemplate(HTMLToken::EndTag, templateTag->localName());
+ AtomHTMLToken endTemplate(HTMLToken::Type::EndTag, templateTag->localName());
if (!processTemplateEndTag(WTFMove(endTemplate)))
return false;
@@ -948,7 +948,7 @@
void HTMLTreeBuilder::processStartTagForInTable(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
if (token.name() == captionTag) {
m_tree.openElements().popUntilTableScopeMarker();
m_tree.activeFormattingElements().appendMarker();
@@ -1021,7 +1021,7 @@
void HTMLTreeBuilder::processStartTag(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
switch (m_insertionMode) {
case InsertionMode::Initial:
defaultForInitial();
@@ -1271,7 +1271,7 @@
|| token.name() == trTag
|| isTableCellContextTag(token.name())) {
parseError(token);
- AtomHTMLToken endSelect(HTMLToken::EndTag, selectTag->localName());
+ AtomHTMLToken endSelect(HTMLToken::Type::EndTag, selectTag->localName());
processEndTag(WTFMove(endSelect));
processStartTag(WTFMove(token));
return;
@@ -1284,7 +1284,7 @@
}
if (token.name() == optionTag) {
if (is<HTMLOptionElement>(m_tree.currentStackItem().node())) {
- AtomHTMLToken endOption(HTMLToken::EndTag, optionTag->localName());
+ AtomHTMLToken endOption(HTMLToken::Type::EndTag, optionTag->localName());
processEndTag(WTFMove(endOption));
}
m_tree.insertHTMLElement(WTFMove(token));
@@ -1292,11 +1292,11 @@
}
if (token.name() == optgroupTag) {
if (is<HTMLOptionElement>(m_tree.currentStackItem().node())) {
- AtomHTMLToken endOption(HTMLToken::EndTag, optionTag->localName());
+ AtomHTMLToken endOption(HTMLToken::Type::EndTag, optionTag->localName());
processEndTag(WTFMove(endOption));
}
if (is<HTMLOptGroupElement>(m_tree.currentStackItem().node())) {
- AtomHTMLToken endOptgroup(HTMLToken::EndTag, optgroupTag->localName());
+ AtomHTMLToken endOptgroup(HTMLToken::Type::EndTag, optgroupTag->localName());
processEndTag(WTFMove(endOptgroup));
}
m_tree.insertHTMLElement(WTFMove(token));
@@ -1304,7 +1304,7 @@
}
if (token.name() == selectTag) {
parseError(token);
- AtomHTMLToken endSelect(HTMLToken::EndTag, selectTag->localName());
+ AtomHTMLToken endSelect(HTMLToken::Type::EndTag, selectTag->localName());
processEndTag(WTFMove(endSelect));
return;
}
@@ -1314,7 +1314,7 @@
ASSERT(isParsingFragment());
return;
}
- AtomHTMLToken endSelect(HTMLToken::EndTag, selectTag->localName());
+ AtomHTMLToken endSelect(HTMLToken::Type::EndTag, selectTag->localName());
processEndTag(WTFMove(endSelect));
processStartTag(WTFMove(token));
return;
@@ -1384,7 +1384,7 @@
bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
ASSERT(token.name() == bodyTag);
if (!m_tree.openElements().inScope(bodyTag->localName())) {
parseError(token);
@@ -1397,7 +1397,7 @@
void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
for (auto* record = &m_tree.openElements().topRecord(); ; record = record->next()) {
HTMLStackItem& item = record->stackItem();
if (item.matchesHTMLTag(token.name())) {
@@ -1599,7 +1599,7 @@
void HTMLTreeBuilder::processEndTagForInTableBody(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
if (isTableBodyContextTag(token.name())) {
if (!m_tree.openElements().inTableScope(token.name())) {
parseError(token);
@@ -1636,7 +1636,7 @@
void HTMLTreeBuilder::processEndTagForInRow(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
if (token.name() == trTag) {
processTrEndTagForInRow();
return;
@@ -1672,7 +1672,7 @@
void HTMLTreeBuilder::processEndTagForInCell(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
if (isTableCellContextTag(token.name())) {
if (!m_tree.openElements().inTableScope(token.name())) {
parseError(token);
@@ -1709,13 +1709,13 @@
void HTMLTreeBuilder::processEndTagForInBody(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
if (token.name() == bodyTag) {
processBodyEndTagForInBody(WTFMove(token));
return;
}
if (token.name() == htmlTag) {
- AtomHTMLToken endBody(HTMLToken::EndTag, bodyTag->localName());
+ AtomHTMLToken endBody(HTMLToken::Type::EndTag, bodyTag->localName());
if (processBodyEndTagForInBody(WTFMove(endBody)))
processEndTag(WTFMove(token));
return;
@@ -1896,7 +1896,7 @@
void HTMLTreeBuilder::processEndTagForInTable(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
if (token.name() == tableTag) {
processTableEndTagForInTable();
return;
@@ -1918,7 +1918,7 @@
void HTMLTreeBuilder::processEndTag(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndTag);
+ ASSERT(token.type() == HTMLToken::Type::EndTag);
switch (m_insertionMode) {
case InsertionMode::Initial:
defaultForInitial();
@@ -2111,7 +2111,7 @@
|| isTableCellContextTag(token.name())) {
parseError(token);
if (m_tree.openElements().inTableScope(token.name())) {
- AtomHTMLToken endSelect(HTMLToken::EndTag, selectTag->localName());
+ AtomHTMLToken endSelect(HTMLToken::Type::EndTag, selectTag->localName());
processEndTag(WTFMove(endSelect));
processEndTag(WTFMove(token));
}
@@ -2168,7 +2168,7 @@
void HTMLTreeBuilder::processComment(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::Comment);
+ ASSERT(token.type() == HTMLToken::Type::Comment);
if (m_insertionMode == InsertionMode::Initial
|| m_insertionMode == InsertionMode::BeforeHTML
|| m_insertionMode == InsertionMode::AfterAfterBody
@@ -2190,7 +2190,7 @@
void HTMLTreeBuilder::processCharacter(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::Character);
+ ASSERT(token.type() == HTMLToken::Type::Character);
ExternalCharacterTokenBuffer buffer(token);
processCharacterBuffer(buffer);
}
@@ -2204,8 +2204,8 @@
Attribute attribute(HTMLNames::hrefAttr, makeAtomString("tel:"_s, string));
const AtomString& aTagLocalName = aTag->localName();
- AtomHTMLToken aStartToken(HTMLToken::StartTag, aTagLocalName, { WTFMove(attribute) });
- AtomHTMLToken aEndToken(HTMLToken::EndTag, aTagLocalName);
+ AtomHTMLToken aStartToken(HTMLToken::Type::StartTag, aTagLocalName, { WTFMove(attribute) });
+ AtomHTMLToken aEndToken(HTMLToken::Type::EndTag, aTagLocalName);
processStartTag(WTFMove(aStartToken));
m_tree.executeQueuedTasks();
@@ -2449,7 +2449,7 @@
void HTMLTreeBuilder::processEndOfFile(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::EndOfFile);
+ ASSERT(token.type() == HTMLToken::Type::EndOfFile);
switch (m_insertionMode) {
case InsertionMode::Initial:
defaultForInitial();
@@ -2543,7 +2543,7 @@
void HTMLTreeBuilder::defaultForBeforeHTML()
{
- AtomHTMLToken startHTML(HTMLToken::StartTag, htmlTag->localName());
+ AtomHTMLToken startHTML(HTMLToken::Type::StartTag, htmlTag->localName());
m_tree.insertHTMLHtmlStartTagBeforeHTML(WTFMove(startHTML));
m_insertionMode = InsertionMode::BeforeHead;
}
@@ -2550,25 +2550,25 @@
void HTMLTreeBuilder::defaultForBeforeHead()
{
- AtomHTMLToken startHead(HTMLToken::StartTag, headTag->localName());
+ AtomHTMLToken startHead(HTMLToken::Type::StartTag, headTag->localName());
processStartTag(WTFMove(startHead));
}
void HTMLTreeBuilder::defaultForInHead()
{
- AtomHTMLToken endHead(HTMLToken::EndTag, headTag->localName());
+ AtomHTMLToken endHead(HTMLToken::Type::EndTag, headTag->localName());
processEndTag(WTFMove(endHead));
}
void HTMLTreeBuilder::defaultForInHeadNoscript()
{
- AtomHTMLToken endNoscript(HTMLToken::EndTag, noscriptTag->localName());
+ AtomHTMLToken endNoscript(HTMLToken::Type::EndTag, noscriptTag->localName());
processEndTag(WTFMove(endNoscript));
}
void HTMLTreeBuilder::defaultForAfterHead()
{
- AtomHTMLToken startBody(HTMLToken::StartTag, bodyTag->localName());
+ AtomHTMLToken startBody(HTMLToken::Type::StartTag, bodyTag->localName());
processStartTag(WTFMove(startBody));
m_framesetOk = true;
}
@@ -2592,7 +2592,7 @@
bool HTMLTreeBuilder::processStartTagForInHead(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
if (token.name() == htmlTag) {
processHtmlStartTagForInBody(WTFMove(token));
return true;
@@ -2645,7 +2645,7 @@
void HTMLTreeBuilder::processGenericRCDATAStartTag(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
m_tree.insertHTMLElement(WTFMove(token));
m_parser.tokenizer().setRCDATAState();
m_originalInsertionMode = m_insertionMode;
@@ -2654,7 +2654,7 @@
void HTMLTreeBuilder::processGenericRawTextStartTag(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
m_tree.insertHTMLElement(WTFMove(token));
m_parser.tokenizer().setRAWTEXTState();
m_originalInsertionMode = m_insertionMode;
@@ -2663,7 +2663,7 @@
void HTMLTreeBuilder::processScriptStartTag(AtomHTMLToken&& token)
{
- ASSERT(token.type() == HTMLToken::StartTag);
+ ASSERT(token.type() == HTMLToken::Type::StartTag);
m_tree.insertScriptElement(WTFMove(token));
m_parser.tokenizer().setScriptDataState();
m_originalInsertionMode = m_insertionMode;
@@ -2694,24 +2694,24 @@
if (isInHTMLNamespace(adjustedCurrentNode))
return false;
if (HTMLElementStack::isMathMLTextIntegrationPoint(adjustedCurrentNode)) {
- if (token.type() == HTMLToken::StartTag
+ if (token.type() == HTMLToken::Type::StartTag
&& token.name() != MathMLNames::mglyphTag
&& token.name() != MathMLNames::malignmarkTag)
return false;
- if (token.type() == HTMLToken::Character)
+ if (token.type() == HTMLToken::Type::Character)
return false;
}
if (adjustedCurrentNode.hasTagName(MathMLNames::annotation_xmlTag)
- && token.type() == HTMLToken::StartTag
+ && token.type() == HTMLToken::Type::StartTag
&& token.name() == SVGNames::svgTag)
return false;
if (HTMLElementStack::isHTMLIntegrationPoint(adjustedCurrentNode)) {
- if (token.type() == HTMLToken::StartTag)
+ if (token.type() == HTMLToken::Type::StartTag)
return false;
- if (token.type() == HTMLToken::Character)
+ if (token.type() == HTMLToken::Type::Character)
return false;
}
- if (token.type() == HTMLToken::EndOfFile)
+ if (token.type() == HTMLToken::Type::EndOfFile)
return false;
return true;
}
@@ -2726,13 +2726,13 @@
HTMLStackItem& adjustedCurrentNode = adjustedCurrentStackItem();
switch (token.type()) {
- case HTMLToken::Uninitialized:
+ case HTMLToken::Type::Uninitialized:
ASSERT_NOT_REACHED();
break;
- case HTMLToken::DOCTYPE:
+ case HTMLToken::Type::DOCTYPE:
parseError(token);
break;
- case HTMLToken::StartTag: {
+ case HTMLToken::Type::StartTag: {
if (token.name() == bTag
|| token.name() == bigTag
|| token.name() == blockquoteTag
@@ -2789,7 +2789,7 @@
m_tree.insertForeignElement(WTFMove(token), currentNamespace);
break;
}
- case HTMLToken::EndTag: {
+ case HTMLToken::Type::EndTag: {
if (adjustedCurrentNode.namespaceURI() == SVGNames::svgNamespaceURI)
adjustSVGTagNameCase(token);
@@ -2819,17 +2819,17 @@
processEndTag(WTFMove(token));
break;
}
- case HTMLToken::Comment:
+ case HTMLToken::Type::Comment:
m_tree.insertComment(WTFMove(token));
return;
- case HTMLToken::Character: {
- String characters = String(token.characters(), token.charactersLength());
+ case HTMLToken::Type::Character: {
+ String characters = token.characters();
m_tree.insertTextNode(characters);
if (m_framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
m_framesetOk = false;
break;
}
- case HTMLToken::EndOfFile:
+ case HTMLToken::Type::EndOfFile:
ASSERT_NOT_REACHED();
break;
}
Modified: trunk/Source/WebCore/html/parser/TextDocumentParser.cpp (295267 => 295268)
--- trunk/Source/WebCore/html/parser/TextDocumentParser.cpp 2022-06-04 18:32:19 UTC (rev 295267)
+++ trunk/Source/WebCore/html/parser/TextDocumentParser.cpp 2022-06-04 20:59:23 UTC (rev 295268)
@@ -52,7 +52,7 @@
// sending fake bytes through the front-end of the parser to avoid
// distrubing the line/column number calculations.
Attribute attribute(styleAttr, "word-wrap: break-word; white-space: pre-wrap;"_s);
- AtomHTMLToken fakePre(HTMLToken::StartTag, preTag->localName(), { WTFMove(attribute) });
+ AtomHTMLToken fakePre(HTMLToken::Type::StartTag, preTag->localName(), { WTFMove(attribute) });
treeBuilder().constructTree(WTFMove(fakePre));
// Normally we would skip the first \n after a <pre> element, but we don't