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

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

Issue 2739113002: Simplify calls for scale factor (Closed)
Patch Set: nit Created 3 years, 9 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 f6f9f43b7c8910076d73e795fe8b21fa9948b855..9a24bc7176f5c36a9e43f262818d7f5b5c1d27e6 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -662,10 +662,9 @@ 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()));
+ float scale_factor = view_.GetDipScale();
+ return gfx::Size(default_bounds_.right() * scale_factor,
+ default_bounds_.bottom() * scale_factor);
}
return content_view_core_->GetPhysicalBackingSize();
@@ -1299,8 +1298,7 @@ RenderWidgetHostViewAndroid::CreateDrawable() {
content_view_core_->GetContext();
return std::unique_ptr<ui::TouchHandleDrawable>(
new CompositedTouchHandleDrawable(
- content_view_core_->GetViewAndroid()->GetLayer(),
- ui::GetScaleFactorForNativeView(GetNativeView()),
+ content_view_core_->GetViewAndroid()->GetLayer(), view_.GetDipScale(),
// Use the activity context where possible (instead of the application
// context) to ensure proper handle theming.
activityContext.is_null() ? base::android::GetApplicationContext()
@@ -1375,7 +1373,7 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
frame_metadata.top_controls_height *
frame_metadata.top_controls_shown_ratio));
- float dip_scale = ui::GetScaleFactorForNativeView(GetNativeView());
+ float dip_scale = view_.GetDipScale();
float top_controls_pix = frame_metadata.top_controls_height * dip_scale;
float top_shown_pix =
top_controls_pix * frame_metadata.top_controls_shown_ratio;
@@ -2134,8 +2132,7 @@ void RenderWidgetHostViewAndroid::CreateOverscrollControllerIfPossible() {
return;
overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
- overscroll_refresh_handler, compositor,
- ui::GetScaleFactorForNativeView(GetNativeView()));
+ overscroll_refresh_handler, compositor, view_.GetDipScale());
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698