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

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: Created 5 years, 6 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
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/InlineTextBoxPainter.cpp
diff --git a/Source/core/paint/InlineTextBoxPainter.cpp b/Source/core/paint/InlineTextBoxPainter.cpp
index a7503c4527704aaa22ce931760ab6fc094b4e0ec..c17a8fc8cb6c5fe34566782b3f379729862fc9f9 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);
}
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)
pdr. 2015/07/06 22:09:16 extra spaces around int length
Sk.kumar 2015/07/07 12:45:02 Done.
+{
+ if (!m_inlineTextBox.layoutObject().node())
+ return;
+
+ TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBox.layoutObject(), style, true, false);
pdr. 2015/07/06 22:09:16 We shouldn't add all of this code. Can you modify
Sk.kumar 2015/07/07 12:45:02 This is being done to maintain the flow of Paint.
+ 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())
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698