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 @@
#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) {
......
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