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

Side by Side Diff: Source/core/rendering/EllipsisBox.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed build on win and mac Created 7 years, 7 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 | Annotate | Revision Log
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 if (selectionState() != RenderObject::SelectionNone) { 50 if (selectionState() != RenderObject::SelectionNone) {
51 paintSelection(context, paintOffset, style, font); 51 paintSelection(context, paintOffset, style, font);
52 52
53 // Select the correct color for painting the text. 53 // Select the correct color for painting the text.
54 Color foreground = paintInfo.forceBlackText() ? Color::black : renderer( )->selectionForegroundColor(); 54 Color foreground = paintInfo.forceBlackText() ? Color::black : renderer( )->selectionForegroundColor();
55 if (foreground.isValid() && foreground != textColor) 55 if (foreground.isValid() && foreground != textColor)
56 context->setFillColor(foreground, style->colorSpace()); 56 context->setFillColor(foreground, style->colorSpace());
57 } 57 }
58 58
59 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w. 59 // FIXME: Why is this always LTR? Fix by passing correct text run flags belo w.
60 context->drawText(font, RenderBlock::constructTextRun(renderer(), font, m_st r, style, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y () + paintOffset.y() + style->fontMetrics().ascent())); 60 FloatPoint boxOrigin(paintOffset);
61 boxOrigin.move(x(), y());
62 FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + style->fontMetrics().as cent());
63 TextRun textRun = RenderBlock::constructTextRun(renderer(), font, m_str, sty le, TextRun::AllowTrailingExpansion);
64 TextRunPaintInfo textRunPaintInfo(textRun);
65 textRunPaintInfo.bounds = FloatRect(boxOrigin, FloatSize(logicalWidth(), log icalHeight()));
66 context->drawText(font, textRunPaintInfo, textOrigin);
61 67
62 // Restore the regular fill color. 68 // Restore the regular fill color.
63 if (textColor != context->fillColor()) 69 if (textColor != context->fillColor())
64 context->setFillColor(textColor, style->colorSpace()); 70 context->setFillColor(textColor, style->colorSpace());
65 71
66 if (setShadow) 72 if (setShadow)
67 context->clearShadow(); 73 context->clearShadow();
68 74
69 paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style); 75 paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
70 } 76 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) { 155 if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocatio n::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
150 renderer()->updateHitTestResult(result, locationInContainer.point() - to LayoutSize(adjustedLocation)); 156 renderer()->updateHitTestResult(result, locationInContainer.point() - to LayoutSize(adjustedLocation));
151 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, lo cationInContainer, boundsRect)) 157 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, lo cationInContainer, boundsRect))
152 return true; 158 return true;
153 } 159 }
154 160
155 return false; 161 return false;
156 } 162 }
157 163
158 } // namespace WebCore 164 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/skia/SkiaFontWin.cpp ('k') | Source/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698