Chromium Code Reviews| Index: ui/views/controls/native/native_view_host_aura.cc |
| diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc |
| index f690f0574fae9569ff7a6eb73c9470770e691d34..ed0dab43f55b6d0f35788bcd7bafce5f6de73796 100644 |
| --- a/ui/views/controls/native/native_view_host_aura.cc |
| +++ b/ui/views/controls/native/native_view_host_aura.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/logging.h" |
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/client/focus_client.h" |
| +#include "ui/aura/layout_manager.h" |
| #include "ui/aura/window.h" |
| #include "ui/base/cursor/cursor.h" |
| #include "ui/views/controls/native/native_view_host.h" |
| @@ -15,10 +16,37 @@ |
| namespace views { |
| +namespace { |
| + |
| +// This layout manager positions popups relative to the screen |
| +// coordinate system. |
| +class PopupAwareLayoutManager : public aura::LayoutManager { |
| + public: |
| + PopupAwareLayoutManager() {} |
| + virtual ~PopupAwareLayoutManager() {} |
| + |
| + virtual void OnWindowResized() OVERRIDE {} |
| + virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE {} |
| + virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
| + virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {} |
| + virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| + bool visible) OVERRIDE {} |
| + virtual void SetChildBounds(aura::Window* child, |
| + const gfx::Rect& requested_bounds) OVERRIDE { |
| + gfx::Rect bounds = requested_bounds; |
| + if (child->type() == ui::wm::WINDOW_TYPE_POPUP) |
|
Evan Stade
2014/07/17 23:37:01
this may look hokey, but compare to https://code.g
|
| + bounds.Offset(-child->parent()->GetBoundsInScreen().OffsetFromOrigin()); |
|
sky
2014/07/18 15:33:49
How does the autofill code end up using NativeView
Evan Stade
2014/07/18 18:22:53
the web contents native view is the parent of the
|
| + SetChildBoundsDirect(child, bounds); |
| + } |
| +}; |
| + |
| +} // namespace |
| + |
| NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) |
| : host_(host), |
| clipping_window_(NULL) { |
| clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); |
| + clipping_window_.SetLayoutManager(new PopupAwareLayoutManager()); |
| clipping_window_.set_owned_by_parent(false); |
| clipping_window_.SetName("NativeViewHostAuraClip"); |
| clipping_window_.layer()->SetMasksToBounds(true); |