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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 } | 1186 } |
1187 // TODO(wjmaclean) Once we move to a model where the two-viewport model is | 1187 // TODO(wjmaclean) Once we move to a model where the two-viewport model is |
1188 // turned on in all builds, remove the next two lines. For now however, the | 1188 // turned on in all builds, remove the next two lines. For now however, the |
1189 // page scale layer may coincide with the clip layer, and so this is | 1189 // page scale layer may coincide with the clip layer, and so this is |
1190 // necessary. | 1190 // necessary. |
1191 if (page_scale_layer == scroll_clip_layer_) | 1191 if (page_scale_layer == scroll_clip_layer_) |
1192 scale_factor *= layer_tree_impl()->total_page_scale_factor(); | 1192 scale_factor *= layer_tree_impl()->total_page_scale_factor(); |
1193 | 1193 |
1194 scaled_scroll_bounds.SetSize(scale_factor * scaled_scroll_bounds.width(), | 1194 scaled_scroll_bounds.SetSize(scale_factor * scaled_scroll_bounds.width(), |
1195 scale_factor * scaled_scroll_bounds.height()); | 1195 scale_factor * scaled_scroll_bounds.height()); |
| 1196 scaled_scroll_bounds = gfx::ToFlooredSize(scaled_scroll_bounds); |
1196 | 1197 |
1197 gfx::Vector2dF max_offset( | 1198 gfx::Vector2dF max_offset( |
1198 scaled_scroll_bounds.width() - scroll_clip_layer_->bounds().width(), | 1199 scaled_scroll_bounds.width() - scroll_clip_layer_->bounds().width(), |
1199 scaled_scroll_bounds.height() - scroll_clip_layer_->bounds().height()); | 1200 scaled_scroll_bounds.height() - scroll_clip_layer_->bounds().height()); |
1200 // We need the final scroll offset to be in CSS coords. | 1201 // We need the final scroll offset to be in CSS coords. |
1201 max_offset.Scale(1 / scale_factor); | 1202 max_offset.Scale(1 / scale_factor); |
1202 max_offset.SetToMax(gfx::Vector2dF()); | 1203 max_offset.SetToMax(gfx::Vector2dF()); |
1203 return gfx::ToFlooredVector2d(max_offset); | 1204 return gfx::ToFlooredVector2d(max_offset); |
1204 } | 1205 } |
1205 | 1206 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1501 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1501 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1502 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1502 AsValueInto(state.get()); | 1503 AsValueInto(state.get()); |
1503 return state.PassAs<base::Value>(); | 1504 return state.PassAs<base::Value>(); |
1504 } | 1505 } |
1505 | 1506 |
1506 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1507 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1507 benchmark->RunOnLayer(this); | 1508 benchmark->RunOnLayer(this); |
1508 } | 1509 } |
1509 } // namespace cc | 1510 } // namespace cc |
OLD | NEW |