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

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 11308083: Fix the html select tag showing up at the wrong position. This was a regression from r166446. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix win_rel Created 8 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
Index: content/browser/web_contents/web_contents_view_aura.cc
===================================================================
--- content/browser/web_contents/web_contents_view_aura.cc (revision 168623)
+++ content/browser/web_contents/web_contents_view_aura.cc (working copy)
@@ -26,7 +26,9 @@
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/root_window_observer.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_observer.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/os_exchange_data.h"
@@ -234,7 +236,69 @@
} // namespace
+class WebContentsViewAura::WindowObserver
+ : public aura::WindowObserver, public aura::RootWindowObserver {
+ public:
+ explicit WindowObserver(WebContentsViewAura* view)
+ : view_(view),
+ parent_(NULL) {
+ }
+ virtual ~WindowObserver() {
+ if (parent_)
+ parent_->RemoveObserver(this);
+ }
+
+ // Overridden from aura::WindowObserver:
+ virtual void OnWindowParentChanged(aura::Window* window,
+ aura::Window* parent) OVERRIDE {
+ if (parent_)
+ parent_->RemoveObserver(this);
+ parent_ = parent;
+ if (parent)
+ parent->AddObserver(this);
+ }
+
+ virtual void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+ // This is for the Ash case.
+ SendScreenRects();
+ }
+
+ virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE {
+ window->GetRootWindow()->AddRootWindowObserver(this);
+ }
+
+ virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE {
+ window->GetRootWindow()->RemoveRootWindowObserver(this);
+ }
+
+ // Overridden RootWindowObserver:
+ virtual void OnRootWindowMoved(const aura::RootWindow* root,
+ const gfx::Point& new_origin) OVERRIDE {
+ // This is for the desktop case (i.e. Aura desktop).
+ SendScreenRects();
+ }
+
+ private:
+ void SendScreenRects() {
+ if (!view_->view_)
+ return;
+ RenderWidgetHostImpl::From(view_->view_->GetRenderWidgetHost())->
+ SendScreenRects();
+ }
+
+ WebContentsViewAura* view_;
+
+ // We cache the old parent so that we can unregister when it's not the parent
+ // anymore.
+ aura::Window* parent_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowObserver);
+};
+
+
////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, public:
@@ -255,6 +319,10 @@
// WebContentsViewAura, private:
WebContentsViewAura::~WebContentsViewAura() {
+ if (!window_)
+ return;
+
+ window_->RemoveObserver(window_observer_.get());
// Window needs a valid delegate during its destructor, so we explicitly
// delete it here.
window_.reset();
@@ -420,6 +488,9 @@
window_->layer()->SetMasksToBounds(true);
window_->SetName("WebContentsViewAura");
+ window_observer_.reset(new WindowObserver(this));
+ window_->AddObserver(window_observer_.get());
+
// delegate_->GetDragDestDelegate() creates a new delegate on every call.
// Hence, we save a reference to it locally. Similar model is used on other
// platforms as well.
@@ -439,8 +510,7 @@
return render_widget_host->GetView();
}
- view_ = RenderWidgetHostView::CreateViewForWidget(
- render_widget_host);
+ view_ = RenderWidgetHostView::CreateViewForWidget(render_widget_host);
view_->InitAsChild(NULL);
GetNativeView()->AddChild(view_->GetNativeView());
view_->Show();
@@ -456,6 +526,10 @@
return view_;
}
+void WebContentsViewAura::SetView(RenderWidgetHostView* view) {
+ view_ = view;
+}
+
gfx::NativeView WebContentsViewAura::GetNativeView() const {
return window_.get();
}
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | content/browser/web_contents/web_contents_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698