Commit Graph
2107 Commits
Author SHA1 Message Date
Cosmin Sabou 1890f2de9f Revert "Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar" for mochitest failures @ test_dialogfocus.
This reverts commit baa46d0833.
2026-06-11 15:22:43 +00:00
Leo Tenenbaum baa46d0833 Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar
Differential Revision: https://phabricator.services.mozilla.com/D303899
2026-06-11 13:33:50 +00:00
Emilio Cobos Álvarez 8a2eeff8e8 Bug 2044694 - Move ScrollOffsetUpdateType out of FrameMetrics to avoid unnecessary FrameMetrics.h includes. r=botond,layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D304480
2026-06-05 01:19:42 +00:00
agoloman 861a985a35 Revert "Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar" for causing wpt failures @sequential-focus-navigation-starting-point.tentative.html.
This reverts commit 15f3930b2c.
2026-06-04 22:12:33 +00:00
Emilio Cobos Álvarez 1ffa4bb822 Bug 2041502 - Make PresShell forward notifications to DocAccessible. r=layout-reviewers,jwatt
The main difference is that removals get processed before other
observers, like PresShell does. This prevents the options list from
getting re-filled, see the stack in the bug.

While at it, simplify the aria attribute notifications, they don't need
to walk the whole chain, as only DocAccessible cares about it. Route
them through the accessible service like the AttrElement ones.

Differential Revision: https://phabricator.services.mozilla.com/D304716
2026-06-04 22:07:09 +00:00
Leo Tenenbaum 15f3930b2c Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar
Differential Revision: https://phabricator.services.mozilla.com/D303899
2026-06-04 21:17:44 +00:00
agoloman 58b975f528 Revert "Bug 2041502 - Make PresShell forward notifications to DocAccessible. r=layout-reviewers,jwatt" for causing mac bustages @DocAccessibleWrap.h.
This reverts commit 691d8496c3.
2026-06-04 19:16:32 +00:00
Emilio Cobos Álvarez 691d8496c3 Bug 2041502 - Make PresShell forward notifications to DocAccessible. r=layout-reviewers,jwatt
The main difference is that removals get processed before other
observers, like PresShell does. This prevents the options list from
getting re-filled, see the stack in the bug.

While at it, simplify the aria attribute notifications, they don't need
to walk the whole chain, as only DocAccessible cares about it. Route
them through the accessible service like the AttrElement ones.

Differential Revision: https://phabricator.services.mozilla.com/D304716
2026-06-04 18:17:13 +00:00
Emilio Cobos Álvarez dc4494136b No bug - Make ReflowCounter trivially destructible to appease clang-tidy r=layout-reviewers,jwatt DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D304724
2026-06-04 13:39:39 +00:00
Stephen A Pohl 5c406a7341 Bug 2038491: Claim orphaned last-mouse state in PresShell::SynthesizeMouseMove so cursor/:hover restyles take effect after a top-level navigation without a fresh mouse move. r=masayuki
After a top-level navigation, the new PresShell has no per-PresShell mouse state until a real mouse event arrives. PresShell::SynthesizeMouseMove bails on that empty state, so a JS-driven cursor or :hover change (e.g. `body.style.cursor = 'none'` triggered by a keypress) does not take effect until the user moves the mouse.

PointerEventHandler still holds the static last-mouse state from before the navigation. When the previous owning PresShell has been torn down, claim that state for the new PresShell. The existing path in ProcessSynthMouseMoveEvent then dispatches a synthetic eMouseMove at the cached position.

Gate the claim with three checks. Skip if another live PresShell still owns the state (e.g. a popup). Skip unless the widget that originally recorded the state matches aRootPresShell's widget, since PresShell::IsRoot() means root of the in-process presContext tree and the previous owner could have been on a different top-level window in the same content process. And use a new sLastMousePointerId static for the recovered pointerId, since sLastPointerId tracks any pointer (including touch) and would mismatch the eMouseMove dispatched downstream.

