Let nsIFrame::GetIntrinsicRatio() work for both non-replaced and replaced elements
Categories
(Core :: Layout, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox83 | --- | fixed |
People
(Reporter: boris, Assigned: TYLin)
References
(Blocks 1 open bug)
Details
Attachments
(8 files)
|
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 | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
Now, nsIFrame::GetIntrinsicRatio() is only for replaced-elements. For non-replaced elements, we expect it is 0. However, aspect-ratio property works for both non-replaced and replaced elements, and it is defined as "intrinsic aspect ratio" for all the cases indeed. So for readability and maintenance, we may have to update the return type of this function. At least we should make sure it can tell the difference for 1/0, 0/1, and auto value.
| Assignee | ||
Comment 1•5 years ago
|
||
| Assignee | ||
Comment 2•5 years ago
|
||
Depends on D91223
| Assignee | ||
Comment 3•5 years ago
|
||
Depends on D91224
| Assignee | ||
Comment 4•5 years ago
|
||
Now, this method is just an alias of GetIntrinsicRatio().
Depends on D91225
| Assignee | ||
Comment 5•5 years ago
|
||
For now, GetAspectRatio() is just an alias for GetIntrinicRatio(). In
Part 7, we're going to have GetAspectRatio() consider aspect-ratio
property so that each replaced elements only need to report their
intrinsic ratio via GetIntrinicRatio. Non-replaced element can also call
GetAspectRatio() to get the ratio suitable to calculate layout size.
As of this patch, all the replaced elements' GetIntrinsicRatio()
consider aspect-ratio properties (added in bug 1639963), so most of the
existing callers [1] should call GetAspectRatio() instead to retain the
behavior after Part 7. We adapt these callers in this patch.
[1] Exceptions include 1) a caller in nsIFrame::ComputeSize() checking
the frame has no intrinsic ratio; 2) other frame classes implementing
nsIFrame::GetIntrinsicRatio() by calling their parent's
GetIntrinicRatio(). nsSubDocumentFrame::GetIntrinicRatio() is an
example.
Depends on D91226
| Assignee | ||
Comment 6•5 years ago
|
||
IsXULDisplayType() is going to be used in GetAspectRatio() in the next part.
Also rename it to IsXULDisplayStyle() because nsStyleDisplay often has
"Style"-suffix for related helpers.
Depends on D91227
| Assignee | ||
Comment 7•5 years ago
|
||
This patch moves the preferred aspect-ratio calculation from each
replaced elements' GetIntrinicRatio() into GetAspectRatio(), because
they share the same logic.
For nsImageFrame, the cached mIntrinsicRatio now stores only the image's
intrinsic ratio, not considering the aspect-ratio property.
This also makes us pass some of the aspect-ratio tests because we change
GetIntrinicRatio() into GetAspectRatio() in
nsLayoutUtils::IntrinsicForAxis() in Part5, which is used by nsBlockFrame
(via nsLayoutUtils::IntrinsicForContainer) to implement GetMinISize().
Depends on D91228
Updated•5 years ago
|
| Assignee | ||
Comment 8•5 years ago
|
||
This function doesn't consider aspect-ratio property anymore. Hence the
rename.
Depends on D91229
Comment 10•5 years ago
|
||
Comment 12•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/3730e389f359
https://hg.mozilla.org/mozilla-central/rev/8776ac19cb23
https://hg.mozilla.org/mozilla-central/rev/daa98d9d594b
https://hg.mozilla.org/mozilla-central/rev/ed2d90d8c3a0
https://hg.mozilla.org/mozilla-central/rev/7774e55b520c
https://hg.mozilla.org/mozilla-central/rev/6685d0128466
https://hg.mozilla.org/mozilla-central/rev/a81a1a6e1c0f
https://hg.mozilla.org/mozilla-central/rev/0bb66029c0d1
Description
•