OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 // | 310 // |
311 // Starting from the scroll container relative location, removing the | 311 // Starting from the scroll container relative location, removing the |
312 // enclosing layer's offset and the content offset in the composited layer | 312 // enclosing layer's offset and the content offset in the composited layer |
313 // results in the parent-layer relative offset. | 313 // results in the parent-layer relative offset. |
314 FloatPoint parent_relative_sticky_box_offset = | 314 FloatPoint parent_relative_sticky_box_offset = |
315 constraints.ScrollContainerRelativeStickyBoxRect().Location(); | 315 constraints.ScrollContainerRelativeStickyBoxRect().Location(); |
316 | 316 |
317 // The enclosing layers offset returned from |convertToLayerCoords| must be | 317 // The enclosing layers offset returned from |convertToLayerCoords| must be |
318 // adjusted for both scroll and ancestor sticky elements. | 318 // adjusted for both scroll and ancestor sticky elements. |
319 LayoutPoint enclosing_layer_offset; | 319 LayoutPoint enclosing_layer_offset; |
320 compositing_container->ConvertToLayerCoords(ancestor_overflow_layer, | 320 // The offset from the compositing_container to the ancestor_overflow_layer |
321 enclosing_layer_offset); | 321 // when we have a scroll parent or a fix positioned container is computed by |
322 // the source_to_parent vector on the transform node. | |
323 // TODO(yigu): Eventually we want to remove the dependancy of | |
324 // source_to_parent from StickyPositionOffset in property_tree.cc. | |
325 if (!ScrollParent() || | |
326 !compositing_container->GetLayoutObject().IsFixedPositioned()) { | |
flackr
2017/05/19 18:28:31
I thought we wanted to only compute this offset if
yigu
2017/05/19 19:50:45
Done.
| |
327 compositing_container->ConvertToLayerCoords(ancestor_overflow_layer, | |
328 enclosing_layer_offset); | |
329 } | |
330 | |
322 DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer); | 331 DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer); |
323 if (!ScrollParent() && compositing_container != ancestor_overflow_layer) { | 332 if (!ScrollParent() && compositing_container != ancestor_overflow_layer) { |
324 enclosing_layer_offset += LayoutSize( | 333 enclosing_layer_offset += LayoutSize( |
325 ancestor_overflow_layer->GetScrollableArea()->GetScrollOffset()); | 334 ancestor_overflow_layer->GetScrollableArea()->GetScrollOffset()); |
326 } | 335 } |
327 // TODO(smcgruer): Until http://crbug.com/702229 is fixed, the nearest | 336 // TODO(smcgruer): Until http://crbug.com/702229 is fixed, the nearest |
328 // sticky ancestor may be non-composited which will make this offset wrong. | 337 // sticky ancestor may be non-composited which will make this offset wrong. |
329 if (const LayoutBoxModelObject* ancestor = | 338 if (const LayoutBoxModelObject* ancestor = |
330 constraints.NearestStickyAncestor()) { | 339 constraints.NearestStickyAncestor()) { |
331 enclosing_layer_offset -= | 340 enclosing_layer_offset -= |
(...skipping 3330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3662 } else if (graphics_layer == decoration_outline_layer_.get()) { | 3671 } else if (graphics_layer == decoration_outline_layer_.get()) { |
3663 name = "Decoration Layer"; | 3672 name = "Decoration Layer"; |
3664 } else { | 3673 } else { |
3665 NOTREACHED(); | 3674 NOTREACHED(); |
3666 } | 3675 } |
3667 | 3676 |
3668 return name; | 3677 return name; |
3669 } | 3678 } |
3670 | 3679 |
3671 } // namespace blink | 3680 } // namespace blink |
OLD | NEW |