Commit 0fac3886 authored by Ionel Popescu's avatar Ionel Popescu Committed by Commit Bot

Fixed color-picker style when opened from datalist via Other button.

The issue was caused by the fact that the color-picker style wasn't added
when constructing the color-suggestion-picker popup.

Added a test to validate the change and prevent future regressions.

Bug: 1062501
Change-Id: Iaf561f33e18bf2f26a8f87ffd1fb549118e02764
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108091
Commit-Queue: Ionel Popescu <iopopesc@microsoft.com>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751610}
parent af59a676
...@@ -136,6 +136,8 @@ void ColorChooserPopupUIController::WriteColorSuggestionPickerDocument( ...@@ -136,6 +136,8 @@ void ColorChooserPopupUIController::WriteColorSuggestionPickerDocument(
"<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data); "<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data);
data->Append(ChooserResourceLoader::GetPickerCommonStyleSheet()); data->Append(ChooserResourceLoader::GetPickerCommonStyleSheet());
data->Append(ChooserResourceLoader::GetColorSuggestionPickerStyleSheet()); data->Append(ChooserResourceLoader::GetColorSuggestionPickerStyleSheet());
if (features::IsFormControlsRefreshEnabled())
data->Append(ChooserResourceLoader::GetColorPickerStyleSheet());
PagePopupClient::AddString( PagePopupClient::AddString(
"</style></head><body>\n" "</style></head><body>\n"
"<div id='main'>Loading...</div><script>\n" "<div id='main'>Loading...</div><script>\n"
......
<!DOCTYPE html>
<html>
<head>
<script>
testRunner.waitUntilDone();
</script>
<script src='../../../fast/forms/resources/picker-common.js'></script>
</head>
<body>
<input type='color' id='color' list='gray'>
<datalist id='gray'>
<option>#ffffff</option>
<option>#eeeeee</option>
<option>#dddddd</option>
<option>#cccccc</option>
<option>#bbbbbb</option>
<option>#aaaaaa</option>
<option>#999999</option>
<option>#888888</option>
<option>#777777</option>
<option>#666666</option>
<option>#555555</option>
<option>#444444</option>
<option>#333333</option>
<option>#222222</option>
<option>#111111</option>
<option>#000000</option>
</datalist>
<script>
openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone());
function openPickerSuccessfulCallback() {
popupWindow.focus();
const popupDocument = popupWindow.document;
const otherColor = popupDocument.querySelector('.other-color');
const otherColorRect = otherColor.getBoundingClientRect();
// Click the Other color button.
eventSender.mouseMoveTo(otherColorRect.left + (otherColorRect.width / 2), otherColorRect.top + (otherColorRect.height / 2));
eventSender.mouseDown();
eventSender.mouseUp();
popupWindow.focus();
testRunner.notifyDone();
}
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment