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

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

Issue 1933633002: Remove replacedChildren vector from inline layout. (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 | « no previous file | 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google 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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 // simple case of an anonymous block truncating when it's parent is clipped. 1561 // simple case of an anonymous block truncating when it's parent is clipped.
1562 bool hasTextOverflow = (style()->getTextOverflow() && hasOverflowClip()) 1562 bool hasTextOverflow = (style()->getTextOverflow() && hasOverflowClip())
1563 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay outBlock(parent())->canCollapseAnonymousBlockChild() 1563 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay outBlock(parent())->canCollapseAnonymousBlockChild()
1564 && parent()->style()->getTextOverflow() && parent()->hasOverflowClip ()); 1564 && parent()->style()->getTextOverflow() && parent()->hasOverflowClip ());
1565 1565
1566 // Walk all the lines and delete our ellipsis line boxes if they exist. 1566 // Walk all the lines and delete our ellipsis line boxes if they exist.
1567 if (hasTextOverflow) 1567 if (hasTextOverflow)
1568 deleteEllipsisLineBoxes(); 1568 deleteEllipsisLineBoxes();
1569 1569
1570 if (firstChild()) { 1570 if (firstChild()) {
1571 // In full layout mode, clear the line boxes of children upfront. Otherw ise,
1572 // siblings can run into stale root lineboxes during layout. Then layout
1573 // the replaced elements later. In partial layout mode, line boxes are n ot
1574 // deleted and only dirtied. In that case, we can layout the replaced
1575 // elements at the same time.
1576 Vector<LayoutBox*> replacedChildren;
1577 for (InlineWalker walker(LineLayoutBlockFlow(this)); !walker.atEnd(); wa lker.advance()) { 1571 for (InlineWalker walker(LineLayoutBlockFlow(this)); !walker.atEnd(); wa lker.advance()) {
1578 LayoutObject* o = walker.current().layoutObject(); 1572 LayoutObject* o = walker.current().layoutObject();
1579 1573
1580 if (!layoutState.hasInlineChild() && o->isInline()) 1574 if (!layoutState.hasInlineChild() && o->isInline())
1581 layoutState.setHasInlineChild(true); 1575 layoutState.setHasInlineChild(true);
1582 1576
1583 if (o->isAtomicInlineLevel() || o->isFloating() || o->isOutOfFlowPos itioned()) { 1577 if (o->isAtomicInlineLevel() || o->isFloating() || o->isOutOfFlowPos itioned()) {
1584 LayoutBox* box = toLayoutBox(o); 1578 LayoutBox* box = toLayoutBox(o);
1585 1579
1586 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box); 1580 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box);
1587 1581
1588 if (o->isOutOfFlowPositioned()) { 1582 if (o->isOutOfFlowPositioned()) {
1589 o->containingBlock()->insertPositionedObject(box); 1583 o->containingBlock()->insertPositionedObject(box);
1590 } else if (o->isFloating()) { 1584 } else if (o->isFloating()) {
1591 layoutState.floats().append(FloatWithRect(box)); 1585 layoutState.floats().append(FloatWithRect(box));
1592 if (box->needsLayout()) { 1586 if (box->needsLayout()) {
1593 box->layout(); 1587 box->layout();
1594 markLinesDirtyInBlockRange(toLayoutBox(o)->logicalTop(), toLayoutBox(o)->logicalBottom()); 1588 markLinesDirtyInBlockRange(toLayoutBox(o)->logicalTop(), toLayoutBox(o)->logicalBottom());
1595 } 1589 }
1596 } else if (isFullLayout || o->needsLayout()) { 1590 } else if (isFullLayout || o->needsLayout()) {
1597 // Replaced element. 1591 // Atomic inline.
1598 box->dirtyLineBoxes(isFullLayout); 1592 box->dirtyLineBoxes(isFullLayout);
1599 if (isFullLayout) 1593 o->layoutIfNeeded();
1600 replacedChildren.append(box);
1601 else
1602 o->layoutIfNeeded();
1603 } 1594 }
1604 } else if (o->isText() || (o->isLayoutInline() && !walker.atEndOfInl ine())) { 1595 } else if (o->isText() || (o->isLayoutInline() && !walker.atEndOfInl ine())) {
1605 if (!o->isText()) 1596 if (!o->isText())
1606 toLayoutInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout()); 1597 toLayoutInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout());
1607 if (layoutState.isFullLayout() || o->selfNeedsLayout()) 1598 if (layoutState.isFullLayout() || o->selfNeedsLayout())
1608 dirtyLineBoxesForObject(o, layoutState.isFullLayout()); 1599 dirtyLineBoxesForObject(o, layoutState.isFullLayout());
1609 o->clearNeedsLayout(); 1600 o->clearNeedsLayout();
1610 } 1601 }
1611 1602
1612 if (isInlineWithOutlineAndContinuation(*o)) 1603 if (isInlineWithOutlineAndContinuation(*o))
1613 setContainsInlineWithOutlineAndContinuation(true); 1604 setContainsInlineWithOutlineAndContinuation(true);
1614 } 1605 }
1615 1606
1616 for (size_t i = 0; i < replacedChildren.size(); i++)
1617 replacedChildren[i]->layoutIfNeeded();
1618
1619 layoutRunsAndFloats(layoutState); 1607 layoutRunsAndFloats(layoutState);
1620 } 1608 }
1621 1609
1622 // Expand the last line to accommodate Ruby and emphasis marks. 1610 // Expand the last line to accommodate Ruby and emphasis marks.
1623 int lastLineAnnotationsAdjustment = 0; 1611 int lastLineAnnotationsAdjustment = 0;
1624 if (lastRootBox()) { 1612 if (lastRootBox()) {
1625 LayoutUnit lowestAllowedPosition = std::max(lastRootBox()->lineBottom(), logicalHeight() + paddingAfter()); 1613 LayoutUnit lowestAllowedPosition = std::max(lastRootBox()->lineBottom(), logicalHeight() + paddingAfter());
1626 if (!style()->isFlippedLinesWritingMode()) 1614 if (!style()->isFlippedLinesWritingMode())
1627 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition); 1615 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition);
1628 else 1616 else
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 if (!line || !line->isFirstLineStyle()) 2058 if (!line || !line->isFirstLineStyle())
2071 return reason; 2059 return reason;
2072 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be 2060 // It's the RootInlineBox that paints the ::first-line background. Note that since it may be
2073 // expensive to figure out if the first line is affected by any ::first-line selectors at all, 2061 // expensive to figure out if the first line is affected by any ::first-line selectors at all,
2074 // we just invalidate it unconditionally, since that's typically cheaper. 2062 // we just invalidate it unconditionally, since that's typically cheaper.
2075 invalidateDisplayItemClient(*line); 2063 invalidateDisplayItemClient(*line);
2076 return reason; 2064 return reason;
2077 } 2065 }
2078 2066
2079 } // namespace blink 2067 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698