Closed Bug 1357545 Opened 7 years ago Closed 7 years ago

Handle text decoration

Categories

(Core :: Graphics: WebRender, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jrmuizel, Assigned: Gankra)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file, 1 obsolete file)

Currently we fail to use text layers when text decoration happens. This causes noticeable fallback when hover over links.
Whiteboard: [gfx-noted]
Our current thoughts for the way forward here is to change nsDisplayText::RenderToContext to take a new TextPainter class instead of a gfxContext. The TextPainter would wrap a DrawTarget like gfxContext currently does and either forward commands through to the DrawTarget or record the needed information for use by WebRender.

A good first step would probably be to just replace the gfxContext with a TextPainter class that has a more DrawTarget like API. This way we avoid having to use the gfxContext wrapper in the first place.
Assignee: nobody → a.beingessner
Hey [:jrmuizel], here's the changes mostly cleaned up and ready to go. The first patch is the real work, the second patch is just a temporary thing to be replaced by a proper WR update. There's a few TODO's left in the patch that I'd like to address, but I'd rather get feedback on the design first before progressing. I expect a few of these might be left in the final submission as follow-up work.

Discussing with glennw, it looks like we're going to push forward with native text-decoration support as an immediate follow-up, so I'll be hacking away in this code some more after this patch.

Also: not sure if these changes are at all visible to any of the testing bots?
(In reply to Alexis Beingessner [:Gankro] from comment #4)
> Also: not sure if these changes are at all visible to any of the testing
> bots?

Not unless you push to try.
Attachment #8885509 - Attachment is obsolete: true
Attachment #8885508 - Flags: review?(jfkthame)
Comment on attachment 8885508 [details]
Bug 1357545 - handle text-shadows/decorations with webrender (layers-free)

https://reviewboard.mozilla.org/r/156382/#review174880

This seems like it should be OK, but webrender and layers and all that is pretty much foreign territory to me. So consider this "feedback+", but Jeff should do the real review.

::: layout/generic/TextDrawTarget.h:76
(Diff revision 3)
> +  // Prevent this from being copied
> +  TextDrawTarget(const TextDrawTarget& src) = delete;
> +  TextDrawTarget& operator=(const TextDrawTarget&) = delete;
> +
> +  // Change the phase of text we're drawing.
> +  void StartDrawing(Phase aPhase) { mCurrentlyDrawing = aPhase; }

As a sanity-check, might be worth asserting here that we're not attempting to draw a phase out of order?

::: layout/generic/TextDrawTarget.h:94
(Diff revision 3)
> +
> +    // Make sure we're only given color patterns
> +    MOZ_RELEASE_ASSERT(aPattern.GetType() == PatternType::COLOR);
> +    const ColorPattern* colorPat = static_cast<const ColorPattern*>(&aPattern);
> +
> +    // Grab the font, make sure it's the same one we've always seen

The second part of this comment doesn't seem to be correct.

::: layout/generic/TextDrawTarget.h:231
(Diff revision 3)
> +  // We wrap a gfxContext now, but we aspire to only use DrawTarget.
> +  // gfxContext* mContext;

We wrap a commented-out gfxContext? :)

::: layout/generic/nsTextFrame.cpp:5184
(Diff revision 3)
> +      mTextDrawer->GetBeforeDecorations().Length() > 0 ||
> +      mTextDrawer->GetAfterDecorations().Length() > 0) {
> -  return mozilla::LAYER_NONE;
> +    return mozilla::LAYER_NONE;
> -}
> +  }
>  
> +  // Most only have one font (multiple colors is fine)

typo, s/Most/Must/
Attachment #8885508 - Flags: review?(jfkthame)
Comment on attachment 8885508 [details]
Bug 1357545 - handle text-shadows/decorations with webrender (layers-free)

https://reviewboard.mozilla.org/r/156382/#review175042
Attachment #8885508 - Flags: review?(jmuizelaar) → review+
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/564959d26e8d
handle text-shadows/decorations with webrender (layers-free) r=jrmuizel
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/564959d26e8d
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Depends on: 1391996
No longer blocks: 1392171
Depends on: 1392171
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: