summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornolan.robin.cao <nolan.robin.cao@gmail.com>2016-02-01 16:59:35 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-02 01:01:36 +0000
commitb88be591170389f263ad72e0ae18efc6c3c0e7a2 (patch)
tree11dda5d0f7d80b8e1dab6f7f36f9645e3aae2db9
parent3169911a8f59ae808067888750e69d5256311a43 (diff)
downloadchromium_src-b88be591170389f263ad72e0ae18efc6c3c0e7a2.zip
chromium_src-b88be591170389f263ad72e0ae18efc6c3c0e7a2.tar.gz
chromium_src-b88be591170389f263ad72e0ae18efc6c3c0e7a2.tar.bz2
Dropdown menu does not open on clicking when select element is partially visible.
To make it work when it's partially visible, use intersects() instead of contains(). BUG=582344 Review URL: https://codereview.chromium.org/1652783002 Cr-Commit-Position: refs/heads/master@{#372848}
-rw-r--r--third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible-expected.txt5
-rw-r--r--third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible.html37
-rw-r--r--third_party/WebKit/Source/web/PopupMenuImpl.cpp2
3 files changed, 43 insertions, 1 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible-expected.txt
new file mode 100644
index 0000000..be901bc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible-expected.txt
@@ -0,0 +1,5 @@
+PASS window.internals.pagePopupWindow.isWindowHidden() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible.html b/third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible.html
new file mode 100644
index 0000000..6521a1c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-open-partially-visible.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/picker-common.js"></script>
+</head>
+<body>
+<select id="menu" style="position: absolute;">
+ <option>o1</option>
+ <option>o2</option>
+</select>
+<script>
+var menu = document.getElementById('menu');
+var picker;
+
+function openPickerErrorCallback() {
+ testFailed('picker didn\'t open')
+ finishJSTest();
+}
+openPicker(menu, testPartiallyVisible, openPickerErrorCallback);
+
+function testPartiallyVisible() {
+ picker = window.internals.pagePopupWindow.global.picker;
+
+ function onUpdate() {
+ setTimeout(function() {
+ shouldBeFalse('window.internals.pagePopupWindow.isWindowHidden()');
+ picker.removeListener('didUpdate', onUpdate);
+ finishJSTest();
+ });
+ }
+ picker.on('didUpdate', onUpdate);
+ menu.style.top = '-1px';
+}
+</script>
+</body>
+</html>
diff --git a/third_party/WebKit/Source/web/PopupMenuImpl.cpp b/third_party/WebKit/Source/web/PopupMenuImpl.cpp
index e9577f0..6f026c9 100644
--- a/third_party/WebKit/Source/web/PopupMenuImpl.cpp
+++ b/third_party/WebKit/Source/web/PopupMenuImpl.cpp
@@ -501,7 +501,7 @@ void PopupMenuImpl::update()
return;
m_needsUpdate = false;
- if (!ownerElement().document().frame()->view()->visibleContentRect().contains(ownerElement().pixelSnappedBoundingBox())) {
+ if (!ownerElement().document().frame()->view()->visibleContentRect().intersects(ownerElement().pixelSnappedBoundingBox())) {
hide();
return;
}