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

Unified Diff: Source/WebCore/rendering/EllipsisBox.cpp

Issue 10915102: Merge 125635 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/rendering/EllipsisBox.h ('k') | Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « Source/WebCore/rendering/EllipsisBox.h ('k') | Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698