Commit Graph
1215 Commits
Author SHA1 Message Date
Emilio Cobos Álvarez 78b87ae8be Bug 2045230 - Add background-clip: border-area support for solid borders. r=gfx-reviewers,layout-reviewers,firefox-style-system-reviewers,lsalzman,dshin
This is useful for nova (which wants to use a gradient border around the
selected tab and right now hack around it with multiple backgrounds).

For now enable only on chrome code by default since we only support
solid borders (which is what we want anyways), and we don't support
combining it with `background-clip: text`.

Differential Revision: https://phabricator.services.mozilla.com/D304960
2026-06-10 12:24:34 +00:00
Rémi Papillié 8af1d48055 Bug 2046140 - Fix tier-2 compile error in nsIFrame.cpp. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D305832
2026-06-10 11:42:30 +00:00
Rémi Papillié b2f0aef91d Bug 2035317 - Fix compile issue in non-unity builds. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D305640
2026-06-10 04:33:20 +00:00
Mr. M 8880cba9fa Bug 2035317 - Add rendering for CSS corner-shape support r=layout-reviewers,emilio,gfx-reviewers,firefox-style-system-reviewers,cheff,nical
Differential Revision: https://phabricator.services.mozilla.com/D297660
2026-06-09 15:01:50 +00:00
Seva Alipov 4f6218c8fe Bug 1927186: Alternative approach, fixing matrix zoom upsteam. r=firefox-style-system-reviewers,layout-reviewers,emilio,dshin
Differential Revision: https://phabricator.services.mozilla.com/D304905
2026-06-08 19:15:45 +00:00
Josh Aas 0a160f78a3 Bug 2041228 - Fix a regression on macOS in which paragraph movement does not work correctly. r=masayuki,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D301836
2026-06-08 13:55:25 +00:00
Masayuki Nakano 821c05533a Bug 2045219 - Improve the debug print of nsINode r=smaug,dom-core-reviewers
Currently, `operator<<(std::ostram&, const nsINode&)` prints the path
of the node with some attribute information of each node. However, there
are some issues:

1. It's unclear if the reached root is a `DocumentFragment` or
`ShadowRoot` due to the same node name, `#document-fragment`.
2. Do not print the host's path.
3. Cannot print only in a specific node such as a `contenteditable`.
4. It's hard to consider which `Text` if a node has multiple `Text`
nodes.
5. No information about the assigned `<slot>`.
6. No information about `EditContext`.

This patch appends these information to each node. Additionally, adding
`format_as()` for avoiding to use `mozilla::ToString` for `fmt::format`
and `MOZ_LOG_FMT`.

Finally, to test the new data, this makes `Selection` and `SelectionAPI`
log use `MOZ_LOG_FMT`.

Differential Revision: https://phabricator.services.mozilla.com/D304964
2026-06-08 01:00:49 +00:00
Stephen A Pohl f915f2ed04 Bug 2043935: Only set nsIFrame::mBuiltDisplayList for painting display list builds. r=hiro,layout-reviewers,tnikkel
mBuiltDisplayList, read via nsIDOMWindowUtils::CheckAndClearDisplayListState, is observed only by paint-regression tests: reftests and the mochitest helper_bug1669625.html. It was also being set during EventDelivery (hit-testing) display list builds, which nsLayoutUtils::GetFramesForArea performs to find the target frame when delivering a mouse or pointer event. That made those tests intermittently observe a display list build that was really just event hit-testing, unrelated to painting. Gate the three build-time SetBuiltDisplayList(true) calls on nsDisplayListBuilder::IsForPainting() so only painting and print builds record the flag.

Also add a mochitest asserting that hit testing (elementFromPoint) does not mark the document element's display list as built, while painting does.

Differential Revision: https://phabricator.services.mozilla.com/D303633
2026-06-02 12:49:44 +00:00
Atila Butkovits 538abdbf8b Revert "Bug 2041228 - Fix a regression on macOS in which paragraph movement does not work correctly. r=masayuki,layout-reviewers,emilio" for causing failures at selection-direction-on-triple-click.tentative.html.
This reverts commit 5058112a33.
2026-05-31 12:05:40 +00:00
Josh Aas 5058112a33 Bug 2041228 - Fix a regression on macOS in which paragraph movement does not work correctly. r=masayuki,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D301836
2026-05-31 09:59:54 +00:00
serge-sans-paille 57804a4fa1 Bug 2041298 - Comply with clang-tidy's modernize-use-nullptr check for layout/ r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D301770
2026-05-26 14:31:53 +00:00
Emilio Cobos Álvarez c50b9a0d59 Bug 2041235 - Avoid triggering table selection outside text control. r=smaug
I haven't been able to reproduce this bug consistently, but I did manage
to trigger some assertions here:

https://searchfox.org/firefox-main/rev/8097ef6fac6522ded33f1e2d4d521c16331be5db/dom/base/nsContentUtils.cpp#8470-8477

And pretty sure it's the same root cause... Before my patch, mouse
events weren't routed outside the scroller which papered over this
issue.

Differential Revision: https://phabricator.services.mozilla.com/D302364
2026-05-25 18:23:24 +00:00
Sajid Anwar a3e1d680bb Bug 2010717 - Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging. r=layout-reviewers,firefox-style-system-reviewers,dshin
Also adds WPT reftests to validate alignment behavior in horizontal and vertical
writing modes with the different `alignment-baseline` values. Additionally:

- The `alignment-baseline: middle` tests have failing expectations. This is
  because the existing implementation does not match the css-inline-3 definition
  (which the new WPTs follow). See Bug 2030203.

- The WidthTest-Regular.otf support font was updated to remove its unusual
  ideographic-under baseline value, which affected its synthesized central
  baseline. With the new support for `alignment-baseline: central`, this broke a
  number of `text-combine-upright-compression-*` WPT reftests. The non-centered
  baseline values were removed from this test using FontForge, so that the
  synthesized central baseline matched the expectation of the test references.

Differential Revision: https://phabricator.services.mozilla.com/D292136
2026-05-19 13:49:52 +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 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 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
Daniel Holbert 9c0ef373b0 Bug 2038723: Use MakeRefPtr to do allocation for local RefPtr variables, in layout. r=layout-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D299753
2026-05-12 19:56:07 +00:00
Silaghi e2f7575a37 Revert "Bug 2010717, Bug 2029869 - Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging. r=layout-reviewers,firefox-style-system-reviewers,dshin" for causing wr and reftest failures
This reverts commit 482c9f881b.

Revert "Bug 2029869 - Synthesize vertical font metrics/baselines from horizontal metrics/baselines. r=layout-reviewers,jfkthame"

This reverts commit 8699ee2727.
2026-05-11 17:37:06 +00:00
Sajid Anwar 482c9f881b Bug 2010717 - Implement alignment-baseline: alphabetic/ideographic/central/mathematical/hanging. r=layout-reviewers,firefox-style-system-reviewers,dshin
Also adds WPT reftests to validate alignment behavior in horizontal and vertical
writing modes with the different `alignment-baseline` values. Additionally:

- The `alignment-baseline: middle` tests have failing expectations. This is
  because the existing implementation does not match the css-inline-3 definition
  (which the new WPTs follow). See Bug 2030203.

- The WidthTest-Regular.otf support font was updated to remove its unusual
  ideographic-under baseline value, which affected its synthesized central
  baseline. With the new support for `alignment-baseline: central`, this broke a
  number of `text-combine-upright-compression-*` WPT reftests. The non-centered
  baseline values were removed from this test using FontForge, so that the
  synthesized central baseline matched the expectation of the test references.

Differential Revision: https://phabricator.services.mozilla.com/D292136
2026-05-11 15:44:58 +00:00
Ting-Yu Lin 1a4668757b Bug 2038366 - Add a child frame iterator for nsLineBox, and adapt callers. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D299505
2026-05-09 13:56:59 +00:00
serge-sans-paille d12845e8cc Bug 2037577 - Deduplicate implementation of MarkPrincipalChildrenDirty(...) r=layout-reviewers,emilio
Same implementation over two different compilation units advocate for
promotion to a method.

This also prevents conflicts in the generalization of unified build.

Differential Revision: https://phabricator.services.mozilla.com/D298968
2026-05-07 07:49:19 +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
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
Eugeniusz Lewandowski 6a11c5d881 Bug 2036580 - Move BreakType definition out of ReflowInput class r=dholbert,layout-reviewers
Moved ReflowInput::BreakType enumuration outside ReflowInput class to mozilla::BreakType, and refactored the functions using it to reflect the change.

Differential Revision: https://phabricator.services.mozilla.com/D298034
2026-05-03 02:16:53 +00:00
Masayuki Nakano 5382e4a2a9 Bug 2036298 - Make nsIFrame::MoveCaretToEventPoint compare with the inclusive flattened tree ancestor element to consider if during a drag gesture r=emilio,layout-reviewers
`EventStateManager::mGestureDownContent` needs to be a `Text` if the
drag gestures started from the `Text` even though the event target
should be its parent element. The reason is, various places maintain
`Selection` with the `Text` node.

On the other hand, `nsIFrame::MoveCaretToEventPoint` considers whether
it's in a drag gesture with checking `mGestureDownContent` is different
from its `mContent`. However, this is not enough if the text frame is
reframed by a `mousedown` listener. In that case, we handle the
`eMouseDown` event with the parent element's frame. Therefore, current
code does not work with the editable `Text` in `<input>` and
`<textarea>` (the drag starting to select from start of the `Text` and
cannot collapse the non-collapsed selection). Therefore, we should
check whether the frame content is different from the parent element of
`mGestureDownContent` too.

Differential Revision: https://phabricator.services.mozilla.com/D297855
2026-05-01 12:16:17 +00:00
Emilio Cobos Álvarez fb61e154ec Bug 2034897 - Fix aspect-ratio handling in ComputeSizeWithIntrinsicDimensions. r=boris,firefox-style-system-reviewers,layout-reviewers,firefox-svg-reviewers,longsonr
Prefer aspect-ratio to the tentative BSize if we have both tentative
ISize and BSize.

Also make auto aspect-ratio handling a bit more explicit.

To prevent some regressions, we need to:

 * Fix size-containment aspect ratio for <embed> (nsSubDocumentFrame).
 * Fix RasterImage::GetIntrinsicRatio with uneven ratios.
 * Avoid SVG root from using the aspect ratio from the viewbox, see
   bug 2035918.

Differential Revision: https://phabricator.services.mozilla.com/D296982
2026-04-29 22:03:12 +00:00
Emilio Cobos Álvarez 68df57dca6 Bug 1930674 - Don't consider will-change: transform an always-active layer. r=gfx-reviewers,jrmuizel
will-change doesn't mean it is changing. We already did the same thing
for opacity years ago in bug 1754834.

will-change is useful to prevent side effects when the property changes
(like going from being a containing block for fixed-pos descendants to
not being it).

Given its limited extra effect and the complexity involved, let's remove
it.

We allow it to keep prerendering, since that is actually tested, and
seems worth doing.

Differential Revision: https://phabricator.services.mozilla.com/D228650
2026-04-28 20:06:11 +00:00
Sajid Anwar 9268560edd Bug 2029867 - Unify synthesis of margin-based and content/padding/border-based box baselines. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D292133
2026-04-24 18:40:03 +00:00
rperta 39e7a3043e Revert "Bug 2029867 - Use default fallback baseline synthesis for tables. r=layout-reviewers,dshin" for causing reftest failures at 1966466.html
This reverts commit cc6c0c9099.

This reverts commit d2148eedc8.

This reverts commit 6f4a9dd2eb.

This reverts commit 7de5c26642.

This reverts commit baf0863064.
2026-04-24 13:12:08 +00:00
Sajid Anwar d2148eedc8 Bug 2029867 - Unify synthesis of margin-based and content/padding/border-based box baselines. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D292133
2026-04-24 10:58:24 +00:00
Silaghi 6deafabdf7 Revert "Bug 2029867, Bug 2029864 - Use default fallback baseline synthesis for tables. r=layout-reviewers,dshin" for causing reftests failures at 1966466.html
This reverts commit 656073d672.

Revert "Bug 2029867 - Unify synthesis of margin-based and content/padding/border-based box baselines. r=layout-reviewers,dshin"

This reverts commit 40a9b5db71.

Revert "Bug 2029864 - Adjust 1083848-3-inline-background-repeat.html with more robust font size handling. r=layout-reviewers,dshin"

This reverts commit 708a2904ee.

Revert "Bug 2029864 - Adjust 1115916-1-vertical-metrics.html reftest with more robust Ahem font size. r=layout-reviewers,dshin"

This reverts commit 677a5812f8.

