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

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

Issue 2416993002: Introduce support for text-decoration-skip: ink (Closed)
Patch Set: Falling back to adding rebaseline expectation Created 4 years, 1 month 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 04f3235a9f8eadc9bdf839430cb354afda3b8bae..95c02bdc54bdc641501c9078a7330a6fae5dbfce 100644
--- a/third_party/WebKit/Source/core/paint/TextPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TextPainter.cpp
@@ -253,6 +253,38 @@ void TextPainter::paintInternal(unsigned startOffset,
}
}
+void TextPainter::clipDecorationsStripe(float upper,
+ float stripeWidth,
+ float dilation) {
+ TextRunPaintInfo textRunPaintInfo(m_run);
+
+ if (!m_run.length())
+ return;
+
+ Vector<Font::TextIntercept> textIntercepts;
+ m_font.getTextIntercepts(
+ textRunPaintInfo, m_graphicsContext.deviceScaleFactor(),
+ m_graphicsContext.fillPaint(),
+ std::make_tuple(upper, upper + stripeWidth), textIntercepts);
+
+ for (auto intercept : textIntercepts) {
+ FloatPoint clipOrigin(m_textOrigin);
+ FloatRect clipRect(
+ clipOrigin + FloatPoint(intercept.m_begin, upper),
+ FloatSize(intercept.m_end - intercept.m_begin, stripeWidth));
+ clipRect.inflateX(dilation);
+ // We need to ensure the clip rectangle is covering the full underline
+ // extent. For horizontal drawing, using enclosingIntRect would be
+ // sufficient, since we can clamp to full device pixels that way. However,
+ // for vertical drawing, we have a transformation applied, which breaks the
+ // integers-equal-device pixels assumption, so vertically inflating by 1
+ // pixel makes sure we're always covering. This should only be done on the
+ // clipping rectangle, not when computing the glyph intersects.
+ clipRect.inflateY(1.0);
+ m_graphicsContext.clipOut(clipRect);
+ }
+}
+
void TextPainter::paintEmphasisMarkForCombinedText() {
const SimpleFontData* fontData = m_font.primaryFont();
DCHECK(fontData);
« no previous file with comments | « third_party/WebKit/Source/core/paint/TextPainter.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698