| OLD | NEW |
| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 } | 618 } |
| 619 | 619 |
| 620 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { | 620 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { |
| 621 if (!scroll_clip_layer_) | 621 if (!scroll_clip_layer_) |
| 622 return gfx::Vector2dF(); | 622 return gfx::Vector2dF(); |
| 623 | 623 |
| 624 float scale_delta = layer_tree_impl()->page_scale_delta(); | 624 float scale_delta = layer_tree_impl()->page_scale_delta(); |
| 625 float scale = layer_tree_impl()->page_scale_factor(); | 625 float scale = layer_tree_impl()->page_scale_factor(); |
| 626 | 626 |
| 627 gfx::Vector2dF delta_from_scroll = scroll_clip_layer_->bounds_delta(); | 627 gfx::Vector2dF delta_from_scroll = scroll_clip_layer_->bounds_delta(); |
| 628 |
| 629 // In virtual-viewport mode, we don't need to compensate for pinch zoom or |
| 630 // scale since the fixed container is the outer viewport, which sits below |
| 631 // the page scale. |
| 632 if (layer_tree_impl()->settings().use_pinch_virtual_viewport) |
| 633 return delta_from_scroll; |
| 634 |
| 628 delta_from_scroll.Scale(1.f / scale); | 635 delta_from_scroll.Scale(1.f / scale); |
| 629 | 636 |
| 630 // The delta-from-pinch component requires some explanation: A viewport of | 637 // The delta-from-pinch component requires some explanation: A viewport of |
| 631 // size (w,h) will appear to be size (w/s,h/s) under scale s in the content | 638 // size (w,h) will appear to be size (w/s,h/s) under scale s in the content |
| 632 // space. If s -> s' on the impl thread, where s' = s * ds, then the apparent | 639 // space. If s -> s' on the impl thread, where s' = s * ds, then the apparent |
| 633 // viewport size change in the content space due to ds is: | 640 // viewport size change in the content space due to ds is: |
| 634 // | 641 // |
| 635 // (w/s',h/s') - (w/s,h/s) = (w,h)(1/s' - 1/s) = (w,h)(1 - ds)/(s ds) | 642 // (w/s',h/s') - (w/s,h/s) = (w,h)(1/s' - 1/s) = (w,h)(1 - ds)/(s ds) |
| 636 // | 643 // |
| 637 gfx::Vector2dF delta_from_pinch = | 644 gfx::Vector2dF delta_from_pinch = |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 | 1587 |
| 1581 void LayerImpl::NotifyAnimationFinished( | 1588 void LayerImpl::NotifyAnimationFinished( |
| 1582 base::TimeTicks monotonic_time, | 1589 base::TimeTicks monotonic_time, |
| 1583 Animation::TargetProperty target_property, | 1590 Animation::TargetProperty target_property, |
| 1584 int group) { | 1591 int group) { |
| 1585 if (target_property == Animation::ScrollOffset) | 1592 if (target_property == Animation::ScrollOffset) |
| 1586 layer_tree_impl_->InputScrollAnimationFinished(); | 1593 layer_tree_impl_->InputScrollAnimationFinished(); |
| 1587 } | 1594 } |
| 1588 | 1595 |
| 1589 } // namespace cc | 1596 } // namespace cc |
| OLD | NEW |