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

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

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: add missing files Created 3 years, 10 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_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 9f1db2872bbd5f3fa006ee7f5a07050e31c82b76..5de92f4ddd9b0c4949efa6d559294b09effe8cd7 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -552,7 +552,8 @@ void RenderWidgetHostViewAndroid::GetScaledContentBitmap(
DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width());
DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height());
const display::Display& display =
- display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView());
+ display::Screen::GetScreen()->GetDisplayNearestWindow(
+ GetNativeView()->GetWindowAndroid());
float device_scale_factor = display.device_scale_factor();
DCHECK_GT(device_scale_factor, 0);
gfx::Size dst_size(
@@ -666,10 +667,8 @@ gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const {
if (!content_view_core_) {
if (default_bounds_.IsEmpty()) return gfx::Size();
- return gfx::Size(default_bounds_.right()
- * ui::GetScaleFactorForNativeView(GetNativeView()),
- default_bounds_.bottom()
- * ui::GetScaleFactorForNativeView(GetNativeView()));
+ return gfx::Size(default_bounds_.right() * GetScaleFactorForNativeView(),
tapted 2017/02/15 00:36:10 gfx::ScaleToFlooredSize() ?
Jinsuk Kim 2017/02/16 10:11:25 Done.
+ default_bounds_.bottom() * GetScaleFactorForNativeView());
}
return content_view_core_->GetPhysicalBackingSize();
@@ -948,7 +947,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
base::TimeTicks start_time = base::TimeTicks::Now();
const display::Display& display =
- display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView());
+ display::Screen::GetScreen()->GetDisplayNearestWindow(
+ GetNativeView()->GetWindowAndroid());
float device_scale_factor = display.device_scale_factor();
gfx::Size dst_size_in_pixel =
gfx::ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size();
@@ -1202,7 +1202,7 @@ RenderWidgetHostViewAndroid::CreateDrawable() {
return std::unique_ptr<ui::TouchHandleDrawable>(
new CompositedTouchHandleDrawable(
content_view_core_->GetViewAndroid()->GetLayer(),
- ui::GetScaleFactorForNativeView(GetNativeView()),
+ GetScaleFactorForNativeView(),
// Use the activity context where possible (instead of the application
// context) to ensure proper handle theming.
activityContext.is_null() ? base::android::GetApplicationContext()
@@ -1278,7 +1278,7 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
frame_metadata.top_controls_height *
frame_metadata.top_controls_shown_ratio));
- float dip_scale = ui::GetScaleFactorForNativeView(GetNativeView());
+ float dip_scale = GetScaleFactorForNativeView();
float top_controls_pix = frame_metadata.top_controls_height * dip_scale;
float top_shown_pix = top_controls_pix
* frame_metadata.top_controls_shown_ratio;
@@ -2000,8 +2000,7 @@ void RenderWidgetHostViewAndroid::CreateOverscrollControllerIfPossible() {
return;
overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
- overscroll_refresh_handler, compositor,
- ui::GetScaleFactorForNativeView(GetNativeView()));
+ overscroll_refresh_handler, compositor, GetScaleFactorForNativeView());
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698