diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 00:05:44 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 00:05:44 +0000 |
commit | e2be10e34a5209ca4d1bad89b7465f2e614f6f90 (patch) | |
tree | 7e34003faef21e23b6a48fc0c4cf6498e3114f28 | |
parent | 59c527d66551560be08588835a2e7c7aa0f06e6c (diff) | |
download | chromium_src-e2be10e34a5209ca4d1bad89b7465f2e614f6f90.zip chromium_src-e2be10e34a5209ca4d1bad89b7465f2e614f6f90.tar.gz chromium_src-e2be10e34a5209ca4d1bad89b7465f2e614f6f90.tar.bz2 |
Align web content's layer to toplevel window instead of root on ash.
On ash, toplevel window (which is a widget) is already aligned so the RWHV should be aligned to the toplevel window intead of RootWindow.
This depends on the following CL:
https://codereview.chromium.org/375693006/
https://codereview.chromium.org/357063002/
BUG=391822
Review URL: https://codereview.chromium.org/379483002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283940 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 22 |
1 files changed, 13 insertions, 9 deletions
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 76805ce..205f3fc 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -62,6 +62,7 @@ #include "ui/base/ime/input_method.h" #include "ui/base/ui_base_types.h" #include "ui/compositor/compositor_vsync_manager.h" +#include "ui/compositor/dip_util.h" #include "ui/events/event.h" #include "ui/events/event_utils.h" #include "ui/events/gestures/gesture_recognizer.h" @@ -1618,6 +1619,7 @@ void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( GetDisplayNearestWindow(window_); DCHECK_EQ(device_scale_factor, display.device_scale_factor()); current_cursor_.SetDisplayInfo(display); + SnapToPhysicalPixelBoundary(); } void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { @@ -2251,15 +2253,17 @@ void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { // to avoid the web contents area looking blurry we translate the web contents // in the +x, +y direction to land on the nearest pixel boundary. This may // cause the bottom and right edges to be clipped slightly, but that's ok. - gfx::Point view_offset_dips = window_->GetBoundsInRootWindow().origin(); - gfx::PointF view_offset = view_offset_dips; - view_offset.Scale(current_device_scale_factor_); - gfx::PointF view_offset_snapped(std::ceil(view_offset.x()), - std::ceil(view_offset.y())); - - gfx::Vector2dF fudge = view_offset_snapped - view_offset; - fudge.Scale(1.0 / current_device_scale_factor_); - GetLayer()->SetSubpixelPositionOffset(fudge); + aura::Window* snapped = NULL; + // On desktop, use the root window. On alternative environment (ash), + // use the toplevel window which must be already snapped. + if (gfx::Screen::GetScreenFor(window_) != + gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE)) { + snapped = window_->GetRootWindow(); + } else { + snapped = window_->GetToplevelWindow(); + } + if (snapped && snapped != window_) + ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer()); } void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { |