LGTM On Wed, Sep 5, 2012 at 12:14 PM, <cevans@chromium.org> wrote: > Reviewers: ojan, > > Description: > Merge 125635 > BUG=137052 > > Please review this at https://chromiumcodereview.**appspot.com/10915102/<https://chromiumcodereview... > > SVN Base: http://svn.webkit.org/**repository/webkit/branches/** > chromium/1229/<http://svn.webkit.org/repository/webkit/branches/chromium/1229/> > > Affected files: > A + LayoutTests/fast/overflow/**line-clamp-and-columns-**expected.html > A + LayoutTests/fast/overflow/**line-clamp-and-columns.html > M Source/WebCore/rendering/**EllipsisBox.h > M Source/WebCore/rendering/**EllipsisBox.cpp > M Source/WebCore/rendering/**RenderDeprecatedFlexibleBox.**cpp > > > ### BEGIN SVN COPY METADATA > #$ svn cp -r 125635 trunk/LayoutTests/fast/**overflow/line-clamp-and-**columns.html > LayoutTests/fast/overflow/**line-clamp-and-columns.html ### WARNING: note > non-trunk copy > #$ cp trunk/LayoutTests/fast/**overflow/line-clamp-and-**columns-expected.html > LayoutTests/fast/overflow/**line-clamp-and-columns-**expected.html > ### END SVN COPY METADATA > Index: LayoutTests/fast/overflow/**line-clamp-and-columns-**expected.html > Index: LayoutTests/fast/overflow/**line-clamp-and-columns.html > Index: Source/WebCore/rendering/**EllipsisBox.cpp > ==============================**==============================**======= > --- Source/WebCore/rendering/**EllipsisBox.cpp (revision 127625) > +++ Source/WebCore/rendering/**EllipsisBox.cpp (working copy) > @@ -65,15 +65,31 @@ > if (setShadow) > context->clearShadow(); > > - if (m_markupBox) { > - // Paint the markup box > - LayoutPoint adjustedPaintOffset = paintOffset; > - adjustedPaintOffset.move(x() + m_logicalWidth - m_markupBox->x(), > - y() + style->fontMetrics().ascent() - (m_markupBox->y() + > m_markupBox->renderer()->**style(isFirstLineStyle())->** > fontMetrics().ascent())); > - m_markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, > lineBottom); > - } > + paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style); > } > > +void EllipsisBox::paintMarkupBox(**PaintInfo& paintInfo, const > LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, > RenderStyle* style) > +{ > + if (!m_shouldPaintMarkupBox || !m_renderer->isRenderBlock()) > + return; > + > + RenderBlock* block = toRenderBlock(m_renderer); > + RootInlineBox* lastLine = block->lineAtIndex(block->**lineCount() - > 1); > + if (!lastLine) > + return; > + > + // If the last line-box on the last line of a block is a link, > -webkit-line-clamp paints that box after the ellipsis. > + // It does not actually move the link. > + InlineBox* anchorBox = lastLine->lastChild(); > + if (!anchorBox || !anchorBox->renderer()->style(**)->isLink()) > + return; > + > + LayoutPoint adjustedPaintOffset = paintOffset; > + adjustedPaintOffset.move(x() + m_logicalWidth - anchorBox->x(), > + y() + style->fontMetrics().ascent() - (anchorBox->y() + > anchorBox->renderer()->style(**isFirstLineStyle())->** > fontMetrics().ascent())); > + anchorBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); > +} > + > IntRect EllipsisBox::selectionRect() > { > RenderStyle* style = m_renderer->style(**isFirstLineStyle()); > Index: Source/WebCore/rendering/**EllipsisBox.h > ==============================**==============================**======= > --- Source/WebCore/rendering/**EllipsisBox.h (revision 127625) > +++ Source/WebCore/rendering/**EllipsisBox.h (working copy) > @@ -32,9 +32,9 @@ > EllipsisBox(RenderObject* obj, const AtomicString& ellipsisStr, > InlineFlowBox* parent, > int width, int height, int y, bool firstLine, bool > isVertical, InlineBox* markupBox) > : InlineBox(obj, FloatPoint(0, y), width, firstLine, true, false, > false, isVertical, 0, 0, parent) > + , m_shouldPaintMarkupBox(**markupBox) > , m_height(height) > , m_str(ellipsisStr) > - , m_markupBox(markupBox) > , m_selectionState(RenderObject:**:SelectionNone) > { > } > @@ -45,13 +45,14 @@ > IntRect selectionRect(); > > private: > + void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, > LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle*); > virtual int height() const { return m_height; } > virtual RenderObject::SelectionState selectionState() { return > m_selectionState; } > void paintSelection(**GraphicsContext*, const LayoutPoint&, > RenderStyle*, const Font&); > > + bool m_shouldPaintMarkupBox; > int m_height; > AtomicString m_str; > - InlineBox* m_markupBox; > RenderObject::SelectionState m_selectionState; > }; > > Index: Source/WebCore/rendering/**RenderDeprecatedFlexibleBox.**cpp > ==============================**==============================**======= > --- Source/WebCore/rendering/**RenderDeprecatedFlexibleBox.**cpp > (revision 127625) > +++ Source/WebCore/rendering/**RenderDeprecatedFlexibleBox.**cpp > (working copy) > @@ -885,6 +885,7 @@ > if (**childDoesNotAffectWidthOrFlexi**ng(child)) > continue; > > + child->clearOverrideSize(); > if (relayoutChildren || (child->isReplaced() && > (child->style()->width().**isPercent() || child->style()->height().** > isPercent())) > || (child->style()->height().**isAuto() && > child->isBlockFlow())) { > child->setChildNeedsLayout(**true, MarkOnlyThis); > @@ -925,7 +926,6 @@ > m_flexingChildren = true; > child->layoutIfNeeded(); > m_flexingChildren = false; > - child->clearOverrideSize(); > > // FIXME: For now don't support RTL. > if (style()->direction() != LTR) > @@ -988,6 +988,7 @@ > if (**childDoesNotAffectWidthOrFlexi**ng(child)) > continue; > > + child->clearOverrideSize(); > if ((child->isReplaced() && (child->style()->width().**isPercent() > || child->style()->height().**isPercent())) > || (child->style()->height().**isAuto() && > child->isBlockFlow())) { > child->setChildNeedsLayout(**true); > > >