OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 module implements the shared functionality for different guestview | 5 // This module implements the shared functionality for different guestview |
6 // containers, such as web_view, app_view, etc. | 6 // containers, such as web_view, app_view, etc. |
7 | 7 |
8 var DocumentNatives = requireNative('document_natives'); | 8 var DocumentNatives = requireNative('document_natives'); |
9 var GuestView = require('guestView').GuestView; | 9 var GuestView = require('guestView').GuestView; |
10 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 10 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 }; | 94 }; |
95 | 95 |
96 GuestViewContainer.prototype.setupFocusPropagation = function() { | 96 GuestViewContainer.prototype.setupFocusPropagation = function() { |
97 if (!this.element.hasAttribute('tabIndex')) { | 97 if (!this.element.hasAttribute('tabIndex')) { |
98 // GuestViewContainer needs a tabIndex in order to be focusable. | 98 // GuestViewContainer needs a tabIndex in order to be focusable. |
99 // TODO(fsamuel): It would be nice to avoid exposing a tabIndex attribute | 99 // TODO(fsamuel): It would be nice to avoid exposing a tabIndex attribute |
100 // to allow GuestViewContainer to be focusable. | 100 // to allow GuestViewContainer to be focusable. |
101 // See http://crbug.com/231664. | 101 // See http://crbug.com/231664. |
102 this.element.setAttribute('tabIndex', -1); | 102 this.element.setAttribute('tabIndex', -1); |
103 } | 103 } |
104 this.element.addEventListener('focus', this.weakWrapper(function(e) { | |
Fady Samuel
2016/07/06 14:55:06
Not LGTM. This will break focus, although I think
Fady Samuel
2016/07/06 17:31:57
Ah I think I see why/how this is not necessary any
avallee
2016/07/06 17:34:23
I could see how propagating the event might make s
| |
105 // Focus the BrowserPlugin when the GuestViewContainer takes focus. | |
106 privates(this).internalElement.focus(); | |
107 })); | |
108 this.element.addEventListener('blur', this.weakWrapper(function(e) { | |
109 // Blur the BrowserPlugin when the GuestViewContainer loses focus. | |
110 privates(this).internalElement.blur(); | |
111 })); | |
112 }; | 104 }; |
113 | 105 |
114 GuestViewContainer.prototype.focus = function() { | 106 GuestViewContainer.prototype.focus = function() { |
115 // Focus the internal element when focus() is called on the GuestView element. | 107 // Focus the internal element when focus() is called on the GuestView element. |
116 privates(this).internalElement.focus(); | 108 privates(this).internalElement.focus(); |
117 } | 109 } |
118 | 110 |
119 GuestViewContainer.prototype.attachWindow$ = function() { | 111 GuestViewContainer.prototype.attachWindow$ = function() { |
120 if (!this.internalInstanceId) { | 112 if (!this.internalInstanceId) { |
121 return true; | 113 return true; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 // Delete the callbacks so developers cannot call them and produce unexpected | 294 // Delete the callbacks so developers cannot call them and produce unexpected |
303 // behavior. | 295 // behavior. |
304 delete proto.createdCallback; | 296 delete proto.createdCallback; |
305 delete proto.attachedCallback; | 297 delete proto.attachedCallback; |
306 delete proto.detachedCallback; | 298 delete proto.detachedCallback; |
307 delete proto.attributeChangedCallback; | 299 delete proto.attributeChangedCallback; |
308 } | 300 } |
309 | 301 |
310 // Exports. | 302 // Exports. |
311 exports.$set('GuestViewContainer', GuestViewContainer); | 303 exports.$set('GuestViewContainer', GuestViewContainer); |
OLD | NEW |