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

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 216973006: Fix fixed-pos jitter related to physical pixel snapping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set fallback value to 1 Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698