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

Unified Diff: third_party/WebKit/Source/core/paint/TextPainter.cpp

Issue 2416993002: Introduce support for text-decoration-skip: ink (Closed)
Patch Set: Created 4 years, 2 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: third_party/WebKit/Source/core/paint/TextPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TextPainter.cpp b/third_party/WebKit/Source/core/paint/TextPainter.cpp
index 274b395f30f443bc2f389e92c5abbd614ea0a6f6..77d78da1d921a6c2d66b2262c230c1860912371c 100644
--- a/third_party/WebKit/Source/core/paint/TextPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TextPainter.cpp
@@ -252,6 +252,35 @@ void TextPainter::paintInternal(unsigned startOffset,
}
}
+void TextPainter::clipDecorationsStripe(float upper,
+ float stripeWidth,
+ float dilation) {
+ TextRunPaintInfo textRunPaintInfo(m_run);
+
+ if (!m_run.length())
+ return;
+
+ SkScalar lineBounds[] = {upper, upper + stripeWidth};
+ const int numIntervals = m_graphicsContext.getTextIntercepts(
+ m_font, textRunPaintInfo, lineBounds, nullptr);
+ SkScalar intervals[numIntervals];
+ m_graphicsContext.getTextIntercepts(m_font, textRunPaintInfo, lineBounds,
+ intervals);
+
+ for (int i = 0; i < numIntervals; i += 2) {
eae 2016/10/13 18:18:54 Do we want to assert that the number of intervals
drott 2016/10/13 18:39:29 Makes sense, adding an assert.
+ FloatPoint clipOrigin(m_textOrigin);
+ FloatRect clipRect(clipOrigin + FloatPoint(intervals[i], upper),
+ FloatSize(intervals[i + 1] - intervals[i], stripeWidth));
+ clipRect.inflateX(dilation);
+ clipRect = enclosingIntRect(clipRect);
+ m_graphicsContext.setFillColor(Color(127, 0, 0, 127));
eae 2016/10/13 18:18:54 Hard coded color? This is temporary, right?
drott 2016/10/13 18:39:29 Yep, the whole paintRect can go, and no color sett
+ FloatRect paintClipRect(clipRect);
+ paintClipRect.inflateX(clipRect.width() * -0.25);
eae 2016/10/13 18:18:54 Please add a comment explaining the 0.25 value.
+ // m_graphicsContext.fillRect(paintClipRect);
+ m_graphicsContext.clipOut(clipRect);
+ }
+}
+
void TextPainter::paintEmphasisMarkForCombinedText() {
ASSERT(m_combinedText);
TextRun placeholderTextRun(&ideographicFullStopCharacter, 1);

Powered by Google App Engine
This is Rietveld 408576698