Commit Graph
277 Commits
Author SHA1 Message Date
Leo Tenenbaum 14e83643ee Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D299228
2026-05-15 17:25:28 +00:00
Atila Butkovits 6706fac649 Revert "Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki" for causing failures at test_drag_drop_caret.html.
This reverts commit 524b0cc22b.
2026-05-15 13:53:29 +00:00
Leo Tenenbaum 524b0cc22b Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D299228
2026-05-15 13:07:26 +00:00
Daniel Holbert 9c0ef373b0 Bug 2038723: Use MakeRefPtr to do allocation for local RefPtr variables, in layout. r=layout-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D299753
2026-05-12 19:56:07 +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
Timothy Nikkel 706ca7fd37 Bug 2034989. Use UniquePtr to manage TextOverflow objects in nsBlockFrame::BuildDisplayList to save some stack space. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D296518
2026-04-25 15:41:01 +00:00
Jonathan Kew 2dcc342e1a Bug 1983677 - patch 2 - Cache ellipsis textrun in TextOverflow for cases where it is rendered on multiple lines in the block. r=layout-reviewers,lsalzman,dshin
This is helpful in cases like a large <pre> element with text-wrap:nowrap and
text-overflow:ellipsis where there are many long lines, all of which get an
ellipsis rendered.

Differential Revision: https://phabricator.services.mozilla.com/D295901
2026-04-23 08:01:39 +00:00
Jonathan Kew 9851e0e8a8 Bug 1983677 - patch 1 - Remove the cached ellipsis textrun from gfxFontGroup. r=lsalzman
This also lets us get rid of gfxTextRun::ReleaseFontGroup and associated cruft.

Differential Revision: https://phabricator.services.mozilla.com/D295900
2026-04-23 08:01:35 +00:00
serge-sans-paille 115d971353 Bug 2025273 - Activate modernize-loop-convert clang-tidy check r=media-playback-reviewers,webrtc-reviewers,profiler-reviewers,firefox-svg-reviewers,canaltinova,longsonr,mjf,alwu
This is mostly the result of running ./mach static-analysis check --fix
with the new linter activated, with the following caveats:

- use std::fill when it makes sense
- use appropriate names for the loop target variable
- fix constness
- use array default initialization instead of an explicit loop when it
  makes sense

Differential Revision: https://phabricator.services.mozilla.com/D289172
2026-03-26 12:27:13 +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
Emilio Cobos Álvarez 30b7a3d89a Bug 2014922 - Untangle pseudo-element and anon box definitions. r=firefox-style-system-reviewers,xpcom-reviewers,layout-reviewers,dshin,nika
I looked at this because in bug 2014331 I need to mark more pseudos as
element-backed, and it's kinda silly the state our setup is in right
now.

This is all a somewhat historical mess, because in the old style system
pseudo-elements were just atoms, and we had that different types of atom
setup. The source of truth for these right now lives in a header macro
file, which isn't very flexible.

But now we have PseudoStyleType which represents both pseudos and anon
boxes, and is similar to the rust side PseudoElement enum.

Plus, the ::-moz-tree pseudo-elements are defined as anon boxes which
doesn't make any sense, so move them to pseudo-elements while at it.

Unify this in a similar way we treat CSS properties: Source of truth is
in pseudo_elements.toml / anon_boxes.toml, and we generate Rust and C++
as needed. This allows removing the nsStaticAtom subclass thing from
XPCOM, too.

This avoids some nasty duplication around which pseudos are pref-gated
and what not as well.

Differential Revision: https://phabricator.services.mozilla.com/D282076
2026-02-06 07:39:54 +00:00
Norisz Fay 27f4694604 Revert "Bug 2014922 - Untangle pseudo-element and anon box definitions. r=firefox-style-system-reviewers,xpcom-reviewers,layout-reviewers,dshin,nika" for causing bustage @ ElementAnimationData.h
This reverts commit c70290c619.
2026-02-06 05:34:42 +00:00
Emilio Cobos Álvarez c70290c619 Bug 2014922 - Untangle pseudo-element and anon box definitions. r=firefox-style-system-reviewers,xpcom-reviewers,layout-reviewers,dshin,nika
I looked at this because in bug 2014331 I need to mark more pseudos as
element-backed, and it's kinda silly the state our setup is in right
now.

This is all a somewhat historical mess, because in the old style system
pseudo-elements were just atoms, and we had that different types of atom
setup. The source of truth for these right now lives in a header macro
file, which isn't very flexible.

