Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: third_party/WebKit/Source/web/resources/listPicker.js

Issue 1468353002: New SELECT Popup: Do not select and scroll to an option of which visible area is less than 1px heig… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove a comment Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/fast/forms/select/popup-menu-mouse-operations-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/resources/listPicker.js
diff --git a/third_party/WebKit/Source/web/resources/listPicker.js b/third_party/WebKit/Source/web/resources/listPicker.js
index 167ad3cd77cc1ceb90b253edb6253f6541488ac0..1f5d2e964e2ed802a2ab77dc47596de0089b5045 100644
--- a/third_party/WebKit/Source/web/resources/listPicker.js
+++ b/third_party/WebKit/Source/web/resources/listPicker.js
@@ -87,7 +87,25 @@ ListPicker.prototype._handleWindowMessage = function(event) {
delete window.updateData;
};
+// This should be matched to the border width of the internal listbox
+// SELECT. See listPicker.css and html.css.
+ListPicker.ListboxSelectBorder = 1;
+
ListPicker.prototype._handleWindowMouseMove = function (event) {
+ var visibleTop = ListPicker.ListboxSelectBorder;
+ var visibleBottom = this._selectElement.offsetHeight - ListPicker.ListboxSelectBorder;
+ var optionBounds = event.target.getBoundingClientRect();
+ if (optionBounds.height >= 1.0) {
+ // If the height of the visible part of event.target is less than 1px,
+ // ignore this event because it may be an error by sub-pixel layout.
+ if (optionBounds.top < visibleTop) {
+ if (optionBounds.bottom - visibleTop < 1.0)
+ return;
+ } else if (optionBounds.bottom > visibleBottom) {
+ if (visibleBottom - optionBounds.top < 1.0)
+ return;
+ }
+ }
this.lastMousePositionX = event.clientX;
this.lastMousePositionY = event.clientY;
this._highlightOption(event.target);
@@ -194,10 +212,7 @@ ListPicker.prototype._handleKeyDown = function(event) {
ListPicker.prototype._fixWindowSize = function() {
this._selectElement.style.height = "";
var maxHeight = this._selectElement.offsetHeight;
- // heightOutsideOfContent should be matched to border widths of the listbox
- // SELECT. See listPicker.css and html.css.
- var heightOutsideOfContent = 2;
- var noScrollHeight = Math.round(this._calculateScrollHeight() + heightOutsideOfContent);
+ var noScrollHeight = Math.round(this._calculateScrollHeight() + ListPicker.ListboxSelectBorder * 2);
var desiredWindowHeight = noScrollHeight;
var desiredWindowWidth = this._selectElement.offsetWidth;
var expectingScrollbar = false;
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/fast/forms/select/popup-menu-mouse-operations-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698