Commit graph

569 commits

Author SHA1 Message Date
Cosmin Sabou
543905e105 Backed out 3 changesets (bug 1809568) for causing build bustages on nsBlockFrame.cpp. CLOSED TREE
Backed out changeset eaa7fe280317 (bug 1809568)
Backed out changeset ab0f2bcb2d9b (bug 1809568)
Backed out changeset a481bf06452b (bug 1809568)
2023-05-01 21:42:14 +03:00
David Shin
d2ebe93a83 Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-01 17:04:27 +00:00
Iulian Moraru
c9ffb3ffa8 Backed out 3 changesets (bug 1809568) for causing build bustages on nsLineLayout.cpp. CLOSED TREE
Backed out changeset 573dc0bd9554 (bug 1809568)
Backed out changeset b8401947aea0 (bug 1809568)
Backed out changeset 7ecabe895121 (bug 1809568)
2023-05-01 17:59:21 +03:00
David Shin
8ff73f5fcc Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-01 13:44:43 +00:00
Emilio Cobos Álvarez
8b5b7ad998 Bug 1827856 - Remove nativeAnonymousChildList observers. r=smaug,credential-management-reviewers,devtools-reviewers,sgalich,nchevobbe
You let me know if this seems appealing to you :)

Differential Revision: https://phabricator.services.mozilla.com/D175382
2023-04-18 14:58:34 +00:00
Emilio Cobos Álvarez
9ba02d6644 Bug 1827997 - Couple other minor consistency clean-ups in that function. r=tnikkel
All other comments use the inline style, so be consistent. Also remove
some useless parenthesis.

Differential Revision: https://phabricator.services.mozilla.com/D175409
2023-04-14 08:22:08 +00:00
Emilio Cobos Álvarez
299e4fd476 Bug 1827997 - Remove some unused AutoSaveRestore variables in BuildDisplayListForStackingContext. r=mstange
We don't modify the clip in their scope, so we don't really need them,
afaict.

Bug 1413073 removed the clearing, but not the restore calls.

I was looking at these because of bug 1827428.

Differential Revision: https://phabricator.services.mozilla.com/D175408
2023-04-14 08:22:08 +00:00
Robert Longson
e47a68c1a6 Bug 1751025 - Opacity CSS property should apply to all children of text elements r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D174964
2023-04-11 22:08:24 +00:00
Natalia Csoregi
cd523b2514 Backed out changeset a846d1b82b98 (bug 1751025) for failures on opacity.svg. CLOSED TREE 2023-04-11 09:46:16 +03:00
Robert Longson
3a9c792127 Bug 1751025 - Opacity CSS property should apply to all children of text elements r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D174964
2023-04-11 03:25:14 +00:00
Emilio Cobos Álvarez
641fa20731 Bug 1825825 - Simplify NAC setup. r=smaug
Make all UA widgets also NAC.

Keep the UA widget flag but break at anonymous subtree boundaries, so
that only nodes inside the UA widget directly (and not NAC from those)
get the flag.

This is important because two callers depend on this difference:

 * The style system, since we still want to match content rules from
   stylesheets in the UA widget. We also match user rules, which is a
   bit sketchy, but that was the previous behavior, will file a
   follow-up for that.

 * The reflector code, since we want the scope for UA widgets to not
   include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
   got it wrong.

After this patch, ChromeOnlyAccess is equivalent to
IsInNativeAnonymousSubtree, so we should probably unify the naming.
That's left for a follow-up patch because I don't have a strong
preference.

Differential Revision: https://phabricator.services.mozilla.com/D174310
2023-04-05 09:19:15 +00:00
Robert Longson
7e65e06613 Bug 1826001 - Change SVGUtils::IsInSVGTextSubtree into a member function on nsIFrame r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D174375
2023-04-02 21:17:07 +00:00
Emilio Cobos Álvarez
2d0e69f4a1 Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin
And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
2023-03-29 21:23:55 +00:00
Emilio Cobos Álvarez
28e6c8dbfe Bug 1824986 - Factor widget styling in nsMenuPopupFrame. r=mstange
We had these spread around, it's better to have a single central place where we
update the widget based on the styling of the popups.

Differential Revision: https://phabricator.services.mozilla.com/D173836
2023-03-28 14:33:18 +00:00
Emilio Cobos Álvarez
b9d1536d46 Bug 1824489 - Remove nsBoxFrame, nsBoxLayout and related code. r=jwatt
We still have some remnants of XUL layout due to nsBox / nsLeafBoxFrame
which XUL trees / nsTextBoxFrame still use.

However all this code can go away before we get rid of those.
nsSplitterFrame was the last thing inheriting from nsBoxFrame.

Differential Revision: https://phabricator.services.mozilla.com/D173601
2023-03-27 23:25:42 +00:00
David Shin
a47e766d75 Bug 1812679 - Handle central baseline calculation in GetNaturalBaselineBOffset. r=layout-reviewers,emilio
Previously, for writing-mode using central baseline alignment (i.e. `vertical-(lr|rl)`,
we simply used the center of content-box in `nsLineLayout::VerticalAlignFrames`.
However, this is incorrect for e.g. a `div` with two lines of text - just like how
its alphabetical baseline is the baseline of the second line of text, the central
baseline should be the centerline of the second line.

Differential Revision: https://phabricator.services.mozilla.com/D172165
2023-03-24 16:23:16 +00:00
Norisz Fay
97050950be Backed out changeset 11ba57726279 (bug 1812679) for causing Wr failures on text-combine-upright-value-all-002.html 2023-03-24 01:51:06 +02:00
David Shin
6cb3b01af3 Bug 1812679 - Handle central baseline calculation in GetNaturalBaselineBOffset. r=layout-reviewers,emilio
Previously, for writing-mode using central baseline alignment (i.e. `vertical-(lr|rl)`,
we simply used the center of content-box in `nsLineLayout::VerticalAlignFrames`.
However, this is incorrect for e.g. a `div` with two lines of text - just like how
its alphabetical baseline is the baseline of the second line of text, the central
baseline should be the centerline of the second line.

Differential Revision: https://phabricator.services.mozilla.com/D172165
2023-03-23 17:36:49 +00:00
Stanca Serban
7c4f609327 Backed out changeset 49646b0d59aa (bug 1812679) for causing mochitests failures in layout/style/test/test_revert.html. CLOSED TREE 2023-03-23 17:39:13 +02:00
David Shin
2f94be9968 Bug 1812679 - Handle central baseline calculation in GetNaturalBaselineBOffset. r=layout-reviewers,emilio
Previously, for writing-mode using central baseline alignment (i.e. `vertical-(lr|rl)`,
we simply used the center of content-box in `nsLineLayout::VerticalAlignFrames`.
However, this is incorrect for e.g. a `div` with two lines of text - just like how
its alphabetical baseline is the baseline of the second line of text, the central
baseline should be the centerline of the second line.

Differential Revision: https://phabricator.services.mozilla.com/D172165
2023-03-23 14:35:12 +00:00
Emilio Cobos Álvarez
1a63dbdc1e Bug 1823455 - Add a missing include to fix hybrid builds.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2023-03-22 15:33:29 +01:00
Masayuki Nakano
5b59e4aeae Bug 1384606 - part 4: Make nsIFrame::GetFrameFromDirection allow to return content in different native anonymous subtree if the caller wants r=emilio
The a11y module wants to traverse frames in native anonymous subtrees.
Therefore, this patch adds new option for allowing it, makes
`nsIFrame::GetFrameFromDirection` check it before comparing native anonymous
subtree root nodes, and makes `HyperTextAccessible::FindOffset` use the
option.

Differential Revision: https://phabricator.services.mozilla.com/D172759
2023-03-18 04:18:53 +00:00
Masayuki Nakano
01d2fe15e1 Bug 1384606 - part 3: Make nsPeekOffsetStruct and its handlers treat bool options with an EnumSet r=emilio
The constructor of `nsPeekOffsetStruct` and `nsIFrame::GetFrameFromDirection`
take too many `bool` arguments.  Therefore, adding new `bool` arguments does
not make sense.  Now, we have a useful `mozilla:EnumSet` class to treat them
with an `enum class`. Therefore, let's change `nsPeekOffsetStruct` with it.

Differential Revision: https://phabricator.services.mozilla.com/D172758
2023-03-18 04:18:53 +00:00
Masayuki Nakano
bf5792cbac Bug 1384606 - part 1: Make nsIFrame::GetFrameFromDirection treat frames in different native anonymous subtree not selectable r=emilio
It's called by `PeekOffsetFor*` and `GetPrevNextBidiLevels`, so it's used for
considering whether to put caret or move a selection range boundary.
Therefore, it should treat nodes which can be managed by `Selection` as
selectable.  In theory, even if a native anonymous subtree does not have
an independent selection, its content nodes should not be the container of
the selection range boundaries of selection outside the subtree since
Selection API shouldn't expose nodes in native anonymous subtrees.  Therefore,
it can simply treat content nodes in different anonymous subtrees are not
selectable.

Note that it's not standardized that how `Selection.modify` works with various
content nodes.
https://w3c.github.io/selection-api/#dom-selection-modify

And also Chrome cannot cross generated content like form controls with this API.
This could cause web-compat issues, but it does not make sense for caret
navigation, and anyway out of scope of this bug.  Therefore, this patch just
adds the crash test.

Differential Revision: https://phabricator.services.mozilla.com/D172204
2023-03-18 04:18:52 +00:00
Iulian Moraru
6f60d5fa4d Backed out 4 changesets (bug 1384606) for causing mochitest browser a11y failures on browser_text_basics.js. CLOSED TREE
Backed out changeset 6f7176c0d6a3 (bug 1384606)
Backed out changeset 19c51e735059 (bug 1384606)
Backed out changeset eb8a5705b2d3 (bug 1384606)
Backed out changeset 39b202962261 (bug 1384606)
2023-03-17 10:40:53 +02:00
Masayuki Nakano
25e942f2a0 Bug 1384606 - part 4: Make nsIFrame::GetFrameFromDirection allow to return content in different native anonymous subtree if the caller wants r=emilio
The a11y module wants to traverse frames in native anonymous subtrees.
Therefore, this patch adds new option for allowing it, makes
`nsIFrame::GetFrameFromDirection` check it before comparing native anonymous
subtree root nodes, and makes `HyperTextAccessible::FindOffset` use the
option.

Differential Revision: https://phabricator.services.mozilla.com/D172759
2023-03-17 06:26:03 +00:00
Masayuki Nakano
9cf5036656 Bug 1384606 - part 3: Make nsPeekOffsetStruct and its handlers treat bool options with an EnumSet r=emilio
The constructor of `nsPeekOffsetStruct` and `nsIFrame::GetFrameFromDirection`
take too many `bool` arguments.  Therefore, adding new `bool` arguments does
not make sense.  Now, we have a useful `mozilla:EnumSet` class to treat them
with an `enum class`. Therefore, let's change `nsPeekOffsetStruct` with it.

Differential Revision: https://phabricator.services.mozilla.com/D172758
2023-03-17 06:26:03 +00:00
Masayuki Nakano
458f69ffc8 Bug 1384606 - part 1: Make nsIFrame::GetFrameFromDirection treat frames in different native anonymous subtree not selectable r=emilio
It's called by `PeekOffsetFor*` and `GetPrevNextBidiLevels`, so it's used for
considering whether to put caret or move a selection range boundary.
Therefore, it should treat nodes which can be managed by `Selection` as
selectable.  In theory, even if a native anonymous subtree does not have
an independent selection, its content nodes should not be the container of
the selection range boundaries of selection outside the subtree since
Selection API shouldn't expose nodes in native anonymous subtrees.  Therefore,
it can simply treat content nodes in different anonymous subtrees are not
selectable.

Note that it's not standardized that how `Selection.modify` works with various
content nodes.
https://w3c.github.io/selection-api/#dom-selection-modify

And also Chrome cannot cross generated content like form controls with this API.
This could cause web-compat issues, but it does not make sense for caret
navigation, and anyway out of scope of this bug.  Therefore, this patch just
adds the crash test.

Differential Revision: https://phabricator.services.mozilla.com/D172204
2023-03-17 06:26:02 +00:00
Noemi Erli
585fe519f1 Backed out 4 changesets (bug 1384606) for causing build bustage in nsFrameSelection.h CLOSED TREE
Backed out changeset 917f487fdf0f (bug 1384606)
Backed out changeset 0782f42b2a99 (bug 1384606)
Backed out changeset 22099c5efaf6 (bug 1384606)
Backed out changeset f3a38b1eac88 (bug 1384606)
2023-03-17 06:54:59 +02:00
Masayuki Nakano
c2b9c4058b Bug 1384606 - part 4: Make nsIFrame::GetFrameFromDirection allow to return content in different native anonymous subtree if the caller wants r=emilio
The a11y module wants to traverse frames in native anonymous subtrees.
Therefore, this patch adds new option for allowing it, makes
`nsIFrame::GetFrameFromDirection` check it before comparing native anonymous
subtree root nodes, and makes `HyperTextAccessible::FindOffset` use the
option.

Depends on D172758

Differential Revision: https://phabricator.services.mozilla.com/D172759
2023-03-17 04:22:05 +00:00
Masayuki Nakano
1387f2e7bc Bug 1384606 - part 3: Make nsPeekOffsetStruct and its handlers treat bool options with an EnumSet r=emilio
The constructor of `nsPeekOffsetStruct` and `nsIFrame::GetFrameFromDirection`
take too many `bool` arguments.  Therefore, adding new `bool` arguments does
not make sense.  Now, we have a useful `mozilla:EnumSet` class to treat them
with an `enum class`. Therefore, let's change `nsPeekOffsetStruct` with it.

Differential Revision: https://phabricator.services.mozilla.com/D172758
2023-03-17 04:22:05 +00:00
Masayuki Nakano
c5e00ff09c Bug 1384606 - part 1: Make nsIFrame::GetFrameFromDirection treat frames in different native anonymous subtree not selectable r=emilio
It's called by `PeekOffsetFor*` and `GetPrevNextBidiLevels`, so it's used for
considering whether to put caret or move a selection range boundary.
Therefore, it should treat nodes which can be managed by `Selection` as
selectable.  In theory, even if a native anonymous subtree does not have
an independent selection, its content nodes should not be the container of
the selection range boundaries of selection outside the subtree since
Selection API shouldn't expose nodes in native anonymous subtrees.  Therefore,
it can simply treat content nodes in different anonymous subtrees are not
selectable.

Note that it's not standardized that how `Selection.modify` works with various
content nodes.
https://w3c.github.io/selection-api/#dom-selection-modify

And also Chrome cannot cross generated content like form controls with this API.
This could cause web-compat issues, but it does not make sense for caret
navigation, and anyway out of scope of this bug.  Therefore, this patch just
adds the crash test.

Differential Revision: https://phabricator.services.mozilla.com/D172204
2023-03-17 04:22:04 +00:00
Norisz Fay
5349e0db4d Backed out 2 changesets (bug 1384606) for causing failures on test_atcaretoffset.html CLOSED TREE
Backed out changeset bfc8cf25efac (bug 1384606)
Backed out changeset b3c0fd32af16 (bug 1384606)
2023-03-14 07:25:51 +02:00
Masayuki Nakano
5b8469c0d5 Bug 1384606 - Make nsIFrame::GetFrameFromDirection treat frames in different native anonymous subtree not selectable r=emilio
It's called by `PeekOffsetFor*` and `GetPrevNextBidiLevels`, so it's used for
considering whether to put caret or move a selection range boundary.
Therefore, it should treat nodes which can be managed by `Selection` as
selectable.  In theory, even if a native anonymous subtree does not have
an independent selection, its content nodes should not be the container of
the selection range boundaries of selection outside the subtree since
Selection API shouldn't expose nodes in native anonymous subtrees.  Therefore,
it can simply treat content nodes in different anonymous subtrees are not
selectable.

Note that it's not standardized that how `Selection.modify` works with various
content nodes.
https://w3c.github.io/selection-api/#dom-selection-modify

And also Chrome cannot cross generated content like form controls with this API.
This could cause web-compat issues, but it does not make sense for caret
navigation, and anyway out of scope of this bug.  Therefore, this patch just
adds the crash test.

Differential Revision: https://phabricator.services.mozilla.com/D172204
2023-03-14 04:04:12 +00:00
Emilio Cobos Álvarez
b5ab8c533c Bug 1564526 - Remove CachedBorderImageData. r=tnikkel
See comments in the bug, which still stand.

This cache is barely hit, and when it is hit it causes correctness
issues, see bug 1815022 for a recent example.

Differential Revision: https://phabricator.services.mozilla.com/D171391
2023-03-08 12:04:03 +00:00
Masayuki Nakano
9f3a55f73d Bug 1818128 - Add logging code for Selection API calls r=smaug
It's hard to check Selection API calls from both JS and internals when we debug
web apps which has complicated `contenteditable` editor.  Therefore, I'd like to
add an ability to log Selection API calls.

This patch needs to stop some methods inlined.  Therefore, this could affect to
the performance in release builds, though.  If so, I need to work on some
optimization later.

For minimizing the impact for performance, this patch also makes them to check
the logging level before calling logging methods.  It's currently redundant
for `LogLevel::Info` case.  However, this avoids any performance impact from
changes of `MOZ_LOG` implementation and in the blocks.

Differential Revision: https://phabricator.services.mozilla.com/D170585
2023-03-05 22:38:05 +00:00
David Shin
e9eaa316b3 Bug 1815729: Replace GetCaretBaseline with GetCaretBlockAxisMetrics. r=emilio
Callers of `GetCaretBaseline` just use it to get offset and size of the caret, so
refactor the shared logic. In the call sites, delay conversion of logical to physical
rect to reduce variable shuffling.

Differential Revision: https://phabricator.services.mozilla.com/D169210
2023-02-24 17:26:44 +00:00
David Shin
f5a42005e2 Bug 1811311 - Part 3: Refactor GetNaturalBaselineBOffset to return Maybe<nscoord>. r=layout-reviewers,emilio
Changed from returning `bool` & taking an out parameter.

Differential Revision: https://phabricator.services.mozilla.com/D168998
2023-02-23 14:53:27 +00:00
David Shin
5c7c22165f Bug 1811311 - Part 1: Unite baseline-related functions in nsIFrame into one. r=emilio
Before, there existed 3 virtual functions that calculated baselines:

- `GetLogicalBaseline`
- `GetVerticalAlignBaseline`
- `GetNaturalBaselineBOffset`

Each of them had slightly different behaviours:

- `GetLogicalBaseline` would synthesize a baseline if there is no baseline.
  Others would simply return `false`.
- `GetNaturalBaselineBOffset` requires the caller to pick which of first/last
  baseline to calculate. Others pick on on their own.
- `GetNaturalBaselineBOffset`'s result can be either offset from border box
   start/end edge, depending on the caller-supplied baseline. Others always
   return offset from border box start edge.

Now:

- `GetNaturalBaselineBOffset` is the sole virtual function.
- `GetLogicalBaseline` exists to support its use, with 2 virtual helper functions:
  - `SynthesizeFallbackBaseline` to generate a baseline for elements that
    doesn't have one.
  - `GetBaselineSharingGroup` to preserve the default baseline picking behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D167990
2023-02-23 14:53:26 +00:00
Robert Longson
824c238c5e Bug 1817413 - add const to various method signatures or allow them to be given const pointers r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D170188
2023-02-17 12:47:27 +00:00
Fred Chasen
cb0a8abc0b Bug 1591210 - Add forced-color-adjust property r=emilio
Adds the forced-color-adjust property and ForcedColorAdjust keywords.
Updates tweak_when_ignoring_colors to check for `none` value of that property when determining if a color adjustment in needed.
Adds a check for `none` when styling selections to make sure they can be styled in forced color modes.

Differential Revision: https://phabricator.services.mozilla.com/D169000
2023-02-16 21:29:07 +00:00
Robert Longson
2ec308723b Bug 1651129 - Convert uses of mState to various StateBits methods and make mState private r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D169943
2023-02-15 21:35:46 +00:00
Emilio Cobos Álvarez
27dd98b647 Bug 1816915 - Clean up EffectSet APIs. r=firefox-animation-reviewers,boris
EffectSet::GetEffectSet seems rather redundant, use just EffectSet::Get
and tweak naming of similar APIs.

Differential Revision: https://phabricator.services.mozilla.com/D169931
2023-02-15 20:39:16 +00:00
Emilio Cobos Álvarez
6c32b964cd Bug 1807003 - Centralize animation data in slots. r=smaug,firefox-animation-reviewers,boris
This should both be faster and simpler. Also will allow us in the future
to animate more pseudos without having to add a gazillion properties.

I think we should try to clear more stuff (maybe the whole animation
data) on unbind, but that's a bit tangential.

Differential Revision: https://phabricator.services.mozilla.com/D169860
2023-02-15 14:12:33 +00:00
Marian-Vasile Laza
91a3c1e0ce Backed out changeset f4fe07518400 (bug 1591210) for web-platform failures on forced-colors-mode-14.html. CLOSED TREE 2023-02-14 06:40:31 +02:00
Fred Chasen
6f6759dce8 Bug 1591210 - Add forced-color-adjust property r=emilio
Adds the forced-color-adjust property and ForcedColorAdjust keywords.
Updates tweak_when_ignoring_colors to check for `none` value of that property when determining if a color adjustment in needed.
Adds a check for `none` when styling selections to make sure they can be styled in forced color modes.

Differential Revision: https://phabricator.services.mozilla.com/D169000
2023-02-14 00:52:26 +00:00
James Teh
8cd27f807a Bug 1775684 part 1: Ignore frame visibility when caching focusable state for a11y. r=morgan,emilio
See the code comment in LocalAccessible::NativeInteractiveState for explanation.

Differential Revision: https://phabricator.services.mozilla.com/D168910
2023-02-09 04:50:53 +00:00
Alexander Surkov
f0b145fdd2 Bug 1791759 - remove unused ContentRelevancyReason::DescendantOfTopLayerElement r=emilio
A small cleanup, follow up from D159693.

Differential Revision: https://phabricator.services.mozilla.com/D169212
2023-02-09 01:18:04 +00:00
Emilio Cobos Álvarez
b96c7ac29d Bug 1812194 - Add a missing null-check in content-visibility: auto handling. r=mrobinson
Differential Revision: https://phabricator.services.mozilla.com/D169085
2023-02-08 16:38:09 +00:00
Sandor Molnar
28c0d45a55 Backed out changeset 8b8c8ae333a9 (bug 1812194) for causing crashes/asertion failures in dom/base/nsRange.cpp CLOSED TREE 2023-02-08 14:55:30 +02:00