Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1239)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 366543004: Make 1.5x DPI text render crisply. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reorder methods Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
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 fe64a522e2db1a4628635877d14551b627ae8696..06d349a2849ce00ce6c7a2232f1d61336bcb0257 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -968,78 +968,6 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceInitialized(int host_id,
int route_id) {
}
-void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() {
- // The top left corner of our view in window coordinates might not land on a
- // device pixel boundary if we have a non-integer device scale. In that case,
- // 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);
-}
-
-void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) {
- if (HasDisplayPropertyChanged(window_))
- host_->InvalidateScreenInfo();
-
- SnapToPhysicalPixelBoundary();
- // Don't recursively call SetBounds if this bounds update is the result of
- // a Window::SetBoundsInternal call.
- if (!in_bounds_changed_)
- window_->SetBounds(rect);
- host_->WasResized();
- delegated_frame_host_->WasResized();
- if (touch_editing_client_) {
- touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_,
- selection_focus_rect_);
- }
-#if defined(OS_WIN)
- // Create the legacy dummy window which corresponds to the bounds of the
- // webcontents. This will be passed as the container window for windowless
- // plugins.
- // Plugins like Flash assume the container window which is returned via the
- // NPNVnetscapeWindow property corresponds to the bounds of the webpage.
- // This is not true in Aura where we have only HWND which is the main Aura
- // window. If we return this window to plugins like Flash then it causes the
- // coordinate translations done by these plugins to break.
- // Additonally the legacy dummy window is needed for accessibility and for
- // scrolling to work in legacy drivers for trackpoints/trackpads, etc.
- if (!legacy_window_destroyed_ && GetNativeViewId()) {
- if (!legacy_render_widget_host_HWND_) {
- legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create(
- reinterpret_cast<HWND>(GetNativeViewId()));
- }
- if (legacy_render_widget_host_HWND_) {
- legacy_render_widget_host_HWND_->set_host(this);
- legacy_render_widget_host_HWND_->SetBounds(
- window_->GetBoundsInRootWindow());
- // There are cases where the parent window is created, made visible and
- // the associated RenderWidget is also visible before the
- // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown
- // here.
- if (!host_->is_hidden())
- legacy_render_widget_host_HWND_->Show();
-
- BrowserAccessibilityManagerWin* manager =
- static_cast<BrowserAccessibilityManagerWin*>(
- GetBrowserAccessibilityManager());
- if (manager)
- manager->SetAccessibleHWND(legacy_render_widget_host_HWND_);
- }
- }
-
- if (mouse_locked_)
- UpdateMouseLockRegion();
-#endif
-}
-
#if defined(OS_WIN)
bool RenderWidgetHostViewAura::UsesNativeWindowFrame() const {
return (legacy_render_widget_host_HWND_ != NULL);
@@ -2314,6 +2242,78 @@ void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) {
overscroll_controller_.reset(new OverscrollController());
}
+void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() {
+ // The top left corner of our view in window coordinates might not land on a
+ // device pixel boundary if we have a non-integer device scale. In that case,
+ // 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);
+}
+
+void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) {
+ if (HasDisplayPropertyChanged(window_))
+ host_->InvalidateScreenInfo();
+
+ SnapToPhysicalPixelBoundary();
+ // Don't recursively call SetBounds if this bounds update is the result of
+ // a Window::SetBoundsInternal call.
+ if (!in_bounds_changed_)
+ window_->SetBounds(rect);
+ host_->WasResized();
+ delegated_frame_host_->WasResized();
+ if (touch_editing_client_) {
+ touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_,
+ selection_focus_rect_);
+ }
+#if defined(OS_WIN)
+ // Create the legacy dummy window which corresponds to the bounds of the
+ // webcontents. This will be passed as the container window for windowless
+ // plugins.
+ // Plugins like Flash assume the container window which is returned via the
+ // NPNVnetscapeWindow property corresponds to the bounds of the webpage.
+ // This is not true in Aura where we have only HWND which is the main Aura
+ // window. If we return this window to plugins like Flash then it causes the
+ // coordinate translations done by these plugins to break.
+ // Additonally the legacy dummy window is needed for accessibility and for
+ // scrolling to work in legacy drivers for trackpoints/trackpads, etc.
+ if (!legacy_window_destroyed_ && GetNativeViewId()) {
+ if (!legacy_render_widget_host_HWND_) {
+ legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create(
+ reinterpret_cast<HWND>(GetNativeViewId()));
+ }
+ if (legacy_render_widget_host_HWND_) {
+ legacy_render_widget_host_HWND_->set_host(this);
+ legacy_render_widget_host_HWND_->SetBounds(
+ window_->GetBoundsInRootWindow());
+ // There are cases where the parent window is created, made visible and
+ // the associated RenderWidget is also visible before the
+ // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown
+ // here.
+ if (!host_->is_hidden())
+ legacy_render_widget_host_HWND_->Show();
+
+ BrowserAccessibilityManagerWin* manager =
+ static_cast<BrowserAccessibilityManagerWin*>(
+ GetBrowserAccessibilityManager());
+ if (manager)
+ manager->SetAccessibleHWND(legacy_render_widget_host_HWND_);
+ }
+ }
+
+ if (mouse_locked_)
+ UpdateMouseLockRegion();
+#endif
+}
+
void RenderWidgetHostViewAura::SchedulePaintIfNotInClip(
const gfx::Rect& rect,
const gfx::Rect& clip) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698