Commit Graph
728 Commits
Author SHA1 Message Date
Emilio Cobos Álvarez f0909e022f Bug 1897827 - Remove FrameChildListID::Popup. r=dholbert
It's no longer used. I made popups regular absolutely-positioned frames
a long time ago.

Differential Revision: https://phabricator.services.mozilla.com/D210949
2024-05-20 22:00:08 +00:00
Ting-Yu Lin 4f688de577 Bug 1824877 Part 6 - Rename IsScrollContainer() to IsScrollContainerOrSubclass(). r=dholbert
This is to avoid confusion with `IsScrollContainerFrame()` introduced in Part 3.

A note to performance concern:

We've used `IsScrollContainerOrSubclass()` in bug 1873414 to avoid expensive
`nsIScrollableFrame* sf = do_QueryFrame()`. Per [1], casting from `nsIFrame*` to
`nsIScrollableFrame*` has no fast path.

Ideally, `ScrollContainerFrame* sf = do_QueryFrame()` should be fast, and we can
use it to implement `IsScrollContainerOrSubclass()` like
`IsImageFrameOrSubclass()`. However, in this patch, I intend to keep the
performance metrics unchanged.

Remove `GetAsScrollContainer()` since it's only used in `MOZ_ASSERT`, and I'm
planning to remove `nsIScrollableFrame` in bug 1896516.

[1] https://searchfox.org/mozilla-central/rev/dd6e430c1bc2db90d9b3b1dd7e5215b4edc4d51a/layout/generic/nsQueryFrame.h#117-121

Differential Revision: https://phabricator.services.mozilla.com/D210395
2024-05-15 17:50:50 +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 27bb908f13 Bug 1824877 Part 2 - Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame. r=dholbert
Also, change the ScrollContainerFrame::GetFrameName() to return
"ScrollContainer" instead of "HTMLScroll".

Differential Revision: https://phabricator.services.mozilla.com/D210233
2024-05-15 17:50:48 +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 bf22d33f87 Bug 1895208 - Refactor IsFocusable checks to take flags rather than bool arguments. r=smaug
This doesn't change behavior on its own, but it's likely we want to make
the tab focusability more complicated in bug 1895184, and this will make
changes to this area less painful.

Differential Revision: https://phabricator.services.mozilla.com/D209525
2024-05-06 21:54:37 +00:00
Ting-Yu Lin 9fdd977b52 Bug 1890238 Part 2 - Honor forced break values on flex items. r=dholbert
This patch stops the frame constructor from inserting nsPageBreakFrame as a flex
item, because flex container does not rely on it to do forced page break at all,
and nsPageBreakFrame can produce wrong layout result.

The majority of this patch is to honor forced break values on flex items in
nsFlexContainerFrame::ReflowChildren(). In this patch, we don't handle avoid
break values such as `break-before:avoid` and `break-after:avoid` since they are
not handled in other frame types yet.

WPTs are added in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D207910
2024-05-03 20:43:35 +00:00
Ting-Yu Lin 5604d30ede Bug 1488080 Part 1 - Convert GetAllInFlowRects flags to EnumSet. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D209096
2024-05-03 18:42:41 +00:00
Ting-Yu Lin 603a872707 Bug 1748891 Part 1 - Exclude sticky position border-box from scrollable overflow in an overflow area getter. r=emilio
This helper is used in `nsContainerFrame::ConsiderChildOverflow()` and
`nsLayoutUtils::UnionChildOverflow()`.

This patch is adapted from a WIP written by
Daniel Holbert <[email protected]>
in https://phabricator.services.mozilla.com/D150427

Differential Revision: https://phabricator.services.mozilla.com/D208171
2024-04-25 23:32:46 +00:00
Hiroyuki Ikezoe 737c69f10f Bug 1893357 - Drop |aRepaintExposedAreaOnly| argument from nsViewManager::ResizeView(). r=tnikkel
It hasn't been used since bug 873944 in
https://hg.mozilla.org/mozilla-central/rev/b75f6184008a .

