OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 // This file adheres to closure-compiler conventions in order to enable | 5 // This file adheres to closure-compiler conventions in order to enable |
6 // compilation with ADVANCED_OPTIMIZATIONS. In particular, members that are to | 6 // compilation with ADVANCED_OPTIMIZATIONS. In particular, members that are to |
7 // be accessed externally should be specified in this['style'] as opposed to | 7 // be accessed externally should be specified in this['style'] as opposed to |
8 // this.style because member identifiers are minified by default. | 8 // this.style because member identifiers are minified by default. |
9 // See http://goo.gl/FwOgy | 9 // See http://goo.gl/FwOgy |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 'message': event.message.toString()}); | 35 'message': event.message.toString()}); |
36 }); | 36 }); |
37 | 37 |
38 /** | 38 /** |
39 * Margin in points around touchable elements (e.g. links for custom context | 39 * Margin in points around touchable elements (e.g. links for custom context |
40 * menu). | 40 * menu). |
41 * @type {number} | 41 * @type {number} |
42 */ | 42 */ |
43 var touchMargin_ = 25; | 43 var touchMargin_ = 25; |
44 | 44 |
45 __gCrWeb['innerSizeAsString'] = function() { | 45 __gCrWeb['getPageWidth'] = function() { |
46 return window.innerWidth + '/' + window.innerHeight; | 46 var documentElement = document.documentElement; |
| 47 var documentBody = document.body; |
| 48 return Math.max(documentElement.clientWidth, |
| 49 documentElement.scrollWidth, |
| 50 documentElement.offsetWidth, |
| 51 documentBody.scrollWidth, |
| 52 documentBody.offsetWidth); |
47 }; | 53 }; |
48 | 54 |
49 // Implementation of document.elementFromPoint that is working for iOS4 and | 55 // Implementation of document.elementFromPoint that is working for iOS4 and |
50 // iOS5 and that also goes into frames and iframes. | 56 // iOS5 and that also goes into frames and iframes. |
51 var elementFromPoint_ = function(x, y) { | 57 var elementFromPoint_ = function(x, y) { |
52 var elementFromPointIsUsingViewPortCoordinates = function(win) { | 58 var elementFromPointIsUsingViewPortCoordinates = function(win) { |
53 if (win.pageYOffset > 0) { // Page scrolled down. | 59 if (win.pageYOffset > 0) { // Page scrolled down. |
54 return (win.document.elementFromPoint( | 60 return (win.document.elementFromPoint( |
55 0, win.pageYOffset + win.innerHeight - 1) === null); | 61 0, win.pageYOffset + win.innerHeight - 1) === null); |
56 } | 62 } |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 __gCrWeb.core.documentInject(); | 647 __gCrWeb.core.documentInject(); |
642 | 648 |
643 // Form prototype loaded with event to supply Autocomplete API | 649 // Form prototype loaded with event to supply Autocomplete API |
644 // functionality. | 650 // functionality. |
645 HTMLFormElement.prototype.requestAutocomplete = function() { | 651 HTMLFormElement.prototype.requestAutocomplete = function() { |
646 invokeOnHost_( | 652 invokeOnHost_( |
647 {'command': 'form.requestAutocomplete', | 653 {'command': 'form.requestAutocomplete', |
648 'formName': __gCrWeb.common.getFormIdentifier(this)}); | 654 'formName': __gCrWeb.common.getFormIdentifier(this)}); |
649 }; | 655 }; |
650 } // End of anonymous object | 656 } // End of anonymous object |
OLD | NEW |