Chromium Code Reviews| 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 c1bc1a12c4dff940fccb6e5f4c4bbb2e89d79213..88b30bbbf62a62d6bb6b04e822fcf2d7fbe1780b 100644 |
| --- a/cc/trees/layer_tree_host_common.cc |
| +++ b/cc/trees/layer_tree_host_common.cc |
| @@ -1518,25 +1518,6 @@ static void CalculateDrawPropertiesInternal( |
| combined_transform.Translate(position.x(), position.y()); |
| } |
| - gfx::Vector2dF effective_scroll_delta = GetEffectiveScrollDelta(layer); |
| - if (!animating_transform_to_target && layer->scrollable() && |
| - combined_transform.IsScaleOrTranslation()) { |
| - // Align the scrollable layer's position to screen space pixels to avoid |
| - // blurriness. To avoid side-effects, do this only if the transform is |
| - // simple. |
| - gfx::Vector2dF previous_translation = combined_transform.To2dTranslation(); |
| - RoundTranslationComponents(&combined_transform); |
| - gfx::Vector2dF current_translation = combined_transform.To2dTranslation(); |
| - |
| - // This rounding changes the scroll delta, and so must be included |
| - // in the scroll compensation matrix. |
| - effective_scroll_delta -= current_translation - previous_translation; |
| - } |
| - |
| - // Apply adjustment from position constraints. |
| - ApplyPositionAdjustment(layer, data_from_ancestor.fixed_container, |
| - data_from_ancestor.scroll_compensation_matrix, &combined_transform); |
| - |
| // Compute the 2d scale components of the transform hierarchy up to the target |
| // surface. From there, we can decide on a contents scale for the layer. |
| float layer_scale_factors = globals.device_scale_factor; |
| @@ -1561,6 +1542,30 @@ static void CalculateDrawPropertiesInternal( |
| globals.page_scale_factor : 1.f, |
| animating_transform_to_screen); |
| + gfx::Vector2dF effective_scroll_delta = GetEffectiveScrollDelta(layer); |
| + if (!animating_transform_to_target && layer->scrollable() && |
| + combined_transform.IsScaleOrTranslation()) { |
| + // Align the scrollable layer's position to screen space pixels to avoid |
| + // blurriness. To avoid side-effects, do this only if the transform is |
| + // simple. |
| + gfx::Vector2dF previous_translation = combined_transform.To2dTranslation(); |
| + RoundTranslationComponents(&combined_transform); |
| + gfx::Vector2dF current_translation = combined_transform.To2dTranslation(); |
| + |
| + // This rounding changes the scroll delta, and so must be included |
| + // in the scroll compensation matrix. |
|
enne (OOO)
2014/03/31 22:45:22
Can you also mention why you're scaling the offset
aelias_OOO_until_Jul13
2014/04/01 06:24:20
Added a longer comment.
|
| + effective_scroll_delta -= |
| + gfx::ScaleVector2d(current_translation - previous_translation, |
| + 1 / combined_transform_scales.x(), |
|
enne (OOO)
2014/03/31 22:45:22
style nit: 1.f
aelias_OOO_until_Jul13
2014/04/01 06:24:20
Done.
|
| + 1 / combined_transform_scales.y()); |
| + } |
| + |
| + // Apply adjustment from position constraints. |
| + ApplyPositionAdjustment(layer, |
| + data_from_ancestor.fixed_container, |
| + data_from_ancestor.scroll_compensation_matrix, |
| + &combined_transform); |
| + |
| // The draw_transform that gets computed below is effectively the layer's |
| // draw_transform, unless the layer itself creates a render_surface. In that |
| // case, the render_surface re-parents the transforms. |