https://bugs.webkit.org/show_bug.cgi?id=168421
<rdar://problem/
30593185>
Reviewed by Ryosuke Niwa.
Source/WebCore:
The 'readonly' attribute should not apply to <input type=color> as per the
HTML specification:
- https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
Chrome / Firefox and Edge already behave as per the specification.
Tests: fast/forms/color/input-color-disabled.html
fast/forms/color/input-color-readonly.html
* html/ColorInputType.cpp:
(WebCore::ColorInputType::handleDOMActivateEvent):
(WebCore::ColorInputType::didChooseColor):
LayoutTests:
Add layout test coverage.
* fast/forms/color/input-color-disabled-expected.txt: Added.
* fast/forms/color/input-color-disabled.html: Added.
* fast/forms/color/input-color-readonly-expected.txt: Added.
* fast/forms/color/input-color-readonly.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212617
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-02-19 Chris Dumez <cdumez@apple.com>
+
+ <input type=color readonly> doesn't act per spec
+ https://bugs.webkit.org/show_bug.cgi?id=168421
+ <rdar://problem/30593185>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add layout test coverage.
+
+ * fast/forms/color/input-color-disabled-expected.txt: Added.
+ * fast/forms/color/input-color-disabled.html: Added.
+ * fast/forms/color/input-color-readonly-expected.txt: Added.
+ * fast/forms/color/input-color-readonly.html: Added.
+
2017-02-19 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r212466.
--- /dev/null
+Tests that it is not possible to select a color on a input type=color that is marked as disabled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS onChangeCount is 0
+PASS onChangeCount is 0
+PASS input.value is "#000000"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Tests that it is not possible to select a color on a input type=color that is marked as disabled.");
+
+var input = document.createElement('input');
+input.type = 'color';
+input.disabled = true;
+input.value = '#000000';
+document.body.appendChild(input);
+
+input.style.position = 'absolute';
+input.style.left = '0';
+input.style.top = '0';
+input.style.width = '20px';
+input.style.height = '20px';
+
+var onChangeCount = 0;
+input.onchange = function() {
+ debug("change event dispatched - value changed to " + input.value);
+ onChangeCount++;
+};
+
+input.oninput = function() {
+ debug("input event dispatched - value is: " + input.value);
+};
+
+eventSender.mouseMoveTo(10, 10);
+eventSender.mouseDown();
+eventSender.mouseUp();
+
+shouldBe('onChangeCount', '0');
+internals.selectColorInColorChooser(input, '#ff0000');
+shouldBe('onChangeCount', '0');
+shouldBeEqualToString('input.value', '#000000');
+</script>
+</body>
+</html>
--- /dev/null
+Tests that it is possible to select a color on a input type=color that is marked as readOnly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS onChangeCount is 0
+input event dispatched - value is: #ff0000
+change event dispatched - value changed to #ff0000
+PASS onChangeCount is 1
+PASS input.value is "#ff0000"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Tests that it is possible to select a color on a input type=color that is marked as readOnly.");
+
+var input = document.createElement('input');
+input.type = 'color';
+input.readOnly = true;
+input.value = '#000000';
+document.body.appendChild(input);
+
+input.style.position = 'absolute';
+input.style.left = '0';
+input.style.top = '0';
+input.style.width = '20px';
+input.style.height = '20px';
+
+var onChangeCount = 0;
+input.onchange = function() {
+ debug("change event dispatched - value changed to " + input.value);
+ onChangeCount++;
+};
+
+input.oninput = function() {
+ debug("input event dispatched - value is: " + input.value);
+};
+
+eventSender.mouseMoveTo(10, 10);
+eventSender.mouseDown();
+eventSender.mouseUp();
+
+shouldBe('onChangeCount', '0');
+
+// input.onchange should be called
+internals.selectColorInColorChooser(input, '#ff0000');
+shouldBe('onChangeCount', '1');
+shouldBeEqualToString('input.value', '#ff0000');
+</script>
+</body>
+</html>
fast/forms/autofocus-opera-003.html [ Failure ]
fast/forms/button-inner-block-reuse.html [ Failure ]
fast/forms/button-with-float.html [ ImageOnlyFailure ]
-fast/forms/color/color-setrangetext.html [ Failure ]
+
+# <input type=color> is not supported on iOS.
fast/forms/color/input-color-onchange-event.html [ Failure ]
+fast/forms/color/input-color-readonly.html [ Failure ]
fast/forms/color/input-value-sanitization-color.html [ Failure ]
+fast/forms/color/color-setrangetext.html [ Failure ]
fast/forms/datalist/datalist-fallback-content.html [ ImageOnlyFailure ]
fast/forms/datalist/datalist-nonoption-child.html [ Failure ]
# Color input is not yet implemented on Mac WK1. Currently, using it erroneously triggers an ASSERT_NOT_REACHED.
webkit.org/b/119094 fast/forms/color/input-color-onchange-event.html [ Skip ]
webkit.org/b/119094 fast/forms/color/color-suggestion-picker-crash-on-set-value.html [ Skip ]
+webkit.org/b/119094 fast/forms/color/input-color-readonly.html [ Skip ]
# DumpRenderTree doesn't support logging calls to runOpenPanel.
fast/forms/file/open-file-panel.html [ Skip ]
+2017-02-19 Chris Dumez <cdumez@apple.com>
+
+ <input type=color readonly> doesn't act per spec
+ https://bugs.webkit.org/show_bug.cgi?id=168421
+ <rdar://problem/30593185>
+
+ Reviewed by Ryosuke Niwa.
+
+ The 'readonly' attribute should not apply to <input type=color> as per the
+ HTML specification:
+ - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
+
+ Chrome / Firefox and Edge already behave as per the specification.
+
+ Tests: fast/forms/color/input-color-disabled.html
+ fast/forms/color/input-color-readonly.html
+
+ * html/ColorInputType.cpp:
+ (WebCore::ColorInputType::handleDOMActivateEvent):
+ (WebCore::ColorInputType::didChooseColor):
+
2017-02-19 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r212466.
void ColorInputType::handleDOMActivateEvent(Event& event)
{
- if (element().isDisabledOrReadOnly() || !element().renderer())
+ if (element().isDisabledFormControl() || !element().renderer())
return;
if (!ScriptController::processingUserGesture())
void ColorInputType::didChooseColor(const Color& color)
{
- if (element().isDisabledOrReadOnly() || color == valueAsColor())
+ if (element().isDisabledFormControl() || color == valueAsColor())
return;
EventQueueScope scope;
element().setValueFromRenderer(color.serialized());