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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // | 309 // |
310 // Starting from the scroll container relative location, removing the | 310 // Starting from the scroll container relative location, removing the |
311 // enclosing layer's offset and the content offset in the composited layer | 311 // enclosing layer's offset and the content offset in the composited layer |
312 // results in the parent-layer relative offset. | 312 // results in the parent-layer relative offset. |
313 FloatPoint parent_relative_sticky_box_offset = | 313 FloatPoint parent_relative_sticky_box_offset = |
314 constraints.ScrollContainerRelativeStickyBoxRect().Location(); | 314 constraints.ScrollContainerRelativeStickyBoxRect().Location(); |
315 | 315 |
316 // The enclosing layers offset returned from |convertToLayerCoords| must be | 316 // The enclosing layers offset returned from |convertToLayerCoords| must be |
317 // adjusted for both scroll and ancestor sticky elements. | 317 // adjusted for both scroll and ancestor sticky elements. |
318 LayoutPoint enclosing_layer_offset; | 318 LayoutPoint enclosing_layer_offset; |
319 compositing_container->ConvertToLayerCoords(ancestor_overflow_layer, | 319 // The offset from the compositing_container to the ancestor_overflow_layer |
320 enclosing_layer_offset); | 320 // when we have a scroll parent is computed by the source_to_parent vector |
| 321 // on the transform node. |
| 322 // TODO(yigu): Eventually we want to remove the dependancy of |
| 323 // source_to_parent from StickyPositionOffset in property_tree.cc. |
| 324 if (!ScrollParent()) { |
| 325 compositing_container->ConvertToLayerCoords(ancestor_overflow_layer, |
| 326 enclosing_layer_offset); |
| 327 } |
| 328 |
321 DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer); | 329 DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer); |
322 if (!ScrollParent() && compositing_container != ancestor_overflow_layer) { | 330 if (!ScrollParent() && compositing_container != ancestor_overflow_layer) { |
323 enclosing_layer_offset += LayoutSize( | 331 enclosing_layer_offset += LayoutSize( |
324 ancestor_overflow_layer->GetScrollableArea()->GetScrollOffset()); | 332 ancestor_overflow_layer->GetScrollableArea()->GetScrollOffset()); |
325 } | 333 } |
326 // TODO(smcgruer): Until http://crbug.com/702229 is fixed, the nearest | 334 // TODO(smcgruer): Until http://crbug.com/702229 is fixed, the nearest |
327 // sticky ancestor may be non-composited which will make this offset wrong. | 335 // sticky ancestor may be non-composited which will make this offset wrong. |
328 if (const LayoutBoxModelObject* ancestor = | 336 if (const LayoutBoxModelObject* ancestor = |
329 constraints.NearestStickyAncestor()) { | 337 constraints.NearestStickyAncestor()) { |
330 enclosing_layer_offset -= | 338 enclosing_layer_offset -= |
(...skipping 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3634 } else if (graphics_layer == decoration_outline_layer_.get()) { | 3642 } else if (graphics_layer == decoration_outline_layer_.get()) { |
3635 name = "Decoration Layer"; | 3643 name = "Decoration Layer"; |
3636 } else { | 3644 } else { |
3637 NOTREACHED(); | 3645 NOTREACHED(); |
3638 } | 3646 } |
3639 | 3647 |
3640 return name; | 3648 return name; |
3641 } | 3649 } |
3642 | 3650 |
3643 } // namespace blink | 3651 } // namespace blink |
OLD | NEW |