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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w. 58 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w.
59 context->drawText(font, RenderBlock::constructTextRun(renderer(), font, m_st r, style, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y () + paintOffset.y() + style->fontMetrics().ascent())); 59 context->drawText(font, RenderBlock::constructTextRun(renderer(), font, m_st r, style, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y () + paintOffset.y() + style->fontMetrics().ascent()));
60 60
61 // Restore the regular fill color. 61 // Restore the regular fill color.
62 if (textColor != context->fillColor()) 62 if (textColor != context->fillColor())
63 context->setFillColor(textColor, style->colorSpace()); 63 context->setFillColor(textColor, style->colorSpace());
64 64
65 if (setShadow) 65 if (setShadow)
66 context->clearShadow(); 66 context->clearShadow();
67 67
68 if (m_markupBox) { 68 paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
69 // Paint the markup box 69 }
70 LayoutPoint adjustedPaintOffset = paintOffset; 70
71 adjustedPaintOffset.move(x() + m_logicalWidth - m_markupBox->x(), 71 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintO ffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style)
72 y() + style->fontMetrics().ascent() - (m_markupBox->y() + m_markupBo x->renderer()->style(isFirstLineStyle())->fontMetrics().ascent())); 72 {
73 m_markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); 73 if (!m_shouldPaintMarkupBox || !m_renderer->isRenderBlock())
74 } 74 return;
75
76 RenderBlock* block = toRenderBlock(m_renderer);
77 RootInlineBox* lastLine = block->lineAtIndex(block->lineCount() - 1);
78 if (!lastLine)
79 return;
80
81 // If the last line-box on the last line of a block is a link, -webkit-line- clamp paints that box after the ellipsis.
82 // It does not actually move the link.
83 InlineBox* anchorBox = lastLine->lastChild();
84 if (!anchorBox || !anchorBox->renderer()->style()->isLink())
85 return;
86
87 LayoutPoint adjustedPaintOffset = paintOffset;
88 adjustedPaintOffset.move(x() + m_logicalWidth - anchorBox->x(),
89 y() + style->fontMetrics().ascent() - (anchorBox->y() + anchorBox->rende rer()->style(isFirstLineStyle())->fontMetrics().ascent()));
90 anchorBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom);
75 } 91 }
76 92
77 IntRect EllipsisBox::selectionRect() 93 IntRect EllipsisBox::selectionRect()
78 { 94 {
79 RenderStyle* style = m_renderer->style(isFirstLineStyle()); 95 RenderStyle* style = m_renderer->style(isFirstLineStyle());
80 const Font& font = style->font(); 96 const Font& font = style->font();
81 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w. 97 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w.
82 return enclosingIntRect(font.selectionRectForText(RenderBlock::constructText Run(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(x (), y() + root()->selectionTopAdjustedForPrecedingBlock()), root()->selectionHei ghtAdjustedForPrecedingBlock())); 98 return enclosingIntRect(font.selectionRectForText(RenderBlock::constructText Run(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), IntPoint(x (), y() + root()->selectionTopAdjustedForPrecedingBlock()), root()->selectionHei ghtAdjustedForPrecedingBlock()));
83 } 99 }
84 100
(...skipping 18 matching lines...) Expand all
103 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w. 119 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w.
104 context->drawHighlightForText(font, RenderBlock::constructTextRun(renderer() , font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPo int(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style->colorSpac e()); 120 context->drawHighlightForText(font, RenderBlock::constructTextRun(renderer() , font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPo int(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style->colorSpac e());
105 } 121 }
106 122
107 bool EllipsisBox::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTe stPoint&, const LayoutPoint&, LayoutUnit, LayoutUnit) 123 bool EllipsisBox::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTe stPoint&, const LayoutPoint&, LayoutUnit, LayoutUnit)
108 { 124 {
109 return false; 125 return false;
110 } 126 }
111 127
112 } // namespace WebCore 128 } // namespace WebCore
OLDNEW
« 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