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

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

Issue 2219823002: Move content offset to ViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass right bounds to snapshot api Created 4 years 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 a8f20b0ca3adfb75ad8cdd463d1a479a358f703d..6ebb8384266687afebf4f552ec42e35ec2aea8a4 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -695,11 +695,13 @@ gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const {
if (!content_view_core_)
return default_bounds_;
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableOSKOverscroll))
- return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden());
-
- return gfx::Rect(content_view_core_->GetViewSize());
+ bool osk_overscroll = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableOSKOverscroll);
+ gfx::Rect bounds = gfx::Rect(osk_overscroll ?
+ content_view_core_->GetViewSizeWithOSKHidden() :
+ content_view_core_->GetViewSize());
+ bounds.Offset(0, view_.content_offset().y());
+ return bounds;
}
gfx::Size RenderWidgetHostViewAndroid::GetVisibleViewportSize() const {
@@ -1358,6 +1360,10 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
UpdateBackgroundColor(is_transparent ? SK_ColorTRANSPARENT
: frame_metadata.root_background_color);
+ view_.set_content_offset(gfx::Vector2dF(0.0f,
+ frame_metadata.top_controls_height *
+ frame_metadata.top_controls_shown_ratio));
+
// All offsets and sizes are in CSS pixels.
content_view_core_->UpdateFrameInfo(
frame_metadata.root_scroll_offset,

Powered by Google App Engine
This is Rietveld 408576698