Chromium Code Reviews| 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 | 764 |
| 765 layer_tree_impl_->DidAnimateScrollOffset(); | 765 layer_tree_impl_->DidAnimateScrollOffset(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 void LayerImpl::OnAnimationWaitingForDeletion() {} | 768 void LayerImpl::OnAnimationWaitingForDeletion() {} |
| 769 | 769 |
| 770 bool LayerImpl::IsActive() const { | 770 bool LayerImpl::IsActive() const { |
| 771 return layer_tree_impl_->IsActiveTree(); | 771 return layer_tree_impl_->IsActiveTree(); |
| 772 } | 772 } |
| 773 | 773 |
| 774 // TODO(aelias): Convert so that bounds returns SizeF. | 774 // TODO(aelias): Convert so that bounds returns SizeF. |
|
danakj
2014/10/10 18:47:16
remove
bokan
2014/10/10 19:25:54
Done.
| |
| 775 gfx::Size LayerImpl::bounds() const { | 775 gfx::Size LayerImpl::bounds() const { |
| 776 return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(), | 776 return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(), |
|
danakj
2014/10/10 18:47:15
can you snap the delta to an int here and add that
bokan
2014/10/10 19:25:54
Done.
| |
| 777 bounds_.height() + bounds_delta_.y())); | 777 bounds_.height() + bounds_delta_.y())); |
| 778 } | 778 } |
| 779 | 779 |
| 780 gfx::SizeF LayerImpl::BoundsForScrolling() const { | |
|
danakj
2014/10/10 18:47:15
This is much less scary than changing bounds(), th
| |
| 781 return gfx::SizeF(bounds_.width() + bounds_delta_.x(), | |
| 782 bounds_.height() + bounds_delta_.y()); | |
| 783 } | |
| 784 | |
| 780 void LayerImpl::SetBounds(const gfx::Size& bounds) { | 785 void LayerImpl::SetBounds(const gfx::Size& bounds) { |
| 781 if (bounds_ == bounds) | 786 if (bounds_ == bounds) |
| 782 return; | 787 return; |
| 783 | 788 |
| 784 bounds_ = bounds; | 789 bounds_ = bounds; |
| 785 | 790 |
| 786 ScrollbarParametersDidChange(true); | 791 ScrollbarParametersDidChange(true); |
| 787 if (masks_to_bounds()) | 792 if (masks_to_bounds()) |
| 788 NoteLayerPropertyChangedForSubtree(); | 793 NoteLayerPropertyChangedForSubtree(); |
| 789 else | 794 else |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1163 | 1168 |
| 1164 gfx::ScrollOffset LayerImpl::MaxScrollOffset() const { | 1169 gfx::ScrollOffset LayerImpl::MaxScrollOffset() const { |
| 1165 if (!scroll_clip_layer_ || bounds().IsEmpty()) | 1170 if (!scroll_clip_layer_ || bounds().IsEmpty()) |
| 1166 return gfx::ScrollOffset(); | 1171 return gfx::ScrollOffset(); |
| 1167 | 1172 |
| 1168 LayerImpl const* page_scale_layer = layer_tree_impl()->page_scale_layer(); | 1173 LayerImpl const* page_scale_layer = layer_tree_impl()->page_scale_layer(); |
| 1169 DCHECK(this != page_scale_layer); | 1174 DCHECK(this != page_scale_layer); |
| 1170 DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || | 1175 DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || |
| 1171 IsContainerForFixedPositionLayers()); | 1176 IsContainerForFixedPositionLayers()); |
| 1172 | 1177 |
| 1173 gfx::SizeF scaled_scroll_bounds(bounds()); | 1178 gfx::SizeF scaled_scroll_bounds(BoundsForScrolling()); |
| 1174 | 1179 |
| 1175 float scale_factor = 1.f; | 1180 float scale_factor = 1.f; |
| 1176 for (LayerImpl const* current_layer = this; | 1181 for (LayerImpl const* current_layer = this; |
| 1177 current_layer != scroll_clip_layer_; | 1182 current_layer != scroll_clip_layer_; |
| 1178 current_layer = current_layer->parent()) { | 1183 current_layer = current_layer->parent()) { |
| 1179 DCHECK(current_layer); | 1184 DCHECK(current_layer); |
| 1180 float current_layer_scale = 1.f; | 1185 float current_layer_scale = 1.f; |
| 1181 | 1186 |
| 1182 const gfx::Transform& layer_transform = current_layer->transform(); | 1187 const gfx::Transform& layer_transform = current_layer->transform(); |
| 1183 if (current_layer == page_scale_layer) { | 1188 if (current_layer == page_scale_layer) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1556 } | 1561 } |
| 1557 | 1562 |
| 1558 void LayerImpl::NotifyAnimationFinished( | 1563 void LayerImpl::NotifyAnimationFinished( |
| 1559 base::TimeTicks monotonic_time, | 1564 base::TimeTicks monotonic_time, |
| 1560 Animation::TargetProperty target_property) { | 1565 Animation::TargetProperty target_property) { |
| 1561 if (target_property == Animation::ScrollOffset) | 1566 if (target_property == Animation::ScrollOffset) |
| 1562 layer_tree_impl_->InputScrollAnimationFinished(); | 1567 layer_tree_impl_->InputScrollAnimationFinished(); |
| 1563 } | 1568 } |
| 1564 | 1569 |
| 1565 } // namespace cc | 1570 } // namespace cc |
| OLD | NEW |