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

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

Issue 10869055: Merge 125810 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 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
« 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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 // FIXME: CSS3 says that descendants that are clipped must also know how to truncate. This is insanely 1486 // FIXME: CSS3 says that descendants that are clipped must also know how to truncate. This is insanely
1487 // difficult to figure out (especially in the middle of doing layout), and i s really an esoteric pile of nonsense 1487 // difficult to figure out (especially in the middle of doing layout), and i s really an esoteric pile of nonsense
1488 // anyway, so we won't worry about following the draft here. 1488 // anyway, so we won't worry about following the draft here.
1489 bool hasTextOverflow = style()->textOverflow() && hasOverflowClip(); 1489 bool hasTextOverflow = style()->textOverflow() && hasOverflowClip();
1490 1490
1491 // Walk all the lines and delete our ellipsis line boxes if they exist. 1491 // Walk all the lines and delete our ellipsis line boxes if they exist.
1492 if (hasTextOverflow) 1492 if (hasTextOverflow)
1493 deleteEllipsisLineBoxes(); 1493 deleteEllipsisLineBoxes();
1494 1494
1495 if (firstChild()) { 1495 if (firstChild()) {
1496 // layout replaced elements 1496 // In full layout mode, clear the line boxes of children upfront. Otherw ise,
1497 // siblings can run into stale root lineboxes during layout. Then layout
1498 // the replaced elements later. In partial layout mode, line boxes are n ot
1499 // deleted and only dirtied. In that case, we can layout the replaced
1500 // elements at the same time.
1497 bool hasInlineChild = false; 1501 bool hasInlineChild = false;
1502 Vector<RenderBox*> replacedChildren;
1498 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { 1503 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
1499 RenderObject* o = walker.current(); 1504 RenderObject* o = walker.current();
1500 if (!hasInlineChild && o->isInline()) 1505 if (!hasInlineChild && o->isInline())
1501 hasInlineChild = true; 1506 hasInlineChild = true;
1502 1507
1503 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned() ) { 1508 if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned() ) {
1504 RenderBox* box = toRenderBox(o); 1509 RenderBox* box = toRenderBox(o);
1505 1510
1506 if (relayoutChildren || box->hasRelativeDimensions()) 1511 if (relayoutChildren || box->hasRelativeDimensions())
1507 o->setChildNeedsLayout(true, MarkOnlyThis); 1512 o->setChildNeedsLayout(true, MarkOnlyThis);
1508 1513
1509 // 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 . 1514 // 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 .
1510 if (relayoutChildren && box->needsPreferredWidthsRecalculation() ) 1515 if (relayoutChildren && box->needsPreferredWidthsRecalculation() )
1511 o->setPreferredLogicalWidthsDirty(true, MarkOnlyThis); 1516 o->setPreferredLogicalWidthsDirty(true, MarkOnlyThis);
1512 1517
1513 if (o->isOutOfFlowPositioned()) 1518 if (o->isOutOfFlowPositioned())
1514 o->containingBlock()->insertPositionedObject(box); 1519 o->containingBlock()->insertPositionedObject(box);
1515 else if (o->isFloating()) 1520 else if (o->isFloating())
1516 layoutState.floats().append(FloatWithRect(box)); 1521 layoutState.floats().append(FloatWithRect(box));
1517 else if (layoutState.isFullLayout() || o->needsLayout()) { 1522 else if (isFullLayout || o->needsLayout()) {
1518 // Replaced elements 1523 // Replaced element.
1519 toRenderBox(o)->dirtyLineBoxes(layoutState.isFullLayout()); 1524 box->dirtyLineBoxes(isFullLayout);
1525 if (isFullLayout)
1526 replacedChildren.append(box);
1527 else
1528 o->layoutIfNeeded();
1520 } 1529 }
1521 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl ine())) { 1530 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl ine())) {
1522 if (!o->isText()) 1531 if (!o->isText())
1523 toRenderInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout()); 1532 toRenderInline(o)->updateAlwaysCreateLineBoxes(layoutState.i sFullLayout());
1524 if (layoutState.isFullLayout() || o->selfNeedsLayout()) 1533 if (layoutState.isFullLayout() || o->selfNeedsLayout())
1525 dirtyLineBoxesForRenderer(o, layoutState.isFullLayout()); 1534 dirtyLineBoxesForRenderer(o, layoutState.isFullLayout());
1526 o->setNeedsLayout(false); 1535 o->setNeedsLayout(false);
1527 } 1536 }
1528 } 1537 }
1529 1538
1539 if (replacedChildren.size()) {
1540 for (size_t i = 0; i < replacedChildren.size(); i++)
1541 replacedChildren[i]->layoutIfNeeded();
1542 }
1543
1530 layoutRunsAndFloats(layoutState, hasInlineChild); 1544 layoutRunsAndFloats(layoutState, hasInlineChild);
1531 } 1545 }
1532 1546
1533 // Expand the last line to accommodate Ruby and emphasis marks. 1547 // Expand the last line to accommodate Ruby and emphasis marks.
1534 int lastLineAnnotationsAdjustment = 0; 1548 int lastLineAnnotationsAdjustment = 0;
1535 if (lastRootBox()) { 1549 if (lastRootBox()) {
1536 LayoutUnit lowestAllowedPosition = max(lastRootBox()->lineBottom(), logi calHeight() + paddingAfter()); 1550 LayoutUnit lowestAllowedPosition = max(lastRootBox()->lineBottom(), logi calHeight() + paddingAfter());
1537 if (!style()->isFlippedLinesWritingMode()) 1551 if (!style()->isFlippedLinesWritingMode())
1538 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition); 1552 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition);
1539 else 1553 else
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 // additional spaces we see will be discarded. 2293 // additional spaces we see will be discarded.
2280 currentCharacterIsSpace = true; 2294 currentCharacterIsSpace = true;
2281 currentCharacterIsWS = true; 2295 currentCharacterIsWS = true;
2282 ignoringSpaces = true; 2296 ignoringSpaces = true;
2283 } 2297 }
2284 } 2298 }
2285 2299
2286 width.addUncommittedWidth(borderPaddingMarginStart(flowBox) + border PaddingMarginEnd(flowBox)); 2300 width.addUncommittedWidth(borderPaddingMarginStart(flowBox) + border PaddingMarginEnd(flowBox));
2287 } else if (current.m_obj->isReplaced()) { 2301 } else if (current.m_obj->isReplaced()) {
2288 RenderBox* replacedBox = toRenderBox(current.m_obj); 2302 RenderBox* replacedBox = toRenderBox(current.m_obj);
2289 replacedBox->layoutIfNeeded();
2290 2303
2291 // Break on replaced elements if either has normal white-space. 2304 // Break on replaced elements if either has normal white-space.
2292 if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj-> isImage() || allowImagesToBreak)) { 2305 if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj-> isImage() || allowImagesToBreak)) {
2293 width.commit(); 2306 width.commit();
2294 lBreak.moveToStartOf(current.m_obj); 2307 lBreak.moveToStartOf(current.m_obj);
2295 } 2308 }
2296 2309
2297 if (ignoringSpaces) 2310 if (ignoringSpaces)
2298 addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); 2311 addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0));
2299 2312
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2854 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 2867 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
2855 2868
2856 setLineGridBox(lineGridBox); 2869 setLineGridBox(lineGridBox);
2857 2870
2858 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying 2871 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying
2859 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 2872 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
2860 // to this grid. 2873 // to this grid.
2861 } 2874 }
2862 2875
2863 } 2876 }
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