OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 currently_scrolling_layer_ = layer; | 265 currently_scrolling_layer_ = layer; |
266 if (layer && layer->scrollbar_animation_controller()) | 266 if (layer && layer->scrollbar_animation_controller()) |
267 layer->scrollbar_animation_controller()->DidScrollBegin(); | 267 layer->scrollbar_animation_controller()->DidScrollBegin(); |
268 } | 268 } |
269 | 269 |
270 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { | 270 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { |
271 SetCurrentlyScrollingLayer(NULL); | 271 SetCurrentlyScrollingLayer(NULL); |
272 scrolling_layer_id_from_previous_tree_ = 0; | 272 scrolling_layer_id_from_previous_tree_ = 0; |
273 } | 273 } |
274 | 274 |
275 float LayerTreeImpl::VerticalAdjust(const int clip_layer_id) const { | |
276 LayerImpl* container_layer = InnerViewportContainerLayer(); | |
277 if (!container_layer || clip_layer_id != container_layer->id()) | |
278 return 0.f; | |
279 | |
280 return layer_tree_host_impl_->VerticalAdjust(); | |
281 } | |
282 | |
283 namespace { | 275 namespace { |
284 | 276 |
285 void ForceScrollbarParameterUpdateAfterScaleChange(LayerImpl* current_layer) { | 277 void ForceScrollbarParameterUpdateAfterScaleChange(LayerImpl* current_layer) { |
286 if (!current_layer) | 278 if (!current_layer) |
287 return; | 279 return; |
288 | 280 |
289 while (current_layer) { | 281 while (current_layer) { |
290 current_layer->ScrollbarParametersDidChange(); | 282 current_layer->ScrollbarParametersDidChange(); |
291 current_layer = current_layer->parent(); | 283 current_layer = current_layer->parent(); |
292 } | 284 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 ScrollableSize(), | 340 ScrollableSize(), |
349 total_page_scale_factor(), | 341 total_page_scale_factor(), |
350 min_page_scale_factor_, | 342 min_page_scale_factor_, |
351 max_page_scale_factor_); | 343 max_page_scale_factor_); |
352 } | 344 } |
353 | 345 |
354 ForceScrollbarParameterUpdateAfterScaleChange(page_scale_layer()); | 346 ForceScrollbarParameterUpdateAfterScaleChange(page_scale_layer()); |
355 } | 347 } |
356 | 348 |
357 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { | 349 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { |
358 if (outer_viewport_scroll_layer_) | 350 if (!InnerViewportContainerLayer()) |
359 return layer_tree_host_impl_->UnscaledScrollableViewportSize(); | 351 return gfx::SizeF(); |
360 else | 352 |
361 return gfx::ScaleSize( | 353 return gfx::ScaleSize(InnerViewportContainerLayer()->bounds(), |
362 layer_tree_host_impl_->UnscaledScrollableViewportSize(), | 354 1.0f / total_page_scale_factor()); |
363 1.0f / total_page_scale_factor()); | |
364 } | 355 } |
365 | 356 |
366 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const { | 357 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const { |
367 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() | 358 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() |
368 ? OuterViewportScrollLayer() | 359 ? OuterViewportScrollLayer() |
369 : InnerViewportScrollLayer(); | 360 : InnerViewportScrollLayer(); |
370 if (!root_scroll_layer || root_scroll_layer->children().empty()) | 361 if (!root_scroll_layer || root_scroll_layer->children().empty()) |
371 return gfx::Rect(); | 362 return gfx::Rect(); |
372 LayerImpl* layer = root_scroll_layer->children()[0]; | 363 LayerImpl* layer = root_scroll_layer->children()[0]; |
373 return MathUtil::MapEnclosingClippedRect(layer->screen_space_transform(), | 364 return MathUtil::MapEnclosingClippedRect(layer->screen_space_transform(), |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 | 1387 |
1397 void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 1388 void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
1398 layer_tree_host_impl_->UnregisterPictureLayerImpl(layer); | 1389 layer_tree_host_impl_->UnregisterPictureLayerImpl(layer); |
1399 } | 1390 } |
1400 | 1391 |
1401 void LayerTreeImpl::InputScrollAnimationFinished() { | 1392 void LayerTreeImpl::InputScrollAnimationFinished() { |
1402 layer_tree_host_impl_->ScrollEnd(); | 1393 layer_tree_host_impl_->ScrollEnd(); |
1403 } | 1394 } |
1404 | 1395 |
1405 } // namespace cc | 1396 } // namespace cc |
OLD | NEW |