308 Commits
Author SHA1 Message Date
serge-sans-paille 03b0f2574c Bug 2040876 - Activate modernize-use-bool-literals clang-tidy check r=emilio,webrtc-reviewers,cookie-reviewers,places-reviewers,layout-reviewers,mak,bwc
Differential Revision: https://phabricator.services.mozilla.com/D301473
2026-05-25 21:13:49 +00:00
Ting-Yu Lin 1a4668757b Bug 2038366 - Add a child frame iterator for nsLineBox, and adapt callers. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D299505
2026-05-09 13:56:59 +00:00
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
Emily McDonough 2490e6d383 Bug 1994516 - Make nsILineIterator::FindLineContaining take a const nsIFrame*. r=layout-reviewers,TYLin
This requires making nsTHashtable::Contains and nsFrameList::IndexOf accept
const pointers.

Differential Revision: https://phabricator.services.mozilla.com/D268778
2025-10-16 18:14:53 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Jonathan Kew 34f2bedc14 Bug 1968899 - Add a missing space to nsLineBox::List output. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D251496
2025-05-28 10:29:23 +00:00
Otto Länd 601b7c4b76 Bug 1945944: apply code formatting via Lando
# ignore-this-changeset
2025-02-06 15:52:02 +00:00
David Shin 61d5b05704 Bug 1945944: Add flag to dump frame tree with only deterministic information for diffing. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D236797
2025-02-06 15:34:27 +00:00
Jonathan Kew 55066c9ce0 Bug 1887465 - Introduce UsedFloat and UsedClear types in layout, for the used values of CSS float and clear properties after resolving logical values. r=layout-reviewers,emilio
No change in behavior, just makes it clearer when we're working with used values
where the inline-* logical values have been resolved.

Differential Revision: https://phabricator.services.mozilla.com/D230029
2024-11-25 22:58:47 +00:00
Jonathan Kew 0813b3e111 Bug 1887465 - Use the containing block's writing mode to resolve logical values for CSS float and clear properties. r=layout-reviewers,emilio
And don't resolve them prematurely; the computed value should remain
logical, and only be mapped to physical sides at use time.

Differential Revision: https://phabricator.services.mozilla.com/D229998
2024-11-25 22:58:46 +00:00
Alexandru Marc ed1511635d Backed out 2 changesets (bug 1887465) for causing build bustages @ WritingModes.h . CLOSED TREE
Backed out changeset 5203c09eceb4 (bug 1887465)
Backed out changeset 0507fcccf575 (bug 1887465)
2024-11-25 18:47:23 +02:00
Jonathan Kew 4d1ec66bf7 Bug 1887465 - Introduce UsedFloat and UsedClear types in layout, for the used values of CSS float and clear properties after resolving logical values. r=layout-reviewers,emilio
No change in behavior, just makes it clearer when we're working with used values
where the inline-* logical values have been resolved.

Differential Revision: https://phabricator.services.mozilla.com/D230029
2024-11-25 14:02:27 +00:00
Jonathan Kew 64fa9b6bb6 Bug 1887465 - Use the containing block's writing mode to resolve logical values for CSS float and clear properties. r=layout-reviewers,emilio
And don't resolve them prematurely; the computed value should remain
logical, and only be mapped to physical sides at use time.

Differential Revision: https://phabricator.services.mozilla.com/D229998
2024-11-25 14:02:26 +00:00
David Shin c35c146cbd Bug 1768921 - Ensure that padding inflated bounds of in-flow children are included in the scrollable element's overflow area. r=dholbert
This means that when users scroll to the inline-end of a scroller, they will
see that the inline-end padding of that scroller is added in.

This is achieved by unioning an additional rect into the scrollable element's
overflow area (Which is an accumulation of the recursive overflow-area
contributions from its subtree).

This additional rect is calculated as follows:
- In-flow children and float's margin boxes are unioned (including zero-size boxes)
- The unioned rect is then inflated by the scrollable element's padding

Note: The bounds of zero-area in-flow-child rects are included in this rect,
in both block- and inline- directions. This is a change in behavior; Divs of
huge inline size and zero block size used to not affect the scrollable overflow,
where divs with huge block size and zero inline size did, as a side effect of now
removed `nsBlockFrame::ConsiderBlockEndEdgeOfChildren`.

Note on WPT change sizing-orthog-(vlr|vrl)-in-htb-(008|020)-ref.xht - the padding existed
to force empty space below `p#sentence-after`. However, this only applies to previous
Firefox. Any combination of browser + default font (+ its default size) causing a scroll
would cause the test to fail as false positive (According to wpt.fyi, this is what happens
with sizing-orthog-(vlr|vrl)-008.xht tests). This change brings Firefox's scroll behaviour
inline with other browsers.

Differential Revision: https://phabricator.services.mozilla.com/D151310
2024-11-13 20:29:13 +00:00
Norisz Fay 07ccada8ce Backed out changeset 1445e1cfc71f (bug 1768921) for causing multiple failures CLOSED TREE 2024-11-08 00:09:56 +02:00
David Shin 361dd30414 Bug 1768921 - Ensure that padding inflated bounds of in-flow children are included in the scrollable element's overflow area. r=dholbert
This means that when users scroll to the inline-end of a scroller, they will
see that the inline-end padding of that scroller is added in.

This is achieved by unioning an additional rect into the scrollable element's
overflow area (Which is an accumulation of the recursive overflow-area
contributions from its subtree).

This additional rect is calculated as follows:
- In-flow children and float's margin boxes are unioned (including zero-size boxes)
- The unioned rect is then inflated by the scrollable element's padding

Note: The bounds of zero-area in-flow-child rects are included in this rect,
in both block- and inline- directions. This is a change in behavior; Divs of
huge inline size and zero block size used to not affect the scrollable overflow,
where divs with huge block size and zero inline size did, as a side effect of now
removed `nsBlockFrame::ConsiderBlockEndEdgeOfChildren`.

Note on WPT change sizing-orthog-(vlr|vrl)-in-htb-(008|020)-ref.xht - the padding existed
to force empty space below `p#sentence-after`. However, this only applies to previous
Firefox. Any combination of browser + default font (+ its default size) causing a scroll
would cause the test to fail as false positive (According to wpt.fyi, this is what happens
with sizing-orthog-(vlr|vrl)-008.xht tests). This change brings Firefox's scroll behaviour
inline with other browsers.

Differential Revision: https://phabricator.services.mozilla.com/D151310
2024-11-07 21:03:05 +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
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 2196dff2ca Bug 1896875 - Destroy line list and the frames in reverse order to avoid non-linear time complexity. r=layout-reviewers,eeejay,emilio
This patch is similar to
https://hg.mozilla.org/mozilla-central/rev/e8114275db22

We destroy the line list and the frames in reverse order to avoid unnecessary
first-in-flow and first-continuation cache update.

Differential Revision: https://phabricator.services.mozilla.com/D211681
2024-05-28 16:53:23 +00:00
Ting-Yu Lin 3b85ae14c5 Bug 1839994 Part 3 - Improve the implementation and docs around mHasForcedLineBreak and mFloatClearType. r=dholbert
Rename `mHasForcedLineBreak` to `mHasForcedLineBreakAfter` since block lines
don't need to set this bit. This patch removes setting the bit in
`SetFloatClearTypeBefore()`, and adds an assertion in
`HasForcedLineBreakAfter()` to ensure that.

Improve `HasFloatClearType(Before|After)` implementation by using
`FloatClearType(Before|After)`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D205154
2024-03-20 17:05:42 +00:00
Norisz Fay a7b0088da8 Backed out 4 changesets (bug 1865012) for causing mochitest failure on test_gencontent.html CLOSED TREE
Backed out changeset 95d920859b91 (bug 1865012)
Backed out changeset 26f6c2765cb5 (bug 1865012)
Backed out changeset 30a3c356ebc9 (bug 1865012)
Backed out changeset 4fb71ff990ae (bug 1865012)
2024-01-23 02:17:49 +02:00
Ting-Yu Lin 93ff832b21 Bug 1865012 Part 2 - Add nsFrameList::RemoveLastChild, and destroy frame list in reverse order. r=dholbert
With only the Part 1, `layout/generic/crashtests/1683126.html` will timeout.
It can be reproduced locally via

```
./mach crashtest layout/generic/crashtests/1683126.html
```

It is because if we destroy a frame list from the first child to the last child,
each time we destroy the first child [1], the second child become the new first
child, and we have to update the first-in-flow and first-continuation cache for
later continuations, which is a linear time operation.

[1] See nsSplittableFrame::RemoveFromFlow() with the argument being the first
child in a frame list.

Differential Revision: https://phabricator.services.mozilla.com/D197967
2024-01-22 19:50:48 +00:00
Sylvestre Ledru b0fe72dee5 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan 7388749830 Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru 4a97019e39 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Emilio Cobos Álvarez 6c324c6d1b Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
2023-09-07 11:46:30 +00:00
Narcis Beleuzu 33592fec5e Backed out changeset 55052ae7d067 (bug 1851868) for reftest failure on 1153695.html . CLOSED TREE 2023-09-07 02:42:25 +03:00
Emilio Cobos Álvarez 0698c96bd1 Bug 1851868 - Refactor nsIFrame::Destroy to pass a single DestroyContext parameter. r=dholbert
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.

This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.

It's also a bit nicer to add things there if we need to in the future.

Differential Revision: https://phabricator.services.mozilla.com/D187578
2023-09-06 22:34:35 +00:00
Emilio Cobos Álvarez 1dfe44d7d4 Bug 1792333 - Factor out the "find closest frame in the line" checks. r=dholbert
Depends on D158085

Differential Revision: https://phabricator.services.mozilla.com/D158437
2022-10-02 07:06:46 +00:00
Ting-Yu Lin 78c77ab5fa Bug 1792134 Part 6 - More rename and clean up related to StyleClear. r=emilio
* Rename `mBreakType` to `mFloatClearType` in nsLineBox and nsReflowStatus and
  the methods around it.
* Rename `mBreakType` to `mClear` in nsStyleDisplay.
* Many other method parameters or local variables rename such as from
  `aBreakType` to `aClearType`.

Differential Revision: https://phabricator.services.mozilla.com/D158276
2022-09-29 03:40:56 +00:00
Ting-Yu Lin 4ba1c43b5f Bug 1792134 Part 5 - Improve nsLineBox log. r=emilio
* Print StyleClear value verbatim.
* Print mHasForcedLineBreak bit.
* Remove mAllFlags since I doubt anyone can decipher FlagBits from it.

Differential Revision: https://phabricator.services.mozilla.com/D158226
2022-09-29 03:40:56 +00:00
Ting-Yu Lin 3ce44b3c06 Bug 1792134 Part 3 - Remove StyleClear::Line. r=emilio
Before this patch, StyleClear::Line indicates that the nsLineBox has break-after
but no float clearance (note we don't allow line break-before with clear:none);
StyleClear::None indicates the line has no break-before nor break-after.

In this patch, I added `mHasForcedLineBreak` bit in nsLineBox to indicate the
line has a break so that StyleClear can serve its original meaning -- the float
clearance. In Part 6, I'll rename more existing methods and variables related to
float clearance.

Now, instead of using StyleClear::None to clear the line break status, the
caller should use ClearForcedLineBreak(); Similar to set
SetInlineLineBreakBeforeAndReset() and SetInlineLineBreakAfter on
nsReflowStatus, SetBreakTypeBefore/SetBreakTypeAfter on nsLineBox always sets
break status with an optional float clearance parameter.

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D158224
2022-09-29 03:40:55 +00:00
Ting-Yu Lin 1f1d620f94 Bug 1792391 Part 3 - Override GetFrameName() for BRFrame, and improve nsLineBox::List(). r=emilio
Override GetFrameName() for BRFrame so that frame tree dump shows `BR(br)`
rather than `Frame(br)`.

Also, expand nsLineBox::StateToString() in List() to get rid of `cbuf`.

Differential Revision: https://phabricator.services.mozilla.com/D158111
2022-09-26 16:32:33 +00:00
Ting-Yu Lin 3092101882 Bug 498986 Part 2 - Remove unused nsFloatCache, nsFloatCacheList, and nsFloatCacheFreeList. r=emilio
Also, remove unused `LINE_MAX_CHILD_COUNT` in nsLineBox.h

Differential Revision: https://phabricator.services.mozilla.com/D157977
2022-09-23 06:42:09 +00:00
Ting-Yu Lin 602a614514 Bug 498986 Part 1 - Use nsTArray<nsIFrame*> to store float list in nsLineBox and BlockReflowState. r=emilio
Nowadays, nsFloatCache stores no extra information but `nsIFrame*`, which makes
nsFloatCacheList and nsFloatCacheFreeList are just singly and doubly linked
list of frames, respectively.

Most of this patch is a plain rewrite to use nsTArray APIs. There are two
rewrite that need more explanation.

1. `BlockReflowState::mFloatCacheFreeList` is served as a temporarily list to
   avoid extra allocations of nsFloatCache. It takes the ownership of floats
   from a line via FreeFloats(), and later reuses the cache in AddFloat().
   We don't need this anymore, so we remove it.

2. In `PlaceBelowCurrentLineFloats()`, the old code removes a float which
   needs to be pushed to next continuation from `mBelowCurrentLineFloats`.
   After looking through all of the floats, the remaining of
   `mBelowCurrentLineFloats` are moved to the line because they belong to the
   line. In this patch, rather than removing the pushed floats one by one from
   `mBelowCurrentLineFloats`, I use a new list to collect the floats that need
   to be added to the line, and just clear `mBelowCurrentLineFloats` at the
   end of the method.

Differential Revision: https://phabricator.services.mozilla.com/D157976
2022-09-23 06:42:09 +00:00
Ting-Yu Lin d3eb874b94 Bug 1791701 - Remove StyleClear::Max. r=emilio
The `static_assert` is not very useful and maybe too strict because `StyleClear`
is 8-bits, and we've asserted that `FlagBits` should be not greater than 32-bits
in nsLineBox.h.

Differential Revision: https://phabricator.services.mozilla.com/D157772
2022-09-21 15:26:51 +00:00
Jonathan Kew 2aefad4cba Bug 1732674 - Make nsLineIterator a lightweight wrapper for an nsLineList_iterator instead of building a separate array. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D126671
2021-11-09 15:55:54 +00:00
Norisz Fay eff51791b8 Backed out 2 changesets (bug 1732674) for line iterator crashes (bug 1733047) a=backout
Backed out changeset 730555699380 (bug 1732674)
Backed out changeset f529288a6dde (bug 1732674)
2021-10-20 12:24:14 +03:00
Jonathan Kew 7876f52255 Bug 1732674 - Make nsLineIterator a lightweight wrapper for an nsLineList_iterator instead of building a separate array. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D126671
2021-10-19 09:29:13 +00:00
criss 11a1ff81b1 Backed out changeset ce929d9e000a (bug 1732674) for causing nsLineIterator::FindLineContaining crashes (bug 1733047) . a=aryx 2021-10-16 12:46:38 +03:00
Jonathan Kew bdae338df9 Bug 1732674 - Make nsLineIterator a lightweight wrapper for an nsLineList_iterator instead of building a separate array. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D126671
2021-10-15 13:13:04 +00:00
Alexandru Michis ea4bf7df26 Backed out changeset a4ebb978f792 (bug 1732674) for causing layout crashes (bug 1733047). a=backout 2021-09-30 17:38:15 +03:00
Jonathan Kew c3d0562e7d Bug 1732674 - Make nsLineIterator a lightweight wrapper for an nsLineList_iterator instead of building a separate array. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D126671
2021-09-29 17:55:44 +00:00
Cristian Tuns 3093f32574 Backed out changeset 43d9f690a94f (bug 1732674) to fix nsLineIterator crashes (bug 1733047). CLOSED TREE 2021-09-29 03:45:51 -04:00
Jonathan Kew 122603416d Bug 1732674 - Make nsLineIterator a lightweight wrapper for an nsLineList_iterator instead of building a separate array. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D126671
2021-09-28 11:34:02 +00:00
Jonathan Kew 63a0a7ce02 Bug 1732355 - Eliminate the nsILineIterator::GetNextSiblingOnLine virtual method, whose only implementations are trivial. r=layout-reviewers,emilio
Depends on D126532

Differential Revision: https://phabricator.services.mozilla.com/D126533
2021-09-24 14:20:07 +00:00
Jonathan Kew be38903007 Bug 1732268 - Remove redundant failure-checks from nsLineIterator initialization, as it uses infallible allocation. r=dholbert
This means nsBlockFrame::GetLineIterator is also infallible, so callers that know
they're dealing with an nsBlockFrame (not an arbitrary nsIFrame) don't need to
check for null.

Differential Revision: https://phabricator.services.mozilla.com/D126470
2021-09-24 14:20:05 +00:00
Simon Giesecke 32d04cdc11 Bug 708901 - Migrate to nsTHashSet in layout. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108597
2021-03-24 17:56:46 +00:00