Title: [292960] trunk/Source/WebCore
Revision
292960
Author
cdu...@apple.com
Date
2022-04-18 10:56:11 -0700 (Mon, 18 Apr 2022)

Log Message

Use AtomString as early as possible when string will eventually get atomized
https://bugs.webkit.org/show_bug.cgi?id=239427

Reviewed by Darin Adler.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText const):
(WebCore::StyleProperties::asTextAtom const):
(WebCore::StyleProperties::asTextInternal const):
* css/StyleProperties.h:
* dom/DOMStringMap.idl:
* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::setNamedItem):
* dom/DatasetDOMStringMap.h:
* dom/Document.cpp:
(WebCore::Document::createAttribute):
(WebCore::Document::createAttributeNS):
* dom/ElementContentEditable.idl:
* dom/StyledElement.cpp:
(WebCore::StyledElement::synchronizeStyleAttributeInternalImpl):
(WebCore::StyledElement::invalidateStyleAttribute):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::removeCSSStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::ReplacementFragment):
(WebCore::ReplaceSelectionCommand::inverseTransformColor):
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
* html/DOMTokenList.cpp:
(WebCore::tokenContainsHTMLSpace):
(WebCore::DOMTokenList::validateToken):
(WebCore::DOMTokenList::validateTokens):
(WebCore::DOMTokenList::addInternal):
(WebCore::DOMTokenList::add):
(WebCore::DOMTokenList::removeInternal):
(WebCore::DOMTokenList::remove):
(WebCore::DOMTokenList::setValue):
* html/DOMTokenList.h:
* html/DOMTokenList.idl:
* html/FileInputType.cpp:
(WebCore::UploadButtonElement::createInternal):
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::formControlType const):
* html/HTMLButtonElement.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setEnterKeyHint):
* html/HTMLElement.h:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::setFormEnctype):
(WebCore::HTMLFormControlElement::setFormMethod):
(WebCore::HTMLFormControlElement::setAutocomplete):
* html/HTMLFormControlElement.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::setAction):
(WebCore::HTMLFormElement::setEnctype):
(WebCore::HTMLFormElement::setMethod):
* html/HTMLFormElement.h:
* html/HTMLFormElement.idl:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::setSrc):
(WebCore::HTMLImageElement::setDecoding):
* html/HTMLImageElement.h:
* html/HTMLImageElement.idl:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultValue const):
(WebCore::HTMLInputElement::setDefaultValue):
* html/HTMLInputElement.h:
* html/HTMLInputElement.idl:
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::createForLegacyFactoryFunction):
(WebCore::HTMLOptionElement::setValue):
(WebCore::HTMLOptionElement::setLabel):
* html/HTMLOptionElement.h:
* html/HTMLOptionElement.idl:
* html/InputTypeNames.cpp:
(WebCore::InputTypeNames::button):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createAutoFillButton):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldCancelButtonElement::create):
* page/Frame.h:
* page/ios/FrameIOS.mm:
(WebCore::Frame::initWithSimpleHTMLDocument):
* svg/SVGLengthValue.cpp:
(WebCore::SVGLengthValue::valueAsAtomString const):
* svg/SVGLengthValue.h:
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::orient const):
(WebCore::SVGMarkerElement::setOrient):
* svg/SVGMarkerElement.h:
* svg/SVGMarkerElement.idl:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::transferSizeAttributesToTargetClone const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292959 => 292960)


--- trunk/Source/WebCore/ChangeLog	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/ChangeLog	2022-04-18 17:56:11 UTC (rev 292960)
@@ -1,3 +1,104 @@
+2022-04-18  Chris Dumez  <cdu...@apple.com>
+
+        Use AtomString as early as possible when string will eventually get atomized
+        https://bugs.webkit.org/show_bug.cgi?id=239427
+
+        Reviewed by Darin Adler.
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::asText const):
+        (WebCore::StyleProperties::asTextAtom const):
+        (WebCore::StyleProperties::asTextInternal const):
+        * css/StyleProperties.h:
+        * dom/DOMStringMap.idl:
+        * dom/DatasetDOMStringMap.cpp:
+        (WebCore::DatasetDOMStringMap::setNamedItem):
+        * dom/DatasetDOMStringMap.h:
+        * dom/Document.cpp:
+        (WebCore::Document::createAttribute):
+        (WebCore::Document::createAttributeNS):
+        * dom/ElementContentEditable.idl:
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::synchronizeStyleAttributeInternalImpl):
+        (WebCore::StyledElement::invalidateStyleAttribute):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
+        (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
+        (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+        (WebCore::ApplyStyleCommand::removeCSSStyle):
+        (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
+        (WebCore::ApplyStyleCommand::applyInlineStyleChange):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplacementFragment::ReplacementFragment):
+        (WebCore::ReplaceSelectionCommand::inverseTransformColor):
+        (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
+        (WebCore::ReplaceSelectionCommand::handleStyleSpans):
+        * html/DOMTokenList.cpp:
+        (WebCore::tokenContainsHTMLSpace):
+        (WebCore::DOMTokenList::validateToken):
+        (WebCore::DOMTokenList::validateTokens):
+        (WebCore::DOMTokenList::addInternal):
+        (WebCore::DOMTokenList::add):
+        (WebCore::DOMTokenList::removeInternal):
+        (WebCore::DOMTokenList::remove):
+        (WebCore::DOMTokenList::setValue):
+        * html/DOMTokenList.h:
+        * html/DOMTokenList.idl:
+        * html/FileInputType.cpp:
+        (WebCore::UploadButtonElement::createInternal):
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::formControlType const):
+        * html/HTMLButtonElement.idl:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::setEnterKeyHint):
+        * html/HTMLElement.h:
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::setFormEnctype):
+        (WebCore::HTMLFormControlElement::setFormMethod):
+        (WebCore::HTMLFormControlElement::setAutocomplete):
+        * html/HTMLFormControlElement.h:
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::setAction):
+        (WebCore::HTMLFormElement::setEnctype):
+        (WebCore::HTMLFormElement::setMethod):
+        * html/HTMLFormElement.h:
+        * html/HTMLFormElement.idl:
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::setSrc):
+        (WebCore::HTMLImageElement::setDecoding):
+        * html/HTMLImageElement.h:
+        * html/HTMLImageElement.idl:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::defaultValue const):
+        (WebCore::HTMLInputElement::setDefaultValue):
+        * html/HTMLInputElement.h:
+        * html/HTMLInputElement.idl:
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::createForLegacyFactoryFunction):
+        (WebCore::HTMLOptionElement::setValue):
+        (WebCore::HTMLOptionElement::setLabel):
+        * html/HTMLOptionElement.h:
+        * html/HTMLOptionElement.idl:
+        * html/InputTypeNames.cpp:
+        (WebCore::InputTypeNames::button):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::createAutoFillButton):
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::SearchFieldCancelButtonElement::create):
+        * page/Frame.h:
+        * page/ios/FrameIOS.mm:
+        (WebCore::Frame::initWithSimpleHTMLDocument):
+        * svg/SVGLengthValue.cpp:
+        (WebCore::SVGLengthValue::valueAsAtomString const):
+        * svg/SVGLengthValue.h:
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::orient const):
+        (WebCore::SVGMarkerElement::setOrient):
+        * svg/SVGMarkerElement.h:
+        * svg/SVGMarkerElement.idl:
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::transferSizeAttributesToTargetClone const):
+
 2022-04-18  Elliott Williams  <e...@apple.com>
 
         [XCBuild] Use XCBuild for all command-line and project builds

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (292959 => 292960)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -1396,6 +1396,16 @@
 
 String StyleProperties::asText() const
 {
+    return asTextInternal().toString();
+}
+
+AtomString StyleProperties::asTextAtom() const
+{
+    return asTextInternal().toAtomString();
+}
+
+StringBuilder StyleProperties::asTextInternal() const
+{
     StringBuilder result;
 
     int positionXPropertyIndex = -1;
@@ -1743,7 +1753,7 @@
     appendPositionOrProperty(repeatXPropertyIndex, repeatYPropertyIndex, "background-repeat", backgroundRepeatShorthand());
 
     ASSERT(!numDecls ^ !result.isEmpty());
-    return result.toString();
+    return result;
 }
 
 bool StyleProperties::hasCSSOMWrapper() const

