Closed Bug 1612822 Opened 6 years ago Closed 6 years ago

Refactor & clean up computation of decoration line position/thickness

Categories

(Core :: Layout: Text and Fonts, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(1 file)

The calculation of exactly where to draw text decoration lines (especially underlines) is a bit tricky, and currently there's quite a bit of duplication of the logic across various places that need to know. I think we can clean up and simplify this to make it more understandable and maintainable.

We replace SetWidthIfLength and SetOffsetIfLength with ComputeDecorationLine{Thickness,Offset} functions,
and consolidate more of the computation of the offset within this function to simplify callers.

Here's at least a step along the way to making this more sane. I think we may be able to do more... e.g. it may be possible to eliminate the defaultLineThickness member in nsCSSRendering::DecorationRectParams altogether. But that will involve changes inside nsCSSRendering as well as in nsTextFrame's computation, so I'm leaving that for now.

Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/935e6045865a Refactor text decoration offset/thickness computations. r=emilio
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Regressions: 1613285
Regressions: 1613572
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: