OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/InlineTextBoxPainter.h" | 6 #include "core/paint/InlineTextBoxPainter.h" |
7 | 7 |
8 #include "core/dom/DocumentMarkerController.h" | 8 #include "core/dom/DocumentMarkerController.h" |
9 #include "core/dom/RenderedDocumentMarker.h" | 9 #include "core/dom/RenderedDocumentMarker.h" |
10 #include "core/editing/CompositionUnderline.h" | 10 #include "core/editing/CompositionUnderline.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| | 92 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| |
93 LayoutUnit widthOfVisibleText = m_inlineTextBox.renderer().width(m_i
nlineTextBox.start(), m_inlineTextBox.truncation(), m_inlineTextBox.textPos(), m
_inlineTextBox.isLeftToRightDirection() ? LTR : RTL, m_inlineTextBox.isFirstLine
Style()); | 93 LayoutUnit widthOfVisibleText = m_inlineTextBox.renderer().width(m_i
nlineTextBox.start(), m_inlineTextBox.truncation(), m_inlineTextBox.textPos(), m
_inlineTextBox.isLeftToRightDirection() ? LTR : RTL, m_inlineTextBox.isFirstLine
Style()); |
94 LayoutUnit widthOfHiddenText = m_inlineTextBox.logicalWidth() - widt
hOfVisibleText; | 94 LayoutUnit widthOfHiddenText = m_inlineTextBox.logicalWidth() - widt
hOfVisibleText; |
95 // FIXME: The hit testing logic also needs to take this translation
into account. | 95 // FIXME: The hit testing logic also needs to take this translation
into account. |
96 LayoutSize truncationOffset(m_inlineTextBox.isLeftToRightDirection()
? widthOfHiddenText : -widthOfHiddenText, 0); | 96 LayoutSize truncationOffset(m_inlineTextBox.isLeftToRightDirection()
? widthOfHiddenText : -widthOfHiddenText, 0); |
97 adjustedPaintOffset.move(m_inlineTextBox.isHorizontal() ? truncation
Offset : truncationOffset.transposedSize()); | 97 adjustedPaintOffset.move(m_inlineTextBox.isHorizontal() ? truncation
Offset : truncationOffset.transposedSize()); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 GraphicsContext* context = paintInfo.context; | 101 GraphicsContext* context = paintInfo.context; |
102 RenderStyle* styleToUse = m_inlineTextBox.renderer().style(m_inlineTextBox.i
sFirstLineStyle()); | 102 const RenderStyle* styleToUse = m_inlineTextBox.renderer().style(m_inlineTex
tBox.isFirstLineStyle()); |
103 | 103 |
104 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? LayoutUn
it() : -m_inlineTextBox.logicalHeight().toLayoutUnit()); | 104 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? LayoutUn
it() : -m_inlineTextBox.logicalHeight().toLayoutUnit()); |
105 | 105 |
106 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping().toFloatPo
int(); | 106 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping().toFloatPo
int(); |
107 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); | 107 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); |
108 FloatRect boxRect(boxOrigin, FloatSize(m_inlineTextBox.logicalWidth(), m_inl
ineTextBox.logicalHeight())); | 108 FloatRect boxRect(boxOrigin, FloatSize(m_inlineTextBox.logicalWidth(), m_inl
ineTextBox.logicalHeight())); |
109 | 109 |
110 RenderCombineText* combinedText = styleToUse->hasTextCombine() && m_inlineTe
xtBox.renderer().isCombineText() && toRenderCombineText(m_inlineTextBox.renderer
()).isCombined() ? &toRenderCombineText(m_inlineTextBox.renderer()) : 0; | 110 RenderCombineText* combinedText = styleToUse->hasTextCombine() && m_inlineTe
xtBox.renderer().isCombineText() && toRenderCombineText(m_inlineTextBox.renderer
()).isCombined() ? &toRenderCombineText(m_inlineTextBox.renderer()) : 0; |
111 | 111 |
112 bool shouldRotate = !m_inlineTextBox.isHorizontal() && !combinedText; | 112 bool shouldRotate = !m_inlineTextBox.isHorizontal() && !combinedText; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 | 252 |
253 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und
erline) | 253 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und
erline) |
254 { | 254 { |
255 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset)
; // end() points at the last char, not past it. | 255 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset)
; // end() points at the last char, not past it. |
256 if (m_inlineTextBox.truncation() != cNoTruncation) | 256 if (m_inlineTextBox.truncation() != cNoTruncation) |
257 paintEnd = std::min(paintEnd, static_cast<unsigned>(m_inlineTextBox.star
t() + m_inlineTextBox.truncation())); | 257 paintEnd = std::min(paintEnd, static_cast<unsigned>(m_inlineTextBox.star
t() + m_inlineTextBox.truncation())); |
258 return paintEnd; | 258 return paintEnd; |
259 } | 259 } |
260 | 260 |
261 void InlineTextBoxPainter::paintCompositionBackgrounds(GraphicsContext* pt, cons
t FloatPoint& boxOrigin, RenderStyle* style, const Font& font, bool useCustomUnd
erlines) | 261 void InlineTextBoxPainter::paintCompositionBackgrounds(GraphicsContext* pt, cons
t FloatPoint& boxOrigin, const RenderStyle* style, const Font& font, bool useCus
tomUnderlines) |
262 { | 262 { |
263 if (useCustomUnderlines) { | 263 if (useCustomUnderlines) { |
264 // Paint custom background highlights for compositions. | 264 // Paint custom background highlights for compositions. |
265 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.rendere
r().frame()->inputMethodController().customCompositionUnderlines(); | 265 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.rendere
r().frame()->inputMethodController().customCompositionUnderlines(); |
266 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.start
(), m_inlineTextBox.end()); | 266 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.start
(), m_inlineTextBox.end()); |
267 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begin();
it != filter.end(); ++it) { | 267 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begin();
it != filter.end(); ++it) { |
268 if (it->backgroundColor == Color::transparent) | 268 if (it->backgroundColor == Color::transparent) |
269 continue; | 269 continue; |
270 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, it->
backgroundColor, underlinePaintStart(*it), underlinePaintEnd(*it)); | 270 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, it->
backgroundColor, underlinePaintStart(*it), underlinePaintEnd(*it)); |
271 } | 271 } |
272 | 272 |
273 } else { | 273 } else { |
274 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, LayoutTh
eme::theme().platformDefaultCompositionBackgroundColor(), | 274 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, LayoutTh
eme::theme().platformDefaultCompositionBackgroundColor(), |
275 m_inlineTextBox.renderer().frame()->inputMethodController().composit
ionStart(), | 275 m_inlineTextBox.renderer().frame()->inputMethodController().composit
ionStart(), |
276 m_inlineTextBox.renderer().frame()->inputMethodController().composit
ionEnd()); | 276 m_inlineTextBox.renderer().frame()->inputMethodController().composit
ionEnd()); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext*
context, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, Colo
r backgroundColor, int startPos, int endPos) | 280 void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext*
context, const FloatPoint& boxOrigin, const RenderStyle* style, const Font& font
, Color backgroundColor, int startPos, int endPos) |
281 { | 281 { |
282 int sPos = std::max(startPos - static_cast<int>(m_inlineTextBox.start()), 0)
; | 282 int sPos = std::max(startPos - static_cast<int>(m_inlineTextBox.start()), 0)
; |
283 int ePos = std::min(endPos - static_cast<int>(m_inlineTextBox.start()), stat
ic_cast<int>(m_inlineTextBox.len())); | 283 int ePos = std::min(endPos - static_cast<int>(m_inlineTextBox.start()), stat
ic_cast<int>(m_inlineTextBox.len())); |
284 if (sPos >= ePos) | 284 if (sPos >= ePos) |
285 return; | 285 return; |
286 | 286 |
287 int deltaY = m_inlineTextBox.renderer().style()->isFlippedLinesWritingMode()
? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom() :
m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); | 287 int deltaY = m_inlineTextBox.renderer().style()->isFlippedLinesWritingMode()
? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom() :
m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); |
288 int selHeight = m_inlineTextBox.root().selectionHeight(); | 288 int selHeight = m_inlineTextBox.root().selectionHeight(); |
289 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); | 289 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); |
290 context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style,
font), localOrigin, selHeight, backgroundColor, sPos, ePos); | 290 context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style,
font), localOrigin, selHeight, backgroundColor, sPos, ePos); |
291 } | 291 } |
292 | 292 |
293 void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const Float
Point& boxOrigin, RenderStyle* style, const Font& font, bool background) | 293 void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const Float
Point& boxOrigin, const RenderStyle* style, const Font& font, bool background) |
294 { | 294 { |
295 if (!m_inlineTextBox.renderer().node()) | 295 if (!m_inlineTextBox.renderer().node()) |
296 return; | 296 return; |
297 | 297 |
298 DocumentMarkerVector markers = m_inlineTextBox.renderer().document().markers
().markersFor(m_inlineTextBox.renderer().node()); | 298 DocumentMarkerVector markers = m_inlineTextBox.renderer().document().markers
().markersFor(m_inlineTextBox.renderer().node()); |
299 DocumentMarkerVector::const_iterator markerIt = markers.begin(); | 299 DocumentMarkerVector::const_iterator markerIt = markers.begin(); |
300 | 300 |
301 // Give any document markers that touch this run a chance to draw before the
text has been drawn. | 301 // Give any document markers that touch this run a chance to draw before the
text has been drawn. |
302 // Note end() points at the last char, not one past it like endOffset and ra
nges do. | 302 // Note end() points at the last char, not one past it like endOffset and ra
nges do. |
303 for ( ; markerIt != markers.end(); ++markerIt) { | 303 for ( ; markerIt != markers.end(); ++markerIt) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 case DocumentMarker::Spelling: | 351 case DocumentMarker::Spelling: |
352 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 352 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
353 case DocumentMarker::Grammar: | 353 case DocumentMarker::Grammar: |
354 return GraphicsContext::DocumentMarkerGrammarLineStyle; | 354 return GraphicsContext::DocumentMarkerGrammarLineStyle; |
355 default: | 355 default: |
356 ASSERT_NOT_REACHED(); | 356 ASSERT_NOT_REACHED(); |
357 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 357 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 void InlineTextBoxPainter::paintDocumentMarker(GraphicsContext* pt, const FloatP
oint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font, b
ool grammar) | 361 void InlineTextBoxPainter::paintDocumentMarker(GraphicsContext* pt, const FloatP
oint& boxOrigin, DocumentMarker* marker, const RenderStyle* style, const Font& f
ont, bool grammar) |
362 { | 362 { |
363 // Never print spelling/grammar markers (5327887) | 363 // Never print spelling/grammar markers (5327887) |
364 if (m_inlineTextBox.renderer().document().printing()) | 364 if (m_inlineTextBox.renderer().document().printing()) |
365 return; | 365 return; |
366 | 366 |
367 if (m_inlineTextBox.truncation() == cFullTruncation) | 367 if (m_inlineTextBox.truncation() == cFullTruncation) |
368 return; | 368 return; |
369 | 369 |
370 float start = 0; // start of line to draw, relative to tx | 370 float start = 0; // start of line to draw, relative to tx |
371 float width = m_inlineTextBox.logicalWidth(); // how much line to draw | 371 float width = m_inlineTextBox.logicalWidth(); // how much line to draw |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (descent <= (2 + lineThickness)) { | 419 if (descent <= (2 + lineThickness)) { |
420 // Place the underline at the very bottom of the text in small/medium fo
nts. | 420 // Place the underline at the very bottom of the text in small/medium fo
nts. |
421 underlineOffset = m_inlineTextBox.logicalHeight() - lineThickness; | 421 underlineOffset = m_inlineTextBox.logicalHeight() - lineThickness; |
422 } else { | 422 } else { |
423 // In larger fonts, though, place the underline up near the baseline to
prevent a big gap. | 423 // In larger fonts, though, place the underline up near the baseline to
prevent a big gap. |
424 underlineOffset = baseline + 2; | 424 underlineOffset = baseline + 2; |
425 } | 425 } |
426 pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y(
) + underlineOffset), width, lineStyleForMarkerType(marker->type())); | 426 pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y(
) + underlineOffset), width, lineStyleForMarkerType(marker->type())); |
427 } | 427 } |
428 | 428 |
429 void InlineTextBoxPainter::paintSelection(GraphicsContext* context, const FloatP
oint& boxOrigin, RenderStyle* style, const Font& font, Color textColor) | 429 void InlineTextBoxPainter::paintSelection(GraphicsContext* context, const FloatP
oint& boxOrigin, const RenderStyle* style, const Font& font, Color textColor) |
430 { | 430 { |
431 // See if we have a selection to paint at all. | 431 // See if we have a selection to paint at all. |
432 int sPos, ePos; | 432 int sPos, ePos; |
433 m_inlineTextBox.selectionStartEnd(sPos, ePos); | 433 m_inlineTextBox.selectionStartEnd(sPos, ePos); |
434 if (sPos >= ePos) | 434 if (sPos >= ePos) |
435 return; | 435 return; |
436 | 436 |
437 Color c = m_inlineTextBox.renderer().selectionBackgroundColor(); | 437 Color c = m_inlineTextBox.renderer().selectionBackgroundColor(); |
438 if (!c.alpha()) | 438 if (!c.alpha()) |
439 return; | 439 return; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 701 |
702 // Get the text decoration colors. | 702 // Get the text decoration colors. |
703 RenderObject::AppliedTextDecoration underline, overline, linethrough; | 703 RenderObject::AppliedTextDecoration underline, overline, linethrough; |
704 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline, lin
ethrough, true); | 704 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline, lin
ethrough, true); |
705 if (m_inlineTextBox.isFirstLineStyle()) | 705 if (m_inlineTextBox.isFirstLineStyle()) |
706 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline,
linethrough, true, true); | 706 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline,
linethrough, true, true); |
707 | 707 |
708 // Use a special function for underlines to get the positioning exactly righ
t. | 708 // Use a special function for underlines to get the positioning exactly righ
t. |
709 bool isPrinting = m_inlineTextBox.renderer().document().printing(); | 709 bool isPrinting = m_inlineTextBox.renderer().document().printing(); |
710 | 710 |
711 RenderStyle* styleToUse = m_inlineTextBox.renderer().style(m_inlineTextBox.i
sFirstLineStyle()); | 711 const RenderStyle* styleToUse = m_inlineTextBox.renderer().style(m_inlineTex
tBox.isFirstLineStyle()); |
712 int baseline = styleToUse->fontMetrics().ascent(); | 712 int baseline = styleToUse->fontMetrics().ascent(); |
713 | 713 |
714 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. | 714 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. |
715 // Using computedFontSize should take care of zoom as well. | 715 // Using computedFontSize should take care of zoom as well. |
716 | 716 |
717 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. | 717 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. |
718 float textDecorationThickness = styleToUse->fontMetrics().underlineThickness
(); | 718 float textDecorationThickness = styleToUse->fontMetrics().underlineThickness
(); |
719 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5); | 719 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5); |
720 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fontHei
ghtInt >> 1))) | 720 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fontHei
ghtInt >> 1))) |
721 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize() /
10.f); | 721 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize() /
10.f); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 // We need to have some space between underlines of subsequent clauses, beca
use some input methods do not use different underline styles for those. | 767 // We need to have some space between underlines of subsequent clauses, beca
use some input methods do not use different underline styles for those. |
768 // We make each line shorter, which has a harmless side effect of shortening
the first and last clauses, too. | 768 // We make each line shorter, which has a harmless side effect of shortening
the first and last clauses, too. |
769 start += 1; | 769 start += 1; |
770 width -= 2; | 770 width -= 2; |
771 | 771 |
772 ctx->setStrokeColor(underline.color); | 772 ctx->setStrokeColor(underline.color); |
773 ctx->setStrokeThickness(lineThickness); | 773 ctx->setStrokeThickness(lineThickness); |
774 ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + m_inl
ineTextBox.logicalHeight() - lineThickness), width, m_inlineTextBox.renderer().d
ocument().printing()); | 774 ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + m_inl
ineTextBox.logicalHeight() - lineThickness), width, m_inlineTextBox.renderer().d
ocument().printing()); |
775 } | 775 } |
776 | 776 |
777 void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const Float
Point& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font) | 777 void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const Float
Point& boxOrigin, DocumentMarker* marker, const RenderStyle* style, const Font&
font) |
778 { | 778 { |
779 // Use same y positioning and height as for selection, so that when the sele
ction and this highlight are on | 779 // Use same y positioning and height as for selection, so that when the sele
ction and this highlight are on |
780 // the same word there are no pieces sticking out. | 780 // the same word there are no pieces sticking out. |
781 int deltaY = m_inlineTextBox.renderer().style()->isFlippedLinesWritingMode()
? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom() :
m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); | 781 int deltaY = m_inlineTextBox.renderer().style()->isFlippedLinesWritingMode()
? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom() :
m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); |
782 int selHeight = m_inlineTextBox.root().selectionHeight(); | 782 int selHeight = m_inlineTextBox.root().selectionHeight(); |
783 | 783 |
784 int sPos = std::max(marker->startOffset() - m_inlineTextBox.start(), (unsign
ed)0); | 784 int sPos = std::max(marker->startOffset() - m_inlineTextBox.start(), (unsign
ed)0); |
785 int ePos = std::min(marker->endOffset() - m_inlineTextBox.start(), m_inlineT
extBox.len()); | 785 int ePos = std::min(marker->endOffset() - m_inlineTextBox.start(), m_inlineT
extBox.len()); |
786 TextRun run = m_inlineTextBox.constructTextRun(style, font); | 786 TextRun run = m_inlineTextBox.constructTextRun(style, font); |
787 | 787 |
788 // Always compute and store the rect associated with this marker. The comput
ed rect is in absolute coordinates. | 788 // Always compute and store the rect associated with this marker. The comput
ed rect is in absolute coordinates. |
789 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoin
t(m_inlineTextBox.x(), m_inlineTextBox.root().selectionTop()), selHeight, sPos,
ePos)); | 789 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoin
t(m_inlineTextBox.x(), m_inlineTextBox.root().selectionTop()), selHeight, sPos,
ePos)); |
790 markerRect = m_inlineTextBox.renderer().localToAbsoluteQuad(FloatRect(marker
Rect)).enclosingBoundingBox(); | 790 markerRect = m_inlineTextBox.renderer().localToAbsoluteQuad(FloatRect(marker
Rect)).enclosingBoundingBox(); |
791 toRenderedDocumentMarker(marker)->setRenderedRect(markerRect); | 791 toRenderedDocumentMarker(marker)->setRenderedRect(markerRect); |
792 | 792 |
793 // Optionally highlight the text | 793 // Optionally highlight the text |
794 if (m_inlineTextBox.renderer().frame()->editor().markedTextMatchesAreHighlig
hted()) { | 794 if (m_inlineTextBox.renderer().frame()->editor().markedTextMatchesAreHighlig
hted()) { |
795 Color color = marker->activeMatch() ? | 795 Color color = marker->activeMatch() ? |
796 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : | 796 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : |
797 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); | 797 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); |
798 GraphicsContextStateSaver stateSaver(*pt); | 798 GraphicsContextStateSaver stateSaver(*pt); |
799 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); | 799 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); |
800 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); | 800 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); |
801 } | 801 } |
802 } | 802 } |
803 | 803 |
804 | 804 |
805 } // namespace blink | 805 } // namespace blink |
OLD | NEW |