| Index: cc/layers/layer.cc
|
| diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
|
| index 04fa7f4a4236956fa9657f1ed3ae28b0479c252c..a94cb99798a0e18d7f7441a6ebe488d210cae5b8 100644
|
| --- a/cc/layers/layer.cc
|
| +++ b/cc/layers/layer.cc
|
| @@ -29,6 +29,7 @@
|
| #include "cc/trees/layer_tree_impl.h"
|
| #include "cc/trees/mutable_properties.h"
|
| #include "cc/trees/mutator_host.h"
|
| +#include "cc/trees/scroll_node.h"
|
| #include "cc/trees/transform_node.h"
|
| #include "third_party/skia/include/core/SkImageFilter.h"
|
| #include "ui/gfx/geometry/rect_conversions.h"
|
| @@ -590,10 +591,32 @@ void Layer::SetPosition(const gfx::PointF& position) {
|
| StickyPositionNodeData* sticky_data =
|
| property_trees->transform_tree.StickyPositionData(
|
| transform_tree_index());
|
| + // The sticky box offset calculated in CompositedLayerMapping must be
|
| + // adjusted for the enclosing layers sticky offset.
|
| + // TODO(smcgruer): We may want to do this blink side instead like the
|
| + // scroll.
|
| + gfx::Point sticky_box_offset(
|
| + sticky_data->constraints.parent_relative_sticky_box_offset);
|
| + ScrollNode* scroll_ancestor =
|
| + property_trees->scroll_tree.Node(scroll_tree_index());
|
| + if (parent()->id() != scroll_ancestor->owning_layer_id) {
|
| + sticky_box_offset += gfx::ToFlooredVector2d(
|
| + draw_property_utils::CalculateTotalStickyOffsetToScroller(
|
| + parent(), scroll_ancestor->owning_layer_id));
|
| + }
|
| sticky_data->main_thread_offset =
|
| - position.OffsetFromOrigin() -
|
| - sticky_data->constraints.parent_relative_sticky_box_offset
|
| - .OffsetFromOrigin();
|
| + position.OffsetFromOrigin() - sticky_box_offset.OffsetFromOrigin();
|
| + // Set the ancestor nodes for later use in the property tree.
|
| + if (Layer* layer =
|
| + sticky_data->constraints.nearest_layer_shifting_sticky_box) {
|
| + sticky_data->nearest_node_shifting_sticky_box =
|
| + layer->transform_tree_index();
|
| + }
|
| + if (Layer* layer = sticky_data->constraints
|
| + .nearest_layer_shifting_containing_block) {
|
| + sticky_data->nearest_node_shifting_containing_block =
|
| + layer->transform_tree_index();
|
| + }
|
| }
|
| transform_node->needs_local_transform_update = true;
|
| transform_node->transform_changed = true;
|
|
|