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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 064e91e30c4a985311aaa1aa8e7354ad0196bf13..aa115f722648acc87a848bae40f36ff35eee9116 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -681,9 +681,10 @@ static bool SubtreeShouldRenderToSeparateSurface(
// This function returns a translation matrix that can be applied on a vector
// that's in the layer's target surface coordinate, while the position offset is
// specified in some ancestor layer's coordinate.
+template <typename LayerType>
gfx::Transform ComputeSizeDeltaCompensation(
- LayerImpl* layer,
- LayerImpl* container,
+ LayerType* layer,
+ LayerType* container,
const gfx::Vector2dF& position_offset) {
gfx::Transform result_transform;
@@ -698,8 +699,8 @@ gfx::Transform ComputeSizeDeltaCompensation(
gfx::Transform target_surface_space_to_container_layer_space;
// Calculate step 1a
- LayerImpl* container_target_surface = container->render_target();
- for (LayerImpl* current_target_surface = NextTargetSurface(layer);
+ LayerType* container_target_surface = container->render_target();
+ for (LayerType* current_target_surface = NextTargetSurface(layer);
current_target_surface &&
current_target_surface != container_target_surface;
current_target_surface = NextTargetSurface(current_target_surface)) {
@@ -746,14 +747,10 @@ gfx::Transform ComputeSizeDeltaCompensation(
return result_transform;
}
+template <typename LayerType>
void ApplyPositionAdjustment(
- Layer* layer,
- Layer* container,
- const gfx::Transform& scroll_compensation,
- gfx::Transform* combined_transform) {}
-void ApplyPositionAdjustment(
- LayerImpl* layer,
- LayerImpl* container,
+ LayerType* layer,
+ LayerType* container,
const gfx::Transform& scroll_compensation,
gfx::Transform* combined_transform) {
if (!layer->position_constraint().is_fixed_position())
@@ -784,8 +781,9 @@ void ApplyPositionAdjustment(
ComputeSizeDeltaCompensation(layer, container, position_offset));
}
+template <typename LayerType>
gfx::Transform ComputeScrollCompensationForThisLayer(
- LayerImpl* scrolling_layer,
+ LayerType* scrolling_layer,
const gfx::Transform& parent_matrix,
const gfx::Vector2dF& scroll_delta) {
// For every layer that has non-zero scroll_delta, we have to compute a
@@ -823,18 +821,9 @@ gfx::Transform ComputeScrollCompensationForThisLayer(
return scroll_compensation_for_this_layer;
}
+template <typename LayerType>
gfx::Transform ComputeScrollCompensationMatrixForChildren(
- Layer* current_layer,
- const gfx::Transform& current_parent_matrix,
- const gfx::Transform& current_scroll_compensation,
- const gfx::Vector2dF& scroll_delta) {
- // The main thread (i.e. Layer) does not need to worry about scroll
- // compensation. So we can just return an identity matrix here.
- return gfx::Transform();
-}
-
-gfx::Transform ComputeScrollCompensationMatrixForChildren(
- LayerImpl* layer,
+ LayerType* layer,
const gfx::Transform& parent_matrix,
const gfx::Transform& current_scroll_compensation_matrix,
const gfx::Vector2dF& scroll_delta) {
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698