Bug 1399564 - properly thread through selection-specific decorations to WR. r=jrmuizel

MozReview-Commit-ID: 7prde0BsOFL

--HG--
extra : rebase_source : 188e7b75f7fc93ca2f87a8b3439696a28e3fb431
This commit is contained in:
Alexis Beingessner 2017-09-13 13:25:42 -04:00
Родитель 54c3a0b839
Коммит 952cdf7351
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -6092,6 +6092,7 @@ nsTextFrame::PaintDecorationLine(const PaintDecorationLineParams& aParams)
*/ */
void void
nsTextFrame::DrawSelectionDecorations(gfxContext* aContext, nsTextFrame::DrawSelectionDecorations(gfxContext* aContext,
TextDrawTarget* aTextDrawer,
const LayoutDeviceRect& aDirtyRect, const LayoutDeviceRect& aDirtyRect,
SelectionType aSelectionType, SelectionType aSelectionType,
nsTextPaintStyle& aTextPaintStyle, nsTextPaintStyle& aTextPaintStyle,
@ -6108,6 +6109,7 @@ nsTextFrame::DrawSelectionDecorations(gfxContext* aContext,
{ {
PaintDecorationLineParams params; PaintDecorationLineParams params;
params.context = aContext; params.context = aContext;
params.textDrawer = aTextDrawer;
params.dirtyRect = aDirtyRect; params.dirtyRect = aDirtyRect;
params.pt = aPt; params.pt = aPt;
params.lineSize.width = aWidth; params.lineSize.width = aWidth;
@ -6124,6 +6126,12 @@ nsTextFrame::DrawSelectionDecorations(gfxContext* aContext,
float relativeSize; 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) { switch (aSelectionType) {
case SelectionType::eIMERawClause: case SelectionType::eIMERawClause:
case SelectionType::eIMESelectedRawClause: case SelectionType::eIMESelectedRawClause:
@ -6803,7 +6811,7 @@ nsTextFrame::PaintTextSelectionDecorations(
gfxFloat width = Abs(advance) / app; gfxFloat width = Abs(advance) / app;
gfxFloat xInFrame = pt.x - (aParams.framePt.x / app); gfxFloat xInFrame = pt.x - (aParams.framePt.x / app);
DrawSelectionDecorations( DrawSelectionDecorations(
aParams.context, aParams.dirtyRect, aSelectionType, aParams.context, aParams.textDrawer, aParams.dirtyRect, aSelectionType,
*aParams.textPaintStyle, selectedStyle, pt, xInFrame, *aParams.textPaintStyle, selectedStyle, pt, xInFrame,
width, mAscent / app, decorationMetrics, aParams.callbacks, width, mAscent / app, decorationMetrics, aParams.callbacks,
verticalRun, decorationOffsetDir, kDecoration); verticalRun, decorationOffsetDir, kDecoration);

Просмотреть файл

@ -829,6 +829,7 @@ protected:
* Utility methods to paint selection. * Utility methods to paint selection.
*/ */
void DrawSelectionDecorations(gfxContext* aContext, void DrawSelectionDecorations(gfxContext* aContext,
TextDrawTarget* aTextDrawer,
const LayoutDeviceRect& aDirtyRect, const LayoutDeviceRect& aDirtyRect,
mozilla::SelectionType aSelectionType, mozilla::SelectionType aSelectionType,
nsTextPaintStyle& aTextPaintStyle, nsTextPaintStyle& aTextPaintStyle,