Differential Revision: https://phabricator.services.mozilla.com/D301688
2026-05-28 05:18:31 +00:00
Atila Butkovits 1b783b25f2 Revert "Bug 2038491: Claim orphaned last-mouse state in PresShell::SynthesizeMouseMove so cursor/:hover restyles take effect after a top-level navigation without a fresh mouse move. r=masayuki" for causing leaks.
This reverts commit 1e646d5881.
2026-05-27 22:30:36 +00:00
Stephen A Pohl 1e646d5881 Bug 2038491: Claim orphaned last-mouse state in PresShell::SynthesizeMouseMove so cursor/:hover restyles take effect after a top-level navigation without a fresh mouse move. r=masayuki
After a top-level navigation, the new PresShell has no per-PresShell mouse state until a real mouse event arrives. PresShell::SynthesizeMouseMove bails on that empty state, so a JS-driven cursor or :hover change (e.g. `body.style.cursor = 'none'` triggered by a keypress) does not take effect until the user moves the mouse.

PointerEventHandler still holds the static last-mouse state from before the navigation. When the previous owning PresShell has been torn down, claim that state for the new PresShell. The existing path in ProcessSynthMouseMoveEvent then dispatches a synthetic eMouseMove at the cached position.

Gate the claim with three checks. Skip if another live PresShell still owns the state (e.g. a popup). Skip unless the widget that originally recorded the state matches aRootPresShell's widget, since PresShell::IsRoot() means root of the in-process presContext tree and the previous owner could have been on a different top-level window in the same content process. And use a new sLastMousePointerId static for the recovered pointerId, since sLastPointerId tracks any pointer (including touch) and would mismatch the eMouseMove dispatched downstream.

Differential Revision: https://phabricator.services.mozilla.com/D301688
2026-05-27 22:00:17 +00:00
Hiroyuki Ikezoe b215f7c48f Bug 2036292 - Skip calling ScrollToVisual if the target frame is already in the visual viewport. r=botond,geckoview-reviewers,layout-reviewers,emilio,m_kato
When scrollIntoView() is called on a position:fixed element that is already
visible in the visual viewport, ScrollFrameIntoVisualViewport() was still
calling ScrollToVisual() unnecessarily, causing a spurious visual scroll.

Add a check to skip the visual scroll if the element's rect (converted to
layout coordinates) is already contained within the current visual viewport.
Using layout coordinates is necessary since the visual viewport may have been
panned from the origin, in which case a viewport-origin check would give a
false negative for elements positioned beyond the visual viewport height.

Differential Revision: https://phabricator.services.mozilla.com/D297842
2026-05-26 07:54:51 +00:00
Hiroyuki Ikezoe dcf39df52d Bug 2036292 - Make PresShell::GetVisualViewportSize aware of the dynamic toolbar height. r=layout-reviewers,emilio
Previously, GetVisualViewportSize() returned the raw mVisualViewportSize, so
callers via ScrollContainerFrame::GetVisualViewportSize() were unaware of the
dynamic toolbar state. The toolbar awareness logic that was inline in
VisualViewport.cpp is moved into GetVisualViewportSize() itself, so all callers
get the correct size when the toolbar is collapsing or collapsed.

Differential Revision: https://phabricator.services.mozilla.com/D297841
2026-05-26 07:54:48 +00:00
Masayuki Nakano a7b798c8d2 Bug 2035992 - Add EventStateManager::GetEventTargetContent and PresShell::GetEventTargetContent r=smaug
They have only `GetExplicitEventTargetContent` and some callers may want
to get proper target `Element`. Therefore, we should add them and the
common logic should be shared.

`nsListControlFrame::GetIndexFromEvent` looks for an inclusive ancestor
`<option>`. So, it can start the loop from its inclusive ancestor
element of the explicit event target so that it can use the new API.

Differential Revision: https://phabricator.services.mozilla.com/D300217
2026-05-19 08:19:32 +00:00
Masayuki Nakano f5281398f2 Bug 2035992 - Make PresShell::EventHandler::MaybeDiscardOrDelayMouseEvent use nsIFrame::GetEventTargetContent to set WidgetGUIEvent::mTarget r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D297850
2026-05-19 08:19:13 +00:00
Masayuki Nakano 03c09548c4 Bug 2035992 - Make EventHandler::EventTargetData::SetContentForEventFromFrame use nsIFrame::GetEventTargetContent r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D297849
2026-05-19 08:19:09 +00:00
Masayuki Nakano b77593c2f7 Bug 2035992 - Add nsIFrame::GetEventTargetContent() to get proper event target from the given event r=smaug,emilio,layout-reviewers
Most event targets an element node even if the input occurs on a `Text`.
`EventStateManager`, `PresShell`, `PresShell::EventHandler`, etc use
the result of `nsIFrame::GetContentForEvent` result as-is or looking
for proper ancestor element by the caller selves.

So, I think there should be `GetEventTargetContent()` which solves the
target node kind automatically and in the same way. And also this patch
renames `nsIFrame::GetContentForEvent` to
`nsIFrame::GetEventTargetExplicitContent` for consistency with
`Event::mExplicitOriginalTarget`.

Finally, this patch changes the callers which retrieves a parent
`Element` if the result of `GetContentForEvent` is not an `Element` to
use the new `GetEventTargetContent`.

The following patches make each caller of `GetContentForEvent` marked
with "FIXME" comment fix one by one.

Differential Revision: https://phabricator.services.mozilla.com/D297848
2026-05-19 08:19:05 +00:00
Serban Stanca 37fe53f379 Revert "Bug 2035992 - Add EventStateManager::GetEventTargetContent and PresShell::GetEventTargetContent r=smaug" for causing build bustages in EventStateManager.cpp.
This reverts commit c1105686da.

This reverts commit 65dfa9f984.

This reverts commit adc2bf1081.

This reverts commit 7163909ad8.

This reverts commit fa2354f5f8.

This reverts commit 95a8aec384.

This reverts commit a46e328cae.

This reverts commit 84f304eb70.
2026-05-19 00:52:14 +00:00
Masayuki Nakano c1105686da Bug 2035992 - Add EventStateManager::GetEventTargetContent and PresShell::GetEventTargetContent r=smaug
They have only `GetExplicitEventTargetContent` and some callers may want
to get proper target `Element`. Therefore, we should add them and the
common logic should be shared.

`nsListControlFrame::GetIndexFromEvent` looks for an inclusive ancestor
`<option>`. So, it can start the loop from its inclusive ancestor
element of the explicit event target so that it can use the new API.

Differential Revision: https://phabricator.services.mozilla.com/D300217
2026-05-19 00:09:51 +00:00
Masayuki Nakano 95a8aec384 Bug 2035992 - Make PresShell::EventHandler::MaybeDiscardOrDelayMouseEvent use nsIFrame::GetEventTargetContent to set WidgetGUIEvent::mTarget r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D297850
2026-05-19 00:09:31 +00:00
Masayuki Nakano a46e328cae Bug 2035992 - Make EventHandler::EventTargetData::SetContentForEventFromFrame use nsIFrame::GetEventTargetContent r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D297849
2026-05-19 00:09:27 +00:00
Masayuki Nakano 84f304eb70 Bug 2035992 - Add nsIFrame::GetEventTargetContent() to get proper event target from the given event r=smaug,emilio,layout-reviewers
Most event targets an element node even if the input occurs on a `Text`.
`EventStateManager`, `PresShell`, `PresShell::EventHandler`, etc use
the result of `nsIFrame::GetContentForEvent` result as-is or looking
for proper ancestor element by the caller selves.

So, I think there should be `GetEventTargetContent()` which solves the
target node kind automatically and in the same way. And also this patch
renames `nsIFrame::GetContentForEvent` to
`nsIFrame::GetEventTargetExplicitContent` for consistency with
`Event::mExplicitOriginalTarget`.

Finally, this patch changes the callers which retrieves a parent
`Element` if the result of `GetContentForEvent` is not an `Element` to
use the new `GetEventTargetContent`.

The following patches make each caller of `GetContentForEvent` marked
with "FIXME" comment fix one by one.

Differential Revision: https://phabricator.services.mozilla.com/D297848
2026-05-19 00:09:23 +00:00
Hiroyuki Ikezoe 09bbd3cf97 Bug 2039745 - Drop ScrollTimelineAnimationTracker. r=layout-scroll-driven-animation-reviewers,layout-reviewers,emilio,dshin
Differential Revision: https://phabricator.services.mozilla.com/D300667
2026-05-18 09:42:12 +00:00
Leo Tenenbaum 9e978fd6da Bug 2034851 - Separate sequential focus navigation starting point from selection. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D298958
2026-05-15 17:53:05 +00:00
Leo Tenenbaum 14e83643ee Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D299228
2026-05-15 17:25:28 +00:00
Atila Butkovits 6706fac649 Revert "Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki" for causing failures at test_drag_drop_caret.html.
This reverts commit 524b0cc22b.
2026-05-15 13:53:29 +00:00
Leo Tenenbaum 524b0cc22b Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D299228
2026-05-15 13:07:26 +00:00
Simon Farre 661d23e12c Bug 2037372 - Keyboard locked fullscreen should exit on hold of escape on systems with repeat disabled r=edgar,avandolder
Differential Revision: https://phabricator.services.mozilla.com/D298823
2026-05-12 12:02:07 +00:00
Hiroyuki Ikezoe 1658947399 Bug 2037632 - Resolve scrollIntoView "auto" against the target's writing mode to fix scrollbar-gutter-scroll-into-view regression. r=layout-reviewers,dshin
The previous change collapsed the auto fallback to a fixed pair (Start for
the physical vertical axis, Nearest for the physical horizontal axis), which
matches the spec defaults (block: start, inline: nearest) only in horizontal
writing modes. In vertical writing modes the physical-to-logical mapping is
reversed, and in vertical-rl the block-axis default is "end" rather than
"start".

Compute the auto defaults for the physical vertical and horizontal axes
upfront in ScrollFrameIntoView, taking the target's writing mode into account
when AxesAreLogical is set, and pass them through ScrollToShowRect to
GetApplicableWhereToScroll. This keeps GetApplicableWhereToScroll free of any
writing-mode awareness.

This fixes the
testing/web-platform/tests/css/css-overflow/scrollbar-gutter-scroll-into-view.html
failure.

Differential Revision: https://phabricator.services.mozilla.com/D299089
2026-05-08 00:58:41 +00:00
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
Hiroyuki Ikezoe e08601065e Bug 2037631 - Respect scroll-snap-align when scrolling to a fragment. r=layout-reviewers,webidl,emilio
Add "auto" to ScrollLogicalPosition per https://github.com/w3c/csswg-drafts/issues/9576.
Fragment navigation now passes WhereToScroll::Auto so that scroll-snap-align is
respected when present, falling back to the spec defaults (start for block,
nearest for inline) when absent. Explicit scrollIntoView() alignment values are
no longer overridden by snap alignment.

GetScrollSnapAlignFor previously returned None for all axes when the scroll
container had scroll-snap-type: none. Remove that early return so that fragment
navigation (which uses WhereToScroll::Auto) can still honor the target's
scroll-snap-align even on non-snapping containers, as the spec permits.

Differential Revision: https://phabricator.services.mozilla.com/D298959
2026-05-07 03:23:07 +00:00
Leo Tenenbaum 850c5fdbea Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki
Depends on D290638

Differential Revision: https://phabricator.services.mozilla.com/D294734
2026-05-05 21:38:43 +00:00
Daniel Holbert f67f00d372 Bug 2036951: Use 'MakeRefPtr' instead of 'new' to allocate reference-counted objects, in various places within layout. r=layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D298452
2026-05-05 06:23:23 +00:00
Alexandru Marc 97bc836507 Revert "Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki" for causing mochitest failures @ test_named_deck
This reverts commit 77b32373c4.
2026-05-04 17:20:56 +00:00
Leo Tenenbaum 77b32373c4 Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D294734
2026-05-04 13:12:10 +00:00
Eugeniusz Lewandowski fc8097fcc3 Bug 1650944 - Remove ReflowInput.h include from nsIFrame.h r=firefox-style-system-reviewers,layout-reviewers,emilio
Removed the Reflow Input in nsIFrame. Added includes for ReflowInput as
necessary in cpp files. Also Forward Declared nsLineLayout in 3 header
files.

Differential Revision: https://phabricator.services.mozilla.com/D298203
2026-05-04 12:06:23 +00:00
Alexandru Marc 527e77160d Revert "Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki" for causing ba failures @ browser_text_selection
This reverts commit 5a8dadf613.
2026-05-01 18:04:24 +00:00
Leo Tenenbaum 5a8dadf613 Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D294734
2026-05-01 16:33:02 +00:00
agoloman 8db98c5af2 Revert "Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki" for causing wr failures @nsINode.cpp.
This reverts commit 3e98c374c4.
2026-04-28 14:07:42 +00:00
Leo Tenenbaum 3e98c374c4 Bug 2032191 - Return false in EditorBase::CanKeepHandlingFocusEvent if focused element is not editable. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D294734
2026-04-28 12:56:15 +00:00
Emilio Cobos Álvarez 1ddad57128 Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug
Make them concrete classes rather than interfaces, and make the
inheritance chain simpler.

Differential Revision: https://phabricator.services.mozilla.com/D296484
2026-04-28 07:38:27 +00:00
Silaghi ce61f876cc Revert "Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug" for causing wpt failures at BaseContentList
This reverts commit cde3e5607b.
2026-04-28 03:43:46 +00:00
Emilio Cobos Álvarez cde3e5607b Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug
Make them concrete classes rather than interfaces, and make the
inheritance chain simpler.

Differential Revision: https://phabricator.services.mozilla.com/D296484
2026-04-28 00:24:11 +00:00
Josh Aas 6d07b772d4 Bug 103422 - Add support for paragraph movement commands on macOS, including their selection variants. r=bradwerth,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D284945
2026-04-21 13:09:47 +00:00
Edgar Chen fe9c73f596 Bug 2032718 - Show fullscreen keyboard lock warning when long-press Esc; r=avandolder
Differential Revision: https://phabricator.services.mozilla.com/D294935
2026-04-17 22:53:34 +00:00
rperta f39006524c Revert "Bug 2032682 - Test repeated fullscreen request with different keyboard lock mode r=dom-core,edgar" for causing wpt failures at document-fullscreen-keyboard-lock-change.tentative.window.html
This reverts commit ce9e5a68d9.

This reverts commit f685c19bfe.

This reverts commit 1ebde05734.

This reverts commit 180c005300.

This reverts commit 3e07ae8ab3.
2026-04-17 21:57:05 +00:00
Edgar Chen 1ebde05734 Bug 2032718 - Show fullscreen keyboard lock warning when long-press Esc; r=avandolder
Differential Revision: https://phabricator.services.mozilla.com/D294935
2026-04-17 19:34:11 +00:00
Adam Vandolder f8e6ba4cd5 Bug 700123 - Part 7: Show a warning when user presses Escape while fullscreen keyboard lock is enabled. r=dom-core,smaug
We warn the user the first time they press escape, and then on any
subsequent triple-clicks.

Differential Revision: https://phabricator.services.mozilla.com/D294259
2026-04-16 11:05:42 +00:00
Vincent Hilla 632ffc2bc3 Bug 2030348 - Target document element for hit testing when rendering is suppressed for VT. r=emilio,masayuki,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D292852
2026-04-16 08:02:23 +00:00