Commit graph

420 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
52d097c513 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
77ba6cde90 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
59766eeba4 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
Timothy Nikkel
ed2e1b4059 Bug 1809492. Clear pointer to nsTreeBodyFrame on XULTreeElement after any possible calls that can set it. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184318
2023-08-03 10:50:40 +00:00
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Emilio Cobos Álvarez
c279f7ffe8 Bug 1839066 - Make nsTreeBodyFrame::SetView deal with setting the same view. r=mak
This actually fixes the bug. The issue is that we end up with
nsITreeView.setTree(null) then nsITreeView.setTree(<tree>).

This code deals with the first call:

  https://searchfox.org/mozilla-central/rev/c936f47f3a629ae49a4d528d3366bf29f2d4e4a7/browser/components/places/content/treeView.js#1651

But the later call doesn't restore the state properly and a bunch of nodes end
up unparented. That might be worth fixing on its own...

This is probably a long/forever-standing bug that was uncovered by different
amount of reflow calls.

Depends on D181379

Differential Revision: https://phabricator.services.mozilla.com/D181380
2023-06-20 08:58:10 +00:00
Emilio Cobos Álvarez
9a3a61642f Bug 1831535 - Fix nsTreeBodyFrame invalidation on height changes. r=layout-reviewers,dlrobertson
The previous code ran right before setting mRect so it triggered a
reflow callback / scrollbar update.

Differential Revision: https://phabricator.services.mozilla.com/D177258
2023-05-12 17:22:49 +00:00
Emilio Cobos Álvarez
cd8effeca0 Bug 1826881 - Fix suspicious tree invalidation code. r=dholbert
Could probably figure out a reasonable way to add a test for this but I
don't think it's the best use of our time tbh.

Differential Revision: https://phabricator.services.mozilla.com/D175117
2023-04-12 22:04:03 +00:00
Robert Longson
e47a68c1a6 Bug 1751025 - Opacity CSS property should apply to all children of text elements r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D174964
2023-04-11 22:08:24 +00:00
Natalia Csoregi
cd523b2514 Backed out changeset a846d1b82b98 (bug 1751025) for failures on opacity.svg. CLOSED TREE 2023-04-11 09:46:16 +03:00
Robert Longson
3a9c792127 Bug 1751025 - Opacity CSS property should apply to all children of text elements r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D174964
2023-04-11 03:25:14 +00:00
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
Emilio Cobos Álvarez
e14e3f4311 Bug 1824957 - Use SimpleXULLeafFrame for treebody. r=jwatt
Surprisingly straight-forward:

Use SimpleXULLeafFrame, and override GetIntrinsicBSize to implement the rows
attribute.

Use DidReflow to manage the reflow callback which is equivalent to what the old
code did.

Differential Revision: https://phabricator.services.mozilla.com/D173818
2023-03-28 20:45:03 +00:00
Norisz Fay
93bf71eee0 Backed out changeset 30b054c6db5a (bug 1824957) for causing reftest failures on treechildren-padding-percent-1.xhtml 2023-03-28 21:55:20 +03:00
Emilio Cobos Álvarez
8266de2894 Bug 1824957 - Use SimpleXULLeafFrame for treebody. r=jwatt
Surprisingly straight-forward:

Use SimpleXULLeafFrame, and override GetIntrinsicBSize to implement the rows
attribute.

Use DidReflow to manage the reflow callback which is equivalent to what the old
code did.

Differential Revision: https://phabricator.services.mozilla.com/D173818
2023-03-28 13:24:16 +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
91e6e4c5d4 Bug 1823686 - Share URLExtraData between SVG attribute mapping and style attribute. r=smaug
I don't think there's ever a way these should differ.

Got some include hell from removing ReferrerInfo.h from Document.h but
hopefully should be straight-forward to review.

Depends on D173154

Differential Revision: https://phabricator.services.mozilla.com/D173155
2023-03-22 14:54:43 +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
5f6910e75e Bug 1817071 - Remove -moz-image-region support from layout. r=layout-reviewers,tnikkel
There are no users of non-auto values, so we can just simplify some code and
remove the property.

Differential Revision: https://phabricator.services.mozilla.com/D170010
2023-02-21 12:19:44 +00:00
Jonathan Kew
1b3e69f8aa 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
Emilio Cobos Álvarez
c3271bba59 Bug 1809635 - Somewhat safer usage of tree views in nsTreeBodyFrame. r=smaug
Not convinced this will help with bug 1809492, so different bug... But
these are places where I noticed we call nsITreeView from a member.

Differential Revision: https://phabricator.services.mozilla.com/D166527
2023-01-12 12:29:58 +00:00
Emilio Cobos Álvarez
7445788a03 Bug 1806408 - Try to make nsTreeBodyFrame code more robust. r=smaug
Not a complete fix (there are some callers from reflow which are not
particularly great), but this should make the code more robust.

