Chromium Code Reviews| Index: android_webview/browser/in_process_view_renderer.cc |
| diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc |
| index 28810e2b7aa3c5d303bed9a3ed1b2fcea98ed103..ef4f90a3e5cabe3a8c8fc653d04aca2c8d7b2ef9 100644 |
| --- a/android_webview/browser/in_process_view_renderer.cc |
| +++ b/android_webview/browser/in_process_view_renderer.cc |
| @@ -306,6 +306,7 @@ InProcessViewRenderer::InProcessViewRenderer( |
| web_contents_(web_contents), |
| compositor_(NULL), |
| view_visible_(false), |
| + dip_scale_(0.0), |
| continuous_invalidate_(false), |
| block_invalidates_(false), |
| width_(0), |
| @@ -341,7 +342,7 @@ void InProcessViewRenderer::WebContentsGone() { |
| bool InProcessViewRenderer::OnDraw(jobject java_canvas, |
| bool is_hardware_canvas, |
| - const gfx::Point& scroll, |
| + const gfx::Vector2d& scroll, |
| const gfx::Rect& clip) { |
| scroll_at_start_of_frame_ = scroll; |
| if (is_hardware_canvas && attached_to_window_ && compositor_ && |
| @@ -643,14 +644,44 @@ void InProcessViewRenderer::SetContinuousInvalidate(bool invalidate) { |
| EnsureContinuousInvalidation(NULL); |
| } |
| +void InProcessViewRenderer::SetDipScale(double dip_scale) { |
| + dip_scale_ = dip_scale; |
| + CHECK(dip_scale_ > 0); |
| +} |
| + |
| +void InProcessViewRenderer::ScrollTo(gfx::Vector2d new_value) { |
| + |
|
joth
2013/06/19 05:34:45
nit: spurious \n
mkosiba (inactive)
2013/06/19 11:12:19
Done.
|
| + DCHECK(dip_scale_ > 0); |
| + gfx::Vector2dF new_value_css(new_value.x() / dip_scale_, |
| + new_value.y() / dip_scale_); |
| + DCHECK(scroll_offset_css_ != new_value_css); |
| + |
| + scroll_offset_css_ = new_value_css; |
| + |
| + if (compositor_) |
| + compositor_->DidChangeRootLayerScrollOffset(); |
| +} |
| + |
| void InProcessViewRenderer::SetTotalRootLayerScrollOffset( |
| - gfx::Vector2dF new_value) { |
| - // TODO(mkosiba): Plumb this all the way through to the view. |
| - scroll_offset_ = new_value; |
| + gfx::Vector2dF new_value_css) { |
| + // TOOD(mkosiba): Add a DCHECK to say that this does _not_ get called during |
| + // DrawGl when http://crbug.com/249972 is fixed. |
| + bool value_changed = scroll_offset_css_ != new_value_css; |
|
joth
2013/06/19 05:34:45
nit: local var really needed?
mkosiba (inactive)
2013/06/19 11:12:19
no, I forgot to remove it while restructuring the
|
| + |
| + if (!value_changed) |
| + return; |
| + |
| + scroll_offset_css_ = new_value_css; |
| + |
| + DCHECK(dip_scale_ > 0); |
| + gfx::Vector2d scroll_offset(scroll_offset_css_.x() * dip_scale_, |
| + scroll_offset_css_.y() * dip_scale_); |
| + |
| + client_->ScrollContainerViewTo(scroll_offset); |
| } |
| gfx::Vector2dF InProcessViewRenderer::GetTotalRootLayerScrollOffset() { |
| - return scroll_offset_; |
| + return scroll_offset_css_; |
| } |
| void InProcessViewRenderer::EnsureContinuousInvalidation( |