summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsTextFrame.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /layout/generic/nsTextFrame.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/generic/nsTextFrame.cpp')
-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);