Commit 1fb8eda1 authored by tkent@chromium.org's avatar tkent@chromium.org

date/time inputs should not handle keyboard events if they aren't focused.

This fixes an assertion failure in ~PickerIndicatorElement.

We need to do rebaseline of many tests because these tests opened pickers
without focus.  openPicker() force to focus on <input> elements now.

We confirmed Win10 failures were trivial.  They were due to month
format change and minor font glitch.

BUG=529530

Review URL: https://codereview.chromium.org/1311013012

git-svn-id: svn://svn.chromium.org/blink/trunk@201962 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ca672fa2
......@@ -81,6 +81,37 @@ crbug.com/520739 [ Mac ] http/tests/websocket/close-code-and-reason.html [ Failu
crbug.com/520737 [ Mac ] imported/csswg-test/css-writing-modes-3/writing-mode-vertical-rl-001.xht [ ImageOnlyFailure Pass Timeout ]
crbug.com/520736 [ Win7 ] media/W3C/video/networkState/networkState_during_progress.html [ Failure Pass ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance-ar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance-minimum-date.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance-required-ar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance-required.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance-ru.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance-step.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/calendar-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/date-picker-ax.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/month-picker-appearance-step.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/month-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/month-picker-ax.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/week-picker-appearance-step.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/week-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/calendar-picker/week-picker-ax.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/date-suggestion-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/month-suggestion-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/time-suggestion-picker-appearance.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
crbug.com/529530 fast/forms/suggestion-picker/week-suggestion-picker-appearance.html [ NeedsRebaseline ]
crbug.com/522640 [ Debug ] fast/dom/shadow/access-document-of-detached-stylesheetlist-crash.html [ Crash Pass Timeout ]
crbug.com/522641 inspector/elements/styles-4/styles-update-links.html [ Pass Timeout ]
crbug.com/522642 svg/animations/cssanimation-inactivedocument-crash.html [ Failure Pass ]
......@@ -1147,18 +1178,9 @@ crbug.com/521730 [ Win10 ] virtual/prefer_compositing_to_lcd_text/compositing/ov
crbug.com/521730 [ Win10 ] virtual/stable/webexposed/global-interface-listing.html [ Failure ]
#crbug.com/521730 [ Win10 ] webexposed/global-interface-listing.html [ Failure ]
crbug.com/521730 [ Win10 ] css3/flexbox/auto-margins.html [ ImageOnlyFailure ImageOnlyFailure ImageOnlyFailure Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/calendar-picker-appearance-ar.html [ ImageOnlyFailure Timeout Timeout Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/calendar-picker-appearance-required.html [ ImageOnlyFailure Timeout ImageOnlyFailure ImageOnlyFailure ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/calendar-picker-appearance-step.html [ ImageOnlyFailure Timeout ImageOnlyFailure Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/calendar-picker-appearance.html [ ImageOnlyFailure Timeout Timeout Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/month-picker-appearance-step.html [ ImageOnlyFailure Timeout Timeout ImageOnlyFailure ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/month-picker-appearance.html [ ImageOnlyFailure Timeout Timeout Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/calendar-picker/week-picker-appearance.html [ ImageOnlyFailure ]
crbug.com/521730 [ Win10 ] fast/forms/datetimelocal/datetimelocal-appearance-l10n.html [ ImageOnlyFailure Timeout ImageOnlyFailure Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/month/month-appearance-basic.html [ ImageOnlyFailure ImageOnlyFailure Timeout ImageOnlyFailure ]
crbug.com/521730 [ Win10 ] fast/forms/select/popup-menu-appearance-styled.html [ ImageOnlyFailure Timeout ImageOnlyFailure Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure Timeout Timeout Timeout ]
crbug.com/521730 [ Win10 ] fast/forms/suggestion-picker/month-suggestion-picker-appearance.html [ ImageOnlyFailure Timeout ImageOnlyFailure ImageOnlyFailure ]
crbug.com/521730 [ Win10 ] fast/text-autosizing/hackernews-comments.html [ ImageOnlyFailure ImageOnlyFailure Timeout ImageOnlyFailure ]
crbug.com/521730 [ Win10 ] fast/text-autosizing/list-item-above-dbcat.html [ ImageOnlyFailure Timeout Timeout Timeout ]
crbug.com/521730 [ Win10 ] fast/text-autosizing/supercluster-multiple-layout.html [ ImageOnlyFailure Timeout ImageOnlyFailure ImageOnlyFailure ]
......@@ -1343,13 +1365,9 @@ crbug.com/521764 [ Win10 ] fast/dom/shadow/focus-shadowhost-display-none.html [
crbug.com/521764 [ Win10 ] fast/dom/shadow/iframe-shadow.html [ Failure Pass ]
crbug.com/521764 [ Win10 ] fast/dom/wrapper-classes.html [ Failure Pass ]
crbug.com/521764 [ Win10 ] fast/events/touch/gesture/pad-gesture-cancel.html [ Failure Pass ]
crbug.com/521764 [ Win10 ] fast/forms/calendar-picker/calendar-picker-appearance-minimum-date.html [ ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/forms/calendar-picker/calendar-picker-appearance-required-ar.html [ ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/forms/calendar-picker/week-picker-appearance-step.html [ ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/forms/month/month-appearance-l10n.html [ ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/forms/month/month-appearance-pseudo-elements.html [ ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/forms/search/search-appearance-basic.html [ Failure Timeout ]
crbug.com/521764 [ Win10 ] fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar.html [ Crash ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/html/imports/rel-style-to-import.html [ Pass Timeout ]
crbug.com/521764 [ Win10 ] fast/inline/justify-emphasis-inline-box.html [ ImageOnlyFailure Timeout ]
crbug.com/521764 [ Win10 ] fast/loader/scroll-restore-overrides-fragment.html [ Failure Pass ]
......
......@@ -21,6 +21,7 @@ shouldBeNonNull('internals.pagePopupWindow');
function sendKey(input, keyName, ctrlKey, altKey) {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
input.focus();
input.dispatchEvent(event);
}
</script>
......
Calender picker should not open when the owner element has no focus.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Popup did not open.
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/picker-common.js"></script>
<div id="parent"><input type="date" id="input"></div>
<script>
description('Calender picker should not open when the owner element has no focus.');
var input = document.getElementById('input');
input.focus();
input.remove();
input.offsetTop;
sendKey(input, "Down", false, true);
if (window.internals.pagePopupWindow) {
testFailed('Popup was opened.');
finishJSTest();
} else {
testPassed('Popup did not open.');
finishJSTest();
}
</script>
</body>
</html>
......@@ -21,6 +21,7 @@ shouldBeNonNull('internals.pagePopupWindow');
function sendKey(input, keyName, ctrlKey, altKey) {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
input.focus();
input.dispatchEvent(event);
}
</script>
......
......@@ -21,6 +21,7 @@ shouldBeNonNull('internals.pagePopupWindow');
function sendKey(input, keyName, ctrlKey, altKey) {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
input.focus();
input.dispatchEvent(event);
}
</script>
......
......@@ -21,6 +21,7 @@ shouldBeNonNull('internals.pagePopupWindow');
function sendKey(input, keyName, ctrlKey, altKey) {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
input.focus();
input.dispatchEvent(event);
}
</script>
......
......@@ -40,6 +40,7 @@ function rootWindow() {
function openPicker(element, callback, errorCallback) {
rootWindow().moveTo(window.screenX, window.screenY);
element.offsetTop; // Force to lay out
element.focus();
if (element.tagName === "SELECT") {
sendKey(element, "Down", false, true);
} else if (element.tagName === "INPUT") {
......
......@@ -432,6 +432,8 @@ void BaseMultipleFieldsDateAndTimeInputType::requiredAttributeChanged()
void BaseMultipleFieldsDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event)
{
if (!element().focused())
return;
if (m_pickerIndicatorIsVisible
&& ((event->keyIdentifier() == "Down" && event->getModifierState("Alt")) || (LayoutTheme::theme().shouldOpenPickerWithF4Key() && event->keyIdentifier() == "F4"))) {
if (PickerIndicatorElement* element = pickerIndicatorElement())
......
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