| 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 if (!animating_transform_to_target && layer->scrollable() && | 1522 if (!animating_transform_to_target && layer->scrollable() && |
| 1523 combined_transform.IsScaleOrTranslation()) { | 1523 combined_transform.IsScaleOrTranslation()) { |
| 1524 // Align the scrollable layer's position to screen space pixels to avoid | 1524 // Align the scrollable layer's position to screen space pixels to avoid |
| 1525 // blurriness. To avoid side-effects, do this only if the transform is | 1525 // blurriness. To avoid side-effects, do this only if the transform is |
| 1526 // simple. | 1526 // simple. |
| 1527 gfx::Vector2dF previous_translation = combined_transform.To2dTranslation(); | 1527 gfx::Vector2dF previous_translation = combined_transform.To2dTranslation(); |
| 1528 RoundTranslationComponents(&combined_transform); | 1528 RoundTranslationComponents(&combined_transform); |
| 1529 gfx::Vector2dF current_translation = combined_transform.To2dTranslation(); | 1529 gfx::Vector2dF current_translation = combined_transform.To2dTranslation(); |
| 1530 | 1530 |
| 1531 // This rounding changes the scroll delta, and so must be included | 1531 // This rounding changes the scroll delta, and so must be included |
| 1532 // in the scroll compensation matrix. | 1532 // in the scroll compensation matrix. The scaling converts from physical |
| 1533 effective_scroll_delta -= current_translation - previous_translation; | 1533 // coordinates to the scroll delta's CSS coordinates (using the parent |
| 1534 // matrix instead of combined transform since scrolling is applied before |
| 1535 // the layer's transform). For example, if we have a total scale factor of |
| 1536 // 3.0, then 1 physical pixel is only 1/3 of a CSS pixel. |
| 1537 gfx::Vector2dF parent_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1538 data_from_ancestor.parent_matrix, 1.f); |
| 1539 effective_scroll_delta -= |
| 1540 gfx::ScaleVector2d(current_translation - previous_translation, |
| 1541 1.f / parent_scales.x(), |
| 1542 1.f / parent_scales.y()); |
| 1534 } | 1543 } |
| 1535 | 1544 |
| 1536 // Apply adjustment from position constraints. | 1545 // Apply adjustment from position constraints. |
| 1537 ApplyPositionAdjustment(layer, data_from_ancestor.fixed_container, | 1546 ApplyPositionAdjustment(layer, data_from_ancestor.fixed_container, |
| 1538 data_from_ancestor.scroll_compensation_matrix, &combined_transform); | 1547 data_from_ancestor.scroll_compensation_matrix, &combined_transform); |
| 1539 | 1548 |
| 1540 // Compute the 2d scale components of the transform hierarchy up to the target | 1549 // Compute the 2d scale components of the transform hierarchy up to the target |
| 1541 // surface. From there, we can decide on a contents scale for the layer. | 1550 // surface. From there, we can decide on a contents scale for the layer. |
| 1542 float layer_scale_factors = globals.device_scale_factor; | 1551 float layer_scale_factors = globals.device_scale_factor; |
| 1543 if (data_from_ancestor.in_subtree_of_page_scale_application_layer) | 1552 if (data_from_ancestor.in_subtree_of_page_scale_application_layer) |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 // At this point, we think the point does hit the touch event handler region | 2406 // At this point, we think the point does hit the touch event handler region |
| 2398 // on the layer, but we need to walk up the parents to ensure that the layer | 2407 // on the layer, but we need to walk up the parents to ensure that the layer |
| 2399 // was not clipped in such a way that the hit point actually should not hit | 2408 // was not clipped in such a way that the hit point actually should not hit |
| 2400 // the layer. | 2409 // the layer. |
| 2401 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 2410 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
| 2402 return false; | 2411 return false; |
| 2403 | 2412 |
| 2404 return true; | 2413 return true; |
| 2405 } | 2414 } |
| 2406 } // namespace cc | 2415 } // namespace cc |
| OLD | NEW |