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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 551883002: Deactivate touch selection on transform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index a54d860bc9e646cb9c5d0c9b52559e8042e2f17f..741b07b71b4410008d29e5c69119a1580f4c0042 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -399,14 +399,24 @@ class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver {
public:
explicit WindowObserver(RenderWidgetHostViewAura* view)
: view_(view) {
- view_->window_->AddObserver(this);
+ ObserveHierarchy(view_->window_);
}
virtual ~WindowObserver() {
- view_->window_->RemoveObserver(this);
+ UnobserveHierarchy(view_->window_);
}
// Overridden from aura::WindowObserver:
+ virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE {
+ if (window->Contains(view_->window_))
+ UnobserveHierarchy(window->parent());
+ }
+
+ virtual void OnWindowParentChanged(aura::Window* window,
+ aura::Window* parent) OVERRIDE {
+ ObserveHierarchy(parent);
+ }
+
virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE {
if (window == view_->window_)
view_->AddedToRootWindow();
@@ -418,7 +428,22 @@ class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver {
view_->RemovingFromRootWindow();
}
+ virtual void OnWindowTransformed(aura::Window* window) OVERRIDE {
+ if (view_->touch_editing_client_)
+ view_->touch_editing_client_->EndTouchEditing(true);
+ }
+
private:
+ void ObserveHierarchy(aura::Window* window) {
+ for (; window; window = window->parent())
sky 2014/09/08 20:24:56 This is going to be fragile and easy to get wrong.
mohsen 2014/09/09 21:36:36 Isn't it going to be costly? E.g. if a transform i
+ window->AddObserver(this);
+ }
+
+ void UnobserveHierarchy(aura::Window* window) {
+ for (; window; window = window->parent())
+ window->RemoveObserver(this);
+ }
+
RenderWidgetHostViewAura* view_;
DISALLOW_COPY_AND_ASSIGN(WindowObserver);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698