| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |