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

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

Issue 1141403003: [S.P.] Expand cull-rect for text boxes with selection bounds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use localSelectionRect. Created 5 years, 7 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 dcedbec439e0f5a9008172baefb131d7ecdfb885..f288e7cba5170d2934f8954a49f5a5a84ec9cd07 100644
--- a/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/Source/core/paint/InlineTextBoxPainter.cpp
@@ -41,6 +41,11 @@ static TextBlobPtr* addToTextBlobCache(InlineTextBox& inlineTextBox)
return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value;
}
+static bool paintsMarkerHighlights(const LayoutObject& layoutObject)
+{
+ return layoutObject.node() && layoutObject.document().markers().hasMarkers(layoutObject.node());
+}
+
void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (m_inlineTextBox.isLineBreak() || !paintInfo.shouldPaintWithinRoot(&m_inlineTextBox.layoutObject()) || m_inlineTextBox.layoutObject().style()->visibility() != VISIBLE
@@ -71,11 +76,17 @@ void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
return;
}
+ // Determine whether or not we have composition underlines to draw.
+ bool containsComposition = m_inlineTextBox.layoutObject().node() && m_inlineTextBox.layoutObject().frame()->inputMethodController().compositionNode() == m_inlineTextBox.layoutObject().node();
+ bool useCustomUnderlines = containsComposition && m_inlineTextBox.layoutObject().frame()->inputMethodController().compositionUsesCustomUnderlines();
+
// The text clip phase already has a DrawingRecorder. Text clips are initiated only in BoxPainter::paintLayerExtended, which is already
// within a DrawingRecorder.
OwnPtr<DrawingRecorder> drawingRecorder;
if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != PaintPhaseTextClip) {
LayoutRect paintRect(m_inlineTextBox.logicalRectToPhysicalRect(logicalVisualOverflow));
+ if (paintInfo.phase != PaintPhaseSelection && (haveSelection || containsComposition || paintsMarkerHighlights(m_inlineTextBox.layoutObject())))
+ paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.start(), m_inlineTextBox.start() + m_inlineTextBox.len()));
paintRect.moveBy(adjustedPaintOffset);
drawingRecorder = adoptPtr(new DrawingRecorder(*paintInfo.context, m_inlineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase), paintRect));
if (drawingRecorder->canUseCachedDrawing())
@@ -124,10 +135,6 @@ void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
}
}
- // Determine whether or not we have composition underlines to draw.
- bool containsComposition = m_inlineTextBox.layoutObject().node() && m_inlineTextBox.layoutObject().frame()->inputMethodController().compositionNode() == m_inlineTextBox.layoutObject().node();
- bool useCustomUnderlines = containsComposition && m_inlineTextBox.layoutObject().frame()->inputMethodController().compositionUsesCustomUnderlines();
-
// Determine text colors.
TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBox.layoutObject(), styleToUse, paintInfo.forceBlackText(), isPrinting);
TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_inlineTextBox.layoutObject(), haveSelection, paintInfo.forceBlackText(), isPrinting, textStyle);
« 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