Commit graph

3543 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2d0e69f4a1 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
Emily McDonough
c0c82e4fc5 Bug 1819468 - Do not propagate page names from subclasses of block frames r=dholbert
Remove some related now-default pref setting in printing crashtests.list
while we're here.

Differential Revision: https://phabricator.services.mozilla.com/D172342
2023-03-28 22:22:59 +00:00
Emilio Cobos Álvarez
58acdee9a2 Bug 1824667 - Remove nsTextBoxFrame. r=jwatt
Use a MiddleCroppingBlockFrame subclass that looks at the value attribute
instead. We don't need accesskey etc for these so we can just reuse it as is.

Differential Revision: https://phabricator.services.mozilla.com/D173669
2023-03-27 23:46:51 +00:00
Emilio Cobos Álvarez
b9d1536d46 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
38b10eafda Bug 1824236 - Stop using XUL layout for scrollbars. r=jwatt
This rewrites scrollbar layout to work with regular reflow rather than
box layout.

Overall it's about the same amount of code (mostly because
nsScrollbarFrame::Reflow is sorta hand-rolled), but it cleans up a bit
and it is progress towards removing XUL layout altogether, without
getting into much deeper refactoring.

This also blocks some other performance improvements and refactorings I
want to make in this code.

We make some assumptions to simplify the code that to some extent were
made already before, both explicitly and by virtue of using XUL layout.

In particular, we assume that scrollbar / slider / thumb has no border or
padding and that the writing-mode is horizontal ltr.

Differential Revision: https://phabricator.services.mozilla.com/D173489
2023-03-27 20:54:53 +00:00
Sandor Molnar
fcbacc6d6c Backed out changeset 7da2469ac949 (bug 1824236) for causing assertion failures in layout/generic/crashtests/369038-1.xhtml CLOSED TREE 2023-03-27 23:20:35 +03:00
Emilio Cobos Álvarez
914393e83e Bug 1824236 - Stop using XUL layout for scrollbars. r=jwatt
This rewrites scrollbar layout to work with regular reflow rather than
box layout.

Overall it's about the same amount of code (mostly because
nsScrollbarFrame::Reflow is sorta hand-rolled), but it cleans up a bit
and it is progress towards removing XUL layout altogether, without
getting into much deeper refactoring.

This also blocks some other performance improvements and refactorings I
want to make in this code.

We make some assumptions to simplify the code that to some extent were
made already before, both explicitly and by virtue of using XUL layout.

In particular, we assume that scrollbar / slider / thumb has no border or
padding and that the writing-mode is horizontal ltr.

Differential Revision: https://phabricator.services.mozilla.com/D173489
2023-03-27 19:12:52 +00:00
Emilio Cobos Álvarez
894fd5d4c3 Bug 1824667 - Factor middle-cropping out of nsFileControlFrame. r=jfkthame,layout-reviewers
Factor a MiddleCroppingBlockFrame that does the double reflow shenanigans.

That should both be faster and easier to reason about. The only thing we need
to be careful about is to use the current inline coord from the line layout if
present to compute the real available isize.

Differential Revision: https://phabricator.services.mozilla.com/D173668
2023-03-27 17:13:50 +00:00
Emily McDonough
8f3d8a7d82 Bug 1822919 - Remove unused declaration from nsCSSFrameConstructor.cpp r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D172843
2023-03-20 21:29:01 +00:00
Emilio Cobos Álvarez
82623a74ae Bug 1600542 - Remove nsXULScrollFrame. r=dshin
We no longer have any use of it.

