diff options
author | danakj <danakj@chromium.org> | 2015-09-17 15:25:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-17 22:27:43 +0000 |
commit | a342d6f3b63c7fb91ea548e00784c6e4ad538b6b (patch) | |
tree | 9e21df9aac8819f63adb2d815525ed3d7168cbd5 /android_webview/browser/browser_view_renderer.cc | |
parent | cbc31262a5b99ea1c426fdee47313223aee05913 (diff) | |
download | chromium_src-a342d6f3b63c7fb91ea548e00784c6e4ad538b6b.zip chromium_src-a342d6f3b63c7fb91ea548e00784c6e4ad538b6b.tar.gz chromium_src-a342d6f3b63c7fb91ea548e00784c6e4ad538b6b.tar.bz2 |
webview: Move calls to update the root scroll delegate to LTHI.
This moves the calls to update the delegate out to the LayerTreeHostImpl
instead of having it on LayerTreeImpl. This has a few benefits.
1) Things that are only for the active tree don't make the most sense
on LayerTreeImpl in general, since it's an abstraction around things
that occur on both the pending and active tree.
2) This avoids the needs to set the root scroll delegate to null and
back during activation and pinch updates. Instead of updating the root
delegate reactionarily when things change, we just call it at the end
of steps that might change the root scroll delegate's data (and early
out in BrowserViewRenderer if they are unchanged instead).
3) Avoids plumbing around concepts of the root scroll delegate through
LayerImpl and LayerTreeImpl.
R=boliu
BUG=531746
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1345353002
Cr-Commit-Position: refs/heads/master@{#349520}
Diffstat (limited to 'android_webview/browser/browser_view_renderer.cc')
-rw-r--r-- | android_webview/browser/browser_view_renderer.cc | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc index deb9901..4bf5e4b 100644 --- a/android_webview/browser/browser_view_renderer.cc +++ b/android_webview/browser/browser_view_renderer.cc @@ -94,13 +94,14 @@ BrowserViewRenderer::BrowserViewRenderer( window_visible_(false), attached_to_window_(false), hardware_enabled_(false), - dip_scale_(0.0), - page_scale_factor_(1.0), + dip_scale_(0.f), + page_scale_factor_(1.f), + min_page_scale_factor_(0.f), + max_page_scale_factor_(0.f), on_new_picture_enable_(false), clear_view_(false), offscreen_pre_raster_(false), - fallback_tick_pending_(false) { -} + fallback_tick_pending_(false) {} BrowserViewRenderer::~BrowserViewRenderer() { } @@ -530,11 +531,8 @@ void BrowserViewRenderer::DidUpdateContent() { void BrowserViewRenderer::SetTotalRootLayerScrollOffset( gfx::Vector2dF scroll_offset_dip) { - // TOOD(mkosiba): Add a DCHECK to say that this does _not_ get called during - // DrawGl when http://crbug.com/249972 is fixed. if (scroll_offset_dip_ == scroll_offset_dip) return; - scroll_offset_dip_ = scroll_offset_dip; gfx::Vector2d max_offset = max_scroll_offset(); @@ -573,20 +571,27 @@ void BrowserViewRenderer::UpdateRootLayerState( "state", RootLayerStateAsValue(total_scroll_offset_dip, scrollable_size_dip)); + DCHECK_GE(max_scroll_offset_dip.x(), 0.f); + DCHECK_GE(max_scroll_offset_dip.y(), 0.f); + DCHECK_GT(page_scale_factor, 0.f); + // SetDipScale should have been called at least once before this is called. DCHECK_GT(dip_scale_, 0.f); - max_scroll_offset_dip_ = max_scroll_offset_dip; - DCHECK_LE(0.f, max_scroll_offset_dip_.x()); - DCHECK_LE(0.f, max_scroll_offset_dip_.y()); - - page_scale_factor_ = page_scale_factor; - DCHECK_GT(page_scale_factor_, 0.f); - - client_->UpdateScrollState(max_scroll_offset(), - scrollable_size_dip, - page_scale_factor, - min_page_scale_factor, - max_page_scale_factor); + if (max_scroll_offset_dip_ != max_scroll_offset_dip || + scrollable_size_dip_ != scrollable_size_dip || + page_scale_factor_ != page_scale_factor || + min_page_scale_factor_ != min_page_scale_factor || + max_page_scale_factor_ != max_page_scale_factor) { + max_scroll_offset_dip_ = max_scroll_offset_dip; + scrollable_size_dip_ = scrollable_size_dip; + page_scale_factor_ = page_scale_factor; + min_page_scale_factor_ = min_page_scale_factor; + max_page_scale_factor_ = max_page_scale_factor; + + client_->UpdateScrollState(max_scroll_offset(), scrollable_size_dip, + page_scale_factor, min_page_scale_factor, + max_page_scale_factor); + } SetTotalRootLayerScrollOffset(total_scroll_offset_dip); } |