Commit Graph

2290 Commits

Author SHA1 Message Date
longsonr
e1526d9b0e Bug 1734476 - Don't run on compositor when content may contain non-scaling-stroke r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D227400
2024-11-07 11:03:46 +00:00
serge-sans-paille
262f78c07f Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Jonathan Kew
fe3fe5ed30 Bug 1927114 - Rename nsLineBox::RIndexOf to RLIndexOf and make it search from both ends of the line. r=dshin
This does not change the result, only the performance characteristics:
the search will be fast if the target frame is near either edge of the line,
not only if it's at the end.

Also includes a bit of trivial cleanup that I noticed in the surrounding
nsLineBox code. (No changes to behavior.)

Differential Revision: https://phabricator.services.mozilla.com/D226916
2024-10-28 08:03:20 +00:00
Alexandru Marc
a5eb905bf4 Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
07101ac24d Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
004e704b22 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
2c916d4973 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Emilio Cobos Álvarez
c3d7719c2c Bug 1791226 - Don't paint line-clamped lines. r=layout-reviewers,dshin
This matches the proposal in
https://github.com/w3c/csswg-drafts/pull/10816, and creates much better
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D157578
2024-10-21 10:41:26 +00:00
Cristina Horotan
86102c2240 Backed out changeset c6ce92301ca1 (bug 1791226) for causing assertion failures at nsBlockFrame.cpp on a CLOSED TREE 2024-10-19 04:50:37 +03:00
Emilio Cobos Álvarez
90631bc35d Bug 1791226 - Don't paint line-clamped lines. r=layout-reviewers,dshin
This matches the proposal in
https://github.com/w3c/csswg-drafts/pull/10816, and creates much better
behavior.

Differential Revision: https://phabricator.services.mozilla.com/D157578
2024-10-18 23:03:13 +00:00
Emilio Cobos Álvarez
9381d7e414 Bug 1791226 - Improve line-clamp behavior with padding / nested blocks. r=layout-reviewers,dshin
This matches Blink with border / padding in nested blocks, and seems
worth doing even if we paint the nested lines. Follow-up patch will
prevent painting the nested lines.

Differential Revision: https://phabricator.services.mozilla.com/D157572
2024-10-18 19:21:22 +00:00
Tamas Szentpeteri
3c21e7547c Backed out changeset 8396d1845d92 (bug 1791226) for causing wr failures on webkit-line-clamp-050.html. CLOSED TREE 2024-10-18 20:08:05 +03:00
Emilio Cobos Álvarez
f38521a63a Bug 1791226 - Harvest a block frame state bit. r=layout-reviewers,jfkthame
This will be useful.

Differential Revision: https://phabricator.services.mozilla.com/D223433
2024-10-18 13:10:54 +00:00
Emilio Cobos Álvarez
5d2e26f710 Bug 1791226 - Improve line-clamp behavior with padding / nested blocks. r=layout-reviewers,dshin
This matches Blink with border / padding in nested blocks, and seems
worth doing even if we paint the nested lines. Follow-up patch will
prevent painting the nested lines.

Differential Revision: https://phabricator.services.mozilla.com/D157572
2024-10-18 12:15:15 +00:00
Timothy Nikkel
4f863bbf4d Bug 1924698. Avoid a few blockframe queryframes. r=jwatt
Saw these in the long tail of a profile of an sp3 test.

Differential Revision: https://phabricator.services.mozilla.com/D225633
2024-10-17 12:05:27 +00:00
Emilio Cobos Álvarez
cb41273547 Bug 1922900 - container-type should stablish a BFC, but not layout containment. r=layout-reviewers,firefox-style-system-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D224764
2024-10-08 06:49:14 +00:00
Emilio Cobos Álvarez
130cfff85c Bug 1920603 - Templatize line-list iterators. r=layout-reviewers,jfkthame
No behavior change, but this removes a bunch of duplicated code.

Differential Revision: https://phabricator.services.mozilla.com/D223235
2024-09-24 11:22:02 +00:00
Ting-Yu Lin
aa389ab830 Bug 1917144 Part 2 - Add IntrinsicSizeInput::mContainingBlockSize. r=dholbert
Currently, only the grid container needs the containing block size to resolve
the transferred min and max sizes for `repeat()` function in
`nsGridContainerFrame::ComputeIntrinsicISize()`.

This patch is a preparation for Bug 1865438. `mContainingBlockSize` will be used
there, so it does not change any behavior yet.

Differential Revision: https://phabricator.services.mozilla.com/D221333
2024-09-11 18:01:40 +00:00
Ting-Yu Lin
07296da4c0 Bug 1917144 Part 1 - Rename mPercentageBasis to mPercentageBasisForChildren in IntrinsicSizeInput. r=dholbert
Rename `mPercentageBasis` to `mPercentageBasisForChildren` to clarify that the
percentage basis is intended for resolving the percentage sizes for child
frames.