Differential Revision: https://phabricator.services.mozilla.com/D172876
2023-03-20 17:19:29 +00:00
Robert Longson
4264460c99 Bug 367994 - Map all SVG styles to all non-animation SVG elements r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D172590
2023-03-15 19:13:51 +00:00
Cosmin Sabou
f87f82e3b9 Backed out changeset 77efe6b04864 (bug 367994) for causing SVGLength animation wpt failures. CLOSED TREE 2023-03-15 17:11:05 +02:00
Robert Longson
23eb98ba93 Bug 367994 - Map all SVG styles to all non-animation SVG elements r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D172590
2023-03-15 13:27:02 +00:00
Emilio Cobos Álvarez
6634317253 Bug 1816672 - Deal with async root element insertions in layout. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D171578
2023-03-08 13:55:19 +00:00
Emilio Cobos Álvarez
01a41fb486 Bug 1820280 - Be consistent for which URIs we expose chrome rules. r=dshin
Differential Revision: https://phabricator.services.mozilla.com/D171640
2023-03-07 20:22:23 +00:00
Emilio Cobos Álvarez
941a0e0a1c Bug 1820634 - Remove nsTreeColFrame. r=Gijs
Layout-wise it doesn't have any special code. Only weirdness is:

 * Invalidation when size changes (we can do that with a
   ResizeObserver).

 * Weird paint retargetting to the splitter, which we can fix by using
   negative margins instead and using a regular splitter.

Differential Revision: https://phabricator.services.mozilla.com/D171768
2023-03-07 10:32:32 +00:00
Emilio Cobos Álvarez
e18c9b7ad6 Bug 1815552 - Make positioned table parts deal correctly with switching position without being reframed. r=TYLin,layout-reviewers
While looking at the backout, I noticed table parts relied on reframing
on abspos-container-ness changes in a subtle way, see the test, which
fails with the first patch of this bug applied without these changes.

Make the NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN mean the same for table parts
as for everything else. Instead, keep the registration status on each
relevant frame class individually.

Depends on D169127

Differential Revision: https://phabricator.services.mozilla.com/D170969
2023-03-01 19:04:17 +00:00
Cristina Horotan
e15f3e3295 Backed out 2 changesets (bug 1815552) for causing Bp-hybrid bustages at ComputedStyle.h on a CLOSED TREE
Backed out changeset da0f9295df91 (bug 1815552)
Backed out changeset cda1ee891058 (bug 1815552)
2023-03-01 16:05:19 +02:00
Emilio Cobos Álvarez
029e62f738 Bug 1815552 - Make positioned table parts deal correctly with switching position without being reframed. r=TYLin,layout-reviewers
While looking at the backout, I noticed table parts relied on reframing
on abspos-container-ness changes in a subtle way, see the test, which
fails with the first patch of this bug applied without these changes.

Make the NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN mean the same for table parts
as for everything else. Instead, keep the registration status on each
relevant frame class individually.

Depends on D169127

Differential Revision: https://phabricator.services.mozilla.com/D170969
2023-03-01 10:36:54 +00:00
Emilio Cobos Álvarez
a228002bd2 Bug 1815229 - Remove nsImageBoxFrame. r=tnikkel,layout-reviewers
nsImageFrame has support for displaying style URIs / an owned image
request, so use it.

The main behavior difference is that we don't fire `load` / `error`
events for those images anymore, but I don't see any event listener for
those around, so I think they can go.

Differential Revision: https://phabricator.services.mozilla.com/D168958
2023-02-21 17:36:11 +00:00
Emilio Cobos Álvarez
6384797392 Bug 1812329 - Remove nsMenuBarFrame. r=smaug
This ended up being a lot more straight-forward than the menu changes.

TLDR:

 * nsMenuBarFrame -> XULMenuBarElement
 * nsMenuBarListener -> MenuBarListener

Rest should be rather straight-forward.

Depends on D168649

Differential Revision: https://phabricator.services.mozilla.com/D167809
2023-02-08 13:12:23 +00:00
Iulian Moraru
d19790ed5f Backed out 2 changesets (bug 1812329) for causing multiple leaks. CLOSED TREE
Backed out changeset d663fc115ab9 (bug 1812329)
Backed out changeset 5464978a27a8 (bug 1812329)
2023-02-07 23:45:43 +02:00
Emilio Cobos Álvarez
b9833bfcca Bug 1812329 - Remove nsMenuBarFrame. r=smaug
This ended up being a lot more straight-forward than the menu changes.

TLDR:

 * nsMenuBarFrame -> XULMenuBarElement
 * nsMenuBarListener -> MenuBarListener

Rest should be rather straight-forward.

Depends on D168649

Differential Revision: https://phabricator.services.mozilla.com/D167809
2023-02-07 18:09:37 +00:00
Emilio Cobos Álvarez
825e54cafc Bug 1812329 - Move accesskey out of nsMenubarListener. r=smaug
This makes the following patch simpler.

