Title: [277778] trunk
Revision
277778
Author
akeer...@apple.com
Date
2021-05-20 06:21:40 -0700 (Thu, 20 May 2021)

Log Message

Value of a color input does not update visually when using setAttribute
https://bugs.webkit.org/show_bug.cgi?id=166930
<rdar://problem/29983218>

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/forms/color/color-input-set-attribute-value.html

* html/ColorInputType.cpp:
(WebCore::ColorInputType::attributeChanged):

Update the color swatch when the value attribute is changed.

* html/ColorInputType.h:

LayoutTests:

* fast/forms/color/color-input-set-attribute-value-expected.html: Added.
* fast/forms/color/color-input-set-attribute-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277777 => 277778)


--- trunk/LayoutTests/ChangeLog	2021-05-20 08:00:20 UTC (rev 277777)
+++ trunk/LayoutTests/ChangeLog	2021-05-20 13:21:40 UTC (rev 277778)
@@ -1,3 +1,14 @@
+2021-05-20  Aditya Keerthi  <akeer...@apple.com>
+
+        Value of a color input does not update visually when using setAttribute
+        https://bugs.webkit.org/show_bug.cgi?id=166930
+        <rdar://problem/29983218>
+
+        Reviewed by Simon Fraser.
+
+        * fast/forms/color/color-input-set-attribute-value-expected.html: Added.
+        * fast/forms/color/color-input-set-attribute-value.html: Added.
+
 2021-05-20  Felipe Erias  <felipeer...@igalia.com>
 
         [css-flexbox] Wrong height of an empty table inside an orthogonal flex parent

Added: trunk/LayoutTests/fast/forms/color/color-input-set-attribute-value-expected.html (0 => 277778)


--- trunk/LayoutTests/fast/forms/color/color-input-set-attribute-value-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/color/color-input-set-attribute-value-expected.html	2021-05-20 13:21:40 UTC (rev 277778)
@@ -0,0 +1 @@
+<input type="color" value="#ff0000"/>

Added: trunk/LayoutTests/fast/forms/color/color-input-set-attribute-value.html (0 => 277778)


--- trunk/LayoutTests/fast/forms/color/color-input-set-attribute-value.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/color/color-input-set-attribute-value.html	2021-05-20 13:21:40 UTC (rev 277778)
@@ -0,0 +1,5 @@
+<input type="color" id="input" value="#0000ff"/>
+<script>
+let input = document.getElementById("input");
+input.setAttribute("value", "#ff0000")
+</script>

Modified: trunk/Source/WebCore/ChangeLog (277777 => 277778)


--- trunk/Source/WebCore/ChangeLog	2021-05-20 08:00:20 UTC (rev 277777)
+++ trunk/Source/WebCore/ChangeLog	2021-05-20 13:21:40 UTC (rev 277778)
@@ -1,3 +1,20 @@
+2021-05-20  Aditya Keerthi  <akeer...@apple.com>
+
+        Value of a color input does not update visually when using setAttribute
+        https://bugs.webkit.org/show_bug.cgi?id=166930
+        <rdar://problem/29983218>
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/forms/color/color-input-set-attribute-value.html
+
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::attributeChanged):
+
+        Update the color swatch when the value attribute is changed.
+
+        * html/ColorInputType.h:
+
 2021-05-20  Felipe Erias  <felipeer...@igalia.com>
 
         [css-flexbox] Wrong height of an empty table inside an orthogonal flex parent

Modified: trunk/Source/WebCore/html/ColorInputType.cpp (277777 => 277778)


--- trunk/Source/WebCore/html/ColorInputType.cpp	2021-05-20 08:00:20 UTC (rev 277777)
+++ trunk/Source/WebCore/html/ColorInputType.cpp	2021-05-20 13:21:40 UTC (rev 277778)
@@ -165,6 +165,14 @@
         m_chooser->setSelectedColor(valueAsColor());
 }
 
+void ColorInputType::attributeChanged(const QualifiedName& name)
+{
+    if (name == valueAttr)
+        updateColorSwatch();
+
+    InputType::attributeChanged(name);
+}
+
 void ColorInputType::handleDOMActivateEvent(Event& event)
 {
     ASSERT(element());

Modified: trunk/Source/WebCore/html/ColorInputType.h (277777 => 277778)


--- trunk/Source/WebCore/html/ColorInputType.h	2021-05-20 08:00:20 UTC (rev 277777)
+++ trunk/Source/WebCore/html/ColorInputType.h	2021-05-20 13:21:40 UTC (rev 277778)
@@ -59,6 +59,7 @@
     String sanitizeValue(const String&) const final;
     void createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool) final;
     void setValue(const String&, bool valueChanged, TextFieldEventBehavior) final;
+    void attributeChanged(const QualifiedName&) final;
     void handleDOMActivateEvent(Event&) final;
     void detach() final;
     void elementDidBlur() final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to