Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 ///////////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////////// |
| 7 // OptionsPage class: | 7 // OptionsPage class: |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Base class for options page. | 10 * Base class for options page. |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 * closing subpages and/or stopping event propagation. | 692 * closing subpages and/or stopping event propagation. |
| 693 * @return {Event} a mousedown or click event. | 693 * @return {Event} a mousedown or click event. |
| 694 * @private | 694 * @private |
| 695 */ | 695 */ |
| 696 OptionsPage.bodyMouseEventHandler_ = function(event) { | 696 OptionsPage.bodyMouseEventHandler_ = function(event) { |
| 697 // Do nothing if a subpage isn't showing. | 697 // Do nothing if a subpage isn't showing. |
| 698 var topPage = this.getTopmostVisiblePage(); | 698 var topPage = this.getTopmostVisiblePage(); |
| 699 if (!topPage || topPage.isOverlay || !topPage.parentPage) | 699 if (!topPage || topPage.isOverlay || !topPage.parentPage) |
| 700 return; | 700 return; |
| 701 | 701 |
| 702 // Don't close subpages if a user is clicking in a select element. | |
| 703 // This is necessary because WebKit sends click events with strange | |
| 704 // coordinates when a user selects a new entry in a select element. | |
|
Evan Stade
2011/06/23 02:05:05
add crbug link
| |
| 705 if (event.srcElement.nodeName == 'SELECT') | |
| 706 return; | |
| 707 | |
| 702 // Do nothing if the client coordinates are not within the source element. | 708 // Do nothing if the client coordinates are not within the source element. |
| 703 // This occurs if the user toggles a checkbox by pressing spacebar. | 709 // This occurs if the user toggles a checkbox by pressing spacebar. |
| 704 // This is a workaround to prevent keyboard events from closing the window. | 710 // This is a workaround to prevent keyboard events from closing the window. |
| 705 // See: crosbug.com/15678 | 711 // See: crosbug.com/15678 |
| 706 if (event.clientX == -document.body.scrollLeft && | 712 if (event.clientX == -document.body.scrollLeft && |
| 707 event.clientY == -document.body.scrollTop) { | 713 event.clientY == -document.body.scrollTop) { |
| 708 return; | 714 return; |
| 709 } | 715 } |
| 710 | 716 |
| 711 // Don't interfere with navbar clicks. | 717 // Don't interfere with navbar clicks. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1003 canShowPage: function() { | 1009 canShowPage: function() { |
| 1004 return true; | 1010 return true; |
| 1005 }, | 1011 }, |
| 1006 }; | 1012 }; |
| 1007 | 1013 |
| 1008 // Export | 1014 // Export |
| 1009 return { | 1015 return { |
| 1010 OptionsPage: OptionsPage | 1016 OptionsPage: OptionsPage |
| 1011 }; | 1017 }; |
| 1012 }); | 1018 }); |
| OLD | NEW |