summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsTextFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--layout/generic/nsTextFrame.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
index 369722fe8d..9afefc5c28 100644
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -226,6 +226,7 @@ struct nsTextFrame::DrawTextRunParams {
float textStrokeWidth = 0.0f;
bool drawSoftHyphen = false;
bool hasTextShadow = false;
+ bool paintingShadows = false;
DrawTextRunParams(gfxContext* aContext,
mozilla::gfx::PaletteCache& aPaletteCache)
: context(aContext), paletteCache(aPaletteCache) {}
@@ -276,6 +277,7 @@ struct nsTextFrame::PaintShadowParams {
Point framePt;
Point textBaselinePt;
gfxContext* context;
+ DrawPathCallbacks* callbacks = nullptr;
nscolor foregroundColor = NS_RGBA(0, 0, 0, 0);
const ClipEdges* clipEdges = nullptr;
PropertyProvider* provider = nullptr;
@@ -5374,9 +5376,8 @@ void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
// Text-shadow overflows
if (aIncludeShadows) {
- nsRect shadowRect =
+ *aInkOverflowRect =
nsLayoutUtils::GetTextShadowRectsUnion(*aInkOverflowRect, this);
- aInkOverflowRect->UnionRect(*aInkOverflowRect, shadowRect);
}
// When this frame is not selected, the text-decoration area must be in
@@ -5460,6 +5461,7 @@ struct nsTextFrame::PaintDecorationLineParams
gfxFloat baselineOffset = 0.0f;
DecorationType decorationType = DecorationType::Normal;
DrawPathCallbacks* callbacks = nullptr;
+ bool paintingShadows = false;
};
void nsTextFrame::PaintDecorationLine(
@@ -5474,9 +5476,11 @@ void nsTextFrame::PaintDecorationLine(
if (aParams.callbacks) {
Rect path = nsCSSRendering::DecorationLineToPath(params);
if (aParams.decorationType == DecorationType::Normal) {
- aParams.callbacks->PaintDecorationLine(path, params.color);
+ aParams.callbacks->PaintDecorationLine(path, aParams.paintingShadows,
+ params.color);
} else {
- aParams.callbacks->PaintSelectionDecorationLine(path, params.color);
+ aParams.callbacks->PaintSelectionDecorationLine(
+ path, aParams.paintingShadows, params.color);
}
} else {
nsCSSRendering::PaintDecorationLine(this, *aParams.context->GetDrawTarget(),
@@ -5938,6 +5942,7 @@ void nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams,
gfxFloat advanceWidth;
nsTextPaintStyle textPaintStyle(this);
DrawTextParams params(shadowContext, PresContext()->FontPaletteCache());
+ params.paintingShadows = true;
params.advanceWidth = &advanceWidth;
params.dirtyRect = aParams.dirtyRect;
params.framePt = aParams.framePt + shadowGfxOffset;
@@ -5945,9 +5950,10 @@ void nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams,
params.textStyle = &textPaintStyle;
params.textColor =
aParams.context == shadowContext ? shadowColor : NS_RGB(0, 0, 0);
+ params.callbacks = aParams.callbacks;
params.clipEdges = aParams.clipEdges;
params.drawSoftHyphen = HasAnyStateBits(TEXT_HYPHEN_BREAK);
- // Multi-color shadow is not allowed, so we use the same color of the text
+ // Multi-color shadow is not allowed, so we use the same color as the text
// color.
params.decorationOverrideColor = &params.textColor;
params.fontPalette = StyleFont()->GetFontPaletteAtom();
@@ -6253,6 +6259,7 @@ bool nsTextFrame::PaintTextWithSelectionColors(
PaintShadowParams shadowParams(aParams);
shadowParams.provider = aParams.provider;
+ shadowParams.callbacks = aParams.callbacks;
shadowParams.clipEdges = &aClipEdges;
// Draw text
@@ -6815,6 +6822,7 @@ void nsTextFrame::PaintText(const PaintTextParams& aParams,
shadowParams.textBaselinePt = textBaselinePt;
shadowParams.leftSideOffset = snappedStartEdge;
shadowParams.provider = &provider;
+ shadowParams.callbacks = aParams.callbacks;
shadowParams.foregroundColor = foregroundColor;
shadowParams.clipEdges = &clipEdges;
PaintShadows(textStyle->mTextShadow.AsSpan(), shadowParams);
@@ -6854,7 +6862,8 @@ static void DrawTextRun(const gfxTextRun* aTextRun,
params.callbacks = aParams.callbacks;
params.hasTextShadow = aParams.hasTextShadow;
if (aParams.callbacks) {
- aParams.callbacks->NotifyBeforeText(aParams.textColor);
+ aParams.callbacks->NotifyBeforeText(aParams.paintingShadows,
+ aParams.textColor);
params.drawMode = DrawMode::GLYPH_PATH;
aTextRun->Draw(aRange, aTextBaselinePt, params);
aParams.callbacks->NotifyAfterText();
@@ -6995,6 +7004,7 @@ void nsTextFrame::DrawTextRunAndDecorations(
params.callbacks = aParams.callbacks;
params.glyphRange = aParams.glyphRange;
params.provider = aParams.provider;
+ params.paintingShadows = aParams.paintingShadows;
// pt is the physical point where the decoration is to be drawn,
// relative to the frame; one of its coordinates will be updated below.
params.pt = Point(x / app, y / app);