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

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

Issue 1298603004: Ensure floats get added to floating objects list even if they don't have a linebox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « 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) 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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 } 1035 }
1036 } 1036 }
1037 1037
1038 void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats) 1038 void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats)
1039 { 1039 {
1040 size_t floatCount = floats.size(); 1040 size_t floatCount = floats.size();
1041 // Floats that did not have layout did not paint invalidations when we laid them out. They would have 1041 // Floats that did not have layout did not paint invalidations when we laid them out. They would have
1042 // painted by now if they had moved, but if they stayed at (0, 0), they stil l need to be 1042 // painted by now if they had moved, but if they stayed at (0, 0), they stil l need to be
1043 // painted. 1043 // painted.
1044 for (size_t i = 0; i < floatCount; ++i) { 1044 for (size_t i = 0; i < floatCount; ++i) {
1045 LayoutBox* f = floats[i].object;
1045 if (!floats[i].everHadLayout) { 1046 if (!floats[i].everHadLayout) {
1046 LayoutBox* f = floats[i].object;
1047 if (!f->location().x() && !f->location().y()) 1047 if (!f->location().x() && !f->location().y())
1048 f->setShouldDoFullPaintInvalidation(); 1048 f->setShouldDoFullPaintInvalidation();
1049 } 1049 }
1050 insertFloatingObject(*f);
1050 } 1051 }
1052 positionNewFloats();
1051 } 1053 }
1052 1054
1053 struct InlineMinMaxIterator { 1055 struct InlineMinMaxIterator {
1054 /* InlineMinMaxIterator is a class that will iterate over all layout objects tha t contribute to 1056 /* InlineMinMaxIterator is a class that will iterate over all layout objects tha t contribute to
1055 inline min/max width calculations. Note the following about the way it walks : 1057 inline min/max width calculations. Note the following about the way it walks :
1056 (1) Positioned content is skipped (since it does not contribute to min/max wi dth of a block) 1058 (1) Positioned content is skipped (since it does not contribute to min/max wi dth of a block)
1057 (2) We do not drill into the children of floats or replaced elements, since y ou can't break 1059 (2) We do not drill into the children of floats or replaced elements, since y ou can't break
1058 in the middle of such an element. 1060 in the middle of such an element.
1059 (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side c an have 1061 (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side c an have
1060 distinct borders/margin/padding that contribute to the min/max width. 1062 distinct borders/margin/padding that contribute to the min/max width.
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 if (hasTextOverflow) 1525 if (hasTextOverflow)
1524 deleteEllipsisLineBoxes(); 1526 deleteEllipsisLineBoxes();
1525 1527
1526 if (firstChild()) { 1528 if (firstChild()) {
1527 // In full layout mode, clear the line boxes of children upfront. Otherw ise, 1529 // In full layout mode, clear the line boxes of children upfront. Otherw ise,
1528 // siblings can run into stale root lineboxes during layout. Then layout 1530 // siblings can run into stale root lineboxes during layout. Then layout
1529 // the replaced elements later. In partial layout mode, line boxes are n ot 1531 // the replaced elements later. In partial layout mode, line boxes are n ot
1530 // deleted and only dirtied. In that case, we can layout the replaced 1532 // deleted and only dirtied. In that case, we can layout the replaced
1531 // elements at the same time. 1533 // elements at the same time.
1532 Vector<LayoutBox*> replacedChildren; 1534 Vector<LayoutBox*> replacedChildren;
1533 LayoutObject* lastChild = nullptr;
1534 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { 1535 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
1535 LayoutObject* o = walker.current(); 1536 LayoutObject* o = walker.current();
1536 1537
1537 if (!layoutState.hasInlineChild() && o->isInline()) 1538 if (!layoutState.hasInlineChild() && o->isInline())
1538 layoutState.setHasInlineChild(true); 1539 layoutState.setHasInlineChild(true);
1539 1540
1540 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned() ) { 1541 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned() ) {
1541 LayoutBox* box = toLayoutBox(o); 1542 LayoutBox* box = toLayoutBox(o);
1542 1543
1543 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box); 1544 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *box);
(...skipping 14 matching lines...) Expand all
1558 else 1559 else
1559 o->layoutIfNeeded(); 1560 o->layoutIfNeeded();
1560 } 1561 }
1561 } else if (o->isText() || (o->isLayoutInline() && !walker.atEndOfInl ine())) { 1562 } else if (o->isText() || (o->isLayoutInline() && !walker.atEndOfInl ine())) {
1562 if (!o->isText()) 1563 if (!o->isText())
1563 toLayoutInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout()); 1564 toLayoutInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout());
1564 if (layoutState.isFullLayout() || o->selfNeedsLayout()) 1565 if (layoutState.isFullLayout() || o->selfNeedsLayout())
1565 dirtyLineBoxesForObject(o, layoutState.isFullLayout()); 1566 dirtyLineBoxesForObject(o, layoutState.isFullLayout());
1566 o->clearNeedsLayout(); 1567 o->clearNeedsLayout();
1567 } 1568 }
1568 if (!o->isText() || !toLayoutText(o)->isAllCollapsibleWhitespace())
1569 lastChild = o;
1570 } 1569 }
1571 // If there is a trailing float on the line that will possibly occur aft er a natural line break
1572 // then dirty its adjacent lineboxes to ensure it gets placed.
1573 if (lastChild && lastChild->isFloating())
1574 dirtyLinesFromChangedChild(lastChild);
1575 1570
1576 for (size_t i = 0; i < replacedChildren.size(); i++) 1571 for (size_t i = 0; i < replacedChildren.size(); i++)
1577 replacedChildren[i]->layoutIfNeeded(); 1572 replacedChildren[i]->layoutIfNeeded();
1578 1573
1579 layoutRunsAndFloats(layoutState); 1574 layoutRunsAndFloats(layoutState);
1580 } 1575 }
1581 1576
1582 // Expand the last line to accommodate Ruby and emphasis marks. 1577 // Expand the last line to accommodate Ruby and emphasis marks.
1583 int lastLineAnnotationsAdjustment = 0; 1578 int lastLineAnnotationsAdjustment = 0;
1584 if (lastRootBox()) { 1579 if (lastRootBox()) {
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2013 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
2019 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft; 2014 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft;
2020 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2015 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2021 2016
2022 if (!style()->isLeftToRightDirection()) 2017 if (!style()->isLeftToRightDirection())
2023 return logicalWidth() - logicalLeft; 2018 return logicalWidth() - logicalLeft;
2024 return logicalLeft; 2019 return logicalLeft;
2025 } 2020 }
2026 2021
2027 } 2022 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698