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

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
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 LayerHasEventHandler(LayerType* layer) {
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
440 // - has empty bounds 446 // - has empty bounds
441 // - the layer is not double-sided, but its back face is visible. 447 // - the layer is not double-sided, but its back face is visible.
442 // - is transparent 448 // - is transparent
443 // - does not draw content and does not participate in hit testing. 449 // - does not draw content
444 // 450 //
445 // Some additional conditions need to be computed at a later point after the 451 // Some additional conditions need to be computed at a later point after the
446 // recursion is finished. 452 // recursion is finished.
447 // - the intersection of render_surface content and layer clip_rect is empty 453 // - the intersection of render_surface content and layer clip_rect is empty
448 // - the visible_content_rect is empty 454 // - the visible_content_rect is empty
449 // 455 //
450 // Note, if the layer should not have been drawn due to being fully 456 // 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 457 // 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. 458 // into this function, so it is safe to omit this check here.
453 459
(...skipping 10 matching lines...) Expand all
464 backface_test_layer = layer->parent(); 470 backface_test_layer = layer->parent();
465 } 471 }
466 472
467 // The layer should not be drawn if (1) it is not double-sided and (2) the 473 // 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. 474 // back of the layer is known to be facing the screen.
469 if (!backface_test_layer->double_sided() && 475 if (!backface_test_layer->double_sided() &&
470 TransformToScreenIsKnown(backface_test_layer) && 476 TransformToScreenIsKnown(backface_test_layer) &&
471 IsLayerBackFaceVisible(backface_test_layer)) 477 IsLayerBackFaceVisible(backface_test_layer))
472 return true; 478 return true;
473 479
474 // The layer is visible to events. If it's subject to hit testing, then 480 if (!layer->DrawsContent())
475 // we can't skip it.
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; 481 return true;
480 482
481 return false; 483 return false;
482 } 484 }
483 485
484 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer, 486 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
485 bool layer_is_visible) { 487 bool layer_is_visible) {
486 // When we need to do a readback/copy of a layer's output, we can not skip 488 // When we need to do a readback/copy of a layer's output, we can not skip
487 // it or any of its ancestors. 489 // it or any of its ancestors.
488 if (layer->draw_properties().layer_or_descendant_has_copy_request) 490 if (layer->draw_properties().layer_or_descendant_has_copy_request)
489 return false; 491 return false;
490 492
491 // If the layer is not visible, then skip it and its subtree. 493 // If the layer is not visible, then skip it and its subtree.
492 if (!layer_is_visible) 494 if (!layer_is_visible)
493 return true; 495 return true;
494 496
495 // If layer is on the pending tree and opacity is being animated then 497 // 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 498 // 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. 499 // include tiles for this layer when deciding if tree can be activated.
498 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating()) 500 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating())
499 return false; 501 return false;
500 502
501 // The opacity of a layer always applies to its children (either implicitly 503 // 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 504 // 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. 505 // 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(); 506 return !layer->opacity();
506 } 507 }
507 508
508 static inline bool SubtreeShouldBeSkipped(Layer* layer, 509 static inline bool SubtreeShouldBeSkipped(Layer* layer,
509 bool layer_is_visible) { 510 bool layer_is_visible) {
510 // When we need to do a readback/copy of a layer's output, we can not skip 511 // When we need to do a readback/copy of a layer's output, we can not skip
511 // it or any of its ancestors. 512 // it or any of its ancestors.
512 if (layer->draw_properties().layer_or_descendant_has_copy_request) 513 if (layer->draw_properties().layer_or_descendant_has_copy_request)
513 return false; 514 return false;
514 515
515 // If the layer is not visible, then skip it and its subtree. 516 // If the layer is not visible, then skip it and its subtree.
516 if (!layer_is_visible) 517 if (!layer_is_visible)
517 return true; 518 return true;
518 519
519 // If the opacity is being animated then the opacity on the main thread is 520 // 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 521 // unreliable (since the impl thread may be using a different opacity), so it
521 // should not be trusted. 522 // should not be trusted.
522 // In particular, it should not cause the subtree to be skipped. 523 // In particular, it should not cause the subtree to be skipped.
523 // Similarly, for layers that might animate opacity using an impl-only 524 // Similarly, for layers that might animate opacity using an impl-only
524 // animation, their subtree should also not be skipped. 525 // 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() && 526 return !layer->opacity() && !layer->OpacityIsAnimating() &&
527 !layer->OpacityCanAnimateOnImplThread(); 527 !layer->OpacityCanAnimateOnImplThread();
528 } 528 }
529 529
530 static inline void SavePaintPropertiesLayer(LayerImpl* layer) {} 530 static inline void SavePaintPropertiesLayer(LayerImpl* layer) {}
531 531
532 static inline void SavePaintPropertiesLayer(Layer* layer) { 532 static inline void SavePaintPropertiesLayer(Layer* layer) {
533 layer->SavePaintProperties(); 533 layer->SavePaintProperties();
534 534
535 if (layer->mask_layer()) 535 if (layer->mask_layer())
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 render_surface_layer_list->back()->ClearRenderSurface(); 1011 render_surface_layer_list->back()->ClearRenderSurface();
1012 render_surface_layer_list->pop_back(); 1012 render_surface_layer_list->pop_back();
1013 } 1013 }
1014 DCHECK_EQ(render_surface_layer_list->back(), layer_to_remove); 1014 DCHECK_EQ(render_surface_layer_list->back(), layer_to_remove);
1015 render_surface_layer_list->pop_back(); 1015 render_surface_layer_list->pop_back();
1016 layer_to_remove->ClearRenderSurface(); 1016 layer_to_remove->ClearRenderSurface();
1017 } 1017 }
1018 1018
1019 struct PreCalculateMetaInformationRecursiveData { 1019 struct PreCalculateMetaInformationRecursiveData {
1020 bool layer_or_descendant_has_copy_request; 1020 bool layer_or_descendant_has_copy_request;
1021 bool layer_or_descendant_has_event_handler;
1021 int num_unclipped_descendants; 1022 int num_unclipped_descendants;
1022 1023
1023 PreCalculateMetaInformationRecursiveData() 1024 PreCalculateMetaInformationRecursiveData()
1024 : layer_or_descendant_has_copy_request(false), 1025 : layer_or_descendant_has_copy_request(false),
1026 layer_or_descendant_has_event_handler(false),
1025 num_unclipped_descendants(0) {} 1027 num_unclipped_descendants(0) {}
1026 1028
1027 void Merge(const PreCalculateMetaInformationRecursiveData& data) { 1029 void Merge(const PreCalculateMetaInformationRecursiveData& data) {
1028 layer_or_descendant_has_copy_request |= 1030 layer_or_descendant_has_copy_request |=
1029 data.layer_or_descendant_has_copy_request; 1031 data.layer_or_descendant_has_copy_request;
1032 layer_or_descendant_has_event_handler |=
1033 data.layer_or_descendant_has_event_handler;
1030 num_unclipped_descendants += 1034 num_unclipped_descendants +=
1031 data.num_unclipped_descendants; 1035 data.num_unclipped_descendants;
1032 } 1036 }
1033 }; 1037 };
1034 1038
1035 // Recursively walks the layer tree to compute any information that is needed 1039 // Recursively walks the layer tree to compute any information that is needed
1036 // before doing the main recursion. 1040 // before doing the main recursion.
1037 template <typename LayerType> 1041 template <typename LayerType>
1038 static void PreCalculateMetaInformation( 1042 static void PreCalculateMetaInformation(
1039 LayerType* layer, 1043 LayerType* layer,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1077
1074 if (layer->clip_children()) { 1078 if (layer->clip_children()) {
1075 int num_clip_children = layer->clip_children()->size(); 1079 int num_clip_children = layer->clip_children()->size();
1076 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children); 1080 DCHECK_GE(recursive_data->num_unclipped_descendants, num_clip_children);
1077 recursive_data->num_unclipped_descendants -= num_clip_children; 1081 recursive_data->num_unclipped_descendants -= num_clip_children;
1078 } 1082 }
1079 1083
1080 if (layer->HasCopyRequest()) 1084 if (layer->HasCopyRequest())
1081 recursive_data->layer_or_descendant_has_copy_request = true; 1085 recursive_data->layer_or_descendant_has_copy_request = true;
1082 1086
1087 if (LayerHasEventHandler(layer))
1088 recursive_data->layer_or_descendant_has_event_handler = true;
1089
1083 layer->draw_properties().num_descendants_that_draw_content = 1090 layer->draw_properties().num_descendants_that_draw_content =
1084 num_descendants_that_draw_content; 1091 num_descendants_that_draw_content;
1085 layer->draw_properties().num_unclipped_descendants = 1092 layer->draw_properties().num_unclipped_descendants =
1086 recursive_data->num_unclipped_descendants; 1093 recursive_data->num_unclipped_descendants;
1087 layer->draw_properties().layer_or_descendant_has_copy_request = 1094 layer->draw_properties().layer_or_descendant_has_copy_request =
1088 recursive_data->layer_or_descendant_has_copy_request; 1095 recursive_data->layer_or_descendant_has_copy_request;
1089 } 1096 }
1090 1097
1091 static void RoundTranslationComponents(gfx::Transform* transform) { 1098 static void RoundTranslationComponents(gfx::Transform* transform) {
1092 transform->matrix().set(0, 3, MathUtil::Round(transform->matrix().get(0, 3))); 1099 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))); 1100 transform->matrix().set(1, 3, MathUtil::Round(transform->matrix().get(1, 3)));
1094 } 1101 }
1095 1102
1096 template <typename LayerType> 1103 template <typename LayerType>
1097 struct SubtreeGlobals { 1104 struct SubtreeGlobals {
1098 LayerSorter* layer_sorter; 1105 LayerSorter* layer_sorter;
1099 int max_texture_size; 1106 int max_texture_size;
1100 float device_scale_factor; 1107 float device_scale_factor;
1101 float page_scale_factor; 1108 float page_scale_factor;
1102 const LayerType* page_scale_application_layer; 1109 const LayerType* page_scale_application_layer;
1103 bool can_adjust_raster_scales; 1110 bool can_adjust_raster_scales;
1104 bool can_render_to_separate_surface; 1111 bool can_render_to_separate_surface;
1112 bool tree_has_event_handler;
1105 }; 1113 };
1106 1114
1107 template<typename LayerType> 1115 template<typename LayerType>
1108 struct DataForRecursion { 1116 struct DataForRecursion {
1109 // The accumulated sequence of transforms a layer will use to determine its 1117 // The accumulated sequence of transforms a layer will use to determine its
1110 // own draw transform. 1118 // own draw transform.
1111 gfx::Transform parent_matrix; 1119 gfx::Transform parent_matrix;
1112 1120
1113 // The accumulated sequence of transforms a layer will use to determine its 1121 // The accumulated sequence of transforms a layer will use to determine its
1114 // own screen-space transform. 1122 // own screen-space transform.
(...skipping 20 matching lines...) Expand all
1135 // while dealing with the parent layer, and then this precomputed value is 1143 // while dealing with the parent layer, and then this precomputed value is
1136 // passed down the recursion to the children that actually use it. 1144 // passed down the recursion to the children that actually use it.
1137 gfx::Rect clip_rect_of_target_surface_in_target_space; 1145 gfx::Rect clip_rect_of_target_surface_in_target_space;
1138 1146
1139 bool ancestor_clips_subtree; 1147 bool ancestor_clips_subtree;
1140 typename LayerType::RenderSurfaceType* 1148 typename LayerType::RenderSurfaceType*
1141 nearest_ancestor_surface_that_moves_pixels; 1149 nearest_ancestor_surface_that_moves_pixels;
1142 bool in_subtree_of_page_scale_application_layer; 1150 bool in_subtree_of_page_scale_application_layer;
1143 bool subtree_can_use_lcd_text; 1151 bool subtree_can_use_lcd_text;
1144 bool subtree_is_visible_from_ancestor; 1152 bool subtree_is_visible_from_ancestor;
1153 bool subtree_should_be_skipped_for_drawing;
1145 }; 1154 };
1146 1155
1147 template <typename LayerType> 1156 template <typename LayerType>
1148 static LayerType* GetChildContainingLayer(const LayerType& parent, 1157 static LayerType* GetChildContainingLayer(const LayerType& parent,
1149 LayerType* layer) { 1158 LayerType* layer) {
1150 for (LayerType* ancestor = layer; ancestor; ancestor = ancestor->parent()) { 1159 for (LayerType* ancestor = layer; ancestor; ancestor = ancestor->parent()) {
1151 if (ancestor->parent() == &parent) 1160 if (ancestor->parent() == &parent)
1152 return ancestor; 1161 return ancestor;
1153 } 1162 }
1154 NOTREACHED(); 1163 NOTREACHED();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 (globals.page_scale_factor == 1.f)); 1410 (globals.page_scale_factor == 1.f));
1402 1411
1403 DataForRecursion<LayerType> data_for_children; 1412 DataForRecursion<LayerType> data_for_children;
1404 typename LayerType::RenderSurfaceType* 1413 typename LayerType::RenderSurfaceType*
1405 nearest_ancestor_surface_that_moves_pixels = 1414 nearest_ancestor_surface_that_moves_pixels =
1406 data_from_ancestor.nearest_ancestor_surface_that_moves_pixels; 1415 data_from_ancestor.nearest_ancestor_surface_that_moves_pixels;
1407 data_for_children.in_subtree_of_page_scale_application_layer = 1416 data_for_children.in_subtree_of_page_scale_application_layer =
1408 data_from_ancestor.in_subtree_of_page_scale_application_layer; 1417 data_from_ancestor.in_subtree_of_page_scale_application_layer;
1409 data_for_children.subtree_can_use_lcd_text = 1418 data_for_children.subtree_can_use_lcd_text =
1410 data_from_ancestor.subtree_can_use_lcd_text; 1419 data_from_ancestor.subtree_can_use_lcd_text;
1420 data_for_children.subtree_should_be_skipped_for_drawing =
1421 data_from_ancestor.subtree_should_be_skipped_for_drawing;
1411 1422
1412 // Layers with a copy request are always visible, as well as un-hiding their 1423 // 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 1424 // subtree. Otherise, layers that are marked as hidden will hide themselves
1414 // and their subtree. 1425 // and their subtree.
1415 bool layer_is_visible = 1426 bool layer_is_visible =
1416 data_from_ancestor.subtree_is_visible_from_ancestor && 1427 data_from_ancestor.subtree_is_visible_from_ancestor &&
1417 !layer->hide_layer_and_subtree(); 1428 !layer->hide_layer_and_subtree();
1418 if (layer->HasCopyRequest()) 1429 if (layer->HasCopyRequest())
1419 layer_is_visible = true; 1430 layer_is_visible = true;
1420 1431
1421 // The root layer cannot skip CalcDrawProperties. 1432 // The root layer cannot skip CalcDrawProperties.
1422 if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_visible)) { 1433 if (!IsRootLayer(layer) &&
1423 if (layer->render_surface()) 1434 SubtreeShouldBeSkipped(layer, layer_is_visible)) {
1424 layer->ClearRenderSurface(); 1435 if (!globals.tree_has_event_handler) {
1425 return; 1436 if (layer->render_surface())
1437 layer->ClearRenderSurface();
1438 return;
1439 }
1440 data_for_children.subtree_should_be_skipped_for_drawing = true;
1426 } 1441 }
1427 1442
1428 // We need to circumvent the normal recursive flow of information for clip 1443 // We need to circumvent the normal recursive flow of information for clip
1429 // children (they don't inherit their direct ancestor's clip information). 1444 // children (they don't inherit their direct ancestor's clip information).
1430 // This is unfortunate, and would be unnecessary if we were to formally 1445 // This is unfortunate, and would be unnecessary if we were to formally
1431 // separate the clipping hierarchy from the layer hierarchy. 1446 // separate the clipping hierarchy from the layer hierarchy.
1432 bool ancestor_clips_subtree = data_from_ancestor.ancestor_clips_subtree; 1447 bool ancestor_clips_subtree = data_from_ancestor.ancestor_clips_subtree;
1433 gfx::Rect ancestor_clip_rect_in_target_space = 1448 gfx::Rect ancestor_clip_rect_in_target_space =
1434 data_from_ancestor.clip_rect_in_target_space; 1449 data_from_ancestor.clip_rect_in_target_space;
1435 1450
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 } 1855 }
1841 1856
1842 typename LayerType::RenderSurfaceListType& descendants = 1857 typename LayerType::RenderSurfaceListType& descendants =
1843 (layer->render_surface() ? layer->render_surface()->layer_list() 1858 (layer->render_surface() ? layer->render_surface()->layer_list()
1844 : *layer_list); 1859 : *layer_list);
1845 1860
1846 // Any layers that are appended after this point are in the layer's subtree 1861 // Any layers that are appended after this point are in the layer's subtree
1847 // and should be included in the sorting process. 1862 // and should be included in the sorting process.
1848 size_t sorting_start_index = descendants.size(); 1863 size_t sorting_start_index = descendants.size();
1849 1864
1850 if (!LayerShouldBeSkipped(layer, layer_is_visible)) 1865 bool skip_layer = LayerShouldBeSkipped(layer, layer_is_visible);
1866 if (globals.tree_has_event_handler || !skip_layer)
1851 descendants.push_back(layer); 1867 descendants.push_back(layer);
1868 layer_draw_properties.skip_drawing = skip_layer ||
1869 data_for_children.subtree_should_be_skipped_for_drawing;
1852 1870
1853 // Any layers that are appended after this point may need to be sorted if we 1871 // Any layers that are appended after this point may need to be sorted if we
1854 // visit the children out of order. 1872 // visit the children out of order.
1855 size_t render_surface_layer_list_child_sorting_start_index = 1873 size_t render_surface_layer_list_child_sorting_start_index =
1856 render_surface_layer_list->size(); 1874 render_surface_layer_list->size();
1857 size_t layer_list_child_sorting_start_index = descendants.size(); 1875 size_t layer_list_child_sorting_start_index = descendants.size();
1858 1876
1859 if (!layer->children().empty()) { 1877 if (!layer->children().empty()) {
1860 if (layer == globals.page_scale_application_layer) { 1878 if (layer == globals.page_scale_application_layer) {
1861 data_for_children.parent_matrix.Scale( 1879 data_for_children.parent_matrix.Scale(
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 data_for_recursion.scroll_compensation_matrix = identity_matrix; 2153 data_for_recursion.scroll_compensation_matrix = identity_matrix;
2136 data_for_recursion.fixed_container = inputs->root_layer; 2154 data_for_recursion.fixed_container = inputs->root_layer;
2137 data_for_recursion.clip_rect_in_target_space = device_viewport_rect; 2155 data_for_recursion.clip_rect_in_target_space = device_viewport_rect;
2138 data_for_recursion.clip_rect_of_target_surface_in_target_space = 2156 data_for_recursion.clip_rect_of_target_surface_in_target_space =
2139 device_viewport_rect; 2157 device_viewport_rect;
2140 data_for_recursion.ancestor_clips_subtree = true; 2158 data_for_recursion.ancestor_clips_subtree = true;
2141 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL; 2159 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL;
2142 data_for_recursion.in_subtree_of_page_scale_application_layer = false; 2160 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; 2161 data_for_recursion.subtree_can_use_lcd_text = inputs->can_use_lcd_text;
2144 data_for_recursion.subtree_is_visible_from_ancestor = true; 2162 data_for_recursion.subtree_is_visible_from_ancestor = true;
2163 data_for_recursion.subtree_should_be_skipped_for_drawing = false;
2145 2164
2146 PreCalculateMetaInformationRecursiveData recursive_data; 2165 PreCalculateMetaInformationRecursiveData recursive_data;
2147 PreCalculateMetaInformation(inputs->root_layer, &recursive_data); 2166 PreCalculateMetaInformation(inputs->root_layer, &recursive_data);
2167 globals.tree_has_event_handler =
2168 recursive_data.layer_or_descendant_has_event_handler;
2148 std::vector<AccumulatedSurfaceState<Layer> > accumulated_surface_state; 2169 std::vector<AccumulatedSurfaceState<Layer> > accumulated_surface_state;
2149 CalculateDrawPropertiesInternal<Layer>(inputs->root_layer, 2170 CalculateDrawPropertiesInternal<Layer>(inputs->root_layer,
2150 globals, 2171 globals,
2151 data_for_recursion, 2172 data_for_recursion,
2152 inputs->render_surface_layer_list, 2173 inputs->render_surface_layer_list,
2153 &dummy_layer_list, 2174 &dummy_layer_list,
2154 &accumulated_surface_state); 2175 &accumulated_surface_state);
2155 2176
2156 // The dummy layer list should not have been used. 2177 // The dummy layer list should not have been used.
2157 DCHECK_EQ(0u, dummy_layer_list.size()); 2178 DCHECK_EQ(0u, dummy_layer_list.size());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 data_for_recursion.scroll_compensation_matrix = identity_matrix; 2214 data_for_recursion.scroll_compensation_matrix = identity_matrix;
2194 data_for_recursion.fixed_container = inputs->root_layer; 2215 data_for_recursion.fixed_container = inputs->root_layer;
2195 data_for_recursion.clip_rect_in_target_space = device_viewport_rect; 2216 data_for_recursion.clip_rect_in_target_space = device_viewport_rect;
2196 data_for_recursion.clip_rect_of_target_surface_in_target_space = 2217 data_for_recursion.clip_rect_of_target_surface_in_target_space =
2197 device_viewport_rect; 2218 device_viewport_rect;
2198 data_for_recursion.ancestor_clips_subtree = true; 2219 data_for_recursion.ancestor_clips_subtree = true;
2199 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL; 2220 data_for_recursion.nearest_ancestor_surface_that_moves_pixels = NULL;
2200 data_for_recursion.in_subtree_of_page_scale_application_layer = false; 2221 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; 2222 data_for_recursion.subtree_can_use_lcd_text = inputs->can_use_lcd_text;
2202 data_for_recursion.subtree_is_visible_from_ancestor = true; 2223 data_for_recursion.subtree_is_visible_from_ancestor = true;
2224 data_for_recursion.subtree_should_be_skipped_for_drawing = false;
2203 2225
2204 PreCalculateMetaInformationRecursiveData recursive_data; 2226 PreCalculateMetaInformationRecursiveData recursive_data;
2205 PreCalculateMetaInformation(inputs->root_layer, &recursive_data); 2227 PreCalculateMetaInformation(inputs->root_layer, &recursive_data);
2228 globals.tree_has_event_handler =
2229 recursive_data.layer_or_descendant_has_event_handler;
2206 std::vector<AccumulatedSurfaceState<LayerImpl> > 2230 std::vector<AccumulatedSurfaceState<LayerImpl> >
2207 accumulated_surface_state; 2231 accumulated_surface_state;
2208 CalculateDrawPropertiesInternal<LayerImpl>(inputs->root_layer, 2232 CalculateDrawPropertiesInternal<LayerImpl>(inputs->root_layer,
2209 globals, 2233 globals,
2210 data_for_recursion, 2234 data_for_recursion,
2211 inputs->render_surface_layer_list, 2235 inputs->render_surface_layer_list,
2212 &dummy_layer_list, 2236 &dummy_layer_list,
2213 &accumulated_surface_state); 2237 &accumulated_surface_state);
2214 2238
2215 // The dummy layer list should not have been used. 2239 // 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 2415 // 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 2416 // 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 2417 // was not clipped in such a way that the hit point actually should not hit
2394 // the layer. 2418 // the layer.
2395 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) 2419 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl))
2396 return false; 2420 return false;
2397 2421
2398 return true; 2422 return true;
2399 } 2423 }
2400 } // namespace cc 2424 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698