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: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1970453002: Move continuation and line box specific stuff to LayoutBlockFlow::removeChild(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { 2246 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) {
2247 if (beforeChild == flowThread) 2247 if (beforeChild == flowThread)
2248 beforeChild = flowThread->firstChild(); 2248 beforeChild = flowThread->firstChild();
2249 ASSERT(!beforeChild || beforeChild->isDescendantOf(flowThread)); 2249 ASSERT(!beforeChild || beforeChild->isDescendantOf(flowThread));
2250 flowThread->addChild(newChild, beforeChild); 2250 flowThread->addChild(newChild, beforeChild);
2251 return; 2251 return;
2252 } 2252 }
2253 LayoutBlock::addChild(newChild, beforeChild); 2253 LayoutBlock::addChild(newChild, beforeChild);
2254 } 2254 }
2255 2255
2256 void LayoutBlockFlow::removeChild(LayoutObject* oldChild)
2257 {
2258 // No need to waste time in merging or removing empty anonymous blocks.
2259 // We can just bail out if our document is getting destroyed.
2260 if (documentBeingDestroyed()) {
2261 LayoutBox::removeChild(oldChild);
2262 return;
2263 }
2264
2265 LayoutBlock::removeChild(oldChild);
2266 if (!firstChild()) {
2267 // If this was our last child be sure to clear out our line boxes.
2268 if (childrenInline())
2269 deleteLineBoxTree();
2270
2271 // If we are an empty anonymous block in the continuation chain,
2272 // we need to remove ourself and fix the continuation chain.
2273 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is ListMarker()) {
2274 LayoutObject* containingBlockIgnoringAnonymous = containingBlock();
2275 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn onymous->isAnonymous())
2276 containingBlockIgnoringAnonymous = containingBlockIgnoringAnonym ous->containingBlock();
2277 for (LayoutObject* curr = this; curr; curr = curr->previousInPreOrde r(containingBlockIgnoringAnonymous)) {
2278 if (curr->virtualContinuation() != this)
2279 continue;
2280
2281 // Found our previous continuation. We just need to point it to
2282 // |this|'s next continuation.
2283 LayoutBoxModelObject* nextContinuation = continuation();
2284 if (curr->isLayoutInline())
2285 toLayoutInline(curr)->setContinuation(nextContinuation);
2286 else if (curr->isLayoutBlockFlow())
2287 toLayoutBlockFlow(curr)->setContinuation(nextContinuation);
2288 else
2289 ASSERT_NOT_REACHED();
2290
2291 break;
2292 }
2293 setContinuation(nullptr);
2294 destroy();
2295 }
2296 } else if (!beingDestroyed() && !oldChild->isFloatingOrOutOfFlowPositioned() && !oldChild->isAnonymousBlock()) {
2297 // If the child we're removing means that we can now treat all children as inline without the need for anonymous blocks, then do that.
2298 makeChildrenInlineIfPossible();
2299 }
2300 }
2301
2256 void LayoutBlockFlow::moveAllChildrenIncludingFloatsTo(LayoutBlock* toBlock, boo l fullRemoveInsert) 2302 void LayoutBlockFlow::moveAllChildrenIncludingFloatsTo(LayoutBlock* toBlock, boo l fullRemoveInsert)
2257 { 2303 {
2258 LayoutBlockFlow* toBlockFlow = toLayoutBlockFlow(toBlock); 2304 LayoutBlockFlow* toBlockFlow = toLayoutBlockFlow(toBlock);
2259 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); 2305 moveAllChildrenTo(toBlockFlow, fullRemoveInsert);
2260 2306
2261 // When a portion of the layout tree is being detached, anonymous blocks 2307 // When a portion of the layout tree is being detached, anonymous blocks
2262 // will be combined as their children are deleted. In this process, the 2308 // will be combined as their children are deleted. In this process, the
2263 // anonymous block later in the tree is merged into the one preceding it. 2309 // anonymous block later in the tree is merged into the one preceding it.
2264 // It can happen that the later block (this) contains floats that the 2310 // It can happen that the later block (this) contains floats that the
2265 // previous block (toBlockFlow) did not contain, and thus are not in the 2311 // previous block (toBlockFlow) did not contain, and thus are not in the
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 if (!rect.isEmpty()) 3388 if (!rect.isEmpty())
3343 rects.append(rect); 3389 rects.append(rect);
3344 } 3390 }
3345 } 3391 }
3346 3392
3347 if (inlineElementContinuation) 3393 if (inlineElementContinuation)
3348 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows); 3394 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows);
3349 } 3395 }
3350 3396
3351 } // namespace blink 3397 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698