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

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

Issue 2004363003: Only re-use an anonymous block for continuations if it's contained by a block flow. (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/LayoutTests/fast/deprecated-flexbox/inline-with-block-child-expected.html ('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) 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 void LayoutInline::splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox , 430 void LayoutInline::splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox ,
431 LayoutObject* newChild, LayoutBoxModelObject* oldCont) 431 LayoutObject* newChild, LayoutBoxModelObject* oldCont)
432 { 432 {
433 LayoutBlockFlow* containingBlockFlow = toLayoutBlockFlow(containingBlock()); 433 LayoutBlockFlow* containingBlockFlow = toLayoutBlockFlow(containingBlock());
434 LayoutBlock* pre = nullptr; 434 LayoutBlock* pre = nullptr;
435 LayoutBlock* block = containingBlockFlow; 435 LayoutBlock* block = containingBlockFlow;
436 436
437 // Delete our line boxes before we do the inline split into continuations. 437 // Delete our line boxes before we do the inline split into continuations.
438 containingBlockFlow->deleteLineBoxTree(); 438 containingBlockFlow->deleteLineBoxTree();
439 439
440 bool madeNewBeforeBlock = false; 440 bool reusedAnonymousBlock = false;
441 if (block->isAnonymousBlock() && (!block->parent() || !block->parent()->crea tesAnonymousWrapper())) { 441 if (block->isAnonymousBlock()) {
442 // We can reuse this block and make it the preBlock of the next continua tion. 442 LayoutBlock* outerContainingBlock = block->containingBlock();
443 containingBlockFlow->removePositionedObjects(nullptr); 443 if (outerContainingBlock
444 containingBlockFlow->removeFloatingObjects(); 444 && outerContainingBlock->isLayoutBlockFlow()
445 pre = containingBlockFlow; 445 && !outerContainingBlock->createsAnonymousWrapper()) {
446 block = block->containingBlock(); 446 // We can reuse this block and make it the preBlock of the next cont inuation.
447 } else { 447 containingBlockFlow->removePositionedObjects(nullptr);
448 // No anonymous block available for use. Make one. 448 containingBlockFlow->removeFloatingObjects();
449 pre = block->createAnonymousBlock(); 449 pre = containingBlockFlow;
450 madeNewBeforeBlock = true; 450 block = outerContainingBlock;
451 reusedAnonymousBlock = true;
452 }
451 } 453 }
454 if (!reusedAnonymousBlock)
455 pre = block->createAnonymousBlock(); // No anonymous block available for use. Make one.
452 456
453 LayoutBlock* post = toLayoutBlock(pre->createAnonymousBoxWithSameTypeAs(bloc k)); 457 LayoutBlock* post = toLayoutBlock(pre->createAnonymousBoxWithSameTypeAs(bloc k));
454 458
455 LayoutObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nex tSibling(); 459 LayoutObject* boxFirst = !reusedAnonymousBlock ? block->firstChild() : pre-> nextSibling();
456 if (madeNewBeforeBlock) 460 if (!reusedAnonymousBlock)
457 block->children()->insertChildNode(block, pre, boxFirst); 461 block->children()->insertChildNode(block, pre, boxFirst);
458 block->children()->insertChildNode(block, newBlockBox, boxFirst); 462 block->children()->insertChildNode(block, newBlockBox, boxFirst);
459 block->children()->insertChildNode(block, post, boxFirst); 463 block->children()->insertChildNode(block, post, boxFirst);
460 block->setChildrenInline(false); 464 block->setChildrenInline(false);
461 465
462 if (madeNewBeforeBlock) { 466 if (!reusedAnonymousBlock) {
463 LayoutObject* o = boxFirst; 467 LayoutObject* o = boxFirst;
464 while (o) { 468 while (o) {
465 LayoutObject* no = o; 469 LayoutObject* no = o;
466 o = no->nextSibling(); 470 o = no->nextSibling();
467 pre->children()->appendChildNode(pre, block->children()->removeChild Node(block, no)); 471 pre->children()->appendChildNode(pre, block->children()->removeChild Node(block, no));
468 no->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(Layout InvalidationReason::AnonymousBlockChange); 472 no->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(Layout InvalidationReason::AnonymousBlockChange);
469 } 473 }
470 } 474 }
471 475
472 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); 476 splitInlines(pre, post, newBlockBox, beforeChild, oldCont);
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 1357
1354 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1358 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1355 { 1359 {
1356 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1360 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1357 1361
1358 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1362 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1359 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1363 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1360 } 1364 }
1361 1365
1362 } // namespace blink 1366 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/deprecated-flexbox/inline-with-block-child-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698