Differential Revision: https://phabricator.services.mozilla.com/D221332
2024-09-11 18:01:39 +00:00
Ting-Yu Lin
0a5e62e315 Bug 1909761 Part 4 - Construct a percentage basis when computing children's intrinsic inline size contributions. r=dholbert
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 1461852.

Differential Revision: https://phabricator.services.mozilla.com/D219523
2024-09-03 04:25:42 +00:00
Ting-Yu Lin
116ca76700 Bug 1909761 Part 3 - Use IntrinsicSizeInput for AddInlineMinISize() and AddInlinePrefISize(). r=dholbert
Another preparation patch in order to pass down a percentage basis when
computing intrinsic size.

Differential Revision: https://phabricator.services.mozilla.com/D219522
2024-09-03 04:25:42 +00:00
Ting-Yu Lin
6af05a0977 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
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.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-09-03 04:25:41 +00:00
Butkovits Atila
4d06404349 Backed out 6 changesets (bug 1909761) for causing failures at test_contextmenu_rtl.xhtml. CLOSED TREE
Backed out changeset 1e9f47784a54 (bug 1909761)
Backed out changeset d2dcf159185b (bug 1909761)
Backed out changeset 3f48c106bff9 (bug 1909761)
Backed out changeset 38d1e5eda09d (bug 1909761)
Backed out changeset 8de556490289 (bug 1909761)
Backed out changeset 4e7f22f43bb4 (bug 1909761)
2024-08-28 10:44:09 +03:00
Ting-Yu Lin
3ac03672b0 Bug 1909761 Part 4 - Construct a percentage basis when computing children's intrinsic inline size contributions. r=dholbert
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 1461852.

Differential Revision: https://phabricator.services.mozilla.com/D219523
2024-08-28 06:18:45 +00:00
Ting-Yu Lin
caac17bc1b Bug 1909761 Part 3 - Use IntrinsicSizeInput for AddInlineMinISize() and AddInlinePrefISize(). r=dholbert
Another preparation patch in order to pass down a percentage basis when
computing intrinsic size.

Differential Revision: https://phabricator.services.mozilla.com/D219522
2024-08-28 06:18:44 +00:00
Ting-Yu Lin
f0ff97db90 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
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.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-08-28 06:18:44 +00:00
Jonathan Kew
800340ccc6 Bug 727831 - Use the line cursor to optimize nsBlockFrame::DoRemoveFrame, to avoid perf cliff when reflowing/modifying large blocks of text. r=layout-reviewers,emilio
This is basically Mats' line-cursor patch from 2012, updated to account for changes
in nsBlockFrame that have happened since then.

The example in https://bugzilla.mozilla.org/show_bug.cgi?id=1911451, for instance,
benefits hugely from this. Profile of resizing the textarea in the example there,
after pasting in the huge JS source:

Current mozilla-central: https://share.firefox.dev/3M6gUui
(truncated because I got tired of waiting for the reflow to finish)

With this patch applied: https://share.firefox.dev/46RMmpy
It's still janky, but only takes a second or so to reflow at each step.

Differential Revision: https://phabricator.services.mozilla.com/D219358
2024-08-22 12:55:40 +00:00
Emilio Cobos Álvarez
a012cd6770 Bug 1906475 - Improve scroll{Width,Height} implementation for overflow: visible frames. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D218782
2024-08-15 15:02:00 +00:00
Ting-Yu Lin
2969a5e0cb Bug 1909995 Part 2 - Add IntrinsicISize() as a helper to implement GetMinISize() and GetPrefISize(). r=layout-reviewers,emilio
Most frame types have identical or very similar implementation for GetMinISize()
and GetPrefISize(), and many of them already have `IntrinsicISize()` to unify
the implementation. This patch introduces nsIFrame::IntrinsicISize() so that
derived classes only need to override one method.

