Pass percentage basis when computing intrinsic sizes
Categories
(Core :: Layout, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox132 | --- | fixed |
People
(Reporter: TYLin, Assigned: TYLin)
References
(Blocks 3 open bugs)
Details
Attachments
(6 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
This tracks my work to refactor GetMinISize()
and GetPrefISize()
to accept a parameter of current frame's size so that it can be used as a percentage basis when computing child frame's intrinsic contribution.
I think this bug can at least fixes bug 1800991 and some tests on wpt.
Assignee | ||
Updated•7 months ago
|
Assignee | ||
Comment 1•6 months ago
|
||
The main entry point for computing the intrinsic inline size of a frame is nsIFrame::IntrinsicISize()
, which is called when computing the computed inline size of ReflowInput
.
nsLayoutUtils::IntrinsicForAxis()
is an underlying helper method used for calculating children's intrinsic inline size contributions. GetPercentBSize()
is a helper used in nsLayoutUtils::IntrinsicForAxis()
to compute the percentage basis when there is a percentage size in the block axis. GetPercentBSize()
traverses up the containing block chain to find the first ancestor containing block with a definite block size. However, it does not find a definite block size if the containing block's definite block size is established via inline size and aspect-ratio (see bug 1800991).
The main idea of the patch is to pass the frame's definite block size (with min block size and max block size constraints considered) into IntrinsicISize()
. This bug also enables potential future improvements allowing flex or grid items to use stretched block size as a percentage basis for the content inside the items (e.g. bug 1742042).
The patch stack doesn't handle all the edge cases where IntrinsicISize()
, GetPrefISize
, and GetMinISize()
need a percentage basis. For example, AddIntrinsicSizeOffset()
requires more refactor to construct percentage basis easily. After that, we can fix bug 1231059 by removing GetPercentBSize()
.
Assignee | ||
Comment 2•6 months ago
|
||
Capitalize the name of lambda expressions to make them look like functions
rather than variables.
Rename and improve GetContentEdgeToBoxSizing
since I feel the indentation
makes it difficult to read. Also, rename the local Maybe<LogicalSize>
storing
the result of the lambda.
This patch doesn't change behavior.
Assignee | ||
Comment 3•6 months ago
|
||
This patch changes the signature to GetMinISize()
, GetPrefISize()
,
IntrinsicISize
by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.
When passing IntrinsicSizeInput
struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
IntrinsicSizeInput
for our children.
Assignee | ||
Comment 4•6 months ago
|
||
Another preparation patch in order to pass down a percentage basis when
computing intrinsic size.
Assignee | ||
Comment 5•6 months ago
|
||
A percentage basis is needed to resolve percentage block size when computing
children's intrinsic inline size contributions. This is necessary for a child or
descendants with a preferred aspect-ratio so that the block size can transfer
through the aspect-ratio to become an intrinsic inline size.
The change in nsFlexContainerFrame::ComputeIntrinsicISize()
is necessary to
keep us passing
testing/web-platform/tests/css/css-flexbox/image-nested-within-definite-column-flexbox.html
.
The change in nsPlaceholderFrame::AddFloatToIntrinsicISizeData()
is necessary
to keep us passing
testing/web-platform/tests/css/css-sizing/intrinsic-percent-replaced-dynamic-010.html
.
GetISizeInfo()
in BasicTableLayoutStrategy.cpp is modified to pass table cell
frame's bsize as percentage basis. Otherwise,
layout/reftests/bugs/522632-1.html
fails. This is our current behavior, but it
is bug 1542098.
Assignee | ||
Comment 6•6 months ago
|
||
All the tests pass in Google Chrome. They fail in the current Firefox Nightly
but will pass with the patches in this bug.
intrinsic-percent-replaced-{012,013,014}.html
are adapted from the second
testcase in bug 1231059 comment 0.
intrinsic-percent-replaced-{015,016}.html
are adapted from the testcase in bug
1800991 comment 2.
intrinsic-percent-replaced-017.html
is adapted from bug 1910290 comment 7.
Assignee | ||
Comment 7•6 months ago
|
||
Comment 10•6 months ago
|
||
Backed out for causing failures at test_contextmenu_rtl.xhtml.
Backout link: https://hg.mozilla.org/integration/autoland/rev/cf474d30f1b7f477897a8d5beeea49d748b546d0
Failure log: https://treeherder.mozilla.org/logviewer?job_id=472042803&repo=autoland&lineNumber=7673
Comment 12•6 months ago
|
||
Assignee | ||
Updated•6 months ago
|
Comment 13•6 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d0f7ac5c6dc9
https://hg.mozilla.org/mozilla-central/rev/9c9289d5bffc
https://hg.mozilla.org/mozilla-central/rev/f531438e13a4
https://hg.mozilla.org/mozilla-central/rev/b509d1a77c27
https://hg.mozilla.org/mozilla-central/rev/4646bfebde8f
https://hg.mozilla.org/mozilla-central/rev/d0336fee53a3
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Updated•6 months ago
|
Description
•