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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 646623003: Don't scale fixed container adjustment in pinch virtual viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 612 }
613 613
614 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { 614 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const {
615 if (!scroll_clip_layer_) 615 if (!scroll_clip_layer_)
616 return gfx::Vector2dF(); 616 return gfx::Vector2dF();
617 617
618 float scale_delta = layer_tree_impl()->page_scale_delta(); 618 float scale_delta = layer_tree_impl()->page_scale_delta();
619 float scale = layer_tree_impl()->page_scale_factor(); 619 float scale = layer_tree_impl()->page_scale_factor();
620 620
621 gfx::Vector2dF delta_from_scroll = scroll_clip_layer_->bounds_delta(); 621 gfx::Vector2dF delta_from_scroll = scroll_clip_layer_->bounds_delta();
622
623 // In virtual-viewport mode, we don't need to compensate for pinch zoom or
624 // scale since the fixed container is the outer viewport, which sits below
625 // the page scale.
626 if (layer_tree_impl()->settings().use_pinch_virtual_viewport)
627 return delta_from_scroll;
628
622 delta_from_scroll.Scale(1.f / scale); 629 delta_from_scroll.Scale(1.f / scale);
623 630
624 // The delta-from-pinch component requires some explanation: A viewport of 631 // The delta-from-pinch component requires some explanation: A viewport of
625 // size (w,h) will appear to be size (w/s,h/s) under scale s in the content 632 // size (w,h) will appear to be size (w/s,h/s) under scale s in the content
626 // space. If s -> s' on the impl thread, where s' = s * ds, then the apparent 633 // space. If s -> s' on the impl thread, where s' = s * ds, then the apparent
627 // viewport size change in the content space due to ds is: 634 // viewport size change in the content space due to ds is:
628 // 635 //
629 // (w/s',h/s') - (w/s,h/s) = (w,h)(1/s' - 1/s) = (w,h)(1 - ds)/(s ds) 636 // (w/s',h/s') - (w/s,h/s) = (w,h)(1/s' - 1/s) = (w,h)(1 - ds)/(s ds)
630 // 637 //
631 gfx::Vector2dF delta_from_pinch = 638 gfx::Vector2dF delta_from_pinch =
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 } 1580 }
1574 1581
1575 void LayerImpl::NotifyAnimationFinished( 1582 void LayerImpl::NotifyAnimationFinished(
1576 base::TimeTicks monotonic_time, 1583 base::TimeTicks monotonic_time,
1577 Animation::TargetProperty target_property) { 1584 Animation::TargetProperty target_property) {
1578 if (target_property == Animation::ScrollOffset) 1585 if (target_property == Animation::ScrollOffset)
1579 layer_tree_impl_->InputScrollAnimationFinished(); 1586 layer_tree_impl_->InputScrollAnimationFinished();
1580 } 1587 }
1581 1588
1582 } // namespace cc 1589 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698