| Index: ui/views/controls/native/native_view_host_aura.h
|
| diff --git a/ui/views/controls/native/native_view_host_aura.h b/ui/views/controls/native/native_view_host_aura.h
|
| index eba4b99c9fdf2c0b5cb45c7c571e7b5dc0aca9cc..16663b0ceb870c6bb1d7ea9f901c0ac61ec5b05a 100644
|
| --- a/ui/views/controls/native/native_view_host_aura.h
|
| +++ b/ui/views/controls/native/native_view_host_aura.h
|
| @@ -7,7 +7,10 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/compiler_specific.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "ui/aura/window.h"
|
| #include "ui/aura/window_observer.h"
|
| +#include "ui/compositor/layer.h"
|
| #include "ui/views/controls/native/native_view_host_wrapper.h"
|
| #include "ui/views/views_export.h"
|
|
|
| @@ -24,6 +27,7 @@ class VIEWS_EXPORT NativeViewHostAura : public NativeViewHostWrapper,
|
|
|
| // Overridden from NativeViewHostWrapper:
|
| virtual void NativeViewWillAttach() OVERRIDE;
|
| + virtual void NativeViewAttached() OVERRIDE;
|
| virtual void NativeViewDetaching(bool destroyed) OVERRIDE;
|
| virtual void AddedToWidget() OVERRIDE;
|
| virtual void RemovedFromWidget() OVERRIDE;
|
| @@ -36,15 +40,61 @@ class VIEWS_EXPORT NativeViewHostAura : public NativeViewHostWrapper,
|
| virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
|
|
|
| private:
|
| + friend class NativeViewHostAuraTest;
|
| +
|
| // Overridden from aura::WindowObserver:
|
| virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
|
|
|
| + // Calculates the origin of the native view for the fast resize path, so it
|
| + // can be clipped correctly. This value is affected by the current gravity
|
| + // being applied. The formula for this calulation is:
|
| + //
|
| + // x' = x * width_scaling_factor * (content_width - clip_width)
|
| + // y' = y * height_scaling_factor * (content_heigth - clip_height)
|
| + //
|
| + // , where the scaling factors are either 0, 0.5, or 1.0 depending on the
|
| + // current gravity.
|
| + gfx::Point CalculateNewNativeViewOrigin(const gfx::Rect& input_rect,
|
| + const gfx::Rect& native_rect) const;
|
| +
|
| + // Since the native view is positioned before the clip is installed, the
|
| + // origin for the clip being used needs to be tranformed into the new
|
| + // coordinate system due to the input values to ShowWidget being relative to
|
| + // the native view. This function does the calculation of the origin. This
|
| + // value is affected by the current gravity being applied. The formula for
|
| + // this calulation is:
|
| + //
|
| + // x' = width_scaling_factor * (content_width - clip_width)
|
| + // y' = height_scaling_factor * (content_heigth - clip_height)
|
| + //
|
| + // , where the scaling factors are either 0, 0.5, or 1.0 depending on the
|
| + // current gravity.
|
| + gfx::Point CalculateClipOrigin(const gfx::Rect& input_rect,
|
| + const gfx::Rect& native_rect) const;
|
| +
|
| + // Reparents the native view with the clipping window existing between it and
|
| + // its old parent, so that the fast resize path works.
|
| + void AddClippingWindow();
|
| +
|
| + // If the native view has been reparented via AddClippingWindow, this call
|
| + // undoes it.
|
| + void RemoveClippingWindow();
|
| +
|
| // Our associated NativeViewHost.
|
| NativeViewHost* host_;
|
|
|
| // Have we installed a clip region?
|
| bool installed_clip_;
|
|
|
| + // Window that exists between the native view and the parent that allows for
|
| + // clipping to occur.
|
| + aura::Window clipping_window_;
|
| +
|
| + // The bounds of the content layer before clipping occurs on the fast resize
|
| + // path. This is restored when the clip is uninstalled. This is done since the
|
| + // contents needs to be places relatively to the clip that is about to occur.
|
| + gfx::Rect orig_bounds_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(NativeViewHostAura);
|
| };
|
|
|
|
|