Differential Revision: https://phabricator.services.mozilla.com/D165042
2022-12-19 17:08:59 +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
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
Jonathan Kew
8c2b30ffe2 Bug 1799193 - Refactor XUL textbox-label/treeview-cell cropping to share code. r=emilio
This shouldn't change any behavior, it just refactors the code to use a shared string-cropping function.

It's still an approximation, and theoretically could be quite inaccurate in the case of complex text shaping,
but in practice is "good enough" for the kind of UI-element display where we use it.

Differential Revision: https://phabricator.services.mozilla.com/D161328
2022-11-05 10:45:31 +00:00
Jonathan Kew
72a059fe5c Bug 1799093 - Avoid breaking surrogate pairs etc when truncating titles in nsTreeBodyFrame.cpp. r=emilio
This is basically copied from how nsTextBoxFrame handles truncation, and avoids breaking surrogate pairs
(or other grapheme clusters such as base character + diacritic). It's still a "poor man's" version
of truncation that doesn't correctly measure the string in the presence of complex font shaping.

Longer-term, we should unify all this kind of truncation/ellipsizing of labels etc to use an implementation
based on CSS text-overflow, but that doesn't yet support center-cropping so it's not a drop-in replacement.
So I think we should do this as an interim measure to fix the most egregious brokenness, and make treeview
cells at least work similarly to textbox labels.

Tested manually; seems difficult to do automated tests as it'd be sensitive to exact glyph metrics.

Differential Revision: https://phabricator.services.mozilla.com/D161251
2022-11-04 18:30:12 +00:00
Emilio Cobos Álvarez
2414af9244 Bug 1793689 - Make GetMinimumWidgetSize work properly on non-XUL flexbox. r=TYLin,layout-reviewers
The XUL behavior in nsBox.cpp is fairly different to what the non-XUL
layout code paths do. In particular, canOverride=false means that the
min-{width,height} properties cannot go under the min widget size of the
widget, but that doesn't mean that intrinsic sizes don't affect the
final size of the widget.

This is very visible if you turn on flex emulation on Windows or macOS,
where the toolbar has an appearance that returns
width=0,height=N,canOverride=false.

With flex emulation we'd collapse the item to be zero-width, which is
not good at all.

The good thing is that this is no longer exposed to the web
(non-native-theme always returns canOverride=true), and our front-end
code doesn't seem to rely on this, so we can just remove support for
canOverride=false.

Differential Revision: https://phabricator.services.mozilla.com/D158608
2022-10-05 19:09:29 +00:00
Jeff Muizelaar
5cbce534c4 Bug 1779602 - Remove nsImageGeometryMixin. r=tnikkel
nsImageGeometryMixin was disabled in bug 1776198. No problems have shown up
so let's get rid of it.

Differential Revision: https://phabricator.services.mozilla.com/D151864
2022-07-18 21:20:50 +00:00
Emilio Cobos Álvarez
4414d74633 Bug 1779598 - Stop passing around Maybe<SVGImageContext>. r=aosmond
All its members are optional, so we can just use it as a plain struct
rather than Maybe<> all around, which simplifies the code and prevents
silly bugs like bug 1779592.

Mostly automatic via:

  rg -l 'SVGImageContext' . | xargs sed -i 's/Maybe<SVGImageContext>/SVGImageContext/g'

With trivial build fixes.

Not intended to change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151846
2022-07-14 16:03:25 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Hiroyuki Ikezoe
a457a5cfbb Bug 1766805 - Introduce intended direction and intended end position concepts. r=botond
The scroll snap spec defines the concepts [1]. There are three type of scroll
operations. 1) intended end position, 2) intended direction and end position
and 3) intended direction.

Basically our existing ScrollUnits types correspond;

1) DEVICE_PIXELS, WHOLE => intended end position
2) PAGES => intended direction and end position
3) LINES => intended direction

There are two exceptions in the `intended direction and end position` case,
scrollBy() and fling gestures (on Linux). They were defined as scroll operations
with DEVICE_PIXELS unit, but the spec cleary says they are `intended direction
and end position` operations.

Note that we will also use this information for scroll-snap-stop property since
the properly will only have effects on both 2) and 3) cases.

[1] https://drafts.csswg.org/css-scroll-snap/#scroll-types

Depends on D145190

Differential Revision: https://phabricator.services.mozilla.com/D145191
2022-05-12 12:25:15 +00:00
Norisz Fay
ce587cb281 Backed out 3 changesets (bug 1766805) for causing build bustage on AsyncPanZoomController.cpp CLOSED TREE
Backed out changeset e35a130f2bce (bug 1766805)
Backed out changeset 9f9e2030fbc1 (bug 1766805)
Backed out changeset 898bd12a5da8 (bug 1766805)
2022-05-12 13:42:36 +03:00
Hiroyuki Ikezoe
098b8bc1a5 Bug 1766805 - Introduce intended direction and intended end position concepts. r=botond
The scroll snap spec defines the concepts [1]. There are three type of scroll
operations. 1) intended end position, 2) intended direction and end position
and 3) intended direction.