Revert "Bug 2029864 - Adjust WPT tests for text-emphasis line heights. r=layout-reviewers,dshin"

This reverts commit c50c152a44.
2026-04-23 06:24:07 +00:00
Sajid Anwar 40a9b5db71 Bug 2029867 - Unify synthesis of margin-based and content/padding/border-based box baselines. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D292133
2026-04-23 05:20:33 +00:00
Silaghi c1288cc070 Revert "Bug 2029867, Bug 2029864 - Use default fallback baseline synthesis for tables. r=layout-reviewers,dshin" for causing reftest failures at base/Baseline
This reverts commit 57ab38fd30.

Revert "Bug 2029867 - Unify synthesis of margin-based and content/padding/border-based box baselines. r=layout-reviewers,dshin"

This reverts commit 2c125c7bae.

Revert "Bug 2029864 - Adjust 1083848-3-inline-background-repeat.html with more robust font size handling. r=layout-reviewers,dshin"

This reverts commit 79a72f0bba.

Revert "Bug 2029864 - Adjust 1115916-1-vertical-metrics.html reftest with more robust Ahem font size. r=layout-reviewers,dshin"

This reverts commit 1e038f073e.

Revert "Bug 2029864 - Adjust WPT tests for text-emphasis line heights. r=layout-reviewers,dshin"

This reverts commit bf7b7bf2d3.
2026-04-21 16:28:51 +00:00
Sajid Anwar 2c125c7bae Bug 2029867 - Unify synthesis of margin-based and content/padding/border-based box baselines. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D292133
2026-04-21 15:47:29 +00:00
Lando 55be3ffb6d Bug 2031798: apply code formatting via Lando
# ignore-this-changeset
2026-04-17 02:55:29 +00:00
Hiroyuki Ikezoe 64c9fcc4c4 Bug 2031798 - Register/deregister sticky frames with StickyScrollContainer only for the primary frame. r=layout-reviewers,emilio
StickyScrollContainer only needs to track the primary frame; continuations and
IB-split siblings should not be registered. Move the registration from
DidSetComputedStyle into HandlePrimaryFrameStyleChange, which is called only
for primary frames, making the IsFirstContinuationOrIBSplitSibling check
unnecessary.

This also fixes the original crash: DidSetComputedStyle(nullptr) fires during
InitAndRestoreFrame before IB-split bits are set, so
IsFirstContinuationOrIBSplitSibling incorrectly returns true for non-first
IB-split siblings. Those stale StickyScrollContainer entries triggered an
assertion when new frames were allocated at the same address.

Differential Revision: https://phabricator.services.mozilla.com/D294555
2026-04-17 02:55:14 +00:00
Emilio Cobos Álvarez 34b249c82e Bug 2031757 - Rejigger text input / textarea rendering to make field-sizing easier. r=layout-reviewers,devtools-reviewers,fxview-reviewers,firefox-style-system-reviewers,ochameau,jsudiaman,dshin
This also should fix bug 1881942 (placeholder is now scrollable
alongside the textarea).

This makes nsTextControlFrame a subclass of ScrollContainerFrame (with
an inner block), and tweaks layout to match.

It lays out the inner content using block layout and align-content,
rather than bespoke reflow primitives. This makes field-sizing trivial
to implement on top.

This is a bit scary, but simpler in most ways. In particular, it needs
to teach ScrollContainerFrame of the button, because that goes outside
the scrollable area, like scrollbars. That said it needs less
special-cases added than those removed, and it should also be faster
(needs less frames to layout an input with placeholder etc), and match
other browsers better.

The general set-up is:

  <text-control-editing-root/>
  <placeholder/>
  <autofill-preview/>

