Commit Graph
184 Commits
Author SHA1 Message Date
Daniel Holbert 10725540f6 Bug 2037754: Use 'MakeAndAddRef' instead of 'new' when allocating runnable for nsContentUtils::AddScriptRunner. r=dom-core,smaug
MakeAndAddRef ensures that the freshly-allocated object immediately gets a
refcount of 1 (before it's even passed to AddScriptRunner).  This avoids
several potential footguns that otherwise exist with a zero-refcount
freshly-allocated object.

It also makes the ownership-transfer semantics more clear
(via the already_AddRefed type that it produces) - AddScriptRunner is taking
ownership of the object, rather than using it temporarily while the caller
maintains ownership.

Differential Revision: https://phabricator.services.mozilla.com/D299039
2026-05-07 06:35:57 +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 d9f08ccbc6 Bug 2021694 - Remove GetXULBoolAttr. r=smaug,devtools-reviewers,nchevobbe
Three callers:

 * fixed attribute is only used as fixed=true for treecolumns, so no
   behavior change.
 * noautofocus is already only used as =true or removed, so no behavior
   change.
 * incontentshell is only used with ="false", rename to
   escapecontentshell and flip the meaning.

Remove the API and similar GetXUL* stuff that did the same.

Differential Revision: https://phabricator.services.mozilla.com/D286520
2026-03-09 19:33:57 +00:00
Sam Foster 0625e18cfe Bug 2014761 - Constrain the splitter to actual max width/height when handling arrow keys. r=emilio,tabbrowser-reviewers,layout-reviewers,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D283115
2026-02-13 22:27:57 +00:00
Sam Foster e5754d5a7d Bug 2012633 - Add arrow keydown handling to xul:splitter and hook up keyboard resizing of split views. r=emilio,fluent-reviewers,desktop-theme-reviewers,tabbrowser-reviewers,layout-reviewers,bolsson,nsharpley,@tabbrowser-reviewers,ayeddi
* xul:splitter remains non-focusable by default to avoid blowing up the scope of this patch
* opt-in the splitview splitter to be focusable
* Wire up aria attributes on splitview splitter to cue AT on the resizing behavior
* New string for the aria-label on the splitview splitter
* Make the isSplitViewActive setter a setSplitViewActive method as there's no getter
* Add test coverage for the keyboard events on the splitter widget, and the splitview splitter

Differential Revision: https://phabricator.services.mozilla.com/D281109
2026-02-03 23:38:38 +00:00
serge-sans-paille 9b6eb9c7f9 Bug 1996048 - Remove unused inclusion of UniquePtr.h or UniquePtrExtensions.h r=emilio,media-playback-reviewers,profiler-reviewers,win-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,gstoll,mstange,TYLin,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D269782
2025-10-24 06:50:27 +00:00
Kagami Sascha Rosylight 5158736df9 Bug 1989925 - Return CSSStyleProperties from getComputedStyle and .style r=emilio,webidl,firefox-style-system-reviewers,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D265637
2025-09-22 20:15:13 +00:00
Masayuki Nakano 784537b41e Bug 769207 - part 2: Make nsIFrame use new enum class to receive the type of attribute change r=smaug,dom-core,dshin
`MutationEvent_Bindings::MODIFICATION`,
`MutationEvent_Bindings::ADDITION` and `MutationEvent_Bindings::REMOVAL`
will be removed.  Therefore, we need alternative `enum class` for that.
This patch makes `nsIFrame` and subclasses use the new one.

Differential Revision: https://phabricator.services.mozilla.com/D263053
2025-09-08 00:27:36 +00:00
Emilio Cobos Álvarez 0aa2101448 Bug 1979014 - Make some XUL attributes (hidden/collapsed/autofocus) regular bool attributes. r=dao,desktop-theme-reviewers,credential-management-reviewers,devtools-reviewers,tabbrowser-reviewers,places-reviewers,nchevobbe,search-reviewers,daleharvey,dimi
I audited a bit and non-test things use the script setter, which already
removed the attribute, so should be fine / no behavior change in that
regard.

Tab groups used the collapsed attribute for different purposes, so that
took a bit of digging.

This came up while reviewing some code for the native menubar code on
Linux, which uses SetBoolAttr() and doesn't hide the menubar now:

  https://searchfox.org/mozilla-central/rev/86878e73a24fe32ea09dbae5b55362efaf7485c8/widget/gtk/NativeMenuGtk.cpp#770,785,790

That is disabled by default tho.

Differential Revision: https://phabricator.services.mozilla.com/D258543
2025-07-28 16:13:46 +00:00
David Shin ad5f8e7fd0 Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256291
2025-07-14 21:28:26 +00:00
David Shin 8090f17c2b Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256290
2025-07-14 21:28:23 +00:00
pstanciu 7a21072acf Revert "Bug 1969305: Adjust WPT expectations. r=layout-reviewers,emilio" for causing failures @ anchor-name-003.html
This reverts commit 5e12720896.

Revert "Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio"

This reverts commit 27a56d04a1.

Revert "Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio"

This reverts commit 69b2bd0242.

Revert "Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio"

This reverts commit 23c707d5a7.

Revert "Bug 1969305: Implement anchor size resolution. r=layout-reviewers,emilio"

This reverts commit c0d1d8808d.
2025-07-12 02:02:55 +00:00
David Shin 27a56d04a1 Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256291
2025-07-11 15:21:45 +00:00
David Shin 69b2bd0242 Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256290
2025-07-11 15:21:42 +00:00
Atila Butkovits 0b2944a3d2 Revert "Bug 1969305: Adjust WPT expectations. r=layout-reviewers,emilio" for causing bustages at GeckoBindings.cpp.
This reverts commit 49a7b8afce.

Revert "Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio"

This reverts commit 0b615836cf.

Revert "Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio"

This reverts commit 359badb60e.

Revert "Bug 1969305: Pass anchor resolution params for margin. r=layout-reviewers,emilio"

This reverts commit 17f7f64cd8.

Revert "Bug 1969305: Implement anchor size resolution. r=layout-reviewers,emilio"

This reverts commit 47197ef7ab.
2025-07-11 01:18:14 +00:00
David Shin 0b615836cf Bug 1969305: Pass anchor resolution params for maxsize. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256291
2025-07-10 20:58:24 +00:00
David Shin 359badb60e Bug 1969305: Pass anchor resolution params for size. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D256290
2025-07-10 20:58:21 +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
David Shin 8897bdc924 Bug 1971135: Use anchor resolution params in place of position property. r=TYLin
... The full resolution that makes use of additional parameters will follow
shortly.

Differential Revision: https://phabricator.services.mozilla.com/D253175
2025-06-16 20:35:30 +00:00
David Shin 85c922b0dd Bug 1923959: Resolve anchor for (max) sizes. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D240864
2025-04-08 02:29:18 +00:00
Jonathan Watt bbe13df42d Bug 1931736. Add missing braces around if/loop statements in layout/xul/. r=layout-reviewers,emilio
Depends on D229256

Differential Revision: https://phabricator.services.mozilla.com/D229257
2024-11-17 05:04:02 +00:00
David Shin e52d21fa25 Bug 1900232: Part 5 - Add anchor-size() to sizing properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222534
2024-09-23 13:58:38 +00:00
Ting-Yu Lin cac8ac479b Bug 1914661 Part 1 - Rename NS_CSS_MINMAX, and move it into mozilla namespace. r=dholbert
`NS_CSS_MINMAX` looks like a macro, but it is a function. Let's name it like a
function.

Differential Revision: https://phabricator.services.mozilla.com/D220021
2024-08-23 19:52:49 +00:00
Gregory Pappas 48834b756d Bug 1881845 - Remove nsContentCID.h r=smaug,media-playback-reviewers,karlt
All of these components have been converted to static registration, making this
file unneeded.

Differential Revision: https://phabricator.services.mozilla.com/D202633
2024-03-04 23:41:05 +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 09eaf2464a Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin
And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
2023-03-29 21:23:55 +00:00
Emilio Cobos Álvarez 8a25b72558 Bug 1824489 - Remove nsBoxFrame, nsBoxLayout and related code. r=jwatt
We still have some remnants of XUL layout due to nsBox / nsLeafBoxFrame
which XUL trees / nsTextBoxFrame still use.

However all this code can go away before we get rid of those.
nsSplitterFrame was the last thing inheriting from nsBoxFrame.

Differential Revision: https://phabricator.services.mozilla.com/D173601
2023-03-27 23:25:42 +00:00
Emilio Cobos Álvarez f81638174d Bug 1824489 - Stop using XUL layout for nsSplitterFrame. r=jwatt
Make it a SimpleXULLeafFrame, and carry on. Ideally we'd instead move
this code out of layout altogether into a XULSplitterElement, but given
splitters can have no children, well.

At this point there's only nsTreeBodyFrame an nsTextBoxFrame left to be
able to remove all of XUL layout.

Differential Revision: https://phabricator.services.mozilla.com/D173600
2023-03-27 22:55:09 +00:00
Emilio Cobos Álvarez cdff2ecc8e Bug 1820534 - Move front-end to modern flexbox. r=Gijs,dao,settings-reviewers,credential-management-reviewers,sgalich,devtools-reviewers,nchevobbe
Done mostly automatically via find/replace following the conversions
specified here:

  https://groups.google.com/a/mozilla.org/g/firefox-dev/c/9sGpF1TNbLk/m/QpU3oTUuAgAJ

For the most part I think the "flex: N N" usage could be simplified to
just "flex: N", but I wanted to preserve behavior (-moz-box-flex sets
both flex-grow and flex-shrink).

I changed legacy layout to also look at the order property rather than
-moz-box-ordinal-group because it made splitters and treecols easier (we
don't need to deal with both orders).

Differential Revision: https://phabricator.services.mozilla.com/D171715
2023-03-08 16:13:57 +00:00
Stanca Serban 5d57898ee6 Backed out changeset c25af897c9bc (bug 1820534) for causing reftests and mochitests failures. 2023-03-08 17:34:42 +02:00
Emilio Cobos Álvarez e15feb465b Bug 1820534 - Move front-end to modern flexbox. r=Gijs,dao,settings-reviewers,credential-management-reviewers,sgalich,devtools-reviewers,nchevobbe
Done mostly automatically via find/replace following the conversions
specified here:

  https://groups.google.com/a/mozilla.org/g/firefox-dev/c/9sGpF1TNbLk/m/QpU3oTUuAgAJ

For the most part I think the "flex: N N" usage could be simplified to
just "flex: N", but I wanted to preserve behavior (-moz-box-flex sets
both flex-grow and flex-shrink).

I changed legacy layout to also look at the order property rather than
-moz-box-ordinal-group because it made splitters and treecols easier (we
don't need to deal with both orders).

Differential Revision: https://phabricator.services.mozilla.com/D171715
2023-03-08 14:11:35 +00:00
Jonathan Kew e998377ebb Bug 1815404 - Remove refcounting from gfxContext. r=gfx-reviewers,lsalzman
Depends on D170367

Differential Revision: https://phabricator.services.mozilla.com/D170369
2023-02-21 07:28:24 +00:00
Ting-Yu Lin ef6d896662 Bug 1799732 Part 3 - Convert FrameChildListID to enum class. r=emilio
This patch is first generated by the following script under gecko root folder.

```
#!/bin/bash

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "kPrincipalList" "FrameChildListID::Principal"
rename "kPopupList" "FrameChildListID::Popup"
rename "kCaptionList" "FrameChildListID::Caption"
rename "kColGroupList" "FrameChildListID::ColGroup"
rename "kAbsoluteList" "FrameChildListID::Absolute"
rename "kFixedList" "FrameChildListID::Fixed"
rename "kOverflowList" "FrameChildListID::Overflow"
rename "kOverflowContainersList" "FrameChildListID::OverflowContainers"
rename "kExcessOverflowContainersList" "FrameChildListID::ExcessOverflowContainers"
rename "kOverflowOutOfFlowList" "FrameChildListID::OverflowOutOfFlow"
rename "kFloatList" "FrameChildListID::Float"
rename "kBulletList" "FrameChildListID::Bullet"
rename "kPushedFloatsList" "FrameChildListID::PushedFloats"
rename "kBackdropList" "FrameChildListID::Backdrop"
rename "kNoReflowPrincipalList" "FrameChildListID::NoReflowPrincipal"
```

And then:
1. Manually fix `FrameChildListID` definition in nsFrameList.h.
2. Apply clang-format.

Differential Revision: https://phabricator.services.mozilla.com/D161864
2022-11-12 04:38:53 +00:00
Ting-Yu Lin 6c9e155611 Bug 1799732 Part 2 - Flatten the namespace for FrameChildList and co. by removing namespace layout. r=emilio
After moving FrameChildListID into mozilla namespace, `kPrincipalList` etc. are
also exposed in the mozilla namespace. In the next part, I'll convert
FrameChildListID enum into an enum class, so the naming pollution shouldn't be
an issue.

This patch has a nice side effect that it is now easier to remove all the
aliases of FrameChildListID (`kPrincipalList` etc.) defined in multiple places
since it is confusion to have the same thing written in different ways, e.g.
`nsIFrame::kPrincipalList`, `mozilla::layout::kPrincipalList`,
`FrameChildListID::kPrincipalList`, `kPrincipalList`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D161863
2022-11-12 04:38:53 +00:00
Noemi Erli a66dba1527 Backed out 3 changesets (bug 1799732) for causing build bustages in nsIFrame.cpp CLOSED TREE
Backed out changeset e559f9dbc76f (bug 1799732)
Backed out changeset c40fda7a8b0b (bug 1799732)
Backed out changeset 1f84bfb41ab8 (bug 1799732)
2022-11-12 02:16:45 +02:00
Ting-Yu Lin 60a57a352d Bug 1799732 Part 3 - Convert FrameChildListID to enum class. r=emilio
This patch is first generated by the following script under gecko root folder.

```
#!/bin/bash

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "kPrincipalList" "FrameChildListID::Principal"
rename "kPopupList" "FrameChildListID::Popup"
rename "kCaptionList" "FrameChildListID::Caption"
rename "kColGroupList" "FrameChildListID::ColGroup"
rename "kAbsoluteList" "FrameChildListID::Absolute"
rename "kFixedList" "FrameChildListID::Fixed"
rename "kOverflowList" "FrameChildListID::Overflow"
rename "kOverflowContainersList" "FrameChildListID::OverflowContainers"
rename "kExcessOverflowContainersList" "FrameChildListID::ExcessOverflowContainers"
rename "kOverflowOutOfFlowList" "FrameChildListID::OverflowOutOfFlow"
rename "kFloatList" "FrameChildListID::Float"
rename "kBulletList" "FrameChildListID::Bullet"
rename "kPushedFloatsList" "FrameChildListID::PushedFloats"
rename "kBackdropList" "FrameChildListID::Backdrop"
rename "kNoReflowPrincipalList" "FrameChildListID::NoReflowPrincipal"
```

And then:
1. Manually fix `FrameChildListID` definition in nsFrameList.h.
2. Apply clang-format.

Differential Revision: https://phabricator.services.mozilla.com/D161864
2022-11-11 23:44:17 +00:00
Ting-Yu Lin da1dd7fade Bug 1799732 Part 2 - Flatten the namespace for FrameChildList and co. by removing namespace layout. r=emilio
After moving FrameChildListID into mozilla namespace, `kPrincipalList` etc. are
also exposed in the mozilla namespace. In the next part, I'll convert
FrameChildListID enum into an enum class, so the naming pollution shouldn't be
an issue.

This patch has a nice side effect that it is now easier to remove all the
aliases of FrameChildListID (`kPrincipalList` etc.) defined in multiple places
since it is confusion to have the same thing written in different ways, e.g.
`nsIFrame::kPrincipalList`, `mozilla::layout::kPrincipalList`,
`FrameChildListID::kPrincipalList`, `kPrincipalList`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D161863
2022-11-11 23:44:16 +00:00
Emilio Cobos Álvarez c8cbf87f6d Bug 1794630 - Improve behavior of splitters when child box is flexible. r=TYLin
This is not easy to test precisely. What the width attribute / property
set is the preferred size, but the boxes can flex expanding that, which
may cause jumps when dragging. This is easy to see with the previous
patches on the urlbar / searchbar split.

While at it make the flex and xul code-paths more similar.

Differential Revision: https://phabricator.services.mozilla.com/D159081
2022-10-12 10:57:49 +00:00
Emilio Cobos Álvarez 3a4eafe05e Bug 1794630 - Implement resize{before,after}=none/sibling for XUL splitters. r=TYLin
This trivially enhances splitters so that resizing a single element,
which is a common thing to do in our front-end code, is easier.

Differential Revision: https://phabricator.services.mozilla.com/D159069
2022-10-12 10:47:14 +00:00
Emilio Cobos Álvarez 9615cc7965 Bug 1794388 - Use nsTArray instead of UniquePtr + length in nsSplitterFrame. r=TYLin
No behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D158952
2022-10-10 18:37:29 +00:00
Emilio Cobos Álvarez c5fd0eb2fa Bug 1794388 - Clean ResizeType code. r=TYLin
No behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D158951
2022-10-10 18:37:29 +00:00
Emilio Cobos Álvarez 75e2e7b636 Bug 1794388 - Remove unused splitter data member. r=TYLin
No behavior change intended.

Depends on D158949

Differential Revision: https://phabricator.services.mozilla.com/D158950
2022-10-10 18:37:28 +00:00
Emilio Cobos Álvarez 87d06c1888 Bug 1794388 - Make nsSplitterFrameInner::State an enum class. r=TYLin
No behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D158949
2022-10-10 18:37:28 +00:00
Emilio Cobos Álvarez 403c6e1254 Bug 1792277 - Fix sidebar resizing with flexbox emulation. r=Gijs,dholbert
Add some basic min/max size support in splitters, and make the width
part of the element we're splitting rather than the <browser> child.

I don't _think_ the nsSplitterFrame changes are needed for this in
particular, since we're only distributing across two items (min and max
are useful only if we can distribute the space that one item can't fill
with another), but it doesn't hurt.

Differential Revision: https://phabricator.services.mozilla.com/D158074
2022-09-27 19:55:22 +00:00
Emilio Cobos Álvarez 4974141d16 Bug 1790299 - Make nsSplitterFrame work with regular flex boxes. r=dholbert,layout-reviewers
This allows DevTools to be resized with emulated flexbox.

Differential Revision: https://phabricator.services.mozilla.com/D157250
2022-09-21 10:12:48 +00:00
Noemi Erli 90871e40e9 Backed out changeset bf86de479585 (bug 1790299) for causing failures in test_splitter.xhtml CLOSED TREE 2022-09-21 05:48:12 +03:00
Emilio Cobos Álvarez eacc457b76 Bug 1790299 - Make nsSplitterFrame work with regular flex boxes. r=dholbert,layout-reviewers
This allows DevTools to be resized with emulated flexbox.

Differential Revision: https://phabricator.services.mozilla.com/D157250
2022-09-21 02:04:45 +00:00
Daniel Holbert 8cd75a4b14 Bug 1791471: Use RefPtr to manage lifetime of nsSplitterFrame::mInner, instead of raw pointer with manual AddRef/Release. r=hiro
This patch doesn't change behavior; it just formalizes the refcounting that
we're already doing for this variable by using the RefPtr type.

Differential Revision: https://phabricator.services.mozilla.com/D157683
2022-09-19 23:35:25 +00:00