Index: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
index 8b6925bc2d5d9971948b5becc75219e255cde858..e86cc204f88376db3ef33e188177de17efa82654 100644 |
--- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp |
@@ -319,8 +319,6 @@ void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const Layou |
continue; |
break; |
case DocumentMarker::TextMatch: |
- if (!background) |
- continue; |
break; |
case DocumentMarker::Composition: |
break; |
@@ -347,7 +345,7 @@ void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const Layou |
m_inlineTextBox.paintDocumentMarker(pt, boxOrigin, marker, style, font, true); |
break; |
case DocumentMarker::TextMatch: |
- m_inlineTextBox.paintTextMatchMarker(pt, boxOrigin, marker, style, font); |
+ m_inlineTextBox.paintTextMatchMarker(pt, boxOrigin, marker, style, font, background); |
break; |
case DocumentMarker::Composition: |
{ |
@@ -830,7 +828,7 @@ void InlineTextBoxPainter::paintCompositionUnderline(GraphicsContext* ctx, const |
ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, (boxOrigin.y() + m_inlineTextBox.logicalHeight() - lineThickness).toFloat()), width, m_inlineTextBox.lineLayoutItem().document().printing()); |
} |
-void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const LayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font) |
+void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const LayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font, bool background) |
pdr.
2015/12/01 23:58:48
This function is getting more spaghetti by the day
ramya.v
2015/12/10 09:39:37
Separated code into two distinct functions.
Can I
|
{ |
// Use same y positioning and height as for selection, so that when the selection and this highlight are on |
// the same word there are no pieces sticking out. |
@@ -843,19 +841,24 @@ void InlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* pt, const Layou |
// Optionally highlight the text |
pdr.
2015/12/01 23:58:48
This is a funny comment since it's all this functi
ramya.v
2015/12/10 09:39:37
Done.
|
if (LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem())->frame()->editor().markedTextMatchesAreHighlighted()) { |
- Color color = marker->activeMatch() ? |
+ if (background) { |
+ Color color = marker->activeMatch() ? |
LayoutTheme::theme().platformActiveTextSearchHighlightColor() : |
LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); |
- GraphicsContextStateSaver stateSaver(*pt); |
- pt->clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); |
- pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); |
- |
- // Also Highlight the text with color:transparent |
- if (style.visitedDependentColor(CSSPropertyColor) == Color::transparent) { |
+ GraphicsContextStateSaver stateSaver(*pt); |
+ pt->clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); |
+ pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); |
+ } else { |
+ // Change the text color |
pdr.
2015/12/01 23:58:48
This comment is not useful, lets remove it.
ramya.v
2015/12/10 09:39:37
Done.
|
int length = m_inlineTextBox.len(); |
+ Color textColor = marker->activeMatch() ? |
+ LayoutTheme::theme().platformActiveTextSearchColor() : |
pdr.
2015/12/01 23:58:48
Indent these lines.
ramya.v
2015/12/10 09:39:37
Done.
|
+ LayoutTheme::theme().platformInactiveTextSearchColor(); |
+ if (style.visitedDependentColor(CSSPropertyColor) == textColor) |
+ return; |
TextPainter::Style textStyle; |
// When we use the text as a clip, we only care about the alpha, thus we make all the colors black. |
- textStyle.currentColor = textStyle.fillColor = textStyle.strokeColor = textStyle.emphasisMarkColor = Color::black; |
+ textStyle.currentColor = textStyle.fillColor = textStyle.strokeColor = textStyle.emphasisMarkColor = textColor; |
textStyle.strokeWidth = style.textStrokeWidth(); |
textStyle.shadow = 0; |