Closed Bug 1811311 Opened 1 year ago Closed 1 year ago

Consider Refactoring Various Baseline Functions

Categories

(Core :: Layout: Block and Inline, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: dshin, Assigned: dshin)

References

Details

Attachments

(3 files)

I see GetLogicalBaseline, GetVerticalAlignBaseline, GetNaturalBaselineBOffset, and BaselineBOffset.

The first 3 functions are virtual, the last function is not virtual but calls into GetNaturalBaselineBOffset. Through some hoops, all of these functions ultimately defer to others or use highly duplicated logic. See here for an example.

They make tracking how baselines get calculated tougher - ideally we should have one function for getting a baseline.

Some notes on each function:

GetLogicalBaseline:

  • Always returns something (i.e. Will synthesize for you)
  • Default nsIFrame function: Fallback synthesis
  • Result relative to start of border edge
  • Comment on how it's being replaced by GetVerticalAlignBaseline

GetVerticalAlignBaseline:

  • Can return false (i.e. no baseline & no synthesis)
  • Result relative to start of border edge

GetNaturalBaselineBOffset:

  • Can return false (i.e. no baseline & no synthesis)
  • Can select first/last baseline
  • Result relative to start/end of border edge

BaselineBOffset:

  • Always returns something (i.e. Will synthesize for you)
  • Can select first/last baseline
  • Result relative to start/end of border edge
  • Calls GetNaturalBaselineBOffset
Assignee: nobody → dshin
Severity: -- → S3
Blocks: 1809568

These functions work fine as static functions, and nsIFrame is pretty overloaded.

Depends on D167990

Changed from returning bool & taking an out parameter.

Depends on D167991

Pushed by dshin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4846720fc2c6
Part 1: Unite baseline-related functions in `nsIFrame` into one. r=emilio
https://hg.mozilla.org/integration/autoland/rev/fbf495c37e23
Part 2: Extract `SynthesizeBaselineBOffsetFrom*` out of `nsIFrame`. r=emilio
https://hg.mozilla.org/integration/autoland/rev/ff31765de985
Part 3: Refactor `GetNaturalBaselineBOffset` to return `Maybe<nscoord>`. r=layout-reviewers,emilio
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: