Reviewers: tkent
CL:
https://codereview.chromium.org/2110783002/Message:
PTAL!
Thanks
Description:
Open a color input with display:none via a label
BUG=452838
Base URL:
https://chromium.googlesource.com/chromium/src.git@masterAffected files (+25, -1 lines):
A third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html
M third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
Index: third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html b/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html
new file mode 100644
index 0000000000000000000000000000000000000000..1be0b2b7b5adfcee694db70bbd1bdb54d51b27cc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/color/display-none-input-color-chooser-shown.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+
+<input id="colorPick" type="color" />
+<label for="colorPick" id="labelPick">Pick a color</label>
+
+<script>
+test (function() {
+ assert_true(window.eventSender !== null);
+}, "window.eventSender is required for the test to run");
+
+test (function() {
+ var colorPicker = document.getElementById("colorPick");
+ colorPicker.style.display = "none";
+ var labelPick = document.getElementById("labelPick");
+ var x = labelPick.offsetLeft + labelPick.offsetWidth/2;
+ var y = labelPick.offsetTop + labelPick.offsetHeight/2;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ assert_true(testRunner.isChooserShown());
+}, "Tests click on label for color picker with display none should show chooser");
+</script>
Index: third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
index 3dd217acfd75aa5dfe7a994dca9ae9476ac6e6a8..66b9327d052b4ebc99e34f1738484b444ec8ceeb 100644
--- a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
@@ -167,7 +167,7 @@ void ColorInputType::setValue(const String& value, bool valueChanged, TextFieldE
void ColorInputType::handleDOMActivateEvent(Event* event)
{
- if (element().isDisabledFormControl() || !element().layoutObject())
+ if (element().isDisabledFormControl())
return;
if (!UserGestureIndicator::utilizeUserGesture())