Basically our existing ScrollUnits types correspond;

1) DEVICE_PIXELS, WHOLE => intended end position
2) PAGES => intended direction and end position
3) LINES => intended direction

There are two exceptions in the `intended direction and end position` case,
scrollBy() and fling gestures (on Linux). They were defined as scroll operations
with DEVICE_PIXELS unit, but the spec cleary says they are `intended direction
and end position` operations.

Note that we will also use this information for scroll-snap-stop property since
the properly will only have effects on both 2) and 3) cases.

[1] https://drafts.csswg.org/css-scroll-snap/#scroll-types

Depends on D145190

Differential Revision: https://phabricator.services.mozilla.com/D145191
2022-05-12 07:45:59 +00:00
Emilio Cobos Álvarez
20b8aec4d5 Bug 1764354 - Propagate color-scheme preference to SVG images on chrome documents. r=aosmond
This allows favicons to respect the user theme even when it doesn't
match the content theme.

Differential Revision: https://phabricator.services.mozilla.com/D143639
2022-04-17 20:38:01 +00:00
Kagami Sascha Rosylight
964184af24 Bug 1539884 - Part 31: Mark nsTreeBodyFrame::FireScrollEvent as CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134414
2021-12-23 16:27:24 +00:00
Cristian Tuns
bbe839255e Backed out 2 changesets (bug 1737694) for causing web platform tests failures on autocapitalize.html CLOSED TREE
Backed out changeset cbfc81505f1a (bug 1737694)
Backed out changeset c2f44297bd03 (bug 1737694)
2021-10-27 10:50:15 -04:00
Edgar Chen
e2e52af396 Bug 1737694 - Part 1: Rename nsTreeColumn::mContent to mElement; r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D129448
2021-10-27 09:59:05 +00:00
Emilio Cobos Álvarez
9fbc18ca4c Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 17:00:36 +00:00
Butkovits Atila
4d927c1fb4 Backed out 4 changesets (bug 1733384) for causing failures at browser_windowPrompt.js. CLOSED TREE
Backed out changeset fa609fadac26 (bug 1733384)
Backed out changeset dd1936d9fe17 (bug 1733384)
Backed out changeset 1a073e40ab1a (bug 1733384)
Backed out changeset 65708a4c708f (bug 1733384)
2021-10-07 17:52:51 +03:00
Emilio Cobos Álvarez
bfdd0fcc77 Bug 1733384 - Make inert not modify the computed style. r=sefeng,layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D127422
2021-10-07 11:47:34 +00:00
Matt Woodrow
642579b68a Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
2021-09-13 05:01:34 +00:00
criss
9640d7f5f3 Backed out 10 changesets (bug 1714138, bug 1542929, bug 1728232, bug 1729236, bug 1728258, bug 1728251, bug 1728050) for causing bug 1424348 a=backout
Backed out changeset c5b71e6ce0e5 (bug 1729236)
Backed out changeset c6bcc4ed3d2e (bug 1729236)
Backed out changeset 7e292895282a (bug 1729236)
Backed out changeset d9ddd915e0c2 (bug 1714138)
Backed out changeset 82b98d2f0dcf (bug 1728258)
Backed out changeset 9a84a36b9dc4 (bug 1542929)
Backed out changeset 96be978630ff (bug 1728251)
Backed out changeset d7a8bf19d849 (bug 1728251)
Backed out changeset cce0c53b439f (bug 1728232)
Backed out changeset 3afd6aee7849 (bug 1728050)
2021-09-12 12:00:30 +03:00
Matt Woodrow
706fce127d Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
2021-09-10 03:43:32 +00:00
Marian-Vasile Laza
d25d135947 Backed out 7 changesets (bug 1728050, bug 1728251, bug 1728232, bug 1542929, bug 1714138, bug 1728258) for causing reftest failures. CLOSED TREE
Backed out changeset 41e053201cd3 (bug 1714138)
Backed out changeset 16ae9f5b4aa0 (bug 1728258)
Backed out changeset 414aa7ff05fe (bug 1542929)
Backed out changeset 7217ecf149c4 (bug 1728251)
Backed out changeset 405ff2ed2110 (bug 1728251)
Backed out changeset 3eec9e6c7218 (bug 1728232)
Backed out changeset 66038c15fe54 (bug 1728050)
2021-09-07 09:00:26 +03:00
Matt Woodrow
3f9d3853cd Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
2021-09-06 23:12:03 +00:00
Matt Woodrow
a1f669f3aa Bug 1728709 - Add nsDisplayItem::GetPaintRect that computes a value using the current clip extents. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D124299
2021-09-03 18:58:18 +00:00