Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 26112002: cc: Fix hit-testing in zero-opacity layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static gfx::Vector2dF GetEffectiveTotalScrollOffset(LayerType* layer) { 56 static gfx::Vector2dF GetEffectiveTotalScrollOffset(LayerType* layer) {
57 gfx::Vector2dF offset = layer->TotalScrollOffset(); 57 gfx::Vector2dF offset = layer->TotalScrollOffset();
58 // The scroll parent's total scroll offset (scroll offset + scroll delta) 58 // The scroll parent's total scroll offset (scroll offset + scroll delta)
59 // can't be used because its scroll offset has already been applied to the 59 // can't be used because its scroll offset has already been applied to the
60 // scroll children's positions by the main thread layer positioning code. 60 // scroll children's positions by the main thread layer positioning code.
61 if (layer->scroll_parent()) 61 if (layer->scroll_parent())
62 offset += layer->scroll_parent()->ScrollDelta(); 62 offset += layer->scroll_parent()->ScrollDelta();
63 return offset; 63 return offset;
64 } 64 }
65 65
66 template <typename LayerType>
67 static inline bool LayerCanAcceptInput(LayerType* layer) {
enne (OOO) 2013/10/29 23:54:22 Maybe call this LayerHasEventHandler to be consist
sadrul 2013/10/30 15:44:42 Done.
68 return !layer->touch_event_handler_region().IsEmpty() ||
69 layer->have_wheel_event_handlers();
70 }
71
66 inline gfx::Rect CalculateVisibleRectWithCachedLayerRect( 72 inline gfx::Rect CalculateVisibleRectWithCachedLayerRect(
67 gfx::Rect target_surface_rect, 73 gfx::Rect target_surface_rect,
68 gfx::Rect layer_bound_rect, 74 gfx::Rect layer_bound_rect,
69 gfx::Rect layer_rect_in_target_space, 75 gfx::Rect layer_rect_in_target_space,
70 const gfx::Transform& transform) { 76 const gfx::Transform& transform) {
71 if (layer_rect_in_target_space.IsEmpty()) 77 if (layer_rect_in_target_space.IsEmpty())
72 return gfx::Rect(); 78 return gfx::Rect();
73 79
74 // Is this layer fully contained within the target surface? 80 // Is this layer fully contained within the target surface?
75 if (target_surface_rect.Contains(layer_rect_in_target_space)) 81 if (target_surface_rect.Contains(layer_rect_in_target_space))
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 436
431 static inline bool TransformToScreenIsKnown(Layer* layer) { 437 static inline bool TransformToScreenIsKnown(Layer* layer) {
432 return !layer->screen_space_transform_is_animating(); 438 return !layer->screen_space_transform_is_animating();
433 } 439 }
434 440
435 template <typename LayerType> 441 template <typename LayerType>
436 static bool LayerShouldBeSkipped(LayerType* layer, 442 static bool LayerShouldBeSkipped(LayerType* layer,
437 bool layer_is_visible) { 443 bool layer_is_visible) {
438 // Layers can be skipped if any of these conditions are met. 444 // Layers can be skipped if any of these conditions are met.
439 // - is not visible due to it or one of its ancestors being hidden. 445 // - is not visible due to it or one of its ancestors being hidden.
446 // - the layer itself and none of its descendants participate in hit testing
440 // - has empty bounds 447 // - has empty bounds
441 // - the layer is not double-sided, but its back face is visible. 448 // - the layer is not double-sided, but its back face is visible.
442 // - is transparent 449 // - is transparent
443 // - does not draw content and does not participate in hit testing. 450 // - does not draw content
444 // 451 //
445 // Some additional conditions need to be computed at a later point after the 452 // Some additional conditions need to be computed at a later point after the
446 // recursion is finished. 453 // recursion is finished.
447 // - the intersection of render_surface content and layer clip_rect is empty 454 // - the intersection of render_surface content and layer clip_rect is empty
448 // - the visible_content_rect is empty 455 // - the visible_content_rect is empty
449 // 456 //
450 // Note, if the layer should not have been drawn due to being fully 457 // Note, if the layer should not have been drawn due to being fully
451 // transparent, we would have skipped the entire subtree and never made it 458 // transparent, we would have skipped the entire subtree and never made it
452 // into this function, so it is safe to omit this check here. 459 // into this function, so it is safe to omit this check here.
453 460
454 if (!layer_is_visible) 461 if (!layer_is_visible)
455 return true; 462 return true;
456 463
464 if (layer->draw_properties().layer_or_descendant_has_event_handler)
enne (OOO) 2013/10/29 23:54:22 I don't think this is sufficient. I feel like wha
sadrul 2013/10/30 05:20:21 I am using DataForRecursion::subtree_has_event_han
465 return false;
466
457 if (layer->bounds().IsEmpty()) 467 if (layer->bounds().IsEmpty())
458 return true; 468 return true;
459 469
460 LayerType* backface_test_layer = layer; 470 LayerType* backface_test_layer = layer;
461 if (layer->use_parent_backface_visibility()) { 471 if (layer->use_parent_backface_visibility()) {
462 DCHECK(layer->parent()); 472 DCHECK(layer->parent());
463 DCHECK(!layer->parent()->use_parent_backface_visibility()); 473 DCHECK(!layer->parent()->use_parent_backface_visibility());
464 backface_test_layer = layer->parent(); 474 backface_test_layer = layer->parent();
465 } 475 }
466 476
467 // The layer should not be drawn if (1) it is not double-sided and (2) the 477 // The layer should not be drawn if (1) it is not double-sided and (2) the
468 // back of the layer is known to be facing the screen. 478 // back of the layer is known to be facing the screen.
469 if (!backface_test_layer->double_sided() && 479 if (!backface_test_layer->double_sided() &&
470 TransformToScreenIsKnown(backface_test_layer) && 480 TransformToScreenIsKnown(backface_test_layer) &&
471 IsLayerBackFaceVisible(backface_test_layer)) 481 IsLayerBackFaceVisible(backface_test_layer))
472 return true; 482 return true;
473 483
474 // The layer is visible to events. If it's subject to hit testing, then 484 // The layer is visible to events.
475 // we can't skip it. 485 if (!layer->DrawsContent())
476 bool can_accept_input = !layer->touch_event_handler_region().IsEmpty() ||
477 layer->have_wheel_event_handlers();
478 if (!layer->DrawsContent() && !can_accept_input)
479 return true; 486 return true;
480 487
481 return false; 488 return false;
482 } 489 }
483 490
484 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer, 491 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
485 bool layer_is_visible) { 492 bool layer_is_visible) {
486 // When we need to do a readback/copy of a layer's output, we can not skip 493 // When we need to do a readback/copy of a layer's output, we can not skip
487 // it or any of its ancestors. 494 // it or any of its ancestors.
488 if (layer->draw_properties().layer_or_descendant_has_copy_request) 495 if (layer->draw_properties().layer_or_descendant_has_copy_request)
489 return false; 496 return false;
490 497
491 // If the layer is not visible, then skip it and its subtree. 498 // If the layer is not visible, then skip it and its subtree.
492 if (!layer_is_visible) 499 if (!layer_is_visible)
493 return true; 500 return true;
494 501
495 // If layer is on the pending tree and opacity is being animated then 502 // If layer is on the pending tree and opacity is being animated then
496 // this subtree can't be skipped as we need to create, prioritize and 503 // this subtree can't be skipped as we need to create, prioritize and
497 // include tiles for this layer when deciding if tree can be activated. 504 // include tiles for this layer when deciding if tree can be activated.
498 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating()) 505 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating())
499 return false; 506 return false;
500 507
508 if (layer->draw_properties().layer_or_descendant_has_event_handler)
509 return false;
510
501 // The opacity of a layer always applies to its children (either implicitly 511 // The opacity of a layer always applies to its children (either implicitly
502 // via a render surface or explicitly if the parent preserves 3D), so the 512 // via a render surface or explicitly if the parent preserves 3D), so the
503 // entire subtree can be skipped if this layer is fully transparent. 513 // entire subtree can be skipped if this layer is fully transparent.
504 // TODO(sad): Don't skip layers used for hit testing crbug.com/295295.
505 return !layer->opacity(); 514 return !layer->opacity();
506 } 515 }
507 516
508 static inline bool SubtreeShouldBeSkipped(Layer* layer, 517 static inline bool SubtreeShouldBeSkipped(Layer* layer,
509 bool layer_is_visible) { 518 bool layer_is_visible) {
510 // When we need to do a readback/copy of a layer's output, we can not skip 519 // When we need to do a readback/copy of a layer's output, we can not skip
511 // it or any of its ancestors. 520 // it or any of its ancestors.
512 if (layer->draw_properties().layer_or_descendant_has_copy_request) 521 if (layer->draw_properties().layer_or_descendant_has_copy_request)
513 return false; 522 return false;
514 523
515 // If the layer is not visible, then skip it and its subtree. 524 // If the layer is not visible, then skip it and its subtree.
516 if (!layer_is_visible) 525 if (!layer_is_visible)
517 return true; 526 return true;
518 527
528 if (layer->draw_properties().layer_or_descendant_has_event_handler)
529 return false;
530
519 // If the opacity is being animated then the opacity on the main thread is 531 // If the opacity is being animated then the opacity on the main thread is
520 // unreliable (since the impl thread may be using a different opacity), so it 532 // unreliable (since the impl thread may be using a different opacity), so it
521 // should not be trusted. 533 // should not be trusted.
522 // In particular, it should not cause the subtree to be skipped. 534 // In particular, it should not cause the subtree to be skipped.
523 // Similarly, for layers that might animate opacity using an impl-only 535 // Similarly, for layers that might animate opacity using an impl-only
524 // animation, their subtree should also not be skipped. 536 // animation, their subtree should also not be skipped.
525 // TODO(sad): Don't skip layers used for hit testing crbug.com/295295.
526 return !layer->opacity() && !layer->OpacityIsAnimating() && 537 return !layer->opacity() && !layer->OpacityIsAnimating() &&
527 !layer->OpacityCanAnimateOnImplThread(); 538 !layer->OpacityCanAnimateOnImplThread();
528 } 539 }
529 540
530 static inline void SavePaintPropertiesLayer(LayerImpl* layer) {} 541 static inline void SavePaintPropertiesLayer(LayerImpl* layer) {}
531 542
532 static inline void SavePaintPropertiesLayer(Layer* layer) { 543 static inline void SavePaintPropertiesLayer(Layer* layer) {
533 layer->SavePaintProperties(); 544 layer->SavePaintProperties();
534 545
535 if (layer->mask_layer()) 546 if (layer->mask_layer())
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 render_surface_layer_list->back()->ClearRenderSurface(); 1022 render_surface_layer_list->back()->ClearRenderSurface();
1012 render_surface_layer_list->pop_back(); 1023 render_surface_layer_list->pop_back();
1013 } 1024 }
1014 DCHECK_EQ(render_surface_layer_list->back(), layer_to_remove); 1025 DCHECK_EQ(render_surface_layer_list->back(), layer_to_remove);
1015 render_surface_layer_list->pop_back(); 1026 render_surface_layer_list->pop_back();
1016 layer_to_remove->ClearRenderSurface(); 1027 layer_to_remove->ClearRenderSurface();
1017 } 1028 }
1018 1029
1019 struct PreCalculateMetaInformationRecursiveData { 1030 struct PreCalculateMetaInformationRecursiveData {
1020 bool layer_or_descendant_has_copy_request; 1031 bool layer_or_descendant_has_copy_request;
1032 bool layer_or_descendant_has_event_handler;
1021 int num_unclipped_descendants; 1033 int num_unclipped_descendants;
1022 1034
1023 PreCalculateMetaInformationRecursiveData() 1035 PreCalculateMetaInformationRecursiveData()
1024 : layer_or_descendant_has_copy_request(false), 1036 : layer_or_descendant_has_copy_request(false),
1037 layer_or_descendant_has_event_handler(false),
1025 num_unclipped_descendants(0) {} 1038 num_unclipped_descendants(0) {}
1026 1039
1027 void Merge(const PreCalculateMetaInformationRecursiveData& data) { 1040 void Merge(const PreCalculateMetaInformationRecursiveData& data) {
1028 layer_or_descendant_has_copy_request |= 1041 layer_or_descendant_has_copy_request |=
1029 data.layer_or_descendant_has_copy_request; 1042 data.layer_or_descendant_has_copy_request;
1043 layer_or_descendant_has_event_handler |=
1044 data.layer_or_descendant_has_event_handler;
1030 num_unclipped_descendants += 1045 num_unclipped_descendants +=
1031 data.num_unclipped_descendants; 1046 data.num_unclipped_descendants;
1032 } 1047 }
1033 }; 1048 };
1034 1049
1035 // Recursively walks the layer tree to compute any information that is needed 1050 // Recursively walks the layer tree to compute any information that is needed
1036 // before doing the main recursion. 1051 // before doing the main recursion.
1037 template <typename LayerType> 1052 template <typename LayerType>
1038 static void PreCalculateMetaInformation( 1053 static void PreCalculateMetaInformation(
1039 LayerType* layer, 1054 LayerType* layer,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1088
1074 if (layer->clip_children()) { 1089 if (layer->clip_children()) {
1075 int num_clip_children = layer->clip_children()->size(); 1090 int num_clip_children = layer->clip_children()->size();
1076 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); 1091 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children);
1077 recursive_data->num_unclipped_descendants -= num_clip_children; 1092 recursive_data->num_unclipped_descendants -= num_clip_children;
1078 } 1093 }
1079 1094
1080 if (layer->HasCopyRequest()) 1095 if (layer->HasCopyRequest())
1081 recursive_data->layer_or_descendant_has_copy_request = true; 1096 recursive_data->layer_or_descendant_has_copy_request = true;
1082 1097
1098 if (LayerCanAcceptInput(layer))
1099 recursive_data->layer_or_descendant_has_event_handler = true;
1100
1083 layer->draw_properties().num_descendants_that_draw_content = 1101 layer->draw_properties().num_descendants_that_draw_content =
1084 num_descendants_that_draw_content; 1102 num_descendants_that_draw_content;
1085 layer->draw_properties().num_unclipped_descendants = 1103 layer->draw_properties().num_unclipped_descendants =
1086 recursive_data->num_unclipped_descendants; 1104 recursive_data->num_unclipped_descendants;
1087 layer->draw_properties().layer_or_descendant_has_copy_request = 1105 layer->draw_properties().layer_or_descendant_has_copy_request =
1088 recursive_data->layer_or_descendant_has_copy_request; 1106 recursive_data->layer_or_descendant_has_copy_request;
1107 layer->draw_properties().layer_or_descendant_has_event_handler =
1108 recursive_data->layer_or_descendant_has_event_handler;
1089 } 1109 }
1090 1110
1091 static void RoundTranslationComponents(gfx::Transform* transform) { 1111 static void RoundTranslationComponents(gfx::Transform* transform) {
1092 transform->matrix().set(0, 3, MathUtil::Round(transform->matrix().get(0, 3))); 1112 transform->matrix().set(0, 3, MathUtil::Round(transform->matrix().get(0, 3)));
1093 transform->matrix().set(1, 3, MathUtil::Round(transform->matrix().get(1, 3))); 1113 transform->matrix().set(1, 3, MathUtil::Round(transform->matrix().get(1, 3)));
1094 } 1114 }
1095 1115
1096 template <typename LayerType> 1116 template <typename LayerType>
1097 struct SubtreeGlobals { 1117 struct SubtreeGlobals {
1098 LayerSorter* layer_sorter; 1118 LayerSorter* layer_sorter;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 // while dealing with the parent layer, and then this precomputed value is 1155 // while dealing with the parent layer, and then this precomputed value is
1136 // passed down the recursion to the children that actually use it. 1156 // passed down the recursion to the children that actually use it.
1137 gfx::Rect clip_rect_of_target_surface_in_target_space; 1157 gfx::Rect clip_rect_of_target_surface_in_target_space;
1138 1158
1139 bool ancestor_clips_subtree; 1159 bool ancestor_clips_subtree;
1140 typename LayerType::RenderSurfaceType* 1160 typename LayerType::RenderSurfaceType*
1141 nearest_ancestor_surface_that_moves_pixels; 1161 nearest_ancestor_surface_that_moves_pixels;
1142 bool in_subtree_of_page_scale_application_layer; 1162 bool in_subtree_of_page_scale_application_layer;
1143 bool subtree_can_use_lcd_text; 1163 bool subtree_can_use_lcd_text;
1144 bool subtree_is_visible_from_ancestor; 1164 bool subtree_is_visible_from_ancestor;
1165 bool subtree_has_event_handler;
1145 }; 1166 };
1146 1167
1147 template <typename LayerType> 1168 template <typename LayerType>
1148 static LayerType* GetChildContainingLayer(const LayerType& parent, 1169 static LayerType* GetChildContainingLayer(const LayerType& parent,
1149 LayerType* layer) { 1170 LayerType* layer) {
1150 for (LayerType* ancestor = layer; ancestor; ancestor = ancestor->parent()) { 1171 for (LayerType* ancestor = layer; ancestor; ancestor = ancestor->parent()) {
1151 if (ancestor->parent() == &parent) 1172 if (ancestor->parent() == &parent)
1152 return ancestor; 1173 return ancestor;
1153 } 1174 }
1154 NOTREACHED(); 1175 NOTREACHED();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 (globals.page_scale_factor == 1.f)); 1422 (globals.page_scale_factor == 1.f));
1402 1423
1403 DataForRecursion<LayerType> data_for_children; 1424 DataForRecursion<LayerType> data_for_children;
1404 typename LayerType::RenderSurfaceType* 1425 typename LayerType::RenderSurfaceType*
1405 nearest_ancestor_surface_that_moves_pixels = 1426 nearest_ancestor_surface_that_moves_pixels =
1406 data_from_ancestor.nearest_ancestor_surface_that_moves_pixels; 1427 data_from_ancestor.nearest_ancestor_surface_that_moves_pixels;
1407 data_for_children.in_subtree_of_page_scale_application_layer = 1428 data_for_children.in_subtree_of_page_scale_application_layer =
1408 data_from_ancestor.in_subtree_of_page_scale_application_layer; 1429 data_from_ancestor.in_subtree_of_page_scale_application_layer;
1409 data_for_children.subtree_can_use_lcd_text = 1430 data_for_children.subtree_can_use_lcd_text =
1410 data_from_ancestor.subtree_can_use_lcd_text; 1431 data_from_ancestor.subtree_can_use_lcd_text;
1432 data_for_children.subtree_has_event_handler =
1433 data_from_ancestor.subtree_has_event_handler ||
1434 layer->draw_properties().layer_or_descendant_has_event_handler;
1411 1435
1412 // Layers with a copy request are always visible, as well as un-hiding their 1436 // Layers with a copy request are always visible, as well as un-hiding their
1413 // subtree. Otherise, layers that are marked as hidden will hide themselves 1437 // subtree. Otherise, layers that are marked as hidden will hide themselves
1414 // and their subtree. 1438 // and their subtree.
1415 bool layer_is_visible = 1439 bool layer_is_visible =
1416 data_from_ancestor.subtree_is_visible_from_ancestor && 1440 data_from_ancestor.subtree_is_visible_from_ancestor &&
1417 !layer->hide_layer_and_subtree(); 1441 !layer->hide_layer_and_subtree();
1418 if (layer->HasCopyRequest()) 1442 if (layer->HasCopyRequest())
1419 layer_is_visible = true; 1443 layer_is_visible = true;
1420 1444
1421 // The root layer cannot skip CalcDrawProperties. 1445 // The root layer cannot skip CalcDrawProperties.
1422 if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_visible)) { 1446 if (!IsRootLayer(layer) &&
1447 !data_from_ancestor.subtree_has_event_handler &&
1448 SubtreeShouldBeSkipped(layer, layer_is_visible)) {
1423 if (layer->render_surface()) 1449 if (layer->render_surface())
1424 layer->ClearRenderSurface(); 1450 layer->ClearRenderSurface();
1425 return; 1451 return;
1426 } 1452 }
1427 1453
1428 // We need to circumvent the normal recursive flow of information for clip 1454 // We need to circumvent the normal recursive flow of information for clip
1429 // children (they don't inherit their direct ancestor's clip information). 1455 // children (they don't inherit their direct ancestor's clip information).
1430 // This is unfortunate, and would be unnecessary if we were to formally 1456 // This is unfortunate, and would be unnecessary if we were to formally
1431 // separate the clipping hierarchy from the layer hierarchy. 1457 // separate the clipping hierarchy from the layer hierarchy.
1432 bool ancestor_clips_subtree = data_from_ancestor.ancestor_clips_subtree; 1458 bool ancestor_clips_subtree = data_from_ancestor.ancestor_clips_subtree;
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 } 1866 }
1841 1867
1842 typename LayerType::RenderSurfaceListType& descendants = 1868 typename LayerType::RenderSurfaceListType& descendants =
1843 (layer->render_surface() ? layer->render_surface()->layer_list() 1869 (layer->render_surface() ? layer->render_surface()->layer_list()
1844 : *layer_list); 1870 : *layer_list);
1845 1871
1846 // Any layers that are appended after this point are in the layer's subtree 1872 // Any layers that are appended after this point are in the layer's subtree
1847 // and should be included in the sorting process. 1873 // and should be included in the sorting process.
1848 size_t sorting_start_index = descendants.size(); 1874 size_t sorting_start_index = descendants.size();
1849 1875
1850 if (!LayerShouldBeSkipped(layer, layer_is_visible)) 1876 if (data_from_ancestor.subtree_has_event_handler ||
1877 !LayerShouldBeSkipped(layer, layer_is_visible))
1851 descendants.push_back(layer); 1878 descendants.push_back(layer);
1852 1879
1853 // Any layers that are appended after this point may need to be sorted if we 1880 // Any layers that are appended after this point may need to be sorted if we
1854 // visit the children out of order. 1881 // visit the children out of order.
1855 size_t render_surface_layer_list_child_sorting_start_index = 1882 size_t render_surface_layer_list_child_sorting_start_index =
1856 render_surface_layer_list->size(); 1883 render_surface_layer_list->size();
1857 size_t layer_list_child_sorting_start_index = descendants.size(); 1884 size_t layer_list_child_sorting_start_index = descendants.size();
1858 1885
1859 if (!layer->children().empty()) { 1886 if (!layer->children().empty()) {
1860 if (layer == globals.page_scale_application_layer) { 1887 if (layer == globals.page_scale_application_layer) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 data_for_recursion.clip_rect_of_target_surface_in_target_space = 2165 data_for_recursion.clip_rect_of_target_surface_in_target_space =
2139 device_viewport_rect; 2166 device_viewport_rect;
2140 data_for_recursion.ancestor_clips_subtree = true; 2167 data_for_recursion.ancestor_clips_subtree = true;
2141 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL; 2168 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL;
2142 data_for_recursion.in_subtree_of_page_scale_application_layer = false; 2169 data_for_recursion.in_subtree_of_page_scale_application_layer = false;
2143 data_for_recursion.subtree_can_use_lcd_text = inputs->can_use_lcd_text; 2170 data_for_recursion.subtree_can_use_lcd_text = inputs->can_use_lcd_text;
2144 data_for_recursion.subtree_is_visible_from_ancestor = true; 2171 data_for_recursion.subtree_is_visible_from_ancestor = true;
2145 2172
2146 PreCalculateMetaInformationRecursiveData recursive_data; 2173 PreCalculateMetaInformationRecursiveData recursive_data;
2147 PreCalculateMetaInformation(inputs->root_layer, &recursive_data); 2174 PreCalculateMetaInformation(inputs->root_layer, &recursive_data);
2175 data_for_recursion.subtree_has_event_handler =
2176 inputs->root_layer->draw_properties().
2177 layer_or_descendant_has_event_handler;
2148 std::vector<AccumulatedSurfaceState<Layer> > accumulated_surface_state; 2178 std::vector<AccumulatedSurfaceState<Layer> > accumulated_surface_state;
2149 CalculateDrawPropertiesInternal<Layer>(inputs->root_layer, 2179 CalculateDrawPropertiesInternal<Layer>(inputs->root_layer,
2150 globals, 2180 globals,
2151 data_for_recursion, 2181 data_for_recursion,
2152 inputs->render_surface_layer_list, 2182 inputs->render_surface_layer_list,
2153 &dummy_layer_list, 2183 &dummy_layer_list,
2154 &accumulated_surface_state); 2184 &accumulated_surface_state);
2155 2185
2156 // The dummy layer list should not have been used. 2186 // The dummy layer list should not have been used.
2157 DCHECK_EQ(0u, dummy_layer_list.size()); 2187 DCHECK_EQ(0u, dummy_layer_list.size());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 data_for_recursion.clip_rect_of_target_surface_in_target_space = 2226 data_for_recursion.clip_rect_of_target_surface_in_target_space =
2197 device_viewport_rect; 2227 device_viewport_rect;
2198 data_for_recursion.ancestor_clips_subtree = true; 2228 data_for_recursion.ancestor_clips_subtree = true;
2199 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL; 2229 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL;
2200 data_for_recursion.in_subtree_of_page_scale_application_layer = false; 2230 data_for_recursion.in_subtree_of_page_scale_application_layer = false;
2201 data_for_recursion.subtree_can_use_lcd_text = inputs->can_use_lcd_text; 2231 data_for_recursion.subtree_can_use_lcd_text = inputs->can_use_lcd_text;
2202 data_for_recursion.subtree_is_visible_from_ancestor = true; 2232 data_for_recursion.subtree_is_visible_from_ancestor = true;
2203 2233
2204 PreCalculateMetaInformationRecursiveData recursive_data; 2234 PreCalculateMetaInformationRecursiveData recursive_data;
2205 PreCalculateMetaInformation(inputs->root_layer, &recursive_data); 2235 PreCalculateMetaInformation(inputs->root_layer, &recursive_data);
2236 data_for_recursion.subtree_has_event_handler =
2237 inputs->root_layer->draw_properties().
2238 layer_or_descendant_has_event_handler;
2206 std::vector<AccumulatedSurfaceState<LayerImpl> > 2239 std::vector<AccumulatedSurfaceState<LayerImpl> >
2207 accumulated_surface_state; 2240 accumulated_surface_state;
2208 CalculateDrawPropertiesInternal<LayerImpl>(inputs->root_layer, 2241 CalculateDrawPropertiesInternal<LayerImpl>(inputs->root_layer,
2209 globals, 2242 globals,
2210 data_for_recursion, 2243 data_for_recursion,
2211 inputs->render_surface_layer_list, 2244 inputs->render_surface_layer_list,
2212 &dummy_layer_list, 2245 &dummy_layer_list,
2213 &accumulated_surface_state); 2246 &accumulated_surface_state);
2214 2247
2215 // The dummy layer list should not have been used. 2248 // The dummy layer list should not have been used.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 // At this point, we think the point does hit the touch event handler region 2424 // At this point, we think the point does hit the touch event handler region
2392 // on the layer, but we need to walk up the parents to ensure that the layer 2425 // on the layer, but we need to walk up the parents to ensure that the layer
2393 // was not clipped in such a way that the hit point actually should not hit 2426 // was not clipped in such a way that the hit point actually should not hit
2394 // the layer. 2427 // the layer.
2395 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) 2428 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl))
2396 return false; 2429 return false;
2397 2430
2398 return true; 2431 return true;
2399 } 2432 }
2400 } // namespace cc 2433 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698