Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7545)

Unified Diff: chrome/renderer/resources/extensions/web_view.js

Issue 14272003: <webview>: Focusing <webview> should propagate to BrowserPlugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary console.log Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/web_view.js
diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js
index dc91c248dd4ba12d1bbf21f474e5be5c715d0bbc..1caaf0826d4b010e2ff19b663c0a762a243ae170 100644
--- a/chrome/renderer/resources/extensions/web_view.js
+++ b/chrome/renderer/resources/extensions/web_view.js
@@ -63,11 +63,25 @@ function WebView(node) {
}
}, this);
+ if (!this.node_.hasAttribute('tabIndex')) {
+ // <webview> needs a tabIndex in order to respond to keyboard focus.
+ // TODO(fsamuel): Maybe we should fix this so that it's not required.
+ this.node_.setAttribute('tabIndex', 0);
lazyboy 2013/04/15 21:46:58 This feels too hacky though, and would trigger inc
Fady Samuel 2013/04/15 22:15:28 Unfortunately, that didn't work. I've added a bug
+ }
+ var self = this;
+ this.node_.addEventListener('focus', function(e) {
+ // Focus the BrowserPlugin when the <webview> takes focus.
+ self.objectNode_.focus();
+ });
+ this.node_.addEventListener('blur', function(e) {
+ // Blur the BrowserPlugin when the <webview> loses focus.
+ self.objectNode_.blur();
+ });
+
shadowRoot.appendChild(this.objectNode_);
// this.objectNode_[apiMethod] are not necessarily defined immediately after
// the shadow object is appended to the shadow root.
- var self = this;
forEach(WEB_VIEW_API_METHODS, function(i, apiMethod) {
node[apiMethod] = function(var_args) {
return self.objectNode_[apiMethod].apply(self.objectNode_, arguments);

Powered by Google App Engine
This is Rietveld 408576698