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/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 RenderPass::Id LayerImpl::NextContributingRenderPassId(RenderPass::Id id) | 359 RenderPass::Id LayerImpl::NextContributingRenderPassId(RenderPass::Id id) |
360 const { | 360 const { |
361 return RenderPass::Id(0, 0); | 361 return RenderPass::Id(0, 0); |
362 } | 362 } |
363 | 363 |
364 ResourceProvider::ResourceId LayerImpl::ContentsResourceId() const { | 364 ResourceProvider::ResourceId LayerImpl::ContentsResourceId() const { |
365 NOTREACHED(); | 365 NOTREACHED(); |
366 return 0; | 366 return 0; |
367 } | 367 } |
368 | 368 |
369 void LayerImpl::SetSentScrollDelta(gfx::Vector2d sent_scroll_delta) { | 369 void LayerImpl::SetSentScrollDelta(const gfx::Vector2d& sent_scroll_delta) { |
370 // Pending tree never has sent scroll deltas | 370 // Pending tree never has sent scroll deltas |
371 DCHECK(layer_tree_impl()->IsActiveTree()); | 371 DCHECK(layer_tree_impl()->IsActiveTree()); |
372 | 372 |
373 if (sent_scroll_delta_ == sent_scroll_delta) | 373 if (sent_scroll_delta_ == sent_scroll_delta) |
374 return; | 374 return; |
375 | 375 |
376 sent_scroll_delta_ = sent_scroll_delta; | 376 sent_scroll_delta_ = sent_scroll_delta; |
377 } | 377 } |
378 | 378 |
379 gfx::Vector2dF LayerImpl::ScrollBy(const gfx::Vector2dF& scroll) { | 379 gfx::Vector2dF LayerImpl::ScrollBy(const gfx::Vector2dF& scroll) { |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 scroll_offset_delegate_->SetMaxScrollOffset(max_scroll_offset_); | 1080 scroll_offset_delegate_->SetMaxScrollOffset(max_scroll_offset_); |
1081 scroll_offset_delegate_->SetTotalScrollOffset(total_offset); | 1081 scroll_offset_delegate_->SetTotalScrollOffset(total_offset); |
1082 } | 1082 } |
1083 } | 1083 } |
1084 | 1084 |
1085 bool LayerImpl::IsExternalFlingActive() const { | 1085 bool LayerImpl::IsExternalFlingActive() const { |
1086 return scroll_offset_delegate_ && | 1086 return scroll_offset_delegate_ && |
1087 scroll_offset_delegate_->IsExternalFlingActive(); | 1087 scroll_offset_delegate_->IsExternalFlingActive(); |
1088 } | 1088 } |
1089 | 1089 |
1090 void LayerImpl::SetScrollOffset(gfx::Vector2d scroll_offset) { | 1090 void LayerImpl::SetScrollOffset(const gfx::Vector2d& scroll_offset) { |
1091 SetScrollOffsetAndDelta(scroll_offset, ScrollDelta()); | 1091 SetScrollOffsetAndDelta(scroll_offset, ScrollDelta()); |
1092 } | 1092 } |
1093 | 1093 |
1094 void LayerImpl::SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset, | 1094 void LayerImpl::SetScrollOffsetAndDelta(const gfx::Vector2d& scroll_offset, |
1095 const gfx::Vector2dF& scroll_delta) { | 1095 const gfx::Vector2dF& scroll_delta) { |
1096 bool changed = false; | 1096 bool changed = false; |
1097 | 1097 |
1098 if (scroll_offset_ != scroll_offset) { | 1098 if (scroll_offset_ != scroll_offset) { |
1099 changed = true; | 1099 changed = true; |
1100 scroll_offset_ = scroll_offset; | 1100 scroll_offset_ = scroll_offset; |
1101 | 1101 |
1102 if (scroll_offset_delegate_) | 1102 if (scroll_offset_delegate_) |
1103 scroll_offset_delegate_->SetTotalScrollOffset(TotalScrollOffset()); | 1103 scroll_offset_delegate_->SetTotalScrollOffset(TotalScrollOffset()); |
1104 } | 1104 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 Region LayerImpl::VisibleContentOpaqueRegion() const { | 1158 Region LayerImpl::VisibleContentOpaqueRegion() const { |
1159 if (contents_opaque()) | 1159 if (contents_opaque()) |
1160 return visible_content_rect(); | 1160 return visible_content_rect(); |
1161 return Region(); | 1161 return Region(); |
1162 } | 1162 } |
1163 | 1163 |
1164 void LayerImpl::DidBeginTracing() {} | 1164 void LayerImpl::DidBeginTracing() {} |
1165 | 1165 |
1166 void LayerImpl::ReleaseResources() {} | 1166 void LayerImpl::ReleaseResources() {} |
1167 | 1167 |
1168 void LayerImpl::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { | 1168 void LayerImpl::SetMaxScrollOffset(const gfx::Vector2d& max_scroll_offset) { |
1169 if (max_scroll_offset_ == max_scroll_offset) | 1169 if (max_scroll_offset_ == max_scroll_offset) |
1170 return; | 1170 return; |
1171 max_scroll_offset_ = max_scroll_offset; | 1171 max_scroll_offset_ = max_scroll_offset; |
1172 | 1172 |
1173 if (scroll_offset_delegate_) | 1173 if (scroll_offset_delegate_) |
1174 scroll_offset_delegate_->SetMaxScrollOffset(max_scroll_offset_); | 1174 scroll_offset_delegate_->SetMaxScrollOffset(max_scroll_offset_); |
1175 | 1175 |
1176 layer_tree_impl()->set_needs_update_draw_properties(); | 1176 layer_tree_impl()->set_needs_update_draw_properties(); |
1177 UpdateScrollbarPositions(); | 1177 UpdateScrollbarPositions(); |
1178 SetNeedsPushProperties(); | 1178 SetNeedsPushProperties(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1337 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1338 AsValueInto(state.get()); | 1338 AsValueInto(state.get()); |
1339 return state.PassAs<base::Value>(); | 1339 return state.PassAs<base::Value>(); |
1340 } | 1340 } |
1341 | 1341 |
1342 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1342 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1343 benchmark->RunOnLayer(this); | 1343 benchmark->RunOnLayer(this); |
1344 } | 1344 } |
1345 | 1345 |
1346 } // namespace cc | 1346 } // namespace cc |
OLD | NEW |