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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| | 94 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| |
95 LayoutUnit widthOfVisibleText = m_inlineTextBox.layoutObject().width
(m_inlineTextBox.start(), m_inlineTextBox.truncation(), m_inlineTextBox.textPos(
), m_inlineTextBox.isLeftToRightDirection() ? LTR : RTL, m_inlineTextBox.isFirst
LineStyle()); | 95 LayoutUnit widthOfVisibleText = m_inlineTextBox.layoutObject().width
(m_inlineTextBox.start(), m_inlineTextBox.truncation(), m_inlineTextBox.textPos(
), m_inlineTextBox.isLeftToRightDirection() ? LTR : RTL, m_inlineTextBox.isFirst
LineStyle()); |
96 LayoutUnit widthOfHiddenText = m_inlineTextBox.logicalWidth() - widt
hOfVisibleText; | 96 LayoutUnit widthOfHiddenText = m_inlineTextBox.logicalWidth() - widt
hOfVisibleText; |
97 // FIXME: The hit testing logic also needs to take this translation
into account. | 97 // FIXME: The hit testing logic also needs to take this translation
into account. |
98 LayoutSize truncationOffset(m_inlineTextBox.isLeftToRightDirection()
? widthOfHiddenText : -widthOfHiddenText, 0); | 98 LayoutSize truncationOffset(m_inlineTextBox.isLeftToRightDirection()
? widthOfHiddenText : -widthOfHiddenText, 0); |
99 adjustedPaintOffset.move(m_inlineTextBox.isHorizontal() ? truncation
Offset : truncationOffset.transposedSize()); | 99 adjustedPaintOffset.move(m_inlineTextBox.isHorizontal() ? truncation
Offset : truncationOffset.transposedSize()); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 GraphicsContext* context = paintInfo.context; | 103 GraphicsContext* context = paintInfo.context; |
104 const LayoutStyle& styleToUse = m_inlineTextBox.layoutObject().styleRef(m_in
lineTextBox.isFirstLineStyle()); | 104 const ComputedStyle& styleToUse = m_inlineTextBox.layoutObject().styleRef(m_
inlineTextBox.isFirstLineStyle()); |
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 bool shouldRotate = false; | 110 bool shouldRotate = false; |
111 LayoutTextCombine* combinedText = nullptr; | 111 LayoutTextCombine* combinedText = nullptr; |
112 if (!m_inlineTextBox.isHorizontal()) { | 112 if (!m_inlineTextBox.isHorizontal()) { |
113 if (styleToUse.hasTextCombine() && m_inlineTextBox.layoutObject().isComb
ineText()) { | 113 if (styleToUse.hasTextCombine() && m_inlineTextBox.layoutObject().isComb
ineText()) { |
114 combinedText = &toLayoutTextCombine(m_inlineTextBox.layoutObject()); | 114 combinedText = &toLayoutTextCombine(m_inlineTextBox.layoutObject()); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 | 258 |
259 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und
erline) | 259 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und
erline) |
260 { | 260 { |
261 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset)
; // end() points at the last char, not past it. | 261 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset)
; // end() points at the last char, not past it. |
262 if (m_inlineTextBox.truncation() != cNoTruncation) | 262 if (m_inlineTextBox.truncation() != cNoTruncation) |
263 paintEnd = std::min(paintEnd, static_cast<unsigned>(m_inlineTextBox.star
t() + m_inlineTextBox.truncation())); | 263 paintEnd = std::min(paintEnd, static_cast<unsigned>(m_inlineTextBox.star
t() + m_inlineTextBox.truncation())); |
264 return paintEnd; | 264 return paintEnd; |
265 } | 265 } |
266 | 266 |
267 void InlineTextBoxPainter::paintCompositionBackgrounds(GraphicsContext* pt, cons
t FloatPoint& boxOrigin, const LayoutStyle& style, const Font& font, bool useCus
tomUnderlines) | 267 void InlineTextBoxPainter::paintCompositionBackgrounds(GraphicsContext* pt, cons
t FloatPoint& boxOrigin, const ComputedStyle& style, const Font& font, bool useC
ustomUnderlines) |
268 { | 268 { |
269 if (useCustomUnderlines) { | 269 if (useCustomUnderlines) { |
270 // Paint custom background highlights for compositions. | 270 // Paint custom background highlights for compositions. |
271 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.layoutO
bject().frame()->inputMethodController().customCompositionUnderlines(); | 271 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.layoutO
bject().frame()->inputMethodController().customCompositionUnderlines(); |
272 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.start
(), m_inlineTextBox.end()); | 272 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.start
(), m_inlineTextBox.end()); |
273 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begin();
it != filter.end(); ++it) { | 273 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begin();
it != filter.end(); ++it) { |
274 if (it->backgroundColor == Color::transparent) | 274 if (it->backgroundColor == Color::transparent) |
275 continue; | 275 continue; |
276 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, it->
backgroundColor, underlinePaintStart(*it), underlinePaintEnd(*it)); | 276 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, it->
backgroundColor, underlinePaintStart(*it), underlinePaintEnd(*it)); |
277 } | 277 } |
278 | 278 |
279 } else { | 279 } else { |
280 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, LayoutTh
eme::theme().platformDefaultCompositionBackgroundColor(), | 280 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, LayoutTh
eme::theme().platformDefaultCompositionBackgroundColor(), |
281 m_inlineTextBox.layoutObject().frame()->inputMethodController().comp
ositionStart(), | 281 m_inlineTextBox.layoutObject().frame()->inputMethodController().comp
ositionStart(), |
282 m_inlineTextBox.layoutObject().frame()->inputMethodController().comp
ositionEnd()); | 282 m_inlineTextBox.layoutObject().frame()->inputMethodController().comp
ositionEnd()); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext*
context, const FloatPoint& boxOrigin, const LayoutStyle& style, const Font& font
, Color backgroundColor, int startPos, int endPos) | 286 void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext*
context, const FloatPoint& boxOrigin, const ComputedStyle& style, const Font& fo
nt, Color backgroundColor, int startPos, int endPos) |
287 { | 287 { |
288 int sPos = std::max(startPos - static_cast<int>(m_inlineTextBox.start()), 0)
; | 288 int sPos = std::max(startPos - static_cast<int>(m_inlineTextBox.start()), 0)
; |
289 int ePos = std::min(endPos - static_cast<int>(m_inlineTextBox.start()), stat
ic_cast<int>(m_inlineTextBox.len())); | 289 int ePos = std::min(endPos - static_cast<int>(m_inlineTextBox.start()), stat
ic_cast<int>(m_inlineTextBox.len())); |
290 if (sPos >= ePos) | 290 if (sPos >= ePos) |
291 return; | 291 return; |
292 | 292 |
293 int deltaY = m_inlineTextBox.layoutObject().style()->isFlippedLinesWritingMo
de() ? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom(
) : m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); | 293 int deltaY = m_inlineTextBox.layoutObject().style()->isFlippedLinesWritingMo
de() ? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom(
) : m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); |
294 int selHeight = m_inlineTextBox.root().selectionHeight(); | 294 int selHeight = m_inlineTextBox.root().selectionHeight(); |
295 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); | 295 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); |
296 context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style,
font), localOrigin, selHeight, backgroundColor, sPos, ePos); | 296 context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style,
font), localOrigin, selHeight, backgroundColor, sPos, ePos); |
297 } | 297 } |
298 | 298 |
299 void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const Float
Point& boxOrigin, const LayoutStyle& style, const Font& font, bool background) | 299 void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const Float
Point& boxOrigin, const ComputedStyle& style, const Font& font, bool background) |
300 { | 300 { |
301 if (!m_inlineTextBox.layoutObject().node()) | 301 if (!m_inlineTextBox.layoutObject().node()) |
302 return; | 302 return; |
303 | 303 |
304 DocumentMarkerVector markers = m_inlineTextBox.layoutObject().document().mar
kers().markersFor(m_inlineTextBox.layoutObject().node()); | 304 DocumentMarkerVector markers = m_inlineTextBox.layoutObject().document().mar
kers().markersFor(m_inlineTextBox.layoutObject().node()); |
305 DocumentMarkerVector::const_iterator markerIt = markers.begin(); | 305 DocumentMarkerVector::const_iterator markerIt = markers.begin(); |
306 | 306 |
307 // Give any document markers that touch this run a chance to draw before the
text has been drawn. | 307 // Give any document markers that touch this run a chance to draw before the
text has been drawn. |
308 // Note end() points at the last char, not one past it like endOffset and ra
nges do. | 308 // Note end() points at the last char, not one past it like endOffset and ra
nges do. |
309 for ( ; markerIt != markers.end(); ++markerIt) { | 309 for ( ; markerIt != markers.end(); ++markerIt) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 case DocumentMarker::Spelling: | 357 case DocumentMarker::Spelling: |
358 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 358 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
359 case DocumentMarker::Grammar: | 359 case DocumentMarker::Grammar: |
360 return GraphicsContext::DocumentMarkerGrammarLineStyle; | 360 return GraphicsContext::DocumentMarkerGrammarLineStyle; |
361 default: | 361 default: |
362 ASSERT_NOT_REACHED(); | 362 ASSERT_NOT_REACHED(); |
363 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 363 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 void InlineTextBoxPainter::paintDocumentMarker(GraphicsContext* pt, const FloatP
oint& boxOrigin, DocumentMarker* marker, const LayoutStyle& style, const Font& f
ont, bool grammar) | 367 void InlineTextBoxPainter::paintDocumentMarker(GraphicsContext* pt, const FloatP
oint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font&
font, bool grammar) |
368 { | 368 { |
369 // Never print spelling/grammar markers (5327887) | 369 // Never print spelling/grammar markers (5327887) |
370 if (m_inlineTextBox.layoutObject().document().printing()) | 370 if (m_inlineTextBox.layoutObject().document().printing()) |
371 return; | 371 return; |
372 | 372 |
373 if (m_inlineTextBox.truncation() == cFullTruncation) | 373 if (m_inlineTextBox.truncation() == cFullTruncation) |
374 return; | 374 return; |
375 | 375 |
376 float start = 0; // start of line to draw, relative to tx | 376 float start = 0; // start of line to draw, relative to tx |
377 float width = m_inlineTextBox.logicalWidth(); // how much line to draw | 377 float width = m_inlineTextBox.logicalWidth(); // how much line to draw |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // Place the underline at the very bottom of the text in small/medium fo
nts. | 426 // Place the underline at the very bottom of the text in small/medium fo
nts. |
427 underlineOffset = m_inlineTextBox.logicalHeight() - lineThickness; | 427 underlineOffset = m_inlineTextBox.logicalHeight() - lineThickness; |
428 } else { | 428 } else { |
429 // In larger fonts, though, place the underline up near the baseline to
prevent a big gap. | 429 // In larger fonts, though, place the underline up near the baseline to
prevent a big gap. |
430 underlineOffset = baseline + 2; | 430 underlineOffset = baseline + 2; |
431 } | 431 } |
432 pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y(
) + underlineOffset), width, lineStyleForMarkerType(marker->type())); | 432 pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y(
) + underlineOffset), width, lineStyleForMarkerType(marker->type())); |
433 } | 433 } |
434 | 434 |
435 template <InlineTextBoxPainter::PaintOptions options> | 435 template <InlineTextBoxPainter::PaintOptions options> |
436 void InlineTextBoxPainter::paintSelection(GraphicsContext* context, const FloatR
ect& boxRect, const LayoutStyle& style, const Font& font, Color textColor, Layou
tTextCombine* combinedText) | 436 void InlineTextBoxPainter::paintSelection(GraphicsContext* context, const FloatR
ect& boxRect, const ComputedStyle& style, const Font& font, Color textColor, Lay
outTextCombine* combinedText) |
437 { | 437 { |
438 // See if we have a selection to paint at all. | 438 // See if we have a selection to paint at all. |
439 int sPos, ePos; | 439 int sPos, ePos; |
440 m_inlineTextBox.selectionStartEnd(sPos, ePos); | 440 m_inlineTextBox.selectionStartEnd(sPos, ePos); |
441 if (sPos >= ePos) | 441 if (sPos >= ePos) |
442 return; | 442 return; |
443 | 443 |
444 Color c = m_inlineTextBox.layoutObject().selectionBackgroundColor(); | 444 Color c = m_inlineTextBox.layoutObject().selectionBackgroundColor(); |
445 if (!c.alpha()) | 445 if (!c.alpha()) |
446 return; | 446 return; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 | 720 |
721 // Get the text decoration colors. | 721 // Get the text decoration colors. |
722 LayoutObject::AppliedTextDecoration underline, overline, linethrough; | 722 LayoutObject::AppliedTextDecoration underline, overline, linethrough; |
723 m_inlineTextBox.layoutObject().getTextDecorations(deco, underline, overline,
linethrough, true); | 723 m_inlineTextBox.layoutObject().getTextDecorations(deco, underline, overline,
linethrough, true); |
724 if (m_inlineTextBox.isFirstLineStyle()) | 724 if (m_inlineTextBox.isFirstLineStyle()) |
725 m_inlineTextBox.layoutObject().getTextDecorations(deco, underline, overl
ine, linethrough, true, true); | 725 m_inlineTextBox.layoutObject().getTextDecorations(deco, underline, overl
ine, linethrough, true, true); |
726 | 726 |
727 // Use a special function for underlines to get the positioning exactly righ
t. | 727 // Use a special function for underlines to get the positioning exactly righ
t. |
728 bool isPrinting = m_inlineTextBox.layoutObject().document().printing(); | 728 bool isPrinting = m_inlineTextBox.layoutObject().document().printing(); |
729 | 729 |
730 const LayoutStyle& styleToUse = m_inlineTextBox.layoutObject().styleRef(m_in
lineTextBox.isFirstLineStyle()); | 730 const ComputedStyle& styleToUse = m_inlineTextBox.layoutObject().styleRef(m_
inlineTextBox.isFirstLineStyle()); |
731 int baseline = styleToUse.fontMetrics().ascent(); | 731 int baseline = styleToUse.fontMetrics().ascent(); |
732 | 732 |
733 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. | 733 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. |
734 // Using computedFontSize should take care of zoom as well. | 734 // Using computedFontSize should take care of zoom as well. |
735 | 735 |
736 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. | 736 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. |
737 float textDecorationThickness = styleToUse.fontMetrics().underlineThickness(
); | 737 float textDecorationThickness = styleToUse.fontMetrics().underlineThickness(
); |
738 int fontHeightInt = (int)(styleToUse.fontMetrics().floatHeight() + 0.5); | 738 int fontHeightInt = (int)(styleToUse.fontMetrics().floatHeight() + 0.5); |
739 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fontHei
ghtInt >> 1))) | 739 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fontHei
ghtInt >> 1))) |
740 textDecorationThickness = std::max(1.f, styleToUse.computedFontSize() /
10.f); | 740 textDecorationThickness = std::max(1.f, styleToUse.computedFontSize() /
10.f); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 // We need to have some space between underlines of subsequent clauses, beca
use some input methods do not use different underline styles for those. | 786 // We need to have some space between underlines of subsequent clauses, beca
use some input methods do not use different underline styles for those. |
787 // We make each line shorter, which has a harmless side effect of shortening
the first and last clauses, too. | 787 // We make each line shorter, which has a harmless side effect of shortening
the first and last clauses, too. |
788 start += 1; | 788 start += 1; |
789 width -= 2; | 789 width -= 2; |
790 | 790 |
791 ctx->setStrokeColor(underline.color); | 791 ctx->setStrokeColor(underline.color); |
792 ctx->setStrokeThickness(lineThickness); | 792 ctx->setStrokeThickness(lineThickness); |
793 ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + m_inl
ineTextBox.logicalHeight() - lineThickness), width, m_inlineTextBox.layoutObject
().document().printing()); | 793 ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + m_inl
ineTextBox.logicalHeight() - lineThickness), width, m_inlineTextBox.layoutObject
().document().printing()); |
794 } | 794 } |
795 | 795 |
796 void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const Float
Point& boxOrigin, DocumentMarker* marker, const LayoutStyle& style, const Font&
font) | 796 void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const Float
Point& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font
& font) |
797 { | 797 { |
798 // Use same y positioning and height as for selection, so that when the sele
ction and this highlight are on | 798 // Use same y positioning and height as for selection, so that when the sele
ction and this highlight are on |
799 // the same word there are no pieces sticking out. | 799 // the same word there are no pieces sticking out. |
800 int deltaY = m_inlineTextBox.layoutObject().style()->isFlippedLinesWritingMo
de() ? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom(
) : m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); | 800 int deltaY = m_inlineTextBox.layoutObject().style()->isFlippedLinesWritingMo
de() ? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom(
) : m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); |
801 int selHeight = m_inlineTextBox.root().selectionHeight(); | 801 int selHeight = m_inlineTextBox.root().selectionHeight(); |
802 | 802 |
803 int sPos = std::max(marker->startOffset() - m_inlineTextBox.start(), (unsign
ed)0); | 803 int sPos = std::max(marker->startOffset() - m_inlineTextBox.start(), (unsign
ed)0); |
804 int ePos = std::min(marker->endOffset() - m_inlineTextBox.start(), m_inlineT
extBox.len()); | 804 int ePos = std::min(marker->endOffset() - m_inlineTextBox.start(), m_inlineT
extBox.len()); |
805 TextRun run = m_inlineTextBox.constructTextRun(style, font); | 805 TextRun run = m_inlineTextBox.constructTextRun(style, font); |
806 | 806 |
807 // Always compute and store the rect associated with this marker. The comput
ed rect is in absolute coordinates. | 807 // Always compute and store the rect associated with this marker. The comput
ed rect is in absolute coordinates. |
808 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoin
t(m_inlineTextBox.x(), m_inlineTextBox.root().selectionTop()), selHeight, sPos,
ePos)); | 808 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoin
t(m_inlineTextBox.x(), m_inlineTextBox.root().selectionTop()), selHeight, sPos,
ePos)); |
809 markerRect = m_inlineTextBox.layoutObject().localToAbsoluteQuad(FloatRect(ma
rkerRect)).enclosingBoundingBox(); | 809 markerRect = m_inlineTextBox.layoutObject().localToAbsoluteQuad(FloatRect(ma
rkerRect)).enclosingBoundingBox(); |
810 toRenderedDocumentMarker(marker)->setRenderedRect(LayoutRect(markerRect)); | 810 toRenderedDocumentMarker(marker)->setRenderedRect(LayoutRect(markerRect)); |
811 | 811 |
812 // Optionally highlight the text | 812 // Optionally highlight the text |
813 if (m_inlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHig
hlighted()) { | 813 if (m_inlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHig
hlighted()) { |
814 Color color = marker->activeMatch() ? | 814 Color color = marker->activeMatch() ? |
815 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : | 815 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : |
816 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); | 816 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); |
817 GraphicsContextStateSaver stateSaver(*pt); | 817 GraphicsContextStateSaver stateSaver(*pt); |
818 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); | 818 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); |
819 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); | 819 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 | 823 |
824 } // namespace blink | 824 } // namespace blink |
OLD | NEW |