`nsBlockFrame`, `ColumnSetWrapperFrame`, and `nsColumnSetFrame` are the only
three classes where their `GetMinISize()` and `GetPrefISize()` have significant
differences. Therefore, we rename `GetMinISize()` and `GetPrefISize()` to
`MinISize()` and `PrefISize`, respectively, and use them as helpers to implement
their `IntrinsicISize()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D217790
2024-07-26 20:54:56 +00:00
Daniel Holbert
56c38ff56f Bug 1909773 part 2: Create BehavesLikeStretchOnInlineAxis() utility-function as an abstraction for the '-moz-available' sizing behavior. r=emilio
This patch doesn't change behavior.

The '-moz-available' keyword is our closest equivalent to the CSS 'stretch'
keyword, *specifically* for the inline axis (since we currently nerf
'-moz-available' to behave like the initial value in the block axis). Hence, it
makes sense to say that the '-moz-available' keyword "Behaves Like Stretch On
Inline Axis".

By abstracting the existing behavior behind this helper-function, we can
start implementing the actual 'stretch' value in terms of this existing
behavior, in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D217685
2024-07-25 18:18:23 +00:00
Ting-Yu Lin
c182ed4f84 Bug 1908826 - Modernize collapsing margin data structure. r=layout-reviewers,emilio
- Drop the "ns" prefix, and move the class into mozilla namespace.

- Remove unnecessary constructors and `operator=` because compiler can generate
  them automatically.

- Change `get` to `Get` to conform to the coding style.

- Misc cosmetic fix such as adding braces.

Differential Revision: https://phabricator.services.mozilla.com/D217056
2024-07-23 06:29:48 +00:00
Iulian Moraru
c3946b4ab0 Backed out changeset 07b27f0f7e21 (bug 1908826) for causing non unified build bustages on nsBlockReflowContext.h. CLOSED TREE 2024-07-23 04:55:23 +03:00
Ting-Yu Lin
16459adaa6 Bug 1908826 - Modernize collapsing margin data structure. r=layout-reviewers,emilio
- Drop the "ns" prefix, and move the class into mozilla namespace.

- Remove unnecessary constructors and `operator=` because compiler can generate
  them automatically.

- Change `get` to `Get` to conform to the coding style.

- Misc cosmetic fix such as adding braces.

Differential Revision: https://phabricator.services.mozilla.com/D217056
2024-07-22 21:06:54 +00:00
Ting-Yu Lin
54bbd58ae9 Bug 1906768 - Get floats list again after calling AppendPushedFloatChain(). r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D215995
2024-07-11 17:23:34 +00:00
Stanca Serban
ef51e7129d Backed out changeset 9a0e6453ea8f (bug 1906768) for causing android wpt failures. CLOSED TREE 2024-07-10 11:30:08 +03:00
Ting-Yu Lin
bb2d3e235c Bug 1906768 - Get floats list again after calling AppendPushedFloatChain(). r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D215995
2024-07-09 18:50:32 +00:00
Ting-Yu Lin
21d81e2fbe Bug 1905463 - Cap aspect-ratio's automatic minimum size by the maximum size. r=layout-reviewers,emilio
See https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum

The flex container and grid container have already considered max sizes clamping
when computing their sizes. Therefore, `flex-aspect-ratio-043.html`,
`flex-aspect-ratio-044.html`, and `grid-aspect-ratio-042.html` already pass on
the current Nightly without this patch.

- `flex-aspect-ratio-043.html` and `flex-aspect-ratio-044.html` are adapted from
  `flex-aspect-ratio-040.html` and `flex-aspect-ratio-041.html`.
- `grid-aspect-ratio-042.html` is adapted from `grid-aspect-ratio-039.html`.
- `fieldset-element-002.html` is adapted from `fieldset-element-001.html`.

Differential Revision: https://phabricator.services.mozilla.com/D215296
2024-07-01 21:26:25 +00:00
Ting-Yu Lin
9426229a09 Bug 1904409 - Call StartRemoveFrame() before calling ContinueRemoveFrame() in nsBlockFrame::RemoveFloat(). r=dholbert
After Bug 1903141 Part 3 [1], StartRemoveFrame() does not get called when there
is no float list. We need to make sure StartRemoveFrame() is called before
calling ContinueRemoveFrame().

[1] https://hg.mozilla.org/mozilla-central/rev/c2ba52894016007c3f5c4f21241f14d3cd7bd7a3

Differential Revision: https://phabricator.services.mozilla.com/D214775
2024-06-26 20:24:58 +00:00
Ting-Yu Lin
d52e3dc178 Bug 1903141 Part 3 - Store floats list in a frame property rather than in nsBlockFrame::mFloats. r=dholbert
On optimized builds for all desktop platforms, `nsBlockFrame` is 192 bytes, and
`mFloats` is 16 bytes. With this patch, we can reduce the size of `nsBlockFrame`
to 176 bytes, saving 8.33% memory on every `nsBlockFrame` and its derived
subclasses allocated.

On a real webpage like https://en.wikipedia.org/wiki/Firefox, `about:memory`
shows that we allocate 0.36 MB of `nsBlockFrame` consistently. After this patch,
we allocate 0.33 MB, saving approximately 30 KB (0.36 MB * 8.33%) of the memory.

Differential Revision: https://phabricator.services.mozilla.com/D214046
2024-06-19 21:50:41 +00:00
Ting-Yu Lin
d00d8eefb7 Bug 1903141 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert
After Bug 1902542 Part 5 [1], the pushed floats list is deleted if it is empty.
Therefore, we can simplify `MaybeHasFloats()` as suggested in the XXX comment.

[1] https://hg.mozilla.org/mozilla-central/rev/52a9610fc9f2

Differential Revision: https://phabricator.services.mozilla.com/D214044
2024-06-19 21:50:40 +00:00
pstanciu
f3651823b9 Backed out 3 changesets (bug 1903141) for causing crashtest failures on nsSplittableFrame.cpp CLOSED TREE
Backed out changeset ccd18b9b52fc (bug 1903141)
Backed out changeset fbd60d2007b0 (bug 1903141)
Backed out changeset ce65f1574c68 (bug 1903141)
2024-06-19 03:15:25 +03:00
Ting-Yu Lin
94a9ed2943 Bug 1903141 Part 3 - Store floats list in a frame property rather than in nsBlockFrame::mFloats. r=dholbert
On optimized builds for all desktop platforms, `nsBlockFrame` is 192 bytes, and
`mFloats` is 16 bytes. With this patch, we can reduce the size of `nsBlockFrame`
to 176 bytes, saving 8.33% memory on every `nsBlockFrame` and its derived
subclasses allocated.

On a real webpage like https://en.wikipedia.org/wiki/Firefox, `about:memory`
shows that we allocate 0.36 MB of `nsBlockFrame` consistently. After this patch,
we allocate 0.33 MB, saving approximately 30 KB (0.36 MB * 8.33%) of the memory.

Differential Revision: https://phabricator.services.mozilla.com/D214046
2024-06-18 20:13:55 +00:00
Ting-Yu Lin
f8c82f76ac Bug 1903141 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert
After Bug 1902542 Part 5 [1], the pushed floats list is deleted if it is empty.
Therefore, we can simplify `MaybeHasFloats()` as suggested in the XXX comment.

[1] https://hg.mozilla.org/mozilla-central/rev/52a9610fc9f2

Differential Revision: https://phabricator.services.mozilla.com/D214044
2024-06-18 20:13:54 +00:00
Ting-Yu Lin
3fe028079a Bug 1902542 Part 5 - Delete empty pushed floats list in nsBlockFrame::RemoveFloat(). r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D213702
2024-06-14 17:13:05 +00:00
Ting-Yu Lin
b4b72988b8 Bug 1902542 Part 3 - Clean up nsBlockFrame's pushed floats handling. r=layout-reviewers,emilio
Add an "s" to PushedFloatsProperty() to match the state bit.

Rename `RemovePushedFloats()` to `StealPushedFloats()` to match other APIs that
take the ownership of a frame list.
https://searchfox.org/mozilla-central/rev/4c8627a76e2e0a9b49c2b673424da478e08715ad/layout/generic/nsContainerFrame.h#598-612

Differential Revision: https://phabricator.services.mozilla.com/D213700
2024-06-14 17:13:04 +00:00
Ting-Yu Lin
5aea04a131 Bug 1902542 Part 2 - Clean up another nsBlockFrame's state bit related to cached intrinsic. r=layout-reviewers,emilio
Remove "FRAME" for the bit for the consistency with other bits.

Differential Revision: https://phabricator.services.mozilla.com/D213699
2024-06-14 17:13:04 +00:00
Ting-Yu Lin
4be8fd1565 Bug 1902542 Part 1 - Clean up nsBlockFrame's helper and state bits related to ::marker. r=layout-reviewers,emilio
- Remove "FRAME" for nsBlockFrame state bits for the consistency with other bits.

- Use helpers instead of checking state bits if possible.

- Tweak one line documentation to use C++ comment style.

- Move `GetMarker()` to protected section because it is used only internally.

Differential Revision: https://phabricator.services.mozilla.com/D213698
2024-06-14 17:13:03 +00:00
Ting-Yu Lin
a653b7becd Bug 1899894 - Remove debug statements that require customized #define. r=layout-reviewers,emilio
The debug statements all require customized #define to enable. I don't feel it
is useful to leave code that is not compiled in the default debug build.

Differential Revision: https://phabricator.services.mozilla.com/D212192
2024-05-31 17:45:44 +00:00
Ting-Yu Lin
8d546a2fd5 Bug 1899345 Part 1 - Convert PhysicalAxes to an EnumSet<PhysicalAxis>. r=layout-reviewers,emilio
This also makes `PhysicalAxis::{Horizontal,Vertical}` more useful when we
previous needed `PhysicalAxes::{Horizontal,Vertical}`.

Differential Revision: https://phabricator.services.mozilla.com/D211941
2024-05-30 17:58:25 +00:00
Ting-Yu Lin
5cdee429ce Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-30 06:32:22 +00:00