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

Unified Diff: Source/core/paint/InlineTextBoxPainter.cpp

Issue 1220733012: Display transparent text when it's being searched and selected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added Layout Test Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/InlineTextBoxPainter.cpp
diff --git a/Source/core/paint/InlineTextBoxPainter.cpp b/Source/core/paint/InlineTextBoxPainter.cpp
index a7503c4527704aaa22ce931760ab6fc094b4e0ec..afd9de53d9bb139f9e321c66e3dd06c0c8a21bfb 100644
--- a/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/Source/core/paint/InlineTextBoxPainter.cpp
@@ -218,6 +218,10 @@ void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
if (textBlobIsCacheable)
cachedTextBlob = addToTextBlobCache(m_inlineTextBox);
textPainter.paint(startOffset, endOffset, length, textStyle, cachedTextBlob);
+
+ // Paint the text with color:transparent here in Find In Page Scenario.
+ if (styleToUse.visitedDependentColor(CSSPropertyColor) == Color::transparent)
+ paintTextMatchMarkerText(textPainter, length, styleToUse);
pdr. 2015/07/21 05:59:46 Where is the black color of the text coming from?
}
if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart < selectionEnd) {
@@ -305,6 +309,24 @@ void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext*
context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style, font), localOrigin, selHeight, backgroundColor, sPos, ePos);
}
+void InlineTextBoxPainter::paintTextMatchMarkerText(TextPainter textPainter, int length, const ComputedStyle& style)
+{
+ if (!m_inlineTextBox.layoutObject().node())
+ return;
+
+ TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBox.layoutObject(), style, true, false);
pdr. 2015/07/21 05:59:46 We generally try not to duplicate complex logic li
+ DocumentMarkerVector markers = m_inlineTextBox.layoutObject().document().markers().markersFor(m_inlineTextBox.layoutObject().node());
+ DocumentMarkerVector::const_iterator markerIt = markers.begin();
+ for (; markerIt != markers.end(); ++markerIt) {
+ DocumentMarker* marker = *markerIt;
+ if (marker->type() == DocumentMarker::TextMatch) {
+ int sPos = std::max(marker->startOffset() - m_inlineTextBox.start(), (unsigned)0);
+ int ePos = std::min(marker->endOffset() - m_inlineTextBox.start(), m_inlineTextBox.len());
+ textPainter.paint(sPos, ePos, length, textStyle, 0);
+ }
+ }
+}
+
void InlineTextBoxPainter::paintDocumentMarkers(GraphicsContext* pt, const LayoutPoint& boxOrigin, const ComputedStyle& style, const Font& font, bool background)
{
if (!m_inlineTextBox.layoutObject().node())
« Source/core/paint/InlineTextBoxPainter.h ('K') | « Source/core/paint/InlineTextBoxPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698