Simply the flag manipulation (ReflowInputFlags, ComputeSizeFlags) in ReflowInput
Categories
(Core :: Layout, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox82 | --- | fixed |
People
(Reporter: TYLin, Assigned: TYLin)
References
Details
Attachments
(8 files)
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
Bug 1663822 Part 3 - Move ComputeSizeFlags to LayoutConstants.h, and put it under mozilla namespace.
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
While investigating bug 1316534, I notice we may need to add a flag to ComputeSizeFlags to control whether flex-basis can influence a flex-item's main-size property (either width or height).
However, our current flag passing mechanism from ReflowInput's constructor to nsIFrame::ComputeSize is not very ergonomic. For example, if we want to use shrink-wrap behavior, we need to pass an anonymous enum on ReflowInput's constructor. Then ReflowInput sets the relevant ReflowInputFlags in its constructor. Finally, when ReflowInput is about to call nsIFrame::ComputeSize, it then constructs ComputeSizeFlags based on ReflowInputFlags.
So in this bug, I'm planning to fix this with the following goals in mind.
- Make
nsIFrame::ComputeSizeFlagsanEnumSetso that it's easier to use. - Let
ReflowInput's constructor takeComputeSizeFlagsto avoid the flag handover described above. This can eliminate parts of the anonymous enum values that use to constructComputeSizeFlags. The relevant bits inReflowInputFlagscan also be removed. - The rest of the values in the anynoums enum are controlling
ReflowInput's behavior. We can convert it into anEnumSet.
| Assignee | ||
Comment 1•5 years ago
|
||
This change shouldn't change behavior.
| Assignee | ||
Comment 2•5 years ago
|
||
This patch does:
- Rename the original ComputeSizeFlags to ComputeSizeFlag (dropping the
"s"), and make it an enum class. - Make ComputeSizeFlags can an EnumSet.
- Adapt the users to use EnumSet's APIs.
Default enum value in ComputeSizeFlag is not needed. It equals to an
empty ComputeSizeFlags.
This change shouldn't change behavior.
Depends on D89540
| Assignee | ||
Comment 3•5 years ago
|
||
In the next part, I'm going to use ComputeSizeFlags as the arguments in
some ReflowInput's methods. Because nsIFrame.h includes ReflowInput.h,
to solve the circular dependency, ComputeSizeFlags needs to be moved to
somewhere else.
This change shouldn't change behavior.
Depends on D89541
| Assignee | ||
Comment 4•5 years ago
|
||
Currently, to set ComputeSizeFlags, the caller uses an anonymous enum as
a parameter to ReflowInput constructor to set ReflowInputFlags fields,
and then ReflowInput creates a ComputeSizeFlags from the relevant
ReflowInputFlags fields in Init().
This patch simplifies this flags handover by adding ComputeSizeFlags
parameter to ReflowInput so that the caller can create the flags and
pass it to ReflowInput directly. The can also simplifies the process
needed to add a new ComputeSizeFlag.
We still need to store ComputeSizeFlags in ReflowInput since there's one
caller in nsBlockFrame::ComputeFinalSize wanting to checking
ComputeSizeFlag::BClampMarginBoxMinSize.
Note 1: ComputeSizeFlags is added only to the ReflowInput's constructor
that also takes parent ReflowInput. The other constructor's existing
callers don't need it.
Note 2: I don't bother adjust the value of DUMMY_PARENT_REFLOW_INPUT,
CALLER_WILL_INIT, and STATIC_POS_IS_CB_ORIGIN because they are going to
be converted into a enum class in a later patch.
This change shouldn't change behavior.
Depends on D89542
| Assignee | ||
Comment 5•5 years ago
|
||
In previous part, we changed SizeComputationInput::InitOffsets to take a
ComputeSizeFlags parameter instead of ReflowInputFlags. Now there's no
reason to put ReflowInputFlags under SizeComputationInput.
Also rename it to Flags because it now lives in ReflowInput. We'll
use the name more in the next part (in ReflowInput's constructor).
This change shouldn't change behavior.
Depends on D89543
| Assignee | ||
Comment 6•5 years ago
|
||
This change shouldn't change behavior.
Depends on D89544
| Assignee | ||
Comment 7•5 years ago
|
||
Depends on D89545
| Assignee | ||
Comment 8•5 years ago
|
||
Depends on D89546
Comment 9•5 years ago
|
||
This is great - thanks for doing this cleanup & for splitting it out so nicely!
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/070f9ba9109a
https://hg.mozilla.org/mozilla-central/rev/8e587833e629
https://hg.mozilla.org/mozilla-central/rev/fbc1eaa18e51
https://hg.mozilla.org/mozilla-central/rev/bfd617a93523
https://hg.mozilla.org/mozilla-central/rev/bcc431e93c8e
https://hg.mozilla.org/mozilla-central/rev/ff505e83d042
https://hg.mozilla.org/mozilla-central/rev/c7547d0ef4be
https://hg.mozilla.org/mozilla-central/rev/c97d502f76a2
Description
•