Title: [290086] trunk/Source/WebCore
Revision
290086
Author
[email protected]
Date
2022-02-17 16:01:20 -0800 (Thu, 17 Feb 2022)

Log Message

Always use ChildChange::Source::Parser when creating input element UA shadow tree contents
https://bugs.webkit.org/show_bug.cgi?id=236740

Reviewed by Dean Jackson.

When creating an input element's UA shadow tree, we currently use a
ChildChange::Source value that depends on whether the input element
itself was parser- or script-inserted. But since UA shadow trees are
not exposed to content, and we don't have any dependency on the extra
work that inserting using ChildChange::Source::API does, we can use
ChildChange::Source::Parser unconditionally.

Local testing shows this scores a 0.1% Speedometer 2 improvement.

* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/BaseDateAndTimeInputType.h:
* html/ColorInputType.cpp:
(WebCore::ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/ColorInputType.h:
* html/FileInputType.cpp:
(WebCore::FileInputType::appendFormData const):
(WebCore::FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/FileInputType.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/InputType.cpp:
(WebCore::InputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/InputType.h:
* html/RangeInputType.cpp:
(WebCore::RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/RangeInputType.h:
* html/SearchInputType.cpp:
(WebCore::SearchInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/SearchInputType.h:
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
* html/TextFieldInputType.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290085 => 290086)


--- trunk/Source/WebCore/ChangeLog	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/ChangeLog	2022-02-18 00:01:20 UTC (rev 290086)
@@ -1,3 +1,44 @@
+2022-02-17  Cameron McCormack  <[email protected]>
+
+        Always use ChildChange::Source::Parser when creating input element UA shadow tree contents
+        https://bugs.webkit.org/show_bug.cgi?id=236740
+
+        Reviewed by Dean Jackson.
+
+        When creating an input element's UA shadow tree, we currently use a
+        ChildChange::Source value that depends on whether the input element
+        itself was parser- or script-inserted. But since UA shadow trees are
+        not exposed to content, and we don't have any dependency on the extra
+        work that inserting using ChildChange::Source::API does, we can use
+        ChildChange::Source::Parser unconditionally.
+
+        Local testing shows this scores a 0.1% Speedometer 2 improvement.
+
+        * html/BaseDateAndTimeInputType.cpp:
+        (WebCore::BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/BaseDateAndTimeInputType.h:
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/ColorInputType.h:
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::appendFormData const):
+        (WebCore::FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/FileInputType.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/InputType.cpp:
+        (WebCore::InputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/InputType.h:
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/RangeInputType.h:
+        * html/SearchInputType.cpp:
+        (WebCore::SearchInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/SearchInputType.h:
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
+        * html/TextFieldInputType.h:
+
 2022-02-17  Matt Woodrow  <[email protected]>
 
         Include sub grid items in the track sizing algorithm of the outer grid

Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -306,7 +306,7 @@
     }
 }
 
-void BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
+void BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool)
 {
     ASSERT(needsShadowSubtree());
     ASSERT(element());
@@ -316,11 +316,11 @@
 
     if (document.settings().dateTimeInputsEditableComponentsEnabled()) {
         m_dateTimeEditElement = DateTimeEditElement::create(document, *this);
-        element.userAgentShadowRoot()->appendChild(source, *m_dateTimeEditElement);
+        element.userAgentShadowRoot()->appendChild(ContainerNode::ChildChange::Source::Parser, *m_dateTimeEditElement);
     } else {
         auto valueContainer = HTMLDivElement::create(document);
         valueContainer->setPseudo(ShadowPseudoIds::webkitDateAndTimeValue());
-        element.userAgentShadowRoot()->appendChild(source, valueContainer);
+        element.userAgentShadowRoot()->appendChild(ContainerNode::ChildChange::Source::Parser, valueContainer);
     }
     updateInnerTextValue();
 }
@@ -575,4 +575,5 @@
 }
 
 } // namespace WebCore
+
 #endif

Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -114,7 +114,7 @@
     bool isMouseFocusable() const final;
 
     void handleDOMActivateEvent(Event&) override;
-    void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) final;
+    void createShadowSubtreeAndUpdateInnerTextElementEditability(bool) final;
     void destroyShadowSubtree() final;
     void updateInnerTextValue() final;
     bool hasCustomFocusLogic() const final;

Modified: trunk/Source/WebCore/html/ColorInputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/ColorInputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/ColorInputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -136,7 +136,7 @@
     return parseSimpleColorValue(element()->value()).value();
 }
 
-void ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
+void ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool)
 {
     ASSERT(needsShadowSubtree());
     ASSERT(element());
@@ -147,8 +147,8 @@
     wrapperElement->setPseudo(ShadowPseudoIds::webkitColorSwatchWrapper());
     auto colorSwatch = HTMLDivElement::create(document);
     colorSwatch->setPseudo(ShadowPseudoIds::webkitColorSwatch());
-    wrapperElement->appendChild(source, colorSwatch);
-    element()->userAgentShadowRoot()->appendChild(source, wrapperElement);
+    wrapperElement->appendChild(ContainerNode::ChildChange::Source::Parser, colorSwatch);
+    element()->userAgentShadowRoot()->appendChild(ContainerNode::ChildChange::Source::Parser, wrapperElement);
 
     updateColorSwatch();
 }

Modified: trunk/Source/WebCore/html/ColorInputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/ColorInputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/ColorInputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -62,7 +62,7 @@
     bool supportsRequired() const final;
     String fallbackValue() const final;
     String sanitizeValue(const String&) const final;
-    void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) final;
+    void createShadowSubtreeAndUpdateInnerTextElementEditability(bool) final;
     void setValue(const String&, bool valueChanged, TextFieldEventBehavior) final;
     void attributeChanged(const QualifiedName&) final;
     void handleDOMActivateEvent(Event&) final;

Modified: trunk/Source/WebCore/html/FileInputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/FileInputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/FileInputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -175,7 +175,6 @@
         return true;
     }
 
-
     for (auto& file : fileList->files())
         formData.append(name, file.get());
     return true;
@@ -263,12 +262,12 @@
     element()->invalidateStyleForSubtree();
 }
 
-void FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
+void FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool)
 {
     ASSERT(needsShadowSubtree());
     ASSERT(element());
     ASSERT(element()->shadowRoot());
-    element()->userAgentShadowRoot()->appendChild(source, element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()));
+    element()->userAgentShadowRoot()->appendChild(ContainerNode::ChildChange::Source::Parser, element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()));
 }
 
 void FileInputType::disabledStateChanged()

Modified: trunk/Source/WebCore/html/FileInputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/FileInputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/FileInputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -77,7 +77,7 @@
 #endif
 
     Icon* icon() const final;
-    void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) final;
+    void createShadowSubtreeAndUpdateInnerTextElementEditability(bool) final;
     void disabledStateChanged() final;
     void attributeChanged(const QualifiedName&) final;
     String defaultToolTip() const final;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -167,7 +167,7 @@
 void HTMLInputElement::createShadowSubtreeAndUpdateInnerTextElementEditability()
 {
     Ref<InputType> protectedInputType(*m_inputType);
-    protectedInputType->createShadowSubtreeAndUpdateInnerTextElementEditability(m_parsingInProgress ? ChildChange::Source::Parser : ChildChange::Source::API, isInnerTextElementEditable());
+    protectedInputType->createShadowSubtreeAndUpdateInnerTextElementEditability(isInnerTextElementEditable());
 }
 
 HTMLInputElement::~HTMLInputElement()

Modified: trunk/Source/WebCore/html/InputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/InputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/InputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -561,7 +561,7 @@
     element()->defaultBlur();
 }
 
-void InputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool)
+void InputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool)
 {
 }
 

Modified: trunk/Source/WebCore/html/InputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/InputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/InputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -306,7 +306,7 @@
 
     // Shadow tree handling.
 
-    virtual void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool);
+    virtual void createShadowSubtreeAndUpdateInnerTextElementEditability(bool);
     virtual void destroyShadowSubtree();
 
     virtual HTMLElement* containerElement() const { return nullptr; }

Modified: trunk/Source/WebCore/html/RangeInputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/RangeInputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/RangeInputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -241,7 +241,7 @@
     return ShouldCallBaseEventHandler::Yes;
 }
 
-void RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
+void RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool)
 {
     ASSERT(needsShadowSubtree());
     ASSERT(element());
@@ -250,10 +250,10 @@
     Document& document = element()->document();
     auto track = HTMLDivElement::create(document);
     track->setPseudo(ShadowPseudoIds::webkitSliderRunnableTrack());
-    track->appendChild(source, SliderThumbElement::create(document));
+    track->appendChild(ContainerNode::ChildChange::Source::Parser, SliderThumbElement::create(document));
     auto container = SliderContainerElement::create(document);
-    container->appendChild(source, track);
-    element()->userAgentShadowRoot()->appendChild(source, container);
+    container->appendChild(ContainerNode::ChildChange::Source::Parser, track);
+    element()->userAgentShadowRoot()->appendChild(ContainerNode::ChildChange::Source::Parser, container);
 }
 
 HTMLElement* RangeInputType::sliderTrackElement() const

Modified: trunk/Source/WebCore/html/RangeInputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/RangeInputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/RangeInputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -52,7 +52,7 @@
     void handleMouseDownEvent(MouseEvent&) final;
     ShouldCallBaseEventHandler handleKeydownEvent(KeyboardEvent&) final;
     RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) final;
-    void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) final;
+    void createShadowSubtreeAndUpdateInnerTextElementEditability(bool) final;
     Decimal parseToNumber(const String&, const Decimal&) const final;
     String serialize(const Decimal&) const final;
     bool accessKeyAction(bool sendMouseEvents) final;

Modified: trunk/Source/WebCore/html/SearchInputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/SearchInputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/SearchInputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -102,13 +102,13 @@
     return true;
 }
 
-void SearchInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool isInnerTextElementEditable)
+void SearchInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool isInnerTextElementEditable)
 {
     ASSERT(needsShadowSubtree());
     ASSERT(!m_resultsButton);
     ASSERT(!m_cancelButton);
 
-    TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(source, isInnerTextElementEditable);
+    TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(isInnerTextElementEditable);
     RefPtr<HTMLElement> container = containerElement();
     RefPtr<HTMLElement> textWrapper = innerBlockElement();
     ASSERT(container);

Modified: trunk/Source/WebCore/html/SearchInputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/SearchInputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/SearchInputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -51,7 +51,7 @@
     RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) final;
     const AtomString& formControlType() const final;
     bool needsContainer() const final;
-    void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) final;
+    void createShadowSubtreeAndUpdateInnerTextElementEditability(bool) final;
     void destroyShadowSubtree() final;
     HTMLElement* resultsButtonElement() const final;
     HTMLElement* cancelButtonElement() const final;

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (290085 => 290086)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2022-02-18 00:01:20 UTC (rev 290086)
@@ -316,7 +316,7 @@
     return RenderTheme::singleton().shouldHaveCapsLockIndicator(*element());
 }
 
-void TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool isInnerTextElementEditable)
+void TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(bool isInnerTextElementEditable)
 {
     ASSERT(needsShadowSubtree());
     ASSERT(element());
@@ -336,7 +336,7 @@
     m_innerText = TextControlInnerTextElement::create(document, isInnerTextElementEditable);
 
     if (!createsContainer) {
-        element()->userAgentShadowRoot()->appendChild(source, *m_innerText);
+        element()->userAgentShadowRoot()->appendChild(ContainerNode::ChildChange::Source::Parser, *m_innerText);
         updatePlaceholderText();
         return;
     }
@@ -346,7 +346,7 @@
 
     if (shouldHaveSpinButton) {
         m_innerSpinButton = SpinButtonElement::create(document, *this);
-        m_container->appendChild(source, *m_innerSpinButton);
+        m_container->appendChild(ContainerNode::ChildChange::Source::Parser, *m_innerSpinButton);
     }
 
     if (shouldHaveCapsLockIndicator) {
@@ -356,7 +356,7 @@
         bool shouldDrawCapsLockIndicator = this->shouldDrawCapsLockIndicator();
         m_capsLockIndicator->setInlineStyleProperty(CSSPropertyDisplay, shouldDrawCapsLockIndicator ? CSSValueBlock : CSSValueNone, true);
 
-        m_container->appendChild(source, *m_capsLockIndicator);
+        m_container->appendChild(ContainerNode::ChildChange::Source::Parser, *m_capsLockIndicator);
     }
     updateAutoFillButton();
 }

Modified: trunk/Source/WebCore/html/TextFieldInputType.h (290085 => 290086)


--- trunk/Source/WebCore/html/TextFieldInputType.h	2022-02-17 23:48:45 UTC (rev 290085)
+++ trunk/Source/WebCore/html/TextFieldInputType.h	2022-02-18 00:01:20 UTC (rev 290086)
@@ -70,7 +70,7 @@
 #endif
 
     virtual bool needsContainer() const;
-    void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) override;
+    void createShadowSubtreeAndUpdateInnerTextElementEditability(bool) override;
     void destroyShadowSubtree() override;
     void attributeChanged(const QualifiedName&) override;
     void disabledStateChanged() final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to