But now we have PseudoStyleType which represents both pseudos and anon
boxes, and is similar to the rust side PseudoElement enum.

Plus, the ::-moz-tree pseudo-elements are defined as anon boxes which
doesn't make any sense, so move them to pseudo-elements while at it.

Unify this in a similar way we treat CSS properties: Source of truth is
in pseudo_elements.toml / anon_boxes.toml, and we generate Rust and C++
as needed. This allows removing the nsStaticAtom subclass thing from
XPCOM, too.

This avoids some nasty duplication around which pseudos are pref-gated
and what not as well.

Differential Revision: https://phabricator.services.mozilla.com/D282076
2026-02-06 03:42:45 +00:00
serge-sans-paille c3b06ff4b4 Bug 1997165 - Remove unused mfbt inclusion in layout/** r=emilio,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,dshin,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D270577
2025-10-29 22:18:06 +00:00
serge-sans-paille 1667ec582b Bug 1995723 - Remove unused inclusion of mozilla/ArrayUtils.h r=necko-reviewers,application-update-reviewers,media-playback-reviewers,profiler-reviewers,win-reviewers,firefox-svg-reviewers,layout-reviewers,gstoll,canaltinova,bytesized,alwu,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D269573
2025-10-23 07:30:37 +00:00
Emilio Cobos Álvarez fd1f57b58d Bug 1873301 - Remove nsHTMLButtonControlFrame. r=dholbert,layout-reviewers,dshin
This removes the implementation of nsHTMLButtonControlFrame, instead
reusing nsBlockFrame + align-content (or the relevant display type for
flex / grid / columns / etc).

This matches what Blink does and, for the most part, it is trivial.
It requires moving some special cases around, and override inline flow
display, tho so that buttons don't suddenly start fragmenting in the
inline axis.

It adds a tiny fix for a writing-mode mismatch in
nsBlockFrame::AlignContent(), covered by
layout/reftests/writing-mode/1138356-1-button-contents-alignment.html

containing-block-change-button tests are tweaked to avoid overflowing
the 600px viewport from WPT reftests causing scrollbar fuzziness.

contain-layout-baseline-005.html removes the <select> element just like
https://chromium-review.googlesource.com/c/chromium/src/+/5479489
removed the <button>s, since they align the same now, added a test for
that.

Differential Revision: https://phabricator.services.mozilla.com/D257149
2025-07-15 11:05:54 +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
Hiroyuki Ikezoe 04662183d2 Bug 1965330 - Make GetSnappedBaseline[X|Y] gated by layout.disable-pixel-alignment. r=emilio
The reason why we modify mongolian-orientation-002.html.ini is that
we've already set layout.scroll.disable-pixel-alignment to true for all
web platform tests [1].

[1] https://searchfox.org/mozilla-central/rev/ced8457641a062908760d480275f76ccc4d496d1/testing/web-platform/meta/__dir__.ini#1

Differential Revision: https://phabricator.services.mozilla.com/D248531
2025-06-06 09:06:43 +00:00
Julien Cristau 63936e9736 Backed out 5 changesets (bug 1965330) for reftest failures
Backed out changeset 586f132b2ad7 (bug 1965330)
Backed out changeset 6cd2e3e3e11c (bug 1965330)
Backed out changeset 57b4521b3f44 (bug 1965330)
Backed out changeset f758a758914e (bug 1965330)
Backed out changeset cd6ed268f238 (bug 1965330)

Differential Revision: https://phabricator.services.mozilla.com/D252667
2025-06-05 13:53:57 +00:00
Hiroyuki Ikezoe 55889b1fa2 Bug 1965330 - Make GetSnappedBaseline[X|Y] gated by layout.disable-pixel-alignment. r=emilio
The reason why we modify mongolian-orientation-002.html.ini is that
we've already set layout.scroll.disable-pixel-alignment to true for all
web platform tests [1].

[1] https://searchfox.org/mozilla-central/rev/ced8457641a062908760d480275f76ccc4d496d1/testing/web-platform/meta/__dir__.ini#1

Differential Revision: https://phabricator.services.mozilla.com/D248531
2025-06-05 01:22:57 +00:00
Timothy Nikkel 292af322c3 Bug 1933440. Make all display item destructors default and mark all display items final that can be. r=layout-reviewers,jfkthame
This just makes things nice and consistent and lets the compiler optimize if it can.

Differential Revision: https://phabricator.services.mozilla.com/D230249
2024-12-06 13:22:11 +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
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 3ca9c49882 Bug 1917715 - Rename nsLayoutUtils::GetColor. r=longsonr,dholbert
It's suitable for foreground colors only.

Differential Revision: https://phabricator.services.mozilla.com/D221557
2024-09-09 23:12:05 +00:00
Ting-Yu Lin 76523f97b1 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-30 06:32:20 +00:00
Sebastian Hengst bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin 16b24f6c41 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-28 04:46:18 +00:00
Emilio Cobos Álvarez 19f778623d Bug 1899126 - Simplify TextOverflow handling in the style engine. r=jwatt
No good reason to have different computed / specified representations.

Differential Revision: https://phabricator.services.mozilla.com/D211728
2024-05-27 17:14:32 +00:00
Ting-Yu Lin b4a0842882 Bug 1824877 Part 3 - Change ScrollContainerFrame's type from Scroll to ScrollContainer. r=dholbert
This effectively changes the `IsScrollFrame()` helper to
`IsScrollContainerFrame()`.

Differential Revision: https://phabricator.services.mozilla.com/D210357
2024-05-15 17:50:49 +00:00
Ting-Yu Lin 53837706d6 Bug 1824877 Part 1 - Rename nsGfxScrollFrame.{h,cpp} to ScrollContainerFrame.{h,cpp}. r=dholbert
Remove the #include from `nsFrameState.cpp` because it is not used.

Differential Revision: https://phabricator.services.mozilla.com/D210232
2024-05-15 17:50:48 +00:00
Emilio Cobos Álvarez 14c69b2672 Bug 1362907 - Make select use nsHTMLButtonControlFrame for layout. r=jfkthame,dholbert
This simplifies our combobox code a bit more:

 * Reflow() is only needed to compute the label isize.
 * Frame construction uses a setup more similar to <input type=file> to
   get the right frame tree, removing a bunch of special code.
 * Lots of special code removed all over the place.

Differential Revision: https://phabricator.services.mozilla.com/D203010
2024-02-29 11:15:52 +00:00
Robert Longson 841e079aa9 Bug 1816628 Part 1 - Account for horizontal overflow caused by text-shadow r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200435
2024-02-28 18:51:23 +00:00
Stanca Serban 1b062c0f39 Backed out 2 changesets (bug 1816628) for causing OS X mochitests-plain failures in test_bug1426594.html.
Backed out changeset e32deae0b0b4 (bug 1816628)
Backed out changeset 3ee753e740b9 (bug 1816628)
2024-02-24 06:38:52 +02:00
Robert Longson 0d94aa3378 Bug 1816628 Part 1 - Account for horizontal overflow caused by text-shadow r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200435
2024-02-23 23:48:23 +00:00
Stanca Serban 7235cac1d4 Backed out 2 changesets (bug 1816628) for linux related wr failures in SVGTextFrame.cpp. CLOSED TREE
Backed out changeset d58d91582a84 (bug 1816628)
Backed out changeset ddaf27e9243d (bug 1816628)
2024-02-23 21:37:04 +02:00
Robert Longson 9631cdc7fb Bug 1816628 Part 1 - Account for horizontal overflow caused by text-shadow r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200435
2024-02-23 16:58:58 +00:00
Jonathan Kew f9312fc171 Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-04 11:07:44 +00:00
Iulian Moraru 27b6f41469 Backed out changeset 21beaf6ba627 (bug 1872545) for causing windows build bustages on FontPaletteCache.cpp. CLOSED TREE 2024-01-04 01:54:01 +02:00
Jonathan Kew e976fa1b8c Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-03 22:54:10 +00:00
Cristian Tuns 7695546799 Backed out changeset 395cc57551ec (bug 1872545) for causing build bustages in rust.mk CLOSED TREE 2024-01-03 05:14:31 -05:00
Jonathan Kew 66b754598a Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-02 13:12:29 +00:00
Narcis Beleuzu 99b9ad7672 Backed out changeset e959df5e9484 (bug 1872545) for bustages on COLRFonts.cpp 2024-01-02 13:50:05 +02:00
Jonathan Kew c018bc5255 Bug 1872545 - Hoist color-font palette cache out of TextRunDrawParams to the nsPresContext or CanvasRenderingContext2D, for greater effectiveness. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D197463
2024-01-02 09:52:49 +00:00
Emilio Cobos Álvarez c27730d3df Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00