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

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

Issue 1966223002: Helper for interesting things to do when a block becomes a float or out-of-flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup! Helper for interesting things to do when a block becomes a float or out-of-flow. Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('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) 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 LayoutObject* sibling = child->previousSibling(); 314 LayoutObject* sibling = child->previousSibling();
315 parentBlockFlow->moveChildTo(this, child, firstChild(), false); 315 parentBlockFlow->moveChildTo(this, child, firstChild(), false);
316 child = sibling; 316 child = sibling;
317 } 317 }
318 } 318 }
319 319
320 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS tyle) 320 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS tyle)
321 { 321 {
322 LayoutBox::styleDidChange(diff, oldStyle); 322 LayoutBox::styleDidChange(diff, oldStyle);
323 323
324 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isLayoutBlockFlow ()) { 324 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isLayoutBlockFlow ())
325 toLayoutBlock(parent())->makeChildrenInlineIfPossible(); 325 toLayoutBlockFlow(parent())->childBecameFloatingOrOutOfFlow(this);
326 // Reparent to an adjacent anonymous block if one is available.
327 if (previousSibling() && previousSibling()->isAnonymousBlock()) {
328 LayoutBlock* newParent = toLayoutBlock(previousSibling());
329 toLayoutBlock(parent())->moveChildTo(newParent, this, nullptr, false );
330 // The anonymous block we've moved to may now be adjacent to former siblings of ours that it can contain also.
331 newParent->reparentSubsequentFloatingOrOutOfFlowSiblings();
332 } else if (nextSibling() && nextSibling()->isAnonymousBlock()) {
333 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(nextSibling()), t his, nextSibling()->slowFirstChild(), false);
334 }
335 }
336 326
337 const ComputedStyle& newStyle = styleRef(); 327 const ComputedStyle& newStyle = styleRef();
338 328
339 if (oldStyle && parent()) { 329 if (oldStyle && parent()) {
340 if (oldStyle->position() != newStyle.position() && newStyle.position() ! = StaticPosition) { 330 if (oldStyle->position() != newStyle.position() && newStyle.position() ! = StaticPosition) {
341 // Remove our absolute and fixed positioned descendants from their n ew containing block, 331 // Remove our absolute and fixed positioned descendants from their n ew containing block,
342 // in case containingBlock() changes by the change to the position p roperty. 332 // in case containingBlock() changes by the change to the position p roperty.
343 // See styleWillChange() for other cases. 333 // See styleWillChange() for other cases.
344 if (LayoutBlock* cb = containingBlock()) 334 if (LayoutBlock* cb = containingBlock())
345 cb->removePositionedObjects(this, NewContainingBlock); 335 cb->removePositionedObjects(this, NewContainingBlock);
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 2243 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
2254 LayoutBox* currBox = *it; 2244 LayoutBox* currBox = *it;
2255 ASSERT(!currBox->needsLayout()); 2245 ASSERT(!currBox->needsLayout());
2256 } 2246 }
2257 } 2247 }
2258 } 2248 }
2259 2249
2260 #endif 2250 #endif
2261 2251
2262 } // namespace blink 2252 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698