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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2890583002: Fix incorrect use of coords conversion for sticky elements (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // 308 //
309 // Starting from the scroll container relative location, removing the 309 // Starting from the scroll container relative location, removing the
310 // enclosing layer's offset and the content offset in the composited layer 310 // enclosing layer's offset and the content offset in the composited layer
311 // results in the parent-layer relative offset. 311 // results in the parent-layer relative offset.
312 FloatPoint parent_relative_sticky_box_offset = 312 FloatPoint parent_relative_sticky_box_offset =
313 constraints.ScrollContainerRelativeStickyBoxRect().Location(); 313 constraints.ScrollContainerRelativeStickyBoxRect().Location();
314 314
315 // The enclosing layers offset returned from |convertToLayerCoords| must be 315 // The enclosing layers offset returned from |convertToLayerCoords| must be
316 // adjusted for both scroll and ancestor sticky elements. 316 // adjusted for both scroll and ancestor sticky elements.
317 LayoutPoint enclosing_layer_offset; 317 LayoutPoint enclosing_layer_offset;
318 compositing_container->ConvertToLayerCoords(ancestor_overflow_layer, 318 bool is_descendant = false;
flackr 2017/05/17 19:44:03 Is this not equivalent to !ScrollParent()?
yigu 2017/05/17 20:28:15 No. is_descendant will be false if compositing_con
flackr 2017/05/18 15:54:08 Composite which ancestor? If you apply will-change
319 enclosing_layer_offset); 319 compositing_container->ConvertToLayerCoords(
320 ancestor_overflow_layer, enclosing_layer_offset, &is_descendant);
321 if (!is_descendant)
322 enclosing_layer_offset = LayoutPoint();
flackr 2017/05/17 19:44:03 How does the sticky element know where it is with
yigu 2017/05/17 20:28:15 When the compositing_container is a descendant of
flackr 2017/05/18 15:54:08 My concern is when the scroller is not at the top-
323
320 DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer); 324 DCHECK(!ScrollParent() || ScrollParent() == ancestor_overflow_layer);
321 if (!ScrollParent() && compositing_container != ancestor_overflow_layer) { 325 if (!ScrollParent() && compositing_container != ancestor_overflow_layer) {
322 enclosing_layer_offset += LayoutSize( 326 enclosing_layer_offset += LayoutSize(
323 ancestor_overflow_layer->GetScrollableArea()->GetScrollOffset()); 327 ancestor_overflow_layer->GetScrollableArea()->GetScrollOffset());
324 } 328 }
325 // TODO(smcgruer): Until http://crbug.com/702229 is fixed, the nearest 329 // TODO(smcgruer): Until http://crbug.com/702229 is fixed, the nearest
326 // sticky ancestor may be non-composited which will make this offset wrong. 330 // sticky ancestor may be non-composited which will make this offset wrong.
327 if (const LayoutBoxModelObject* ancestor = 331 if (const LayoutBoxModelObject* ancestor =
328 constraints.NearestStickyAncestor()) { 332 constraints.NearestStickyAncestor()) {
329 enclosing_layer_offset -= 333 enclosing_layer_offset -=
(...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 } else if (graphics_layer == decoration_outline_layer_.get()) { 3629 } else if (graphics_layer == decoration_outline_layer_.get()) {
3626 name = "Decoration Layer"; 3630 name = "Decoration Layer";
3627 } else { 3631 } else {
3628 NOTREACHED(); 3632 NOTREACHED();
3629 } 3633 }
3630 3634
3631 return name; 3635 return name;
3632 } 3636 }
3633 3637
3634 } // namespace blink 3638 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698