Differential Revision: https://phabricator.services.mozilla.com/D208575
2024-04-25 02:37:26 +00:00
Jonathan Kew 0d85ba711e Bug 1892816 - Account for out-of-flow frames when generating links in Save-to-PDF output. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D208328
2024-04-23 11:52:22 +00:00
Sean Feng af64dc7f02 Bug 1881097 - Ensure nsContentUtils::IsPointInSelection works for point in selection that crosses the boundary r=smaug
Ths patch introduces a new class called `CrossShadowBoundaryRange` to
make cross shadow boundary range related stuff can be isolated into a
single class.

It also tweaks a few functions along the call stack, the goal here
is to make sure nsContentUtils::IsPointInSelection can detect points
in ShadowDOM selection.

There's an additional change to `SelectionUtils.sys.mjs` to make sure
the correct context menu items are displayed when the current selection
crosses the boundary.

Differential Revision: https://phabricator.services.mozilla.com/D204080
2024-04-15 13:09:08 +00:00
Jan-Niklas Jaeschke dbaf47b1f4 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-04 14:39:32 +00:00
Stanca Serban ce5dc60809 Backed out 6 changesets (bug 1867939) for causing wpt failures in target-text-010.html. CLOSED TREE
Backed out changeset 44101c258e52 (bug 1867939)
Backed out changeset c53267e1b460 (bug 1867939)
Backed out changeset 0748839408e5 (bug 1867939)
Backed out changeset 38631fbd2f2f (bug 1867939)
Backed out changeset d77b9257c842 (bug 1867939)
Backed out changeset 0d269b891421 (bug 1867939)
2024-04-04 00:50:50 +03:00
Jan-Niklas Jaeschke 3f695f17a9 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-03 15:23:02 +00:00
Sandor Molnar 000124e596 Merge mozilla-central to autoland. a=merge 2024-04-03 17:47:38 +03:00
Sandor Molnar 7a867184d3 Backed out 6 changesets (bug 1867939) for causing a top crash in nightly Bug 1889393 CLOSED TREE
Backed out changeset 2110f57e928c (bug 1867939)
Backed out changeset 51890598ecb4 (bug 1867939)
Backed out changeset 839bc1b11a2c (bug 1867939)
Backed out changeset bb88c4d09e82 (bug 1867939)
Backed out changeset 27c76e65cf58 (bug 1867939)
Backed out changeset c3e3c81f9ceb (bug 1867939)
2024-04-03 17:31:56 +03:00
Masayuki Nakano 35abff8a26 Bug 1887954 - Make nsIFrame::GetLastLeaf() never returns a frame in native anonymous subtrees under the given frame r=emilio
It does not check whether the child frame is in a native anonymous subtree
only when every first child at digging the frame tree.  This patch rewrites
the complicated loop with 2 for-loops and make it always check whether the
frame is for a native anonymous subtree root or not before updating the result.

Differential Revision: https://phabricator.services.mozilla.com/D206283
2024-04-03 07:20:57 +00:00
Ting-Yu Lin 4990e85653 Bug 1888535 Part 6 - Unhook display reflow debugging from nsLayoutStatics, and remove display reflow debugging. r=layout-reviewers,emilio
This final patch completely removes display reflow debugging mechanism.

Differential Revision: https://phabricator.services.mozilla.com/D206318
2024-04-02 19:03:06 +00:00
Ting-Yu Lin 8a77ebbb16 Bug 1888535 Part 5 - Remove DISPLAY_REFLOW. r=layout-reviewers,emilio
It is used in `Reflow()` implementations.

Differential Revision: https://phabricator.services.mozilla.com/D206317
2024-04-02 19:03:05 +00:00
Ting-Yu Lin 319fc12b73 Bug 1888535 Part 4 - Remove DISPLAY_PREF_INLINE_SIZE and DISPLAY_MIN_INLINE_SIZE. r=layout-reviewers,emilio
The two macros are used in `GetPrefISize()` and `GetMinISize()` implementations.
After removing them, we could further simplify some implementations because we
don't need a `result` variable in many cases.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D206316
2024-04-02 19:03:04 +00:00
Ting-Yu Lin 512cea0dbf Bug 1888535 Part 3 - Remove DISPLAY_REFLOW_CHANGE used only in nsTableCellFrame. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206315
2024-04-02 19:03:04 +00:00
Ting-Yu Lin 125e604108 Bug 1888535 Part 2 - Remove DISPLAY_INIT_CONSTRAINTS and DISPLAY_INIT_OFFSETS. r=layout-reviewers,emilio
The two macros are only used in ReflowInput.cpp, which are to print margin,
border, padding, available sizes, and other computed sizes in ReflowInput. The
information can be replaced by adding local printf or via `rr` if there are
debug needs.

