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

Side by Side Diff: third_party/WebKit/Source/web/resources/listPicker.js

Issue 2360483002: SELECT popup: Touch input should not be able to select disabled OPTIONs. (Closed)
Patch Set: Created 4 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-touch-operations-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 "use strict"; 1 "use strict";
2 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 2 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 var global = { 6 var global = {
7 argumentsReceived: false, 7 argumentsReceived: false,
8 params: null, 8 params: null,
9 picker: null 9 picker: null
10 }; 10 };
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 this._selectionSetByMouseHover = false; 162 this._selectionSetByMouseHover = false;
163 }; 163 };
164 164
165 ListPicker.prototype._handleWindowTouchEnd = function(event) { 165 ListPicker.prototype._handleWindowTouchEnd = function(event) {
166 if (this._trackingTouchId === null) 166 if (this._trackingTouchId === null)
167 return; 167 return;
168 var touch = this._getTouchForId(event.changedTouches, this._trackingTouchId) ; 168 var touch = this._getTouchForId(event.changedTouches, this._trackingTouchId) ;
169 if (!touch) 169 if (!touch)
170 return; 170 return;
171 var target = document.elementFromPoint(touch.clientX, touch.clientY) 171 var target = document.elementFromPoint(touch.clientX, touch.clientY)
172 if (target.tagName === "OPTION") 172 if (target.tagName === "OPTION" && !target.disabled)
173 window.pagePopupController.setValueAndClosePopup(0, this._selectElement. value); 173 window.pagePopupController.setValueAndClosePopup(0, this._selectElement. value);
174 this._exitTouchSelectMode(); 174 this._exitTouchSelectMode();
175 }; 175 };
176 176
177 ListPicker.prototype._getTouchForId = function (touchList, id) { 177 ListPicker.prototype._getTouchForId = function (touchList, id) {
178 for (var i = 0; i < touchList.length; i++) { 178 for (var i = 0; i < touchList.length; i++) {
179 if (touchList[i].identifier === id) 179 if (touchList[i].identifier === id)
180 return touchList[i]; 180 return touchList[i];
181 } 181 }
182 return null; 182 return null;
183 }; 183 };
184 184
185 ListPicker.prototype._highlightOption = function(target) { 185 ListPicker.prototype._highlightOption = function(target) {
186 if (target.tagName !== "OPTION" || target.selected) 186 if (target.tagName !== "OPTION" || target.selected || target.disabled)
187 return; 187 return;
188 var savedScrollTop = this._selectElement.scrollTop; 188 var savedScrollTop = this._selectElement.scrollTop;
189 // TODO(tkent): Updating HTMLOptionElement::selected is not efficient. We 189 // TODO(tkent): Updating HTMLOptionElement::selected is not efficient. We
190 // should optimize it, or use an alternative way. 190 // should optimize it, or use an alternative way.
191 target.selected = true; 191 target.selected = true;
192 this._selectElement.scrollTop = savedScrollTop; 192 this._selectElement.scrollTop = savedScrollTop;
193 }; 193 };
194 194
195 ListPicker.prototype._handleChange = function(event) { 195 ListPicker.prototype._handleChange = function(event) {
196 window.pagePopupController.setValue(this._selectElement.value); 196 window.pagePopupController.setValue(this._selectElement.value);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 449 }
450 this._applyItemStyle(element, config.style); 450 this._applyItemStyle(element, config.style);
451 }; 451 };
452 452
453 if (window.dialogArguments) { 453 if (window.dialogArguments) {
454 initialize(dialogArguments); 454 initialize(dialogArguments);
455 } else { 455 } else {
456 window.addEventListener("message", handleMessage, false); 456 window.addEventListener("message", handleMessage, false);
457 window.setTimeout(handleArgumentsTimeout, 1000); 457 window.setTimeout(handleArgumentsTimeout, 1000);
458 } 458 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select-popup/popup-menu-touch-operations-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698