From 1c16c5b2cb7fceedd6a75a2c740498339cd93b22 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Fri, 4 Dec 2015 16:28:34 +1100 Subject: [PATCH] Bug 1229739 - Use the color of shadow if available for drawing emphasis marks in shadow. r=jfkthame --- layout/generic/nsTextFrame.cpp | 8 +++++--- layout/generic/nsTextFrame.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 2ec7f74ec8b..7a770cdd512 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -6218,6 +6218,7 @@ void nsTextFrame::DrawEmphasisMarks(gfxContext* aContext, WritingMode aWM, const gfxPoint& aTextBaselinePt, uint32_t aOffset, uint32_t aLength, + const nscolor* aDecorationOverrideColor, PropertyProvider& aProvider) { auto info = static_cast( @@ -6227,8 +6228,8 @@ nsTextFrame::DrawEmphasisMarks(gfxContext* aContext, WritingMode aWM, return; } - nscolor color = nsLayoutUtils:: - GetColor(this, eCSSProperty_text_emphasis_color); + nscolor color = aDecorationOverrideColor ? *aDecorationOverrideColor : + nsLayoutUtils::GetColor(this, eCSSProperty_text_emphasis_color); aContext->SetColor(Color::FromABGR(color)); gfxPoint pt(aTextBaselinePt); if (!aWM.IsVertical()) { @@ -6747,7 +6748,8 @@ nsTextFrame::DrawTextRunAndDecorations( aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks); // Emphasis marks - DrawEmphasisMarks(aCtx, wm, aTextBaselinePt, aOffset, aLength, aProvider); + DrawEmphasisMarks(aCtx, wm, aTextBaselinePt, aOffset, aLength, + aDecorationOverrideColor, aProvider); // Line-throughs for (uint32_t i = aDecorations.mStrikes.Length(); i-- > 0; ) { diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index 3cb5a0404b0..b8c3be3adf9 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -446,6 +446,7 @@ public: mozilla::WritingMode aWM, const gfxPoint& aTextBaselinePt, uint32_t aOffset, uint32_t aLength, + const nscolor* aDecorationOverrideColor, PropertyProvider& aProvider); virtual nscolor GetCaretColorAt(int32_t aOffset) override;