Note: `ReflowInput::DisplayInitFrameTypeEnter` and
`ReflowInput::DisplayInitFrameTypeExit` have been removed in
https://hg.mozilla.org/mozilla-central/rev/429a4d022ade

Differential Revision: https://phabricator.services.mozilla.com/D206314
2024-04-02 19:03:03 +00:00
Ting-Yu Lin 7b29671d76 Bug 1888535 Part 1 - Remove four unused display reflow debugging macros. r=layout-reviewers,emilio
`DISPLAY_LAYOUT`, `DISPLAY_PREF_SIZE`, `DISPLAY_MIN_SIZE`, and
`DISPLAY_MAX_SIZE` are not used in layout at all.

Differential Revision: https://phabricator.services.mozilla.com/D206313
2024-04-02 19:03:03 +00:00
Jan-Niklas Jaeschke f46900e678 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-02 13:44:25 +00:00
Cristian Tuns 9a4d6d56af Backed out 6 changesets (bug 1867939) for causing build bustages in Document.h CLOSED TREE
Backed out changeset 0853f9a7a06c (bug 1867939)
Backed out changeset 2279e6577c13 (bug 1867939)
Backed out changeset 1b3af4b6a27b (bug 1867939)
Backed out changeset 2fbe643ca483 (bug 1867939)
Backed out changeset 575873406614 (bug 1867939)
Backed out changeset 82f99c0210b0 (bug 1867939)
2024-04-02 09:15:46 -04:00
Jan-Niklas Jaeschke 9ce335fcb7 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-02 11:43:21 +00:00
sid 568f27d168 Bug 1825386 - Converted LogicalAxis to enum class and type casted where necessary. r=TYLin
LogicalAxis is one of the Logical* enums. Converting it from enum to
enum class increases type safety. To run with the pre-existing code,
type casting was added when needed. Comments have been edited where
needed.

Differential Revision: https://phabricator.services.mozilla.com/D206108
2024-03-30 16:20:37 +00:00
Emilio Cobos Álvarez 191c066aca Bug 1870380 - Don't use handled hints for table captions. r=tnikkel,layout-reviewers
Table captions have a similar issue as column spanners, where their
parent might not be the in the subtree of the style frame of its
ancestors. In particular, a repaint posted to a table that
doesn't cause a repaint in the table wrapper might not cause a repaint
of its captions.

Handle table captions like we treat out of flows and spanners, and add
more comments around this set-up.

Differential Revision: https://phabricator.services.mozilla.com/D205504
2024-03-26 09:17:06 +00:00
Sean Feng 4a776dbb51 Bug 1867058 - Part 8: Update Selection to support across shadow dom selection r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D195310
2024-03-25 13:40:59 +00:00
Sean Feng 69b0eb74ee Bug 1867058 - Part 1: Implement Selection.direction r=jjaschke,dom-core
This patch implements the .direction attribute

Spec: https://www.w3.org/TR/selection-api/#dom-selection-direction

Differential Revision: https://phabricator.services.mozilla.com/D195301
2024-03-25 13:40:56 +00:00
Emilio Cobos Álvarez f3b7608278 Bug 1740580 - Align shrink-wrap behavior of semi-replaced elements with the spec. r=dholbert,layout-reviewers
The removed reftsts test basically the opposite, and are sufficiently
covered by the WPTs that we start passing, so just remove them.

Differential Revision: https://phabricator.services.mozilla.com/D204797
2024-03-23 15:14:20 +00:00
pstanciu bcc6e01718 Backed out 12 changesets (bug 1867058) for causing bustages on AbstractRange.cpp
Backed out changeset 6254c9c51033 (bug 1867058)
Backed out changeset 2ad556d56736 (bug 1867058)
Backed out changeset a8bc41291ab3 (bug 1867058)
Backed out changeset c30869c03a70 (bug 1867058)
Backed out changeset 39c5816dff6b (bug 1867058)
Backed out changeset 42e226158dc9 (bug 1867058)
Backed out changeset 67bb7158a09f (bug 1867058)
Backed out changeset 7b5a689dc7fd (bug 1867058)
Backed out changeset 3cf108eb13a6 (bug 1867058)
Backed out changeset 8efda4cce80c (bug 1867058)
Backed out changeset 0837e15babab (bug 1867058)
Backed out changeset 8ce7972ea4df (bug 1867058)
2024-03-23 02:24:26 +02:00
Sean Feng e71c2c9c02 Bug 1867058 - Part 8: Update Selection to support across shadow dom selection r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D195310
2024-03-22 17:05:51 +00:00
Sean Feng 4aa13f1825 Bug 1867058 - Part 1: Implement Selection.direction r=jjaschke,dom-core
This patch implements the .direction attribute

