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

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

Issue 2761413002: Fix position of floating layer whose containing block is also floating (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 } 862 }
863 863
864 PaintLayer* PaintLayer::containingLayer(const PaintLayer* ancestor, 864 PaintLayer* PaintLayer::containingLayer(const PaintLayer* ancestor,
865 bool* skippedAncestor) const { 865 bool* skippedAncestor) const {
866 // If we have specified an ancestor, surely the caller needs to know whether 866 // If we have specified an ancestor, surely the caller needs to know whether
867 // we skipped it. 867 // we skipped it.
868 DCHECK(!ancestor || skippedAncestor); 868 DCHECK(!ancestor || skippedAncestor);
869 if (skippedAncestor) 869 if (skippedAncestor)
870 *skippedAncestor = false; 870 *skippedAncestor = false;
871 871
872 LayoutObject& layoutObject = this->layoutObject(); 872 LayoutObject* layoutObject = &this->layoutObject();
873 if (layoutObject.isColumnSpanAll() || 873 if (layoutObject->isColumnSpanAll() || layoutObject->isFloating()) {
874 layoutObject.isFloatingWithNonContainingBlockParent()) {
chrishtr 2017/03/21 21:48:46 Do the other callsites of isFloatingWithNonContain
Xianzhu 2017/03/22 15:03:15 The function is still good for checking if a float
875 Optional<LayoutObject::AncestorSkipInfo> skipInfo; 874 Optional<LayoutObject::AncestorSkipInfo> skipInfo;
876 if (skippedAncestor) 875 if (skippedAncestor)
877 skipInfo.emplace(&ancestor->layoutObject()); 876 skipInfo.emplace(&ancestor->layoutObject());
878 if (auto containingBlock = layoutObject.containingBlock( 877 while (auto containingBlock = layoutObject->containingBlock(
879 skippedAncestor ? &*skipInfo : nullptr)) { 878 skippedAncestor ? &*skipInfo : nullptr)) {
880 if (skippedAncestor && skipInfo->ancestorSkipped()) 879 if (skippedAncestor && skipInfo->ancestorSkipped())
881 *skippedAncestor = true; 880 *skippedAncestor = true;
881 if (layoutObject->isFloating() && containingBlock->isFloating() &&
882 !containingBlock->hasLayer()) {
883 layoutObject = containingBlock;
884 continue;
885 }
882 return containingBlock->enclosingLayer(); 886 return containingBlock->enclosingLayer();
883 } 887 }
884 return nullptr; 888 return nullptr;
885 } 889 }
886 890
887 if (layoutObject.isOutOfFlowPositioned()) { 891 if (layoutObject->isOutOfFlowPositioned()) {
888 auto canContainThisLayer = 892 auto canContainThisLayer =
889 layoutObject.isFixedPositioned() 893 layoutObject->isFixedPositioned()
890 ? &LayoutObject::canContainFixedPositionObjects 894 ? &LayoutObject::canContainFixedPositionObjects
891 : &LayoutObject::canContainAbsolutePositionObjects; 895 : &LayoutObject::canContainAbsolutePositionObjects;
892 896
893 PaintLayer* curr = parent(); 897 PaintLayer* curr = parent();
894 while (curr && !((&curr->layoutObject())->*canContainThisLayer)()) { 898 while (curr && !((&curr->layoutObject())->*canContainThisLayer)()) {
895 if (skippedAncestor && curr == ancestor) 899 if (skippedAncestor && curr == ancestor)
896 *skippedAncestor = true; 900 *skippedAncestor = true;
897 curr = curr->parent(); 901 curr = curr->parent();
898 } 902 }
899 return curr; 903 return curr;
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 } 3226 }
3223 3227
3224 void showLayerTree(const blink::LayoutObject* layoutObject) { 3228 void showLayerTree(const blink::LayoutObject* layoutObject) {
3225 if (!layoutObject) { 3229 if (!layoutObject) {
3226 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3230 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3227 return; 3231 return;
3228 } 3232 }
3229 showLayerTree(layoutObject->enclosingLayer()); 3233 showLayerTree(layoutObject->enclosingLayer());
3230 } 3234 }
3231 #endif 3235 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698