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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 * closing subpages and/or stopping event propagation. | 680 * closing subpages and/or stopping event propagation. |
681 * @return {Event} a mousedown or click event. | 681 * @return {Event} a mousedown or click event. |
682 * @private | 682 * @private |
683 */ | 683 */ |
684 OptionsPage.bodyMouseEventHandler_ = function(event) { | 684 OptionsPage.bodyMouseEventHandler_ = function(event) { |
685 // Do nothing if a subpage isn't showing. | 685 // Do nothing if a subpage isn't showing. |
686 var topPage = this.getTopmostVisiblePage(); | 686 var topPage = this.getTopmostVisiblePage(); |
687 if (!topPage || topPage.isOverlay || !topPage.parentPage) | 687 if (!topPage || topPage.isOverlay || !topPage.parentPage) |
688 return; | 688 return; |
689 | 689 |
690 // Do nothing if the client coordinates are not within the source element. | |
691 // This situation is indicative of a Webkit bug where clicking on a | |
692 // radio/checkbox label span will generate an event with client coordinates | |
693 // of (-scrollX, -scrollY). | |
694 // See https://bugs.webkit.org/show_bug.cgi?id=56606 | |
695 if (event.clientX == -document.body.scrollLeft && | |
696 event.clientY == -document.body.scrollTop) { | |
697 return; | |
698 } | |
699 | |
700 // Don't interfere with navbar clicks. | 690 // Don't interfere with navbar clicks. |
701 if ($('navbar').contains(event.target)) | 691 if ($('navbar').contains(event.target)) |
702 return; | 692 return; |
703 | 693 |
704 // Figure out which page the click happened in. | 694 // Figure out which page the click happened in. |
705 for (var level = topPage.nestingLevel; level >= 0; level--) { | 695 for (var level = topPage.nestingLevel; level >= 0; level--) { |
706 var clickIsWithinLevel = level == 0 ? true : | 696 var clickIsWithinLevel = level == 0 ? true : |
707 OptionsPage.elementContainsPoint_( | 697 OptionsPage.elementContainsPoint_( |
708 $('subpage-sheet-' + level), event.clientX, event.clientY); | 698 $('subpage-sheet-' + level), event.clientX, event.clientY); |
709 | 699 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 shouldClose: function() { | 989 shouldClose: function() { |
1000 return true; | 990 return true; |
1001 }, | 991 }, |
1002 }; | 992 }; |
1003 | 993 |
1004 // Export | 994 // Export |
1005 return { | 995 return { |
1006 OptionsPage: OptionsPage | 996 OptionsPage: OptionsPage |
1007 }; | 997 }; |
1008 }); | 998 }); |
OLD | NEW |