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

Side by Side Diff: Source/WebCore/rendering/RenderBlockLineLayout.cpp

Issue 10871072: Merge 125810 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 3 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 | « LayoutTests/fast/replaced/replaced-last-line-layout-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) 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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 // FIXME: CSS3 says that descendants that are clipped must also know how to truncate. This is insanely 1469 // FIXME: CSS3 says that descendants that are clipped must also know how to truncate. This is insanely
1470 // difficult to figure out (especially in the middle of doing layout), and i s really an esoteric pile of nonsense 1470 // difficult to figure out (especially in the middle of doing layout), and i s really an esoteric pile of nonsense
1471 // anyway, so we won't worry about following the draft here. 1471 // anyway, so we won't worry about following the draft here.
1472 bool hasTextOverflow = style()->textOverflow() && hasOverflowClip(); 1472 bool hasTextOverflow = style()->textOverflow() && hasOverflowClip();
1473 1473
1474 // Walk all the lines and delete our ellipsis line boxes if they exist. 1474 // Walk all the lines and delete our ellipsis line boxes if they exist.
1475 if (hasTextOverflow) 1475 if (hasTextOverflow)
1476 deleteEllipsisLineBoxes(); 1476 deleteEllipsisLineBoxes();
1477 1477
1478 if (firstChild()) { 1478 if (firstChild()) {
1479 // layout replaced elements 1479 // In full layout mode, clear the line boxes of children upfront. Otherw ise,
1480 // siblings can run into stale root lineboxes during layout. Then layout
1481 // the replaced elements later. In partial layout mode, line boxes are n ot
1482 // deleted and only dirtied. In that case, we can layout the replaced
1483 // elements at the same time.
1480 bool hasInlineChild = false; 1484 bool hasInlineChild = false;
1485 Vector<RenderBox*> replacedChildren;
1481 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { 1486 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
1482 RenderObject* o = walker.current(); 1487 RenderObject* o = walker.current();
1483 if (!hasInlineChild && o->isInline()) 1488 if (!hasInlineChild && o->isInline())
1484 hasInlineChild = true; 1489 hasInlineChild = true;
1485 1490
1486 if (o->isReplaced() || o->isFloating() || o->isPositioned()) { 1491 if (o->isReplaced() || o->isFloating() || o->isPositioned()) {
1487 RenderBox* box = toRenderBox(o); 1492 RenderBox* box = toRenderBox(o);
1488 1493
1489 if (relayoutChildren || box->hasRelativeDimensions()) 1494 if (relayoutChildren || box->hasRelativeDimensions())
1490 o->setChildNeedsLayout(true, MarkOnlyThis); 1495 o->setChildNeedsLayout(true, MarkOnlyThis);
1491 1496
1492 // If relayoutChildren is set and the child has percentage paddi ng or an embedded content box, we also need to invalidate the childs pref widths . 1497 // If relayoutChildren is set and the child has percentage paddi ng or an embedded content box, we also need to invalidate the childs pref widths .
1493 if (relayoutChildren && box->needsPreferredWidthsRecalculation() ) 1498 if (relayoutChildren && box->needsPreferredWidthsRecalculation() )
1494 o->setPreferredLogicalWidthsDirty(true, MarkOnlyThis); 1499 o->setPreferredLogicalWidthsDirty(true, MarkOnlyThis);
1495 1500
1496 if (o->isPositioned()) 1501 if (o->isPositioned())
1497 o->containingBlock()->insertPositionedObject(box); 1502 o->containingBlock()->insertPositionedObject(box);
1498 else if (o->isFloating()) 1503 else if (o->isFloating())
1499 layoutState.floats().append(FloatWithRect(box)); 1504 layoutState.floats().append(FloatWithRect(box));
1500 else if (layoutState.isFullLayout() || o->needsLayout()) { 1505 else if (isFullLayout || o->needsLayout()) {
1501 // Replaced elements 1506 // Replaced element.
1502 toRenderBox(o)->dirtyLineBoxes(layoutState.isFullLayout()); 1507 box->dirtyLineBoxes(isFullLayout);
1508 if (isFullLayout)
1509 replacedChildren.append(box);
1510 else
1511 o->layoutIfNeeded();
1503 } 1512 }
1504 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl ine())) { 1513 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl ine())) {
1505 if (!o->isText()) 1514 if (!o->isText())
1506 toRenderInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout()); 1515 toRenderInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout());
1507 if (layoutState.isFullLayout() || o->selfNeedsLayout()) 1516 if (layoutState.isFullLayout() || o->selfNeedsLayout())
1508 dirtyLineBoxesForRenderer(o, layoutState.isFullLayout()); 1517 dirtyLineBoxesForRenderer(o, layoutState.isFullLayout());
1509 o->setNeedsLayout(false); 1518 o->setNeedsLayout(false);
1510 } 1519 }
1511 } 1520 }
1512 1521
1522 if (replacedChildren.size()) {
1523 for (size_t i = 0; i < replacedChildren.size(); i++)
1524 replacedChildren[i]->layoutIfNeeded();
1525 }
1526
1513 layoutRunsAndFloats(layoutState, hasInlineChild); 1527 layoutRunsAndFloats(layoutState, hasInlineChild);
1514 } 1528 }
1515 1529
1516 // Expand the last line to accommodate Ruby and emphasis marks. 1530 // Expand the last line to accommodate Ruby and emphasis marks.
1517 int lastLineAnnotationsAdjustment = 0; 1531 int lastLineAnnotationsAdjustment = 0;
1518 if (lastRootBox()) { 1532 if (lastRootBox()) {
1519 LayoutUnit lowestAllowedPosition = max(lastRootBox()->lineBottom(), logi calHeight() + paddingAfter()); 1533 LayoutUnit lowestAllowedPosition = max(lastRootBox()->lineBottom(), logi calHeight() + paddingAfter());
1520 if (!style()->isFlippedLinesWritingMode()) 1534 if (!style()->isFlippedLinesWritingMode())
1521 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition); 1535 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition);
1522 else 1536 else
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 // additional spaces we see will be discarded. 2276 // additional spaces we see will be discarded.
2263 currentCharacterIsSpace = true; 2277 currentCharacterIsSpace = true;
2264 currentCharacterIsWS = true; 2278 currentCharacterIsWS = true;
2265 ignoringSpaces = true; 2279 ignoringSpaces = true;
2266 } 2280 }
2267 } 2281 }
2268 2282
2269 width.addUncommittedWidth(borderPaddingMarginStart(flowBox) + border PaddingMarginEnd(flowBox)); 2283 width.addUncommittedWidth(borderPaddingMarginStart(flowBox) + border PaddingMarginEnd(flowBox));
2270 } else if (current.m_obj->isReplaced()) { 2284 } else if (current.m_obj->isReplaced()) {
2271 RenderBox* replacedBox = toRenderBox(current.m_obj); 2285 RenderBox* replacedBox = toRenderBox(current.m_obj);
2272 replacedBox->layoutIfNeeded();
2273 2286
2274 // Break on replaced elements if either has normal white-space. 2287 // Break on replaced elements if either has normal white-space.
2275 if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj-> isImage() || allowImagesToBreak)) { 2288 if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj-> isImage() || allowImagesToBreak)) {
2276 width.commit(); 2289 width.commit();
2277 lBreak.moveToStartOf(current.m_obj); 2290 lBreak.moveToStartOf(current.m_obj);
2278 } 2291 }
2279 2292
2280 if (ignoringSpaces) 2293 if (ignoringSpaces)
2281 addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); 2294 addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0));
2282 2295
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 2819 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
2807 2820
2808 setLineGridBox(lineGridBox); 2821 setLineGridBox(lineGridBox);
2809 2822
2810 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying 2823 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying
2811 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 2824 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
2812 // to this grid. 2825 // to this grid.
2813 } 2826 }
2814 2827
2815 } 2828 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/replaced/replaced-last-line-layout-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698