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

Side by Side Diff: Source/core/layout/LayoutBlock.cpp

Issue 1181983002: Ensure that positioned objects' list is always in parent first order (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More comprehensive test cases Created 5 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 setReplaced(newStyle.isDisplayInlineType()); 274 setReplaced(newStyle.isDisplayInlineType());
275 275
276 if (oldStyle && parent()) { 276 if (oldStyle && parent()) {
277 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old Style->hasTransformRelatedProperty(); 277 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old Style->hasTransformRelatedProperty();
278 bool newStyleIsContainer = newStyle.position() != StaticPosition || newS tyle.hasTransformRelatedProperty(); 278 bool newStyleIsContainer = newStyle.position() != StaticPosition || newS tyle.hasTransformRelatedProperty();
279 279
280 if (oldStyleIsContainer && !newStyleIsContainer) { 280 if (oldStyleIsContainer && !newStyleIsContainer) {
281 // Clear our positioned objects list. Our absolutely positioned desc endants will be 281 // Clear our positioned objects list. Our absolutely positioned desc endants will be
282 // inserted into our containing block's positioned objects list duri ng layout. 282 // inserted into our containing block's positioned objects list duri ng layout.
283 removePositionedObjects(0, NewContainingBlock); 283 removePositionedObjects(0, NewContainingBlock);
284 } else if (!oldStyleIsContainer && newStyleIsContainer) { 284 } else if ((!oldStyleIsContainer || oldStyle->position() != newStyle.pos ition()) && newStyleIsContainer) {
285 // Remove our absolutely positioned descendants from their current c ontaining block. 285 // Remove our absolutely positioned descendants from their current c ontaining block.
mstensho (USE GERRIT) 2015/06/15 10:02:55 This comment is now inaccurate. We're removing pos
286 // They will be inserted into our positioned objects list during lay out. 286 // They will be inserted into our positioned objects list during lay out.
287 LayoutObject* cb = parent(); 287 if (LayoutBlock* cb = containingBlock(&newStyle))
mstensho (USE GERRIT) 2015/06/15 10:02:54 Why not do this in styleDidChange() instead of sty
288 while (cb && (cb->style()->position() == StaticPosition || (cb->isIn line() && !cb->isReplaced())) && !cb->isLayoutView()) { 288 cb->removePositionedObjects(this, NewContainingBlock);
289 if (cb->style()->position() == RelativePosition && cb->isInline( ) && !cb->isReplaced()) {
290 cb = cb->containingBlock();
291 break;
292 }
293 cb = cb->parent();
294 }
295
296 if (cb->isLayoutBlock())
297 toLayoutBlock(cb)->removePositionedObjects(this, NewContainingBl ock);
298 } 289 }
299 } 290 }
300 291
301 LayoutBox::styleWillChange(diff, newStyle); 292 LayoutBox::styleWillChange(diff, newStyle);
302 } 293 }
303 294
304 static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) 295 static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle)
305 { 296 {
306 if (newStyle.isHorizontalWritingMode()) { 297 if (newStyle.isHorizontalWritingMode()) {
307 return oldStyle.borderLeftWidth() != newStyle.borderLeftWidth() 298 return oldStyle.borderLeftWidth() != newStyle.borderLeftWidth()
(...skipping 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2898 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2908 { 2899 {
2909 showLayoutObject(); 2900 showLayoutObject();
2910 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2901 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2911 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2902 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2912 } 2903 }
2913 2904
2914 #endif 2905 #endif
2915 2906
2916 } // namespace blink 2907 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698