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_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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1121 |
1122 template <typename LayerType> | 1122 template <typename LayerType> |
1123 struct SubtreeGlobals { | 1123 struct SubtreeGlobals { |
1124 LayerSorter* layer_sorter; | 1124 LayerSorter* layer_sorter; |
1125 int max_texture_size; | 1125 int max_texture_size; |
1126 float device_scale_factor; | 1126 float device_scale_factor; |
1127 float page_scale_factor; | 1127 float page_scale_factor; |
1128 const LayerType* page_scale_application_layer; | 1128 const LayerType* page_scale_application_layer; |
1129 bool can_adjust_raster_scales; | 1129 bool can_adjust_raster_scales; |
1130 bool can_render_to_separate_surface; | 1130 bool can_render_to_separate_surface; |
| 1131 bool* has_fixed_to_bottom_edge_layer; |
1131 }; | 1132 }; |
1132 | 1133 |
1133 template<typename LayerType> | 1134 template<typename LayerType> |
1134 struct DataForRecursion { | 1135 struct DataForRecursion { |
1135 // The accumulated sequence of transforms a layer will use to determine its | 1136 // The accumulated sequence of transforms a layer will use to determine its |
1136 // own draw transform. | 1137 // own draw transform. |
1137 gfx::Transform parent_matrix; | 1138 gfx::Transform parent_matrix; |
1138 | 1139 |
1139 // The accumulated sequence of transforms a layer will use to determine its | 1140 // The accumulated sequence of transforms a layer will use to determine its |
1140 // own screen-space transform. | 1141 // own screen-space transform. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 // The replica draw transform to the root (screen space) origin is: | 1420 // The replica draw transform to the root (screen space) origin is: |
1420 // M[replica2root] = M[surface2root] * Tr[replica->position()] * | 1421 // M[replica2root] = M[surface2root] * Tr[replica->position()] * |
1421 // Tr[replica] * Tr[origin2anchor].inverse() | 1422 // Tr[replica] * Tr[origin2anchor].inverse() |
1422 // | 1423 // |
1423 | 1424 |
1424 // It makes no sense to have a non-unit page_scale_factor without specifying | 1425 // It makes no sense to have a non-unit page_scale_factor without specifying |
1425 // which layer roots the subtree the scale is applied to. | 1426 // which layer roots the subtree the scale is applied to. |
1426 DCHECK(globals.page_scale_application_layer || | 1427 DCHECK(globals.page_scale_application_layer || |
1427 (globals.page_scale_factor == 1.f)); | 1428 (globals.page_scale_factor == 1.f)); |
1428 | 1429 |
| 1430 if (globals.has_fixed_to_bottom_edge_layer) { |
| 1431 *globals.has_fixed_to_bottom_edge_layer |= |
| 1432 layer->position_constraint().is_fixed_to_bottom_edge(); |
| 1433 } |
| 1434 |
1429 DataForRecursion<LayerType> data_for_children; | 1435 DataForRecursion<LayerType> data_for_children; |
1430 typename LayerType::RenderSurfaceType* | 1436 typename LayerType::RenderSurfaceType* |
1431 nearest_occlusion_immune_ancestor_surface = | 1437 nearest_occlusion_immune_ancestor_surface = |
1432 data_from_ancestor.nearest_occlusion_immune_ancestor_surface; | 1438 data_from_ancestor.nearest_occlusion_immune_ancestor_surface; |
1433 data_for_children.in_subtree_of_page_scale_application_layer = | 1439 data_for_children.in_subtree_of_page_scale_application_layer = |
1434 data_from_ancestor.in_subtree_of_page_scale_application_layer; | 1440 data_from_ancestor.in_subtree_of_page_scale_application_layer; |
1435 data_for_children.subtree_can_use_lcd_text = | 1441 data_for_children.subtree_can_use_lcd_text = |
1436 data_from_ancestor.subtree_can_use_lcd_text; | 1442 data_from_ancestor.subtree_can_use_lcd_text; |
1437 | 1443 |
1438 // Layers with a copy request are always visible, as well as un-hiding their | 1444 // Layers with a copy request are always visible, as well as un-hiding their |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 | 2152 |
2147 SubtreeGlobals<Layer> globals; | 2153 SubtreeGlobals<Layer> globals; |
2148 globals.layer_sorter = NULL; | 2154 globals.layer_sorter = NULL; |
2149 globals.max_texture_size = inputs->max_texture_size; | 2155 globals.max_texture_size = inputs->max_texture_size; |
2150 globals.device_scale_factor = inputs->device_scale_factor; | 2156 globals.device_scale_factor = inputs->device_scale_factor; |
2151 globals.page_scale_factor = inputs->page_scale_factor; | 2157 globals.page_scale_factor = inputs->page_scale_factor; |
2152 globals.page_scale_application_layer = inputs->page_scale_application_layer; | 2158 globals.page_scale_application_layer = inputs->page_scale_application_layer; |
2153 globals.can_render_to_separate_surface = | 2159 globals.can_render_to_separate_surface = |
2154 inputs->can_render_to_separate_surface; | 2160 inputs->can_render_to_separate_surface; |
2155 globals.can_adjust_raster_scales = inputs->can_adjust_raster_scales; | 2161 globals.can_adjust_raster_scales = inputs->can_adjust_raster_scales; |
| 2162 globals.has_fixed_to_bottom_edge_layer = |
| 2163 inputs->has_fixed_to_bottom_edge_layer; |
| 2164 if (globals.has_fixed_to_bottom_edge_layer) |
| 2165 *globals.has_fixed_to_bottom_edge_layer = false; |
2156 | 2166 |
2157 DataForRecursion<Layer> data_for_recursion; | 2167 DataForRecursion<Layer> data_for_recursion; |
2158 data_for_recursion.parent_matrix = scaled_device_transform; | 2168 data_for_recursion.parent_matrix = scaled_device_transform; |
2159 data_for_recursion.full_hierarchy_matrix = identity_matrix; | 2169 data_for_recursion.full_hierarchy_matrix = identity_matrix; |
2160 data_for_recursion.scroll_compensation_matrix = identity_matrix; | 2170 data_for_recursion.scroll_compensation_matrix = identity_matrix; |
2161 data_for_recursion.fixed_container = inputs->root_layer; | 2171 data_for_recursion.fixed_container = inputs->root_layer; |
2162 data_for_recursion.clip_rect_in_target_space = device_viewport_rect; | 2172 data_for_recursion.clip_rect_in_target_space = device_viewport_rect; |
2163 data_for_recursion.clip_rect_of_target_surface_in_target_space = | 2173 data_for_recursion.clip_rect_of_target_surface_in_target_space = |
2164 device_viewport_rect; | 2174 device_viewport_rect; |
2165 data_for_recursion.ancestor_clips_subtree = true; | 2175 data_for_recursion.ancestor_clips_subtree = true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 | 2214 |
2205 SubtreeGlobals<LayerImpl> globals; | 2215 SubtreeGlobals<LayerImpl> globals; |
2206 globals.layer_sorter = &layer_sorter; | 2216 globals.layer_sorter = &layer_sorter; |
2207 globals.max_texture_size = inputs->max_texture_size; | 2217 globals.max_texture_size = inputs->max_texture_size; |
2208 globals.device_scale_factor = inputs->device_scale_factor; | 2218 globals.device_scale_factor = inputs->device_scale_factor; |
2209 globals.page_scale_factor = inputs->page_scale_factor; | 2219 globals.page_scale_factor = inputs->page_scale_factor; |
2210 globals.page_scale_application_layer = inputs->page_scale_application_layer; | 2220 globals.page_scale_application_layer = inputs->page_scale_application_layer; |
2211 globals.can_render_to_separate_surface = | 2221 globals.can_render_to_separate_surface = |
2212 inputs->can_render_to_separate_surface; | 2222 inputs->can_render_to_separate_surface; |
2213 globals.can_adjust_raster_scales = inputs->can_adjust_raster_scales; | 2223 globals.can_adjust_raster_scales = inputs->can_adjust_raster_scales; |
| 2224 globals.has_fixed_to_bottom_edge_layer = |
| 2225 inputs->has_fixed_to_bottom_edge_layer; |
| 2226 if (globals.has_fixed_to_bottom_edge_layer) |
| 2227 *globals.has_fixed_to_bottom_edge_layer = false; |
2214 | 2228 |
2215 DataForRecursion<LayerImpl> data_for_recursion; | 2229 DataForRecursion<LayerImpl> data_for_recursion; |
2216 data_for_recursion.parent_matrix = scaled_device_transform; | 2230 data_for_recursion.parent_matrix = scaled_device_transform; |
2217 data_for_recursion.full_hierarchy_matrix = identity_matrix; | 2231 data_for_recursion.full_hierarchy_matrix = identity_matrix; |
2218 data_for_recursion.scroll_compensation_matrix = identity_matrix; | 2232 data_for_recursion.scroll_compensation_matrix = identity_matrix; |
2219 data_for_recursion.fixed_container = inputs->root_layer; | 2233 data_for_recursion.fixed_container = inputs->root_layer; |
2220 data_for_recursion.clip_rect_in_target_space = device_viewport_rect; | 2234 data_for_recursion.clip_rect_in_target_space = device_viewport_rect; |
2221 data_for_recursion.clip_rect_of_target_surface_in_target_space = | 2235 data_for_recursion.clip_rect_of_target_surface_in_target_space = |
2222 device_viewport_rect; | 2236 device_viewport_rect; |
2223 data_for_recursion.ancestor_clips_subtree = true; | 2237 data_for_recursion.ancestor_clips_subtree = true; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 // At this point, we think the point does hit the touch event handler region | 2431 // At this point, we think the point does hit the touch event handler region |
2418 // on the layer, but we need to walk up the parents to ensure that the layer | 2432 // on the layer, but we need to walk up the parents to ensure that the layer |
2419 // was not clipped in such a way that the hit point actually should not hit | 2433 // was not clipped in such a way that the hit point actually should not hit |
2420 // the layer. | 2434 // the layer. |
2421 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 2435 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
2422 return false; | 2436 return false; |
2423 | 2437 |
2424 return true; | 2438 return true; |
2425 } | 2439 } |
2426 } // namespace cc | 2440 } // namespace cc |
OLD | NEW |