Spec: https://www.w3.org/TR/selection-api/#dom-selection-direction

Differential Revision: https://phabricator.services.mozilla.com/D195301
2024-03-22 17:05:48 +00:00
Emilio Cobos Álvarez ef150776cf Bug 1874823 - Remove NS_BLOCK_STATIC_BFC and NS_BLOCK_CLIP_PAGINATED_OVERFLOW. r=fredw
Put all the "is this block a BFC" logic in nsBlockFrame.cpp.

The CLIP_PAGINATED_OVERFLOW flag is also redundant, it can just be "has
non-propagated overflow styles" check in ShouldApplyOverflowClipping(),
and frees another bit.

Shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D203590
2024-03-07 16:36:56 +00:00
Timothy Nikkel 6c4ed3215d Bug 1872487. Create less WebRenderLayerScrollData. r=botond
In order to create less WebRenderLayerScrollData currently we use a deferred transform item

https://searchfox.org/mozilla-central/rev/593c49fa812ceb4be45fcea7c9e90d15f59edb70/gfx/layers/wr/StackingContextHelper.h#82

We don't need a WebRenderLayerScrollData for every transform because a lot of transforms don't contain any ASRs, so the created WebRenderLayerScrollData would be useless.

However this optimization can lead to us creating a lot more WebRenderLayerScrollData later if the transform does contain ASRs. For example, if there is a transform, and then inside that is a ASR, and inside the ASR is a lot of small transforms, we end up having to create a WebRenderLayerScrollData for every little transform which don't contain any ASRs. This is doing the opposite of what the optimization intended.

WebRenderLayerScrollData creation happens during the CreateWebRenderCommands phase, so the display list build phase is complete, and we can tell cheaply if a transform contains any ASRs during display list building. So we just record that and use that to inform our decision about when to defer the transform item or not.

This optimization drastically reduces the total number of WebRenderLayerScrollData that we create during a full run of speedometer3 (summing the number created each paint over every paint). In my testing it went from 12-13k to 2-3k. Mostly subtests fell into two buckets: a single digit number of WebRenderLayerScrollData to begin with and this patch didn't change that, and 100 WebRenderLayerScrollData down to single digits after this patch. So the savings are concentrated in a few subtests that hit the described behaviour above.

I compared a profile before and after this patch of 10 runs of speedometer3, this patch saved 100 samples/ms serializing WebRenderLayerScrollData, which was what I expected based on how long serialization took before the patch combined with how many WebRenderLayerScrollData we were avoiding. The whole run took about 100,000 samples/ms, so this should hopefully be good for about 0.1% improvment. There is also potential savings in other areas outside of serialization step but that was a little harder to measure.

Differential Revision: https://phabricator.services.mozilla.com/D197446
2024-02-29 06:46:45 +00:00
David Shin 2a4ef8f770 Bug 1856640: Ensure layout flush for as-of-yet reflowed frames when querying computed style of elements potentially matching container query. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D202619
2024-02-27 17:48:07 +00:00
Cristian Tuns b3cb6befdc Backed out changeset 8dcd15392aae (bug 1856640) for causing android build bustages CLOSED TREE 2024-02-27 11:35:54 -05:00
Emilio Cobos Álvarez 3e36c0f05a Bug 1881057 - Remove no longer necessary special-case for content-visibility: auto. r=fredw
This comes from the initial content-visibility: auto implementation, and
more crucially before we fixed the timing issues from bug 1807253.

After bug 1807253 we shouldn't get to actually render something without
its initial visibility determined, so this special case can go away.

Differential Revision: https://phabricator.services.mozilla.com/D202723
2024-02-27 15:56:19 +00:00
David Shin 49d8f43c5f Bug 1856640: Ensure layout flush for as-of-yet reflowed frames when querying computed style of elements potentially matching container query. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D202619
2024-02-27 15:55:15 +00:00
Masayuki Nakano 1fa34bf3f6 Bug 1881377 - Make nsIFrame.cpp stop moving selection into a child frame in a native anonymous subtree r=emilio
Even if `<details>` does not have a `<summary>`, it creates a closed shadow DOM
as a UA widget to show the triangle icon and the default summary.  Chrome allows
to move select the default summary with this API, but in that case, Chrome sets
`Selection.focusNode` and `Selection.anchorNode` to `undefined`.  Therefore,
anyway, moving selection into the default summary is not useful for web apps.
Therefore, I think that we can just avoid to move selection into any native
anonymous subtree for keeping the things simple.

Differential Revision: https://phabricator.services.mozilla.com/D202696
2024-02-26 12:32:42 +00:00
Emily McDonough d8944d6766 Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert
This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-02-24 04:05:45 +00:00
Stanca Serban f3138fcd27 Backed out 2 changesets (bug 1865172) for causing wpt failures in page-name-unnamed-trailing-001-print.html.
Backed out changeset fc1f91bbfd85 (bug 1865172)
Backed out changeset 17019e03e97c (bug 1865172)
2024-02-24 01:53:19 +02:00
Emily McDonough fee7314f2a Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert
This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
2024-02-23 22:34:37 +00:00
Masayuki Nakano 6d3d99adcc Bug 1878273 - Make Shift + right click should work as a right click without Shift if contextmenu should forcibly be open r=emilio
We have a pref, `dom.event.contextmenu.shift_suppresses_event`, which is
default to make `Shift` + right click forcibly open the context menu without
dispatching `contextmenu` event to the web.

When user wants to use this feature, they may (or must) assume that it works
as a right click (without `Shift`) except whether it overrides `contextmenu`
event listener of the web app.  Therefore, `Selection` should be collapsed
at the click point instead of expanding to the click point.

Unfortunately, we need to consider it at `mousedown`, not `mouseup` nor
`contextmenu`.  Therefore, `Shift` state may mismatch with the actual state at
`mouseup` and `mousedown`/`poinerdown` listeners of web apps may assume it will
expand selection, but I think that we cannot solve these issues.

Differential Revision: https://phabricator.services.mozilla.com/D201054
2024-02-12 01:42:34 +00:00
Edgar Chen 7c3453d032 Bug 1878976 - Remove plugin-related code in EventStateManager; r=emilio
`nsIFrame::GetCursor()` can never return `Nothing()` after bug 1687239, which
removes `nsPluginFrame`. Therefore `mLastFrameConsumedSetCursor` in
`EventStateManager` can never be true.

Differential Revision: https://phabricator.services.mozilla.com/D200890
2024-02-07 12:35:27 +00:00
Emilio Cobos Álvarez 0b6d473ed5 Bug 1878188 - Avoid re-registering container query frames unnecessarily. r=fredw
This is kind of a wallpaper, but I think it's sound, read below.

The reason this is asserting is that MathML in particular has some odd
frame re-parenting going on (see
nsCSSFrameConstructor::FlushAccumulatedBlock).

That means that our assert in DepthOrderedFrameList is not really
holding depending on when you add or remove the frame from the list.

However this is not a problem in practice, at least for container
queries, because anonymous frames that can wrap mathML cannot be
containers themselves.

I need to figure out what to do with that assert, but given it's useful
for the other users of DepthOrderedFrameList, I think we should take
this for now.

Differential Revision: https://phabricator.services.mozilla.com/D200634
2024-02-05 16:19:03 +00:00
Ting-Yu Lin 4d56aeb66c Bug 1878433 Part 1 - Remove unused #defines in nsIFrame.cpp. r=dholbert
The three #defines are not used elsewhere.

Differential Revision: https://phabricator.services.mozilla.com/D200527
2024-02-03 01:30:38 +00:00
Cathie Chen 356c246299 Bug 1806930 - Intermittent /css/css-contain/content-visibility/content-visibility-auto-state-changed-first-observation.html, r=fredw
Differential Revision: https://phabricator.services.mozilla.com/D198602
2024-01-30 15:54:32 +00:00