Differential Revision: https://phabricator.services.mozilla.com/D168649
2023-02-07 16:29:40 +00:00
Emilio Cobos Álvarez
2e7a582438 Bug 1813960 - Move nsContainerFrame::SyncWindowProperties to PresShell. r=smaug
It's a more natural place for it to live, since it concerns only the
root view.

Clean up a bit while at it, and factor out the window size constraints,
which we're going to use momentarily.

Differential Revision: https://phabricator.services.mozilla.com/D168461
2023-02-02 13:37:02 +00:00
Ben Freist
476cccc35c Bug 1808888 - [refactor] Migrate NS_STYLE_LIST_STYLE_POSITION_* defines r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D166140
2023-01-09 07:07:13 +00:00
Emilio Cobos Álvarez
4f1f5e7314 Bug 1805414 - Remove nsMenuFrame and nsMenuParent. r=smaug,Jamie,desktop-theme-reviewers,settings-reviewers,dao
Move most the event handling stuff to the DOM. I've left nsMenuBarFrame
for now, but I will be removing that in the future.

The basic set up is:

  * nsMenuParent becomes XULMenuParentElement (menubar or popup, manages
    the current active menu item)

  * nsMenuFrame -> XULButtonElements that return true for IsMenu().
    Can't use XULMenuElement because of <button type=menu>, which
    behaves like a, well, menu.

This makes the a11y events for menus (DOMMenuItem{Active,Inactive}) make
sense (before that we were firing duplicate Inactive events etc, and the
event order was rather suspicious).

Differential Revision: https://phabricator.services.mozilla.com/D164210
2023-01-04 19:01:13 +00:00
Csoregi Natalia
9807a6e6e8 Backed out changeset f11c529b2407 (bug 1805414) for failures on test_submenuClose.xhtml and nsMenuPopupFrame.cpp. CLOSED TREE 2023-01-04 01:48:30 +02:00
Emilio Cobos Álvarez
3d82727505 Bug 1805414 - Remove nsMenuFrame and nsMenuParent. r=smaug,Jamie,desktop-theme-reviewers,settings-reviewers,dao
Move most the event handling stuff to the DOM. I've left nsMenuBarFrame
for now, but I will be removing that in the future.

The basic set up is:

  * nsMenuParent becomes XULMenuParentElement (menubar or popup, manages
    the current active menu item)

  * nsMenuFrame -> XULButtonElements that return true for IsMenu().
    Can't use XULMenuElement because of <button type=menu>, which
    behaves like a, well, menu.

This makes the a11y events for menus (DOMMenuItem{Active,Inactive}) make
sense (before that we were firing duplicate Inactive events etc, and the
event order was rather suspicious).

Differential Revision: https://phabricator.services.mozilla.com/D164210
2023-01-03 22:06:01 +00:00
Emilio Cobos Álvarez
82b70b4586 Bug 1806167 - Always append the access key in uppercase. r=jfkthame,layout-reviewers
Make accesskey reftest use modern box layout to test this code path.

Differential Revision: https://phabricator.services.mozilla.com/D164942
2022-12-29 16:58:15 +00:00
Emilio Cobos Álvarez
ace68cc3b4 Bug 1792319 - Use XUL layout for scrollbar parts. r=dholbert
When scrollbar caching is enabled this worked kinda by chance via the
-moz-box-layout: initial declaration there.

Make it work independently of the scrollbar caching pref.

Differential Revision: https://phabricator.services.mozilla.com/D164893
2022-12-21 16:12:29 +00:00
Emily McDonough
a7d0e54361 Bug 1804798 - Explicitly set auto page name (and corresponding debug flag) when inserting frames in nsCSSFrameConstructor::ContentRangeInserted r=dholbert
Unfortunately, this can be called through both reflow and frame construction
much like nsCSSFrameConstructor::ContentAppended, so we can't just use a page-
name tracker.

Differential Revision: https://phabricator.services.mozilla.com/D164760
2022-12-15 20:30:29 +00:00
Emily McDonough
9d851b65c0 Bug 1804571 - Fix missing page-name trackers for Ruby frames r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D164622
2022-12-14 23:16:05 +00:00
Emily McDonough
b010741cdc Bug 1804772 - Make nsIFrame::GetStartPageValue/nsIFrame::GetEndPageValue constant complexity by copying over the PageValuesProperty value when creating frame continuations. r=dholbert
This was causing layout/generic/crashtests/1683126.html to timeout with named
pages enabled.

It is possible for a frame's PageValues struct to have both the start and end
values be set to null as further children are added. In that case, we can
avoid doing an extra allocation for each of that frame's continuations, as a
small optimization.

Differential Revision: https://phabricator.services.mozilla.com/D164266
2022-12-09 21:01:53 +00:00
Butkovits Atila
d2cbc72bd6 Backed out changeset 4af3a83487c7 (bug 1804772) for causing build bustages at nsCSSFrameConstructor.cpp. CLOSED TREE 2022-12-09 01:17:36 +02:00
Emily McDonough
e7f6b82578 Bug 1804772 - Make nsIFrame::GetStartPageValue/nsIFrame::GetEndPageValue constant complexity by copying over the PageValuesProperty value when creating frame continuations. r=dholbert
This was causing layout/generic/crashtests/1683126.html to timeout with named
pages enabled.

It is possible for a frame's PageValues struct to have both the start and end
values be set to null as further children are added. In that case, we can
avoid doing an extra allocation for each of that frame's continuations, as a
small optimization.

Differential Revision: https://phabricator.services.mozilla.com/D164266
2022-12-08 22:04:14 +00:00
Emily McDonough
75e63871f4 Bug 1804750 - Track page name when constructing column set wrapper frames r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D164258
2022-12-08 21:47:05 +00:00
Emily McDonough
d132c606ff Bug 1804551 - Add page-name tracker when constructing table elements r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D164148
2022-12-07 22:48:11 +00:00
Ben Freist
13d8696801 Bug 1803968 - [refactor] Migrate NS_STYLE_LIST_STYLE_* defines r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D163792
2022-12-07 09:58:22 +00:00
Martin Robinson
abb5044ca7 Bug 1803377 - Rename the values of the IntrinsicDirty enum r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D163607
2022-12-02 12:27:31 +00:00
Emilio Cobos Álvarez
154963d4ec Bug 1802533 - Make insertAnonymousContent() not reframe the whole frame tree the first time it's added to the document. r=TYLin
Given the STR I was almost close to WONTFIX this, but it seems worth
fixing regardless, if only because this also happens in content pages
and it's something I've been bitten by before (try to debug a layout
bug, inspect the element, then realize the bug is "fixed" because we
reframed everything).

This is mostly a performance optimization, so it doesn't seem super-easy
to test, particularly since you can't quite just change styles of NAC
easily...

I'll try to remove that block altogether in a follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D163151
2022-11-29 18:57:50 +00:00
Frederic Wang
02f63e4dd3 Bug 1802336 - Align none/mprescripts on MathML Core. r=emilio
See https://w3c.github.io/mathml-core/#prescripts-and-tensor-indices-mmultiscripts

- none/mprescripts are laid out as an mrow.
- none is not involved at all in "invalidity".

Differential Revision: https://phabricator.services.mozilla.com/D163001
2022-11-25 13:30:13 +00:00
James Teh
6c0098d405 Bug 1801433: Remove PresShell::GetAccessibilityService/IsAccessibilityActive. r=emilio
These have just called GetAccService for a long time now, so callers should just call that directly.

Differential Revision: https://phabricator.services.mozilla.com/D162449
2022-11-19 23:04:08 +00:00
Emilio Cobos Álvarez
31c279d479 Bug 1799460 - Implement label[value] and start/end cropping with CSS rather than XUL layout. r=Gijs,jfkthame
This reduces the weird interactions that can appear on menus.

This also progresses BiDi support, including for accesskeys.

Differential Revision: https://phabricator.services.mozilla.com/D161498
2022-11-16 16:27:59 +00:00
Ting-Yu Lin
514d412f9b 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
c565d29604 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
Ting-Yu Lin
5a69e0e771 Bug 1799732 Part 1 - Replace GetChildList(kPrincipalList) with PrincipalChildList(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D161862
2022-11-12 04:38:52 +00:00
Noemi Erli
7c40c0e983 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
192956df1b 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
75940b1777 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