935 Commits

Author SHA1 Message Date
David Shin
19f835d232 Bug 1990786: Don't transform empty overflow. a=RyanVM
Original Revision: https://phabricator.services.mozilla.com/D266907

Differential Revision: https://phabricator.services.mozilla.com/D267818
2025-10-09 12:15:38 +00:00
Masayuki Nakano
e7d692b3a1 Bug 1974970 - Make GetNextPrevLineBlockFrame() guarantee that it won't enter into anonymous subtree r=emilio a=RyanVM
It seems that `nsIFrame::GetLastLeaf()` and `nsIFrame::GetFirstLeaf()`
were designed for helper methods of `nsIFrame::IsVisuallyAtLineEdge()`
and `nsIFrame::IsLogicallyAtLineEdge()`.  Therefore, they require the
`nsTextFrame` which is generated by `::before` or `::after` to check
whether the frame is first or last of the line.  However, only
`nsIFrame::GetLastLeaf()` is used by `GetNextPrevLineBlockFrame()` too
and I changed the behavior only for `GetNextPrevLineBlockFrame()` in
D216371.  Then, that broke the `nsIFrame::IsVisuallyAtLineEdge()` and
`nsIFrame::IsLogicallyAtLineEdge()`.  Therefore, this patch moves the
new check to the caller side, i.e., into `GetNextPrevLineBlockFrame()`.

Differential Revision: https://phabricator.services.mozilla.com/D256211
2025-08-06 18:27:36 +00:00
Emilio Cobos Álvarez
4e9167a7b1 Bug 1969829 - Non-editable <canvas> elements should use the frame edge for selection targetting. r=masayuki, a=dmeehan
Just like images.

Differential Revision: https://phabricator.services.mozilla.com/D253705
2025-06-16 12:38:08 +00:00
Emilio Cobos Álvarez
6e44cddcb8 Bug 1969432 - Treat table captions as paragraph boundaries. r=masayuki a=RyanVM
They create a block even tho they're not block-outside in the CSS sense.
This makes captions consistent with table cells too.

Differential Revision: https://phabricator.services.mozilla.com/D251997
2025-06-03 16:00:04 +00:00
Emilio Cobos Álvarez
eca440806a Bug 1969100 - Don't ignore UA-widget nodes for paragraph selection. r=sefeng a=RyanVM
Not sure how useful adding a test for this really is. The XML pretty
printer is pretty much the only UA widget that has some paragraph
content, and setting it up is non-trivial. If you insist I can look into
adding a test tho.
2025-05-31 21:36:45 +00:00
Emilio Cobos Álvarez
8ff4a65ffa Bug 1967507 - Simplify custom content container set-up. r=smaug,devtools-reviewers,nchevobbe
I haven't been able to reproduce this locally, but I see what's going
on, and I think we could do better.

