Consider Refactoring Various Baseline Functions
Categories
(Core :: Layout: Block and Inline, enhancement)
Tracking
()
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 | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
These functions work fine as static functions, and nsIFrame
is pretty overloaded.
Depends on D167990
Assignee | ||
Comment 3•2 years ago
|
||
Changed from returning bool
& taking an out parameter.
Depends on D167991
Comment 5•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4846720fc2c6
https://hg.mozilla.org/mozilla-central/rev/fbf495c37e23
https://hg.mozilla.org/mozilla-central/rev/ff31765de985
Description
•