Modified: trunk/Source/WebCore/css/StyleProperties.h (292959 => 292960)


--- trunk/Source/WebCore/css/StyleProperties.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/css/StyleProperties.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -134,6 +134,7 @@
     Ref<MutableStyleProperties> copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const;
     
     String asText() const;
+    AtomString asTextAtom() const;
 
     bool hasCSSOMWrapper() const;
     bool isMutable() const { return type() == MutablePropertiesType; }
@@ -180,6 +181,7 @@
     String offsetValue() const;
     void appendFontLonghandValueIfExplicit(CSSPropertyID, StringBuilder& result, String& value) const;
     bool shorthandHasVariableReference(CSSPropertyID, String&) const;
+    StringBuilder asTextInternal() const;
 
     friend class PropertySetCSSStyleDeclaration;
 };

Modified: trunk/Source/WebCore/dom/DOMStringMap.idl (292959 => 292960)


--- trunk/Source/WebCore/dom/DOMStringMap.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/dom/DOMStringMap.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -29,8 +29,8 @@
     SkipVTableValidation,
     Exposed=Window
 ] interface DOMStringMap {
-    getter DOMString (DOMString name);
-    [CEReactions] setter undefined (DOMString name, DOMString value);
+    getter DOMString ([AtomString] DOMString name);
+    [CEReactions] setter undefined (DOMString name, [AtomString] DOMString value);
     [CEReactions] deleter undefined (DOMString name);
 };
 

Modified: trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp (292959 => 292960)


--- trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -221,7 +221,7 @@
     return String { };
 }
 
-ExceptionOr<void> DatasetDOMStringMap::setNamedItem(const String& name, const String& value)
+ExceptionOr<void> DatasetDOMStringMap::setNamedItem(const String& name, const AtomString& value)
 {
     if (!isValidPropertyName(name))
         return Exception { SyntaxError };

Modified: trunk/Source/WebCore/dom/DatasetDOMStringMap.h (292959 => 292960)


--- trunk/Source/WebCore/dom/DatasetDOMStringMap.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/dom/DatasetDOMStringMap.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -47,7 +47,7 @@
     Vector<String> supportedPropertyNames() const;
 
     String namedItem(const AtomString& name) const;
-    ExceptionOr<void> setNamedItem(const String& name, const String& value);
+    ExceptionOr<void> setNamedItem(const String& name, const AtomString& value);
     bool deleteNamedProperty(const String& name);
 
     Element& element() { return m_element; }

Modified: trunk/Source/WebCore/dom/Document.cpp (292959 => 292960)


--- trunk/Source/WebCore/dom/Document.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -6069,7 +6069,7 @@
 {
     if (!isValidName(localName))
         return Exception { InvalidCharacterError };
-    return Attr::create(*this, QualifiedName { nullAtom(), isHTMLDocument() ? localName.convertToASCIILowercase() : localName, nullAtom() }, emptyString());
+    return Attr::create(*this, QualifiedName { nullAtom(), isHTMLDocument() ? localName.convertToASCIILowercase() : localName, nullAtom() }, emptyAtom());
 }
 
 ExceptionOr<Ref<Attr>> Document::createAttributeNS(const AtomString& namespaceURI, const String& qualifiedName, bool shouldIgnoreNamespaceChecks)
@@ -6080,7 +6080,7 @@
     QualifiedName parsedName { parseResult.releaseReturnValue() };
     if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(parsedName))
         return Exception { NamespaceError };
-    return Attr::create(*this, parsedName, emptyString());
+    return Attr::create(*this, parsedName, emptyAtom());
 }
 
 const SVGDocumentExtensions* Document::svgExtensions()

Modified: trunk/Source/WebCore/dom/ElementContentEditable.idl (292959 => 292960)


--- trunk/Source/WebCore/dom/ElementContentEditable.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/dom/ElementContentEditable.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -26,7 +26,7 @@
 // https://html.spec.whatwg.org/#elementcontenteditable
 interface mixin ElementContentEditable {
     [CEReactions] attribute DOMString contentEditable;
-    [CEReactions, EnabledBySetting=EnterKeyHintEnabled] attribute DOMString enterKeyHint;
+    [CEReactions, EnabledBySetting=EnterKeyHintEnabled] attribute [AtomString] DOMString enterKeyHint;
     readonly attribute boolean isContentEditable;
     [CEReactions] attribute [AtomString] DOMString inputMode;
 };

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -65,7 +65,7 @@
     ASSERT(elementData()->styleAttributeIsDirty());
     elementData()->setStyleAttributeIsDirty(false);
     if (const StyleProperties* inlineStyle = this->inlineStyle())
-        setSynchronizedLazyAttribute(styleAttr, inlineStyle->asText());
+        setSynchronizedLazyAttribute(styleAttr, inlineStyle->asTextAtom());
 }
 
 StyledElement::~StyledElement()
@@ -253,7 +253,7 @@
     if (styleResolver().ruleSets().hasComplexSelectorsForStyleAttribute()) {
         if (auto* inlineStyle = this->inlineStyle()) {
             elementData()->setStyleAttributeIsDirty(false);
-            auto newValue = inlineStyle->asText();
+            auto newValue = inlineStyle->asTextAtom();
             Style::AttributeChangeInvalidation styleInvalidation(*this, styleAttr, attributeWithoutSynchronization(styleAttr), newValue);
             setSynchronizedLazyAttribute(styleAttr, newValue);
         }

Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (292959 => 292960)


--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -426,7 +426,7 @@
         }
         if (currentFontSize != desiredFontSize) {
             inlineStyle->setProperty(CSSPropertyFontSize, CSSValuePool::singleton().createValue(desiredFontSize, CSSUnitType::CSS_PX), false);
-            setNodeAttribute(*element, styleAttr, inlineStyle->asText());
+            setNodeAttribute(*element, styleAttr, inlineStyle->asTextAtom());
         }
         if (inlineStyle->isEmpty()) {
             removeNodeAttribute(*element, styleAttr);
@@ -545,7 +545,7 @@
             auto inlineStyle = copyStyleOrCreateEmpty(element.inlineStyle());
             inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
             inlineStyle->removeProperty(CSSPropertyDirection);
-            setNodeAttribute(element, styleAttr, inlineStyle->asText());
+            setNodeAttribute(element, styleAttr, inlineStyle->asTextAtom());
             if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
                 removeNodePreservingChildren(element);
         }
@@ -791,7 +791,7 @@
             RefPtr<MutableStyleProperties> inlineStyle = copyStyleOrCreateEmpty(element.inlineStyle());
             if (RefPtr otherStyle = style.style())
                 inlineStyle->mergeAndOverrideOnConflict(*otherStyle);
-            setNodeAttribute(element, styleAttr, inlineStyle->asText());
+            setNodeAttribute(element, styleAttr, inlineStyle->asTextAtom());
             next = NodeTraversal::nextSkippingChildren(*node);
             continue;
         }
@@ -971,7 +971,7 @@
     if (newInlineStyle->isEmpty())
         removeNodeAttribute(element, styleAttr);
     else
-        setNodeAttribute(element, styleAttr, newInlineStyle->asText());
+        setNodeAttribute(element, styleAttr, newInlineStyle->asTextAtom());
 
     if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
         removeNodePreservingChildren(element);
@@ -1015,7 +1015,7 @@
     // Since addInlineStyleIfNeeded can't add styles to block-flow render objects, add style attribute instead.
     // FIXME: applyInlineStyleToRange should be used here instead.
     if ((node.renderer()->isRenderBlockFlow() || node.hasChildNodes()) && is<HTMLElement>(node)) {
-        setNodeAttribute(downcast<HTMLElement>(node), styleAttr, newInlineStyle->style()->asText());
+        setNodeAttribute(downcast<HTMLElement>(node), styleAttr, newInlineStyle->style()->asTextAtom());
         return;
     }
 
@@ -1464,12 +1464,12 @@
             if (auto existingStyle = styleContainer->inlineStyle()) {
                 auto inlineStyle = EditingStyle::create(existingStyle);
                 inlineStyle->overrideWithStyle(*styleToMerge);
-                setNodeAttribute(*styleContainer, styleAttr, inlineStyle->style()->asText());
+                setNodeAttribute(*styleContainer, styleAttr, inlineStyle->style()->asTextAtom());
             } else
-                setNodeAttribute(*styleContainer, styleAttr, styleToMerge->asText());
+                setNodeAttribute(*styleContainer, styleAttr, styleToMerge->asTextAtom());
         } else {
             auto styleElement = createStyleSpanElement(document());
-            styleElement->setAttribute(styleAttr, styleToMerge->asText());
+            styleElement->setAttribute(styleAttr, styleToMerge->asTextAtom());
             surroundNodeRangeWithElement(*startNode, *endNode, WTFMove(styleElement));
         }
     }

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (292959 => 292960)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -184,7 +184,7 @@
     ASSERT(stagingDocument->body());
 
     ComputedStyleExtractor computedStyleOfEditableRoot(editableRoot.get());
-    stagingDocument->body()->setAttributeWithoutSynchronization(styleAttr, computedStyleOfEditableRoot.copyProperties()->asText());
+    stagingDocument->body()->setAttributeWithoutSynchronization(styleAttr, computedStyleOfEditableRoot.copyProperties()->asTextAtom());
 
     RefPtr<StyledElement> holder = insertFragmentForTestRendering(stagingDocument->body());
     if (!holder) {
@@ -622,7 +622,7 @@
         if (editingStyle.ptr() == transformedStyle.ptr())
             continue;
 
-        setNodeAttribute(element, styleAttr, transformedStyle->style()->asText());
+        setNodeAttribute(element, styleAttr, transformedStyle->style()->asTextAtom());
     }
 }
 
@@ -685,7 +685,7 @@
             }
             removeNodeAttribute(*element, styleAttr);
         } else if (newInlineStyle->style()->propertyCount() != inlineStyle->propertyCount())
-            setNodeAttribute(*element, styleAttr, newInlineStyle->style()->asText());
+            setNodeAttribute(*element, styleAttr, newInlineStyle->style()->asTextAtom());
 
         // FIXME: Tolerate differences in id, class, and style attributes.
         if (element->parentNode() && isNonTableCellHTMLBlockElement(element) && areIdenticalElements(*element, *element->parentNode())
@@ -989,7 +989,7 @@
         insertedNodes.willRemoveNodePreservingChildren(wrappingStyleSpan.get());
         removeNodePreservingChildren(*wrappingStyleSpan);
     } else
-        setNodeAttribute(*wrappingStyleSpan, styleAttr, style->style()->asText());
+        setNodeAttribute(*wrappingStyleSpan, styleAttr, style->style()->asTextAtom());
 }
 
 void ReplaceSelectionCommand::mergeEndIfNeeded()

Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/DOMTokenList.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -42,12 +42,12 @@
 {
 }
 
-static inline bool tokenContainsHTMLSpace(const String& token)
+static inline bool tokenContainsHTMLSpace(StringView token)
 {
     return token.find(isHTMLSpace<UChar>) != notFound;
 }
 
-ExceptionOr<void> DOMTokenList::validateToken(const String& token)
+ExceptionOr<void> DOMTokenList::validateToken(StringView token)
 {
     if (token.isEmpty())
         return Exception { SyntaxError };
@@ -58,7 +58,7 @@
     return { };
 }
 
-ExceptionOr<void> DOMTokenList::validateTokens(const String* tokens, size_t length)
+ExceptionOr<void> DOMTokenList::validateTokens(const AtomString* tokens, size_t length)
 {
     for (size_t i = 0; i < length; ++i) {
         auto result = validateToken(tokens[i]);
@@ -73,7 +73,7 @@
     return tokens().contains(token);
 }
 
-inline ExceptionOr<void> DOMTokenList::addInternal(const String* newTokens, size_t length)
+inline ExceptionOr<void> DOMTokenList::addInternal(const AtomString* newTokens, size_t length)
 {
     // This is usually called with a single token.
     Vector<AtomString, 1> uniqueNewTokens;
@@ -97,7 +97,7 @@
     return { };
 }
 
-ExceptionOr<void> DOMTokenList::add(const FixedVector<String>& tokens)
+ExceptionOr<void> DOMTokenList::add(const FixedVector<AtomString>& tokens)
 {
     return addInternal(tokens.data(), tokens.size());
 }
@@ -104,10 +104,10 @@
 
 ExceptionOr<void> DOMTokenList::add(const AtomString& token)
 {
-    return addInternal(&token.string(), 1);
+    return addInternal(&token, 1);
 }
 
-inline ExceptionOr<void> DOMTokenList::removeInternal(const String* tokensToRemove, size_t length)
+inline ExceptionOr<void> DOMTokenList::removeInternal(const AtomString* tokensToRemove, size_t length)
 {
     auto result = validateTokens(tokensToRemove, length);
     if (result.hasException())
@@ -122,7 +122,7 @@
     return { };
 }
 
-ExceptionOr<void> DOMTokenList::remove(const FixedVector<String>& tokens)
+ExceptionOr<void> DOMTokenList::remove(const FixedVector<AtomString>& tokens)
 {
     return removeInternal(tokens.data(), tokens.size());
 }
@@ -129,7 +129,7 @@
 
 ExceptionOr<void> DOMTokenList::remove(const AtomString& token)
 {
-    return removeInternal(&token.string(), 1);
+    return removeInternal(&token, 1);
 }
 
 ExceptionOr<bool> DOMTokenList::toggle(const AtomString& token, std::optional<bool> force)
@@ -215,7 +215,7 @@
     return m_element.getAttribute(m_attributeName);
 }
 
-void DOMTokenList::setValue(const String& value)
+void DOMTokenList::setValue(const AtomString& value)
 {
     m_element.setAttribute(m_attributeName, value);
 }

Modified: trunk/Source/WebCore/html/DOMTokenList.h (292959 => 292960)


--- trunk/Source/WebCore/html/DOMTokenList.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/DOMTokenList.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -45,9 +45,9 @@
     const AtomString& item(unsigned index) const;
 
     WEBCORE_EXPORT bool contains(const AtomString&) const;
-    ExceptionOr<void> add(const FixedVector<String>&);
+    ExceptionOr<void> add(const FixedVector<AtomString>&);
     ExceptionOr<void> add(const AtomString&);
-    ExceptionOr<void> remove(const FixedVector<String>&);
+    ExceptionOr<void> remove(const FixedVector<AtomString>&);
     ExceptionOr<void> remove(const AtomString&);
     WEBCORE_EXPORT ExceptionOr<bool> toggle(const AtomString&, std::optional<bool> force);
     ExceptionOr<bool> replace(const AtomString& token, const AtomString& newToken);
@@ -55,7 +55,7 @@
 
     Element& element() const { return m_element; }
 
-    WEBCORE_EXPORT void setValue(const String&);
+    WEBCORE_EXPORT void setValue(const AtomString&);
     WEBCORE_EXPORT const AtomString& value() const;
 
 private:
@@ -65,10 +65,10 @@
     WEBCORE_EXPORT Vector<AtomString>& tokens();
     const Vector<AtomString>& tokens() const { return const_cast<DOMTokenList&>(*this).tokens(); }
 
-    static ExceptionOr<void> validateToken(const String&);
-    static ExceptionOr<void> validateTokens(const String* tokens, size_t length);
-    ExceptionOr<void> addInternal(const String* tokens, size_t length);
-    ExceptionOr<void> removeInternal(const String* tokens, size_t length);
+    static ExceptionOr<void> validateToken(StringView);
+    static ExceptionOr<void> validateTokens(const AtomString* tokens, size_t length);
+    ExceptionOr<void> addInternal(const AtomString* tokens, size_t length);
+    ExceptionOr<void> removeInternal(const AtomString* tokens, size_t length);
 
     Element& m_element;
     const WebCore::QualifiedName& m_attributeName;

Modified: trunk/Source/WebCore/html/DOMTokenList.idl (292959 => 292960)


--- trunk/Source/WebCore/html/DOMTokenList.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/DOMTokenList.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -30,12 +30,12 @@
 ] interface DOMTokenList {
     readonly attribute unsigned long length;
     getter DOMString? item(unsigned long index);
-    boolean contains(DOMString token);
-    [CEReactions] undefined add(DOMString... tokens);
-    [CEReactions] undefined remove(DOMString... tokens);
-    [CEReactions] boolean toggle(DOMString token, optional boolean force);
-    [CEReactions] boolean replace(DOMString token, DOMString newToken);
+    boolean contains([AtomString] DOMString token);
+    [CEReactions] undefined add([AtomString] DOMString... tokens);
+    [CEReactions] undefined remove([AtomString] DOMString... tokens);
+    [CEReactions] boolean toggle([AtomString] DOMString token, optional boolean force);
+    [CEReactions] boolean replace([AtomString] DOMString token, [AtomString] DOMString newToken);
     boolean supports(DOMString token);
-    [CEReactions] stringifier attribute DOMString value;
+    [CEReactions] stringifier attribute [AtomString] DOMString value;
     iterable<DOMString>;
 };

Modified: trunk/Source/WebCore/html/FileInputType.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/FileInputType.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/FileInputType.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -94,8 +94,7 @@
 Ref<UploadButtonElement> UploadButtonElement::createInternal(Document& document, const String& value)
 {
     auto button = adoptRef(*new UploadButtonElement(document));
-    static MainThreadNeverDestroyed<const AtomString> buttonName("button", AtomString::ConstructFromLiteral);
-    button->setType(buttonName);
+    button->setType(HTMLNames::buttonTag->localName());
     button->setPseudo(ShadowPseudoIds::fileSelectorButton());
     button->setValue(value);
     return button;

Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLButtonElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -86,10 +86,8 @@
             static MainThreadNeverDestroyed<const AtomString> submit("submit", AtomString::ConstructFromLiteral);
             return submit;
         }
-        case BUTTON: {
-            static MainThreadNeverDestroyed<const AtomString> button("button", AtomString::ConstructFromLiteral);
-            return button;
-        }
+        case BUTTON:
+            return HTMLNames::buttonTag->localName();
         case RESET: {
             static MainThreadNeverDestroyed<const AtomString> reset("reset", AtomString::ConstructFromLiteral);
             return reset;

Modified: trunk/Source/WebCore/html/HTMLButtonElement.idl (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLButtonElement.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLButtonElement.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -25,7 +25,7 @@
     readonly attribute HTMLFormElement form;
     [CEReactions=NotNeeded] attribute USVString formAction;
 
-    [CEReactions=NotNeeded] attribute DOMString formEnctype;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString formEnctype;
     [CEReactions=NotNeeded] attribute DOMString formMethod;
     [CEReactions=NotNeeded] attribute [AtomString] DOMString type;
 

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -1113,7 +1113,7 @@
     return attributeValueForEnterKeyHint(canonicalEnterKeyHint());
 }
 
-void HTMLElement::setEnterKeyHint(const String& value)
+void HTMLElement::setEnterKeyHint(const AtomString& value)
 {
     setAttributeWithoutSynchronization(enterkeyhintAttr, value);
 }

Modified: trunk/Source/WebCore/html/HTMLElement.h (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -130,7 +130,7 @@
 
     WEBCORE_EXPORT EnterKeyHint canonicalEnterKeyHint() const;
     String enterKeyHint() const;
-    void setEnterKeyHint(const String& value);
+    void setEnterKeyHint(const AtomString& value);
 
     WEBCORE_EXPORT static bool shouldExtendSelectionToTargetNode(const Node& targetNode, const VisibleSelection& selectionBeforeUpdate);
 

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -90,7 +90,7 @@
     return FormSubmission::Attributes::parseEncodingType(formEnctypeAttr);
 }
 
-void HTMLFormControlElement::setFormEnctype(const String& value)
+void HTMLFormControlElement::setFormEnctype(const AtomString& value)
 {
     setAttributeWithoutSynchronization(formenctypeAttr, value);
 }
@@ -104,7 +104,7 @@
     return FormSubmission::Attributes::methodString(FormSubmission::Attributes::parseMethodType(formMethodAttr, dialogElementEnabled), dialogElementEnabled);
 }
 
-void HTMLFormControlElement::setFormMethod(const String& value)
+void HTMLFormControlElement::setFormMethod(const AtomString& value)
 {
     setAttributeWithoutSynchronization(formmethodAttr, value);
 }
@@ -616,7 +616,7 @@
     return autofillData().idlExposedValue;
 }
 
-void HTMLFormControlElement::setAutocomplete(const String& value)
+void HTMLFormControlElement::setAutocomplete(const AtomString& value)
 {
     setAttributeWithoutSynchronization(autocompleteAttr, value);
 }

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLFormControlElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -51,9 +51,9 @@
     HTMLFormElement* form() const final { return FormAssociatedElement::form(); }
 
     WEBCORE_EXPORT String formEnctype() const;
-    WEBCORE_EXPORT void setFormEnctype(const String&);
+    WEBCORE_EXPORT void setFormEnctype(const AtomString&);
     WEBCORE_EXPORT String formMethod() const;
-    WEBCORE_EXPORT void setFormMethod(const String&);
+    WEBCORE_EXPORT void setFormMethod(const AtomString&);
     bool formNoValidate() const;
     WEBCORE_EXPORT String formAction() const;
     WEBCORE_EXPORT void setFormAction(const AtomString&);
@@ -117,7 +117,7 @@
     bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isReadOnly; }
 
     WEBCORE_EXPORT String autocomplete() const;
-    WEBCORE_EXPORT void setAutocomplete(const String&);
+    WEBCORE_EXPORT void setAutocomplete(const AtomString&);
 
     AutofillMantle autofillMantle() const;
 

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -732,12 +732,12 @@
     return document().completeURL(stripLeadingAndTrailingHTMLSpaces(value)).string();
 }
 
-void HTMLFormElement::setAction(const String& value)
+void HTMLFormElement::setAction(const AtomString& value)
 {
     setAttributeWithoutSynchronization(actionAttr, value);
 }
 
-void HTMLFormElement::setEnctype(const String& value)
+void HTMLFormElement::setEnctype(const AtomString& value)
 {
     setAttributeWithoutSynchronization(enctypeAttr, value);
 }
@@ -747,7 +747,7 @@
     return FormSubmission::Attributes::methodString(m_attributes.method(), document().settings().dialogElementEnabled());
 }
 
-void HTMLFormElement::setMethod(const String& value)
+void HTMLFormElement::setMethod(const AtomString& value)
 {
     setAttributeWithoutSynchronization(methodAttr, value);
 }

Modified: trunk/Source/WebCore/html/HTMLFormElement.h (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLFormElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLFormElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -57,7 +57,7 @@
     Vector<AtomString> supportedPropertyNames() const;
 
     String enctype() const { return m_attributes.encodingType(); }
-    WEBCORE_EXPORT void setEnctype(const String&);
+    WEBCORE_EXPORT void setEnctype(const AtomString&);
 
     bool shouldAutocomplete() const;
 
@@ -97,10 +97,10 @@
     void setAcceptCharset(const String&);
 
     WEBCORE_EXPORT String action() const;
-    WEBCORE_EXPORT void setAction(const String&);
+    WEBCORE_EXPORT void setAction(const AtomString&);
 
     WEBCORE_EXPORT String method() const;
-    WEBCORE_EXPORT void setMethod(const String&);
+    WEBCORE_EXPORT void setMethod(const AtomString&);
 
     DOMTokenList& relList();
 

Modified: trunk/Source/WebCore/html/HTMLFormElement.idl (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLFormElement.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLFormElement.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -27,9 +27,9 @@
     [CEReactions=NotNeeded, Reflect=accept_charset] attribute DOMString acceptCharset;
     [CEReactions=NotNeeded] attribute USVString action;
     [CEReactions=NotNeeded] attribute [AtomString] DOMString autocomplete;
-    [CEReactions=NotNeeded] attribute DOMString enctype;
-    [CEReactions=NotNeeded, ImplementedAs=enctype] attribute DOMString encoding;
-    [CEReactions=NotNeeded] attribute DOMString method;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString enctype;
+    [CEReactions=NotNeeded, ImplementedAs=enctype] attribute [AtomString] DOMString encoding;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString method;
     [CEReactions=NotNeeded, Reflect] attribute DOMString name;
     [CEReactions=NotNeeded, Reflect] attribute boolean noValidate;
     [CEReactions=NotNeeded, Reflect] attribute DOMString target;

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -621,7 +621,7 @@
     return document().completeURL(attributeWithoutSynchronization(srcAttr));
 }
 
-void HTMLImageElement::setSrc(const String& value)
+void HTMLImageElement::setSrc(const AtomString& value)
 {
     setAttributeWithoutSynchronization(srcAttr, value);
 }
@@ -658,7 +658,7 @@
     return m_imageLoader->imageComplete();
 }
 
-void HTMLImageElement::setDecoding(String&& decodingMode)
+void HTMLImageElement::setDecoding(AtomString&& decodingMode)
 {
     setAttributeWithoutSynchronization(decodingAttr, WTFMove(decodingMode));
 }

Modified: trunk/Source/WebCore/html/HTMLImageElement.h (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLImageElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLImageElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -81,7 +81,7 @@
     WEBCORE_EXPORT void setHeight(unsigned);
 
     URL src() const;
-    void setSrc(const String&);
+    void setSrc(const AtomString&);
 
     WEBCORE_EXPORT void setCrossOrigin(const AtomString&);
     WEBCORE_EXPORT String crossOrigin() const;
@@ -93,7 +93,7 @@
 
     WEBCORE_EXPORT bool complete() const;
 
-    void setDecoding(String&&);
+    void setDecoding(AtomString&&);
     String decoding() const;
 
     DecodingMode decodingMode() const;

Modified: trunk/Source/WebCore/html/HTMLImageElement.idl (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLImageElement.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLImageElement.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -41,7 +41,7 @@
     readonly attribute boolean complete;
     readonly attribute USVString currentSrc;
     [CEReactions=NotNeeded, EnabledBySetting=ReferrerPolicyAttributeEnabled, ImplementedAs=referrerPolicyForBindings] attribute [AtomString] DOMString referrerPolicy;
-    [CEReactions=NotNeeded] attribute DOMString decoding;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString decoding;
     [CEReactions, EnabledBySetting=LazyImageLoadingEnabled, ImplementedAs=loadingForBindings] attribute [AtomString] DOMString loading;
 
     Promise<undefined> decode();

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -1305,12 +1305,12 @@
     return { };
 }
 
-String HTMLInputElement::defaultValue() const
+const AtomString& HTMLInputElement::defaultValue() const
 {
     return attributeWithoutSynchronization(valueAttr);
 }
 
-void HTMLInputElement::setDefaultValue(const String &value)
+void HTMLInputElement::setDefaultValue(const AtomString& value)
 {
     setAttributeWithoutSynchronization(valueAttr, value);
 }

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -223,8 +223,8 @@
 
     int maxResults() const { return m_maxResults; }
 
-    WEBCORE_EXPORT String defaultValue() const;
-    WEBCORE_EXPORT void setDefaultValue(const String&);
+    WEBCORE_EXPORT const AtomString& defaultValue() const;
+    WEBCORE_EXPORT void setDefaultValue(const AtomString&);
 
     Vector<String> acceptMIMETypes();
     Vector<String> acceptFileExtensions();

Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLInputElement.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -35,8 +35,8 @@
     [ImplementedAs=filesForBindings] attribute FileList? files;
     [CEReactions=NotNeeded] attribute USVString formAction;
 
-    [CEReactions=NotNeeded] attribute DOMString formEnctype;
-    [CEReactions=NotNeeded] attribute DOMString formMethod;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString formEnctype;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString formMethod;
 
     [CEReactions=NotNeeded, Reflect] attribute boolean formNoValidate;
     [CEReactions=NotNeeded, Reflect] attribute DOMString formTarget;
@@ -57,7 +57,7 @@
     [CEReactions=NotNeeded, Reflect, URL] attribute USVString src;
     [CEReactions=NotNeeded, Reflect] attribute DOMString step;
     [CEReactions=NotNeeded] attribute [AtomString] DOMString type;
-    [CEReactions=NotNeeded] attribute DOMString defaultValue;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString defaultValue;
     // See the discussion in https://bugs.webkit.org/show_bug.cgi?id=100085
     [CEReactions=NotNeeded] attribute [LegacyNullToEmptyString] DOMString value;
     attribute Date? valueAsDate;

Modified: trunk/Source/WebCore/html/HTMLOptionElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLOptionElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLOptionElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -70,7 +70,7 @@
     return adoptRef(*new HTMLOptionElement(tagName, document));
 }
 
-ExceptionOr<Ref<HTMLOptionElement>> HTMLOptionElement::createForLegacyFactoryFunction(Document& document, const String& text, const String& value, bool defaultSelected, bool selected)
+ExceptionOr<Ref<HTMLOptionElement>> HTMLOptionElement::createForLegacyFactoryFunction(Document& document, const String& text, const AtomString& value, bool defaultSelected, bool selected)
 {
     auto element = create(document);
 
@@ -205,7 +205,7 @@
     return stripLeadingAndTrailingHTMLSpaces(collectOptionInnerText()).simplifyWhiteSpace(isHTMLSpace);
 }
 
-void HTMLOptionElement::setValue(const String& value)
+void HTMLOptionElement::setValue(const AtomString& value)
 {
     setAttributeWithoutSynchronization(valueAttr, value);
 }
@@ -283,7 +283,7 @@
     return label();
 }
 
-void HTMLOptionElement::setLabel(const String& label)
+void HTMLOptionElement::setLabel(const AtomString& label)
 {
     setAttributeWithoutSynchronization(labelAttr, label);
 }

Modified: trunk/Source/WebCore/html/HTMLOptionElement.h (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLOptionElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLOptionElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -37,7 +37,7 @@
 public:
     static Ref<HTMLOptionElement> create(Document&);
     static Ref<HTMLOptionElement> create(const QualifiedName&, Document&);
-    static ExceptionOr<Ref<HTMLOptionElement>> createForLegacyFactoryFunction(Document&, const String& text, const String& value, bool defaultSelected, bool selected);
+    static ExceptionOr<Ref<HTMLOptionElement>> createForLegacyFactoryFunction(Document&, const String& text, const AtomString& value, bool defaultSelected, bool selected);
 
     WEBCORE_EXPORT String text() const;
     void setText(const String&);
@@ -45,7 +45,7 @@
     WEBCORE_EXPORT int index() const;
 
     WEBCORE_EXPORT String value() const;
-    WEBCORE_EXPORT void setValue(const String&);
+    WEBCORE_EXPORT void setValue(const AtomString&);
 
     WEBCORE_EXPORT bool selected(AllowStyleInvalidation = AllowStyleInvalidation::Yes) const;
     WEBCORE_EXPORT void setSelected(bool);
@@ -54,7 +54,7 @@
 
     WEBCORE_EXPORT String label() const;
     String displayLabel() const;
-    WEBCORE_EXPORT void setLabel(const String&);
+    WEBCORE_EXPORT void setLabel(const AtomString&);
 
     bool ownElementDisabled() const { return m_disabled; }
 

Modified: trunk/Source/WebCore/html/HTMLOptionElement.idl (292959 => 292960)


--- trunk/Source/WebCore/html/HTMLOptionElement.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/HTMLOptionElement.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -22,14 +22,14 @@
     JSGenerateToNativeObject,
     Exposed=Window,
     LegacyFactoryFunctionCallWith=CurrentDocument,
-    LegacyFactoryFunction=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false),
+    LegacyFactoryFunction=Option(optional DOMString text = "", optional [AtomString] DOMString value, optional boolean defaultSelected = false, optional boolean selected = false),
 ] interface HTMLOptionElement : HTMLElement {
     [CEReactions=NotNeeded, Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
-    [CEReactions=NotNeeded] attribute DOMString label;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString label;
     [CEReactions=NotNeeded, Reflect=selected] attribute boolean defaultSelected;
     attribute boolean selected;
-    [CEReactions=NotNeeded] attribute DOMString value;
+    [CEReactions=NotNeeded] attribute [AtomString] DOMString value;
 
     [CEReactions=NotNeeded, CEReactions] attribute DOMString text;
     readonly attribute long index;

Modified: trunk/Source/WebCore/html/InputTypeNames.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/InputTypeNames.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/InputTypeNames.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -33,8 +33,7 @@
 
 const AtomString& button()
 {
-    static MainThreadNeverDestroyed<const AtomString> name("button", AtomString::ConstructFromLiteral);
-    return name;
+    return HTMLNames::buttonTag->localName();
 }
 
 const AtomString& checkbox()

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -833,11 +833,10 @@
     if (autoFillButtonType == AutoFillButtonType::None)
         return;
 
-    static MainThreadNeverDestroyed<const AtomString> buttonName("button", AtomString::ConstructFromLiteral);
     ASSERT(element());
     m_autoFillButton = AutoFillButtonElement::create(element()->document(), *this);
     m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType));
-    m_autoFillButton->setAttributeWithoutSynchronization(roleAttr, buttonName);
+    m_autoFillButton->setAttributeWithoutSynchronization(roleAttr, HTMLNames::buttonTag->localName());
     m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(autoFillButtonType));
     m_autoFillButton->setTextContent(autoFillButtonTypeToAutoFillButtonText(autoFillButtonType));
     m_container->appendChild(*m_autoFillButton);

Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (292959 => 292960)


--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -297,12 +297,11 @@
 {
     auto element = adoptRef(*new SearchFieldCancelButtonElement(document));
 
-    static MainThreadNeverDestroyed<const AtomString> buttonName("button", AtomString::ConstructFromLiteral);
     element->setPseudo(ShadowPseudoIds::webkitSearchCancelButton());
 #if !PLATFORM(IOS_FAMILY)
     element->setAttributeWithoutSynchronization(aria_labelAttr, AXSearchFieldCancelButtonText());
 #endif
-    element->setAttributeWithoutSynchronization(roleAttr, buttonName);
+    element->setAttributeWithoutSynchronization(roleAttr, HTMLNames::buttonTag->localName());
     return element;
 }
 

Modified: trunk/Source/WebCore/page/Frame.h (292959 => 292960)


--- trunk/Source/WebCore/page/Frame.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/page/Frame.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -124,7 +124,7 @@
     WEBCORE_EXPORT void init();
 #if PLATFORM(IOS_FAMILY)
     // Creates <html><body style="..."></body></html> doing minimal amount of work.
-    WEBCORE_EXPORT void initWithSimpleHTMLDocument(const String& style, const URL&);
+    WEBCORE_EXPORT void initWithSimpleHTMLDocument(const AtomString& style, const URL&);
 #endif
     WEBCORE_EXPORT void setView(RefPtr<FrameView>&&);
     WEBCORE_EXPORT void createView(const IntSize&, const std::optional<Color>& backgroundColor,

Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (292959 => 292960)


--- trunk/Source/WebCore/page/ios/FrameIOS.mm	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm	2022-04-18 17:56:11 UTC (rev 292960)
@@ -80,7 +80,7 @@
 namespace WebCore {
 
 // Create <html><body (style="...")></body></html> doing minimal amount of work.
-void Frame::initWithSimpleHTMLDocument(const String& style, const URL& url)
+void Frame::initWithSimpleHTMLDocument(const AtomString& style, const URL& url)
 {
     m_loader->initForSynthesizedDocument(url);
 

Modified: trunk/Source/WebCore/svg/SVGLengthValue.cpp (292959 => 292960)


--- trunk/Source/WebCore/svg/SVGLengthValue.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/svg/SVGLengthValue.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -269,6 +269,13 @@
     return makeString(m_valueInSpecifiedUnits, lengthTypeToString(m_lengthType));
 }
 
+AtomString SVGLengthValue::valueAsAtomString() const
+{
+    StringBuilder builder;
+    builder.append(m_valueInSpecifiedUnits, lengthTypeToString(m_lengthType));
+    return builder.toAtomString();
+}
+
 ExceptionOr<float> SVGLengthValue::valueForBindings(const SVGLengthContext& context) const
 {
     return context.convertValueToUserUnits(m_valueInSpecifiedUnits, m_lengthType, m_lengthMode);

Modified: trunk/Source/WebCore/svg/SVGLengthValue.h (292959 => 292960)


--- trunk/Source/WebCore/svg/SVGLengthValue.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/svg/SVGLengthValue.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -80,6 +80,7 @@
     float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
     
     String valueAsString() const;
+    AtomString valueAsAtomString() const;
     ExceptionOr<float> valueForBindings(const SVGLengthContext&) const;
 
     void setValueInSpecifiedUnits(float value) { m_valueInSpecifiedUnits = value; }

Modified: trunk/Source/WebCore/svg/SVGMarkerElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/svg/SVGMarkerElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -120,12 +120,12 @@
     setSVGResourcesInAncestorChainAreDirty();
 }
 
-String SVGMarkerElement::orient() const
+AtomString SVGMarkerElement::orient() const
 {
     return getAttribute(SVGNames::orientAttr);
 }
 
-void SVGMarkerElement::setOrient(const String& orient)
+void SVGMarkerElement::setOrient(const AtomString& orient)
 {
     setAttribute(SVGNames::orientAttr, orient);
 }

Modified: trunk/Source/WebCore/svg/SVGMarkerElement.h (292959 => 292960)


--- trunk/Source/WebCore/svg/SVGMarkerElement.h	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.h	2022-04-18 17:56:11 UTC (rev 292960)
@@ -63,8 +63,8 @@
     SVGAnimatedAngle& orientAngleAnimated() { return m_orientAngle; }
     Ref<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.copyRef(); }
 
-    String orient() const;
-    void setOrient(const String&);
+    AtomString orient() const;
+    void setOrient(const AtomString&);
 
     void setOrientToAuto();
     void setOrientToAngle(const SVGAngle&);

Modified: trunk/Source/WebCore/svg/SVGMarkerElement.idl (292959 => 292960)


--- trunk/Source/WebCore/svg/SVGMarkerElement.idl	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.idl	2022-04-18 17:56:11 UTC (rev 292960)
@@ -44,7 +44,7 @@
     [SameObject] readonly attribute SVGAnimatedEnumeration orientType;
     [SameObject] readonly attribute SVGAnimatedAngle       orientAngle;
 
-    attribute DOMString orient;
+    attribute [AtomString] DOMString orient;
 
     undefined setOrientToAuto();
     undefined setOrientToAngle(SVGAngle angle);

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (292959 => 292960)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2022-04-18 17:49:33 UTC (rev 292959)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2022-04-18 17:56:11 UTC (rev 292960)
@@ -143,14 +143,14 @@
         // If attributes width and/or height are provided on the 'use' element, then these attributes
         // will be transferred to the generated 'svg'. If attributes width and/or height are not specified,
         // the generated 'svg' element will use values of 100% for these attributes.
-        shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomString(width().valueAsString()) : "100%"_s);
-        shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomString(height().valueAsString()) : "100%"_s);
+        shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? width().valueAsAtomString() : "100%"_s);
+        shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? height().valueAsAtomString() : "100%"_s);
     } else if (is<SVGSVGElement>(shadowElement)) {
         // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these
         // values will override the corresponding attributes on the 'svg' in the generated tree.
         RefPtr correspondingElement = shadowElement.correspondingElement();
-        shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom()));
-        shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom()));
+        shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? width().valueAsAtomString() : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom()));
+        shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? height().valueAsAtomString() : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom()));
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to