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

Unified Diff: sky/viewer/document_view.cc

Issue 716223003: Fix contenteditable (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/viewer/document_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/document_view.cc
diff --git a/sky/viewer/document_view.cc b/sky/viewer/document_view.cc
index 1d9bdea793bd2585e4d86acfabacb75e44c8212f..7b4922678f3ae09d813c934c734ff4eb066bffd7 100644
--- a/sky/viewer/document_view.cc
+++ b/sky/viewer/document_view.cc
@@ -114,6 +114,9 @@ void DocumentView::OnEmbed(
gfx::Size size = root_->bounds().To<gfx::Rect>().size();
web_view_->resize(size);
+ // TODO(abarth): We should ask the view whether it is focused instead of
+ // assuming that we're focused.
+ web_view_->setFocus(true);
web_layer_tree_view_impl_->setViewportSize(size);
web_layer_tree_view_impl_->set_view(root_);
root_->AddObserver(this);
@@ -215,6 +218,15 @@ void DocumentView::OnViewBoundsChanged(mojo::View* view,
web_layer_tree_view_impl_->setViewportSize(size);
}
+void DocumentView::OnViewFocusChanged(mojo::View* gained_focus,
+ mojo::View* lost_focus) {
+ if (root_ == lost_focus) {
+ web_view_->setFocus(false);
+ } else if (root_ == gained_focus) {
+ web_view_->setFocus(true);
+ }
+}
+
void DocumentView::OnViewDestroyed(mojo::View* view) {
DCHECK_EQ(view, root_);
« no previous file with comments | « sky/viewer/document_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698