This avoids the frame flush from nsCanvasFrame::CreateAnonymousContent,
and in general makes the anonymous content timing a lot more reasonable
(see the FlushPendingNotifications call that's getting removed).

The ServoStyleSet changes are needed now that there are multiple style
roots that can be unstyled like that.

It also simplifies the API as now it's not dependent on having a canvas
frame around (and thus doesn't need to flush layout).

Differential Revision: https://phabricator.services.mozilla.com/D250531
2025-05-22 13:06:12 +00:00
David Shin
20c44d3414 Bug 1964120: Remove unneeded aConstrainBSize flag in FinishReflowWithAbsoluteFrames and ReflowAbsoluteFrames. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D248268
2025-05-13 21:29:49 +00:00
Emilio Cobos Álvarez
6854d1c91c Bug 1965424 - Don't create compositor hit test info in view transition captured content. r=nical,botond
These are supposed to behave like pointer-events: none per spec, see
https://drafts.csswg.org/css-view-transitions-1/#view-transition-stacking-layer

Differential Revision: https://phabricator.services.mozilla.com/D248042
2025-05-09 08:47:18 +00:00
Botond Ballo
db66870a98 Bug 1964701 - Track in the display list builder whether we're inside a view transition capture. r=nical
No behavior change from this patch on its own, but this will be useful
for bug 1961140.

Co-authored-by: Botond Ballo <botond@mozilla.com>

Differential Revision: https://phabricator.services.mozilla.com/D248017
2025-05-07 15:06:58 +00:00
longsonr
38d6a5988e Bug 1964912 - Fix focus for elements within defs subtree r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D248181
2025-05-07 15:02:44 +00:00
Emilio Cobos Álvarez
0cf9cfd569 Bug 1963368 - Avoid sending two snapshots for the root. r=view-transitions-reviewers,boris
We should handle the root only in ScrollContainerFrame. We don't hit
this code-path more often because the root primary frame is usually not
a stacking context.

Differential Revision: https://phabricator.services.mozilla.com/D247590
2025-05-05 05:45:58 +00:00
Jonathan Watt
28cc2effe2 Bug 1923395. Basic Anchor Positioning 'Finding an Anchor' implementation. r=dshin,emilio
Differential Revision: https://phabricator.services.mozilla.com/D246939
2025-05-05 04:16:04 +00:00
David Shin
aa94ae3860 Bug 1960032: Use UniqueOrNonOwningPtr for AnchorResolved values. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D246661
2025-04-29 23:34:52 +00:00
Emilio Cobos Álvarez
eb7d6dcbb7 Bug 1959116 - Add a null-check to IsRelevantBlockFrame. r=jwatt
From code-inspection / crash inspection, but it doesn't seem
far-fetched. With view transitions we're a bit more likely to hit this
code with the root frame or so, since the top transition layer doesn't
react to pointer events.

Differential Revision: https://phabricator.services.mozilla.com/D246728
2025-04-26 11:40:00 +00:00
Timothy Nikkel
04c7f0a0a0 Bug 1956391. Correct removing retained display items when retained display list pref is off. r=gfx-reviewers,lsalzman
The retained display list pref is live, so even if it is off we can still have a retained display list kicking around if the pref has been toggled.

Differential Revision: https://phabricator.services.mozilla.com/D246099
2025-04-21 23:36:45 +00:00
Emilio Cobos Álvarez
b01262c916 Bug 1961469 - Deal with nested generated content subtrees correctly.
MANUAL PUSH: Trivial-ish fix (almost reverses to previous behavior) in a CLOSED TREE
2025-04-20 01:51:43 +02:00
Emilio Cobos Álvarez
41b37305a4 Bug 1961469 - Make nsIFrame::GetContentForEvent return a potentially display: contents node. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D246078
2025-04-19 19:21:17 +00:00
Emilio Cobos Álvarez
a17ef36279 Bug 1961469 - Simplify nsIFrame::GetContentForEvent. r=smaug
No behavior change (note that nsImageFrame inits the image map on
Init()).

Differential Revision: https://phabricator.services.mozilla.com/D246077
2025-04-19 19:21:17 +00:00
Ting-Yu Lin
25bed1b6a4 Bug 1961428 Part 2 - Move nsGridContainerFrame::CachedBAxisMeasurement to cpp file. r=layout-reviewers,dholbert
The grid item cache is an internal implementation detail that does not need to
be exposed in the header. This patch moves `CachedBAxisMeasurement` to the cpp
file, similar to where `nsFlexContainerFrame::CachedBAxisMeasurement` lives.
This change also reduces compile time when modifying the cache code.

Since `CachedBAxisMeasurement` is now hidden, we add a helper
`MarkCachedGridMeasurementsDirty` to remove `CachedBAxisMeasurement::Prop()` in
`nsIFrame::MarkIntrinsicISizesDirty()`.

Differential Revision: https://phabricator.services.mozilla.com/D246060
2025-04-19 01:05:17 +00:00
Jonathan Kew
a8a835195b Bug 1958985 - Don't allow a generated-content block as a "result frame" in GetNextPrevLineFromBlockFrame. r=layout-reviewers,emilio
If we return the generated-content block, PeekOffsetForLine will descend
into it, and then determine it isn't a valid result, and move on from the
desired target line. Excluding the generated-content block allows us to
properly return the next (or previous) frame on the line instead.

Differential Revision: https://phabricator.services.mozilla.com/D245902
2025-04-18 08:48:47 +00:00
Iulian Moraru
b23488a0ea Backed out changeset cfe3b36a0ea9 (bug 1961140) for causing debug-only assertions. CLOSED TREE 2025-04-17 16:02:07 +03:00
Emilio Cobos Álvarez
88fcb89966 Bug 1961140 - Make view transition contents not be affected by ancestor clips. r=nical
This also improves the rendering of new-content-ancestor-clipped.html,
but doesn't fully fix it. I think there's something going on with the
box shadow / ink overflow coordinates.

Differential Revision: https://phabricator.services.mozilla.com/D245770
2025-04-17 11:59:31 +00:00
Emilio Cobos Álvarez
f2ea56be57 Bug 1959780 - Make GetRangeForFrame() always return the inside range for non-replaced elements, not just blocks and editing hosts. r=masayuki
Otherwise you can't insert stuff in something like an empty
inline-block, there are tests for that luckily, yay.

Differential Revision: https://phabricator.services.mozilla.com/D245266
2025-04-13 07:57:18 +00:00
Emilio Cobos Álvarez
9960c10b9e Bug 1959780 - Add a missing editing host check in GetRangeForFrame. r=masayuki
This is the low risk fix, but I'm not sure I understand what this code
is doing / why are we not just returning the "inner" range for all
frames, including inlines.

Differential Revision: https://phabricator.services.mozilla.com/D245228
2025-04-13 07:32:35 +00:00
Emilio Cobos Álvarez
327d527c49 Bug 1959644 - Turn paint into a regular render phase. r=smaug
This reuses the newly introduced infrastructure to track painting, and
avoids painting if rendering is suppressed (such as for view transitions
and so on).

Rendering suppression of an in-process iframe needs more work because
right now we paint in-process iframes as part of the top document's
display list.

Remove some old paint invalidation printf-debugging, which I suspect
nobody has used in years. Profiler markers are strictly better :)

Differential Revision: https://phabricator.services.mozilla.com/D245063
2025-04-11 11:22:49 +00:00
Ting-Yu Lin
d8e1c44122 Bug 1959646 - Add zero-parameter overloads for dumping frame trees. r=layout-reviewers,emilio
This patch adds zero-parameter overloads for `DumpFrameTree()` and
`DumpFrameTreeInCSSPixels()`, making it easier to call these functions in the
debugger without having to pass `false` as an argument.

Additionally, this patch reverts bug 1959538 since that change [1] is no longer
needed with these new overloads.

[1]https://hg.mozilla.org/mozilla-central/rev/7371d5813735

Differential Revision: https://phabricator.services.mozilla.com/D245155
2025-04-11 00:25:58 +00:00
David Shin
c291c3a105 Bug 1958914: Treat AnchorResolved-using types as instantiations, not subtypes. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D244658
2025-04-08 02:29:19 +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
David Shin
40e6a5c66e Bug 1923959: Resolve anchor for margins. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D240863
2025-04-08 02:29:18 +00:00
Timothy Nikkel
6113108228 Bug 1936189. Only do -moz-subtree-hidden-only-visually checks in the parent process. r=layout-reviewers,emilio
This is a chrome only css property (so it could still be used in a UA sheet that is applied to a content document) that was created solely to tabs/xul decks in a fashion that is more like the rest of css/html. And it still only has that single use in our tree. A UA sheet applying this property to content it doesn't control doesn't seem like it could be very useful.

Even those these checks are simple they are relatively costly because we check them on every frame and when we are traversing the frame tree (for display list building or setting a displayport) we are often memory bound, so pulling in another bit of otherwise cold memory for a rare style struct makes us wait for loading more memory and pushes more useful stuff out of caches. The parent process check remains very quick as verified by profiling.

Differential Revision: https://phabricator.services.mozilla.com/D231648
2025-04-08 00:26:08 +00:00
Emilio Cobos Álvarez
b7f1e63735 Bug 1958639 - Ignore anonymous boxes and NAC for paragraph selection code. r=masayuki
The inner block of a scroller for example (::-moz-scrolled-content)
shouldn't be considered a line break.

Same for scrollbar nodes, we don't want to break on scrollbars (or
native anonymous content in general), since we can't position the caret
and such there anyways.

Differential Revision: https://phabricator.services.mozilla.com/D244519
2025-04-07 09:28:20 +00:00
Cosmin Sabou
f28da8586b Backed out changeset 099bd0ee7554 (bug 1958639) for causing bc failures on browser_clipboard. 2025-04-07 04:45:59 +03:00
Emilio Cobos Álvarez
1008751221 Bug 1958639 - Ignore anonymous boxes and NAC for paragraph selection code. r=masayuki
The inner block of a scroller for example (::-moz-scrolled-content)
shouldn't be considered a line break.

Same for scrollbar nodes, we don't want to break on scrollbars (or
native anonymous content in general), since we can't position the caret
and such there anyways.

Differential Revision: https://phabricator.services.mozilla.com/D244519
2025-04-06 23:58:48 +00:00
Emilio Cobos Álvarez
872737ec7a Bug 1957900 - Ensure view transition snapshots capture opacity / clips / masks. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D244127
2025-04-02 13:05:23 +00:00
Jan-Niklas Jaeschke
94f7a92240 Bug 1724299, part 1 - Implement auto-expanding details. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D241454
2025-04-02 08:22:48 +00:00
Jan-Niklas Jaeschke
a876c168a1 Bug 1761043, part 6 - hidden=until-found: Implementedhidden=until-found in nsFind. r=emilio
This fixes Text Fragments tests as well since
that feature relies on `nsFind`.

Differential Revision: https://phabricator.services.mozilla.com/D241452
2025-04-02 08:22:47 +00:00
Emilio Cobos Álvarez
d025ded17c Bug 1953823 - When the root is snapshotted, snapshot the root contents but not top layer(s). r=view-transitions-reviewers,boris
For fallback snapshots, for now just snapshot the canvas frame.

Differential Revision: https://phabricator.services.mozilla.com/D242016
2025-03-25 14:03:19 +00:00
Jonathan Watt
24e5a0acae Bug 1954764. Rename needAnchorSuppression in nsIFrame::DidSetComputedStyle. r=dshin
This code will soon deal with both scroll anchoring and position anchoring.
Renaming the existing scroll anchoring variable to avoid confusion.

Differential Revision: https://phabricator.services.mozilla.com/D242004
2025-03-24 13:20:07 +00:00
Masayuki Nakano
0ef5624d51 Bug 1954020 - Rename "limiter" of nsFrameSelection to "independent selection root element" r=emilio
It's currently always set to the native anonymous `<div>` for editable content
of text control element.  So, it means that it's an independent selection root.

Depends on D241587

Differential Revision: https://phabricator.services.mozilla.com/D241775
2025-03-17 12:49:58 +00:00
Masayuki Nakano
a5637890c7 Bug 1946001 - Fix some points which may cross independent selection boundary r=emilio,jjaschke
This patch fixes multiple points which may cross independent selection
boundaries which is element boundary of the native anonymous `<div>` for
editable content in text controls.  The reason why I don't split this patch is,
fixing one of them leads another assertion failure.  So, I couldn't pass all
tests with separated patches.

1. `nsFrameTraversal` should take `Element` instead of `nsIFrame` for the
limiter because e.g., inline editing host like `<span contenteditable>` may
have multiple frames if it's wrapped.  Therefore, we should make it take
an element as the ancestor limiter, and check it when getting parent frame
or after getting previous or next frame.
2. `nsIFrame::PeekBackwardAndForward` may cross the boundary because it does not
take the anonymous `<div>` element as ancestor limiter of the selection.  It's
currently used only for extending selection.  Therefore, I rename it to make
it clearer.
3. `SelectionMovementUtils::GetPrevNextBidiLevel` to take the ancestor limiter
for calling `nsIFrame::GetFrameFromDirection()`.
4. `nsINode` should have a method to return the `nsFrameSelection` instance
which manages the selection in the node.  This makes the check simpler, and
this is not expensive.  Then, for making it clearer, I rename
`TextControlElement::GetConstFrameSelection()` to
`GetIndependentFrameSelection()`.
5. `nsINode::GetSelectionRootContent()` should have an option to return
independent selection root when the node is its host for
`nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree()`
6. `nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree()` should not
retrieve independent selection root when the given frame is a text control
frame.
7. `RangeUtils` should get parent with checking the independent selection
boundaries.
8. `Selection::Extend` should assert if the destination is managed by its
frame selection to detect a bug.

Differential Revision: https://phabricator.services.mozilla.com/D241587
2025-03-17 12:49:57 +00:00
Emilio Cobos Álvarez
0ff8015e82 Bug 1922333 - Land view transition plumbing for live capture behind a default-off pref. r=view-transitions-reviewers,boris
It is mostly working, but there are some tests that hit crashes and
asserts that we should sort out. For now, land it default-off.

This does implement other bits that are on by default tho, like creating
image frames for ::view-transition-new() pseudo-elements and so on. I
think that is fine (it's just that for now they are all transparent).

Differential Revision: https://phabricator.services.mozilla.com/D239382
2025-03-05 11:18:18 +00:00
Emilio Cobos Álvarez
f5b2976c45 Bug 1922298 - Add a fast way of tagging frames as captured, and make that view-transition-name a stacking-context-creating property. r=view-transitions-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D239377
2025-02-26 12:29:49 +00:00
Cristina Horotan
5bc51022a0 Backed out 9 changesets (bug 1922300, bug 1950362, bug 1919333, bug 1950176, bug 1948058, bug 1950177, bug 1922298) for causing multiple Wr failures
Backed out changeset 54c87e09251a (bug 1919333)
Backed out changeset 813274ba35a0 (bug 1919333)
Backed out changeset a37d91fc2a7a (bug 1950362)
Backed out changeset 97f67f9048b5 (bug 1922298)
Backed out changeset 4c11b366fcaf (bug 1919333)
Backed out changeset dbde76fa73a9 (bug 1948058)
Backed out changeset ba3d9d95cd56 (bug 1922300)
Backed out changeset 0fe786bf2709 (bug 1950177)
Backed out changeset 8d9f52e91779 (bug 1950176)
2025-02-26 06:23:09 +02:00
Emilio Cobos Álvarez
90fa7916f7 Bug 1922298 - Add a fast way of tagging frames as captured, and make that view-transition-name a stacking-context-creating property. r=view-transitions-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D239377
2025-02-25 22:48:31 +00:00
Sean Feng
d8ecdd8d22 Bug 1930931 - Make the dragging interaction still happens when the event target frame is moved/destroyed upon mousedown r=masayuki,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D238318
2025-02-21 18:25:06 +00:00
Hiroyuki Ikezoe
265c0dd6a2 Bug 1943597 - Avoid creating nsDisplayFixedPotion display items for popup. r=botond,emilio
Differential Revision: https://phabricator.services.mozilla.com/D236812
2025-02-14 02:26:56 +00:00
Norisz Fay
2ba59a28fb Backed out 6 changesets (bug 1943597) for causing Wd,bc process-crashes
Backed out changeset 198a709574b4 (bug 1943597)
Backed out changeset bed944b2f025 (bug 1943597)
Backed out changeset 6bf1e7b3c631 (bug 1943597)
Backed out changeset ef120d0f1555 (bug 1943597)
Backed out changeset a8d8fc79f935 (bug 1943597)
Backed out changeset d3daad7d905d (bug 1943597)
2025-02-13 13:14:26 +02:00
Hiroyuki Ikezoe
d792929dde Bug 1943597 - Avoid creating nsDisplayFixedPotion display items for popup. r=botond,emilio
Differential Revision: https://phabricator.services.mozilla.com/D236812
2025-02-13 08:26:03 +00:00
Alexandru Marc
4e77c545ce Backed out 6 changesets (bug 1943597) for causing bc failures @ browser_test_popup_menu_in_position_fixed.js CLOSED TREE
Backed out changeset e08b121d73a9 (bug 1943597)
Backed out changeset 805c841108cf (bug 1943597)
Backed out changeset 4ab954f5a0e7 (bug 1943597)
Backed out changeset 58dded9a06f8 (bug 1943597)
Backed out changeset fabc3f833a51 (bug 1943597)
Backed out changeset 77607ad7a2c2 (bug 1943597)
2025-02-12 09:03:24 +02:00
Hiroyuki Ikezoe
538f74ce71 Bug 1943597 - Avoid creating nsDisplayFixedPotion display items for popup. r=botond,emilio
Differential Revision: https://phabricator.services.mozilla.com/D236812
2025-02-12 05:30:32 +00:00