diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index ed31cce4b282..b802dc57bd9b 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -6092,6 +6092,7 @@ nsTextFrame::PaintDecorationLine(const PaintDecorationLineParams& aParams) */ void nsTextFrame::DrawSelectionDecorations(gfxContext* aContext, + TextDrawTarget* aTextDrawer, const LayoutDeviceRect& aDirtyRect, SelectionType aSelectionType, nsTextPaintStyle& aTextPaintStyle, @@ -6108,6 +6109,7 @@ nsTextFrame::DrawSelectionDecorations(gfxContext* aContext, { PaintDecorationLineParams params; params.context = aContext; + params.textDrawer = aTextDrawer; params.dirtyRect = aDirtyRect; params.pt = aPt; params.lineSize.width = aWidth; @@ -6124,6 +6126,12 @@ nsTextFrame::DrawSelectionDecorations(gfxContext* aContext, float relativeSize; + // Since this happens after text, all we *should* be allowed to do is strikeThrough. + // If this isn't true, we're at least bug-compatible with gecko! + if (aTextDrawer) { + aTextDrawer->StartDrawing(TextDrawTarget::Phase::eLineThrough); + } + switch (aSelectionType) { case SelectionType::eIMERawClause: case SelectionType::eIMESelectedRawClause: @@ -6803,7 +6811,7 @@ nsTextFrame::PaintTextSelectionDecorations( gfxFloat width = Abs(advance) / app; gfxFloat xInFrame = pt.x - (aParams.framePt.x / app); DrawSelectionDecorations( - aParams.context, aParams.dirtyRect, aSelectionType, + aParams.context, aParams.textDrawer, aParams.dirtyRect, aSelectionType, *aParams.textPaintStyle, selectedStyle, pt, xInFrame, width, mAscent / app, decorationMetrics, aParams.callbacks, verticalRun, decorationOffsetDir, kDecoration); diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index d4cc143af3bc..c941dd3f2fd8 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -829,6 +829,7 @@ protected: * Utility methods to paint selection. */ void DrawSelectionDecorations(gfxContext* aContext, + TextDrawTarget* aTextDrawer, const LayoutDeviceRect& aDirtyRect, mozilla::SelectionType aSelectionType, nsTextPaintStyle& aTextPaintStyle,