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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Address comments Created 3 years, 6 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 .OffsetForInFlowPositionedInline(ToLayoutBox(GetLayoutObject())); 835 .OffsetForInFlowPositionedInline(ToLayoutBox(GetLayoutObject()));
836 local_point += offset; 836 local_point += offset;
837 } 837 }
838 } 838 }
839 839
840 if (GetLayoutObject().IsInFlowPositioned()) { 840 if (GetLayoutObject().IsInFlowPositioned()) {
841 LayoutSize new_offset = GetLayoutObject().OffsetForInFlowPosition(); 841 LayoutSize new_offset = GetLayoutObject().OffsetForInFlowPosition();
842 if (rare_data_ || !new_offset.IsZero()) 842 if (rare_data_ || !new_offset.IsZero())
843 EnsureRareData().offset_for_in_flow_position = new_offset; 843 EnsureRareData().offset_for_in_flow_position = new_offset;
844 local_point.Move(new_offset); 844 local_point.Move(new_offset);
845
846 // Find the layout offset of the unshifted sticky box within its parent
847 // composited layer. This information is used by the compositor side to
848 // compute the additional offset required to keep the element stuck under
849 // compositor scrolling.
850 if (GetLayoutObject().Style()->GetPosition() == EPosition::kSticky &&
851 GetCompositedLayerMapping()) {
852 GetCompositedLayerMapping()
853 ->MainGraphicsLayer()
854 ->SetStickyMainThreadOffset(RoundedIntSize(new_offset));
flackr 2017/06/01 19:01:47 I don't think this is the right place to set the s
yigu 2017/06/01 19:28:40 Done.
855 }
845 } else if (rare_data_) { 856 } else if (rare_data_) {
846 rare_data_->offset_for_in_flow_position = LayoutSize(); 857 rare_data_->offset_for_in_flow_position = LayoutSize();
847 } 858 }
848 859
849 location_ = local_point; 860 location_ = local_point;
850 861
851 #if DCHECK_IS_ON() 862 #if DCHECK_IS_ON()
852 needs_position_update_ = false; 863 needs_position_update_ = false;
853 #endif 864 #endif
854 } 865 }
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 } 3355 }
3345 3356
3346 void showLayerTree(const blink::LayoutObject* layoutObject) { 3357 void showLayerTree(const blink::LayoutObject* layoutObject) {
3347 if (!layoutObject) { 3358 if (!layoutObject) {
3348 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3359 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3349 return; 3360 return;
3350 } 3361 }
3351 showLayerTree(layoutObject->EnclosingLayer()); 3362 showLayerTree(layoutObject->EnclosingLayer());
3352 } 3363 }
3353 #endif 3364 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698