Chromium Code Reviews| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 root_layer_scroll_offset_delegate_, | 431 root_layer_scroll_offset_delegate_, |
| 432 this)); | 432 this)); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void LayerTreeImpl::ClearViewportLayers() { | 435 void LayerTreeImpl::ClearViewportLayers() { |
| 436 page_scale_layer_ = NULL; | 436 page_scale_layer_ = NULL; |
| 437 inner_viewport_scroll_layer_ = NULL; | 437 inner_viewport_scroll_layer_ = NULL; |
| 438 outer_viewport_scroll_layer_ = NULL; | 438 outer_viewport_scroll_layer_ = NULL; |
| 439 } | 439 } |
| 440 | 440 |
| 441 void LayerTreeImpl::UpdateDrawProperties() { | 441 bool LayerTreeImpl::UpdateDrawProperties() { |
| 442 // For max_texture_size. | |
| 443 if (!layer_tree_host_impl_->renderer()) | |
| 444 return false; | |
|
Ian Vollick
2014/06/12 15:55:03
Why don't we want to clear the RSLL when we bail e
danakj
2014/06/12 16:03:58
The flag is still dirty so the values are still ol
Ian Vollick
2014/06/12 16:22:19
sg
| |
| 445 | |
| 446 if (!root_layer()) | |
| 447 return false; | |
| 448 | |
| 442 needs_update_draw_properties_ = false; | 449 needs_update_draw_properties_ = false; |
| 443 render_surface_layer_list_.clear(); | 450 render_surface_layer_list_.clear(); |
| 444 | 451 |
| 445 // For max_texture_size. | |
| 446 if (!layer_tree_host_impl_->renderer()) | |
| 447 return; | |
| 448 | |
| 449 if (!root_layer()) | |
| 450 return; | |
| 451 | |
| 452 { | 452 { |
| 453 TRACE_EVENT2("cc", | 453 TRACE_EVENT2("cc", |
| 454 "LayerTreeImpl::UpdateDrawProperties", | 454 "LayerTreeImpl::UpdateDrawProperties", |
| 455 "IsActive", | 455 "IsActive", |
| 456 IsActiveTree(), | 456 IsActiveTree(), |
| 457 "SourceFrameNumber", | 457 "SourceFrameNumber", |
| 458 source_frame_number_); | 458 source_frame_number_); |
| 459 LayerImpl* page_scale_layer = | 459 LayerImpl* page_scale_layer = |
| 460 page_scale_layer_ ? page_scale_layer_ : InnerViewportContainerLayer(); | 460 page_scale_layer_ ? page_scale_layer_ : InnerViewportContainerLayer(); |
| 461 bool can_render_to_separate_surface = | 461 bool can_render_to_separate_surface = |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 | 503 |
| 504 if (layer->mask_layer()) | 504 if (layer->mask_layer()) |
| 505 layer->mask_layer()->UpdateTilePriorities(); | 505 layer->mask_layer()->UpdateTilePriorities(); |
| 506 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) | 506 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) |
| 507 layer->replica_layer()->mask_layer()->UpdateTilePriorities(); | 507 layer->replica_layer()->mask_layer()->UpdateTilePriorities(); |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 DCHECK(!needs_update_draw_properties_) << | 511 DCHECK(!needs_update_draw_properties_) << |
| 512 "CalcDrawProperties should not set_needs_update_draw_properties()"; | 512 "CalcDrawProperties should not set_needs_update_draw_properties()"; |
| 513 return true; | |
| 513 } | 514 } |
| 514 | 515 |
| 515 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { | 516 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { |
| 516 // If this assert triggers, then the list is dirty. | 517 // If this assert triggers, then the list is dirty. |
| 517 DCHECK(!needs_update_draw_properties_); | 518 DCHECK(!needs_update_draw_properties_); |
| 518 return render_surface_layer_list_; | 519 return render_surface_layer_list_; |
| 519 } | 520 } |
| 520 | 521 |
| 521 gfx::Size LayerTreeImpl::ScrollableSize() const { | 522 gfx::Size LayerTreeImpl::ScrollableSize() const { |
| 522 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() | 523 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 bool operator()(LayerImpl* layer) const { | 1223 bool operator()(LayerImpl* layer) const { |
| 1223 return layer->IsDrawnRenderSurfaceLayerListMember() || | 1224 return layer->IsDrawnRenderSurfaceLayerListMember() || |
| 1224 ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) || | 1225 ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) || |
| 1225 !layer->touch_event_handler_region().IsEmpty() || | 1226 !layer->touch_event_handler_region().IsEmpty() || |
| 1226 layer->have_wheel_event_handlers(); | 1227 layer->have_wheel_event_handlers(); |
| 1227 } | 1228 } |
| 1228 }; | 1229 }; |
| 1229 | 1230 |
| 1230 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( | 1231 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( |
| 1231 const gfx::PointF& screen_space_point) { | 1232 const gfx::PointF& screen_space_point) { |
| 1233 if (!root_layer()) | |
| 1234 return NULL; | |
| 1235 if (needs_update_draw_properties_ && !UpdateDrawProperties()) | |
|
enne (OOO)
2014/06/11 21:28:43
What about having UpdateDrawProperties early out w
danakj
2014/06/11 21:41:19
Ya, I didn't do that only cuz I'm scared it might
danakj
2014/06/12 18:26:50
Done.
| |
| 1236 return NULL; | |
| 1232 FindClosestMatchingLayerDataForRecursion data_for_recursion; | 1237 FindClosestMatchingLayerDataForRecursion data_for_recursion; |
| 1233 FindClosestMatchingLayer(screen_space_point, | 1238 FindClosestMatchingLayer(screen_space_point, |
| 1234 root_layer(), | 1239 root_layer(), |
| 1235 HitTestVisibleScrollableOrTouchableFunctor(), | 1240 HitTestVisibleScrollableOrTouchableFunctor(), |
| 1236 &data_for_recursion); | 1241 &data_for_recursion); |
| 1237 return data_for_recursion.closest_match; | 1242 return data_for_recursion.closest_match; |
| 1238 } | 1243 } |
| 1239 | 1244 |
| 1240 static bool LayerHasTouchEventHandlersAt(const gfx::PointF& screen_space_point, | 1245 static bool LayerHasTouchEventHandlersAt(const gfx::PointF& screen_space_point, |
| 1241 LayerImpl* layer_impl) { | 1246 LayerImpl* layer_impl) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1261 | 1266 |
| 1262 struct FindTouchEventLayerFunctor { | 1267 struct FindTouchEventLayerFunctor { |
| 1263 bool operator()(LayerImpl* layer) const { | 1268 bool operator()(LayerImpl* layer) const { |
| 1264 return LayerHasTouchEventHandlersAt(screen_space_point, layer); | 1269 return LayerHasTouchEventHandlersAt(screen_space_point, layer); |
| 1265 } | 1270 } |
| 1266 const gfx::PointF screen_space_point; | 1271 const gfx::PointF screen_space_point; |
| 1267 }; | 1272 }; |
| 1268 | 1273 |
| 1269 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPointInTouchHandlerRegion( | 1274 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPointInTouchHandlerRegion( |
| 1270 const gfx::PointF& screen_space_point) { | 1275 const gfx::PointF& screen_space_point) { |
| 1276 if (!root_layer()) | |
| 1277 return NULL; | |
| 1278 if (needs_update_draw_properties_ && !UpdateDrawProperties()) | |
| 1279 return NULL; | |
| 1271 FindTouchEventLayerFunctor func = {screen_space_point}; | 1280 FindTouchEventLayerFunctor func = {screen_space_point}; |
| 1272 FindClosestMatchingLayerDataForRecursion data_for_recursion; | 1281 FindClosestMatchingLayerDataForRecursion data_for_recursion; |
| 1273 FindClosestMatchingLayer( | 1282 FindClosestMatchingLayer( |
| 1274 screen_space_point, root_layer(), func, &data_for_recursion); | 1283 screen_space_point, root_layer(), func, &data_for_recursion); |
| 1275 return data_for_recursion.closest_match; | 1284 return data_for_recursion.closest_match; |
| 1276 } | 1285 } |
| 1277 | 1286 |
| 1278 } // namespace cc | 1287 } // namespace cc |
| OLD | NEW |