text-control-editing-root is always inline-block and always displayed
(since it's what grabs the focus / shows the caret). If the
autofill-preview or placeholder are displayed, the editing-root is
zero-width and clipped (note that for placeholder that's guaranteed
because placeholder is only shown with an empty value, but
autofill-preview needs it).

placeholder and autofill-preview are hidden via `display` rather than
visibility. This doesn't make a difference with this patch but it
matters for bug 1977176.

Caret painting needs an extra hop to paint atop the placeholder (no
observable behavior change, but worth calling out).

There is one subtle behavior change, which is that single-line inputs
never report scrollable overflow in the block axis. This matches other
browsers (see the tweak in nsBlockFrame's overflow computation) and is
needed to avoid regressing scrollable-overflow-padding-input.html.

The changes in window_composition_text_querycontent.xhtml are needed
because before this patch, the height of the control editing root was
always the height of the whole textarea. The characters you're composing
might legitimately be taller than the line. Bump the line height so that
that doesn't happen in this test.

Differential Revision: https://phabricator.services.mozilla.com/D293666
2026-04-16 17:09:40 +00:00
Serban Stanca 5d4176345b Revert "Bug 2031757 - Rejigger text input / textarea rendering to make field-sizing easier. r=layout-reviewers,devtools-reviewers,fxview-reviewers,firefox-style-system-reviewers,ochameau,jsudiaman,dshin" for causing several failures.
This reverts commit 81ef425716.
2026-04-16 09:31:32 +00:00
Emilio Cobos Álvarez 81ef425716 Bug 2031757 - Rejigger text input / textarea rendering to make field-sizing easier. r=layout-reviewers,devtools-reviewers,fxview-reviewers,firefox-style-system-reviewers,ochameau,jsudiaman,dshin
This also should fix bug 1881942 (placeholder is now scrollable
alongside the textarea).

This makes nsTextControlFrame a subclass of ScrollContainerFrame (with
an inner block), and tweaks layout to match.

It lays out the inner content using block layout and align-content,
rather than bespoke reflow primitives. This makes field-sizing trivial
to implement on top.

This is a bit scary, but simpler in most ways. In particular, it needs
to teach ScrollContainerFrame of the button, because that goes outside
the scrollable area, like scrollbars. That said it needs less
special-cases added than those removed, and it should also be faster
(needs less frames to layout an input with placeholder etc), and match
other browsers better.

The general set-up is:

  <text-control-editing-root/>
  <placeholder/>
  <autofill-preview/>

text-control-editing-root is always inline-block and always displayed
(since it's what grabs the focus / shows the caret). If the
autofill-preview or placeholder are displayed, the editing-root is
zero-width and clipped (note that for placeholder that's guaranteed
because placeholder is only shown with an empty value, but
autofill-preview needs it).

placeholder and autofill-preview are hidden via `display` rather than
visibility. This doesn't make a difference with this patch but it
matters for bug 1977176.

Caret painting needs an extra hop to paint atop the placeholder (no
observable behavior change, but worth calling out).

There is one subtle behavior change, which is that single-line inputs
never report scrollable overflow in the block axis. This matches other
browsers (see the tweak in nsBlockFrame's overflow computation) and is
needed to avoid regressing scrollable-overflow-padding-input.html.

The changes in window_composition_text_querycontent.xhtml are needed
because before this patch, the height of the control editing root was
always the height of the whole textarea. The characters you're composing
might legitimately be taller than the line. Bump the line height so that
that doesn't happen in this test.

Differential Revision: https://phabricator.services.mozilla.com/D293666
2026-04-16 08:10:39 +00:00
agoloman dfead40619 Revert "Bug 2031757 - Rejigger text input / textarea rendering to make field-sizing easier. r=layout-reviewers,devtools-reviewers,fxview-reviewers,firefox-style-system-reviewers,ochameau,jsudiaman,dshin" for causing crashtest assertions @399262.html.
This reverts commit 51d51c3b33.
2026-04-16 00:28:13 +00:00
Ting-Yu Lin 2f6171db5c Bug 2030432 - Fix abspos painting in wrong column when its containing block has transform. r=layout-reviewers,dshin
When a transformed absolute containing block fragments across multi-column,
abspos children could paint in the wrong column. This happened because the
abspos display item was built when its placeholder was encountered during
display list traversal, and the placeholder could end up in a different column
than where the abspos should paint.

Extend `DisplayPushedAbsoluteFrames` (now renamed to
`DisplayAbsoluteFramesNotBuiltByPlaceholder`) to also directly build abspos
frames whose placeholder lived in a different continuation subtree. Skip
building those abspos frames when they are later traversed via their
placeholders.

Differential Revision: https://phabricator.services.mozilla.com/D294312
2026-04-15 23:27:08 +00:00
Emilio Cobos Álvarez 51d51c3b33 Bug 2031757 - Rejigger text input / textarea rendering to make field-sizing easier. r=layout-reviewers,devtools-reviewers,fxview-reviewers,firefox-style-system-reviewers,ochameau,jsudiaman,dshin
This also should fix bug 1881942 (placeholder is now scrollable
alongside the textarea).

This makes nsTextControlFrame a subclass of ScrollContainerFrame (with
an inner block), and tweaks layout to match.

It lays out the inner content using block layout and align-content,
rather than bespoke reflow primitives. This makes field-sizing trivial
to implement on top.

This is a bit scary, but simpler in most ways. In particular, it needs
to teach ScrollContainerFrame of the button, because that goes outside
the scrollable area, like scrollbars. That said it needs less
special-cases added than those removed, and it should also be faster
(needs less frames to layout an input with placeholder etc), and match
other browsers better.

The general set-up is:

  <text-control-editing-root/>
  <placeholder/>
  <autofill-preview/>

text-control-editing-root is always inline-block and always displayed
(since it's what grabs the focus / shows the caret). If the
autofill-preview or placeholder are displayed, the editing-root is
zero-width and clipped (note that for placeholder that's guaranteed
because placeholder is only shown with an empty value, but
autofill-preview needs it).

placeholder and autofill-preview are hidden via `display` rather than
visibility. This doesn't make a difference with this patch but it
matters for bug 1977176.

Caret painting needs an extra hop to paint atop the placeholder (no
observable behavior change, but worth calling out).

There is one subtle behavior change, which is that single-line inputs
never report scrollable overflow in the block axis. This matches other
browsers (see the tweak in nsBlockFrame's overflow computation) and is
needed to avoid regressing scrollable-overflow-padding-input.html.

The changes in window_composition_text_querycontent.xhtml are needed
because before this patch, the height of the control editing root was
always the height of the whole textarea. The characters you're composing
might legitimately be taller than the line. Bump the line height so that
that doesn't happen in this test.

Differential Revision: https://phabricator.services.mozilla.com/D293666
2026-04-15 23:25:11 +00:00
agoloman 83610050c8 Revert "Bug 2030432 - Fix abspos painting in wrong column when its containing block has transform. r=layout-reviewers,dshin" for causing failures @anchor-position-multicol-fixed-001.html.
This reverts commit d7c27ff2a1.
2026-04-15 21:00:00 +00:00
Ting-Yu Lin d7c27ff2a1 Bug 2030432 - Fix abspos painting in wrong column when its containing block has transform. r=layout-reviewers,dshin
When a transformed absolute containing block fragments across multi-column,
abspos children could paint in the wrong column. This happened because the
abspos display item was built when its placeholder was encountered during
display list traversal, and the placeholder could end up in a different column
than where the abspos should paint.

Extend `DisplayPushedAbsoluteFrames` (now renamed to
`DisplayAbsoluteFramesNotBuiltByPlaceholder`) to also directly build abspos
frames whose placeholder lived in a different continuation subtree. Skip
building those abspos frames when they are later traversed via their
placeholders.

Differential Revision: https://phabricator.services.mozilla.com/D294312
2026-04-15 20:04:19 +00:00
Jan-Niklas Jaeschke 0b2d030087 Bug 2030660 - Remove dom.shadowdom.selection_across_boundary.enabled pref. r=masayuki,webidl
Differential Revision: https://phabricator.services.mozilla.com/D293086
2026-04-10 08:02:43 +00:00
Emilio Cobos Álvarez 3f1228e02a Bug 2014481 - Fix selection dragging when reframed. r=masayuki
When reframed, our frame selection might be reinitialized, losing the
drag state. Fix that up. A bit hacky, better ideas welcome, but I think
it's ok.

Differential Revision: https://phabricator.services.mozilla.com/D292907
2026-04-09 11:23:24 +00:00
Silaghi 1d00c5108d Revert "Bug 2014481 - Fix selection dragging when reframed. r=masayuki" for causing build bustages at TextControlState
This reverts commit 6c9fd4f992.
2026-04-09 09:01:52 +00:00
Emilio Cobos Álvarez 6c9fd4f992 Bug 2014481 - Fix selection dragging when reframed. r=masayuki
When reframed, our frame selection might be reinitialized, losing the
drag state. Fix that up. A bit hacky, better ideas welcome, but I think
it's ok.

Differential Revision: https://phabricator.services.mozilla.com/D292907
2026-04-09 08:44:13 +00:00