Commit e2be10e3 authored by oshima@chromium.org's avatar oshima@chromium.org

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
parent 59c527d6
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method.h"
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"
#include "ui/compositor/compositor_vsync_manager.h" #include "ui/compositor/compositor_vsync_manager.h"
#include "ui/compositor/dip_util.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/events/gestures/gesture_recognizer.h" #include "ui/events/gestures/gesture_recognizer.h"
...@@ -1618,6 +1619,7 @@ void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( ...@@ -1618,6 +1619,7 @@ void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
GetDisplayNearestWindow(window_); GetDisplayNearestWindow(window_);
DCHECK_EQ(device_scale_factor, display.device_scale_factor()); DCHECK_EQ(device_scale_factor, display.device_scale_factor());
current_cursor_.SetDisplayInfo(display); current_cursor_.SetDisplayInfo(display);
SnapToPhysicalPixelBoundary();
} }
void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) {
...@@ -2251,15 +2253,17 @@ void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { ...@@ -2251,15 +2253,17 @@ void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() {
// to avoid the web contents area looking blurry we translate the web contents // 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 // 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. // cause the bottom and right edges to be clipped slightly, but that's ok.
gfx::Point view_offset_dips = window_->GetBoundsInRootWindow().origin(); aura::Window* snapped = NULL;
gfx::PointF view_offset = view_offset_dips; // On desktop, use the root window. On alternative environment (ash),
view_offset.Scale(current_device_scale_factor_); // use the toplevel window which must be already snapped.
gfx::PointF view_offset_snapped(std::ceil(view_offset.x()), if (gfx::Screen::GetScreenFor(window_) !=
std::ceil(view_offset.y())); gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE)) {
snapped = window_->GetRootWindow();
gfx::Vector2dF fudge = view_offset_snapped - view_offset; } else {
fudge.Scale(1.0 / current_device_scale_factor_); snapped = window_->GetToplevelWindow();
GetLayer()->SetSubpixelPositionOffset(fudge); }
if (snapped && snapped != window_)
ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer());
} }
void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment