Commit Graph

846 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
b121dde1da Bug 1932800 - Fix caret baseline of empty inline and text frames. r=dshin
Added Gecko reftests because I don't know what the best place to put
them in WPT is, and caret rendering is kind of undefined, but...

Differential Revision: https://phabricator.services.mozilla.com/D229926
2024-11-23 12:46:48 +00:00
Sandor Molnar
e7348a5625 Backed out 3 changesets (bug 1932800) for causing reftest failures. CLOSED TREE
Backed out changeset c06b939ca2f2 (bug 1932800)
Backed out changeset 048956318eb0 (bug 1932800)
Backed out changeset 333442d03d1a (bug 1932800)
2024-11-23 12:40:11 +02:00
Emilio Cobos Álvarez
775a22ff40 Bug 1932800 - Use ShouldHaveLineIfEmpty() to guarantee buttons have at least one line of height. r=dshin
This is similar to how we treat <div contenteditable>, and allows us to
remove the specialness about anon boxes.

Differential Revision: https://phabricator.services.mozilla.com/D229939
2024-11-23 09:00:29 +00:00
Emilio Cobos Álvarez
8121200d6a Bug 1932800 - Fix caret baseline of empty inline and text frames. r=dshin
Added Gecko reftests because I don't know what the best place to put
them in WPT is, and caret rendering is kind of undefined, but...

Differential Revision: https://phabricator.services.mozilla.com/D229926
2024-11-23 09:00:29 +00:00
Emilio Cobos Álvarez
4647f93559 Bug 1932800 - Add a check to SelfIsSelectable to preserve editor drag and drop behavior. r=masayuki
We were relying on editable text frames not being empty. We fixed that
on the previous patches but this caused editor d&d to break.

For now this preserves the selection behavior. In the future we should
look into removing the IsEmpty() condition or so, probably, or make it
more subtle.

Differential Revision: https://phabricator.services.mozilla.com/D229996
2024-11-23 08:58:14 +00:00
Emilio Cobos Álvarez
fb7777f241 Bug 1932800 - Fold IsEmpty check into SelfIsSelectable(). r=dshin
All the callers check both conditions, so no behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D229995
2024-11-22 22:10:48 +00:00
Ting-Yu Lin
8af89b0f89 Bug 1926015 Part 2 - Construct a percentage basis when calling MinISize() in nsIFrame::ComputeSize(). r=dholbert
We should construct a percentage basis like we did in
nsIFrame::ComputeISizeValue().
https://searchfox.org/mozilla-central/rev/75de397838825ba741820fec27225342ba15fd5b/layout/generic/nsIFrame.cpp#7076-7082

This is necessary to pass `intrinsic-percent-replaced-027.html` (added in the
next part).

Differential Revision: https://phabricator.services.mozilla.com/D229750
2024-11-21 19:55:32 +00:00
Adi
b34823b0fe Backed out 5 changesets (bug 1926015) for causing crashtest failures @1730506.html. CLOSED TREE
Backed out changeset 7df628ab162c (bug 1926015)
Backed out changeset a3524c96da73 (bug 1926015)
Backed out changeset cfbf0fa7bf8d (bug 1926015)
Backed out changeset 2c2f56268bd7 (bug 1926015)
Backed out changeset 55175ed82058 (bug 1926015)
2024-11-21 21:28:08 +02:00
Ting-Yu Lin
674908a2e6 Bug 1926015 Part 2 - Construct a percentage basis when calling MinISize() in nsIFrame::ComputeSize(). r=dholbert
We should construct a percentage basis like we did in
nsIFrame::ComputeISizeValue().
https://searchfox.org/mozilla-central/rev/75de397838825ba741820fec27225342ba15fd5b/layout/generic/nsIFrame.cpp#7076-7082

This is necessary to pass `intrinsic-percent-replaced-027.html` (added in the
next part).

Differential Revision: https://phabricator.services.mozilla.com/D229750
2024-11-21 17:04:15 +00:00
Timothy Nikkel
199fbc82e1 Bug 1931791. Optimize nsIFrame::HasAnimationOfTransform. r=layout-reviewers,emilio
nsCSSPropertyIDSet::IsSubsetOf shows up as a significant chunk of painting. Turns out we can avoid that cost if MayHaveTransformAnimation is false, but its a little awkward because it's a bit seperated, so I included some asserts to make sure things stay in sync.

Differential Revision: https://phabricator.services.mozilla.com/D229284
2024-11-19 07:34:46 +00:00
Jonathan Watt
7532be254f Bug 1931736. Add missing braces around if/loop statements in layout/generic/. r=layout-reviewers,emilio
Depends on D229247

Differential Revision: https://phabricator.services.mozilla.com/D229248
2024-11-17 05:03:58 +00:00
David Shin
6daa1f0fb8 Bug 1930427: Don't stretch abs-positioned frames if any inset is auto. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D228666
2024-11-13 17:36:24 +00:00
Sandor Molnar
94ff673c2e Backed out changeset d5f479eac493 (bug 1930427) for causing wpt failures @ css/css-anchor-position/position-area-anchor-outside.html 2024-11-13 18:32:50 +02:00
David Shin
9554630922 Bug 1930427: Don't stretch abs-positioned frames if any inset is auto. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D228666
2024-11-13 14:32:02 +00:00
Timothy Nikkel
de8dca8cdf Bug 1930633. Change ViewportUtils::GetVisualToLayoutTransform to take an nsIContent instead of a ViewID. r=hiro
In a lot of cases we go from frame/content, look up the id, then GetVisualToLayoutTransform looks up the content from the id. This is a waste. We should just pass in a content, and the one case that starts with an ViewID can look up the content to pass in since we were going to look up the content anyways.

The hashtable lookup of the content/id is showing up as biggest chunk the work in the event handling display list build that we do to handle synth mouse move events during sp3. And synth mouse moves have been identified as something we do that stands out as extra work.

Differential Revision: https://phabricator.services.mozilla.com/D228653
2024-11-13 12:04:36 +00:00
Jonathan Kew
3d04dbeece Bug 1930367 - Fix typo in nsIFrame::ListGeneric logging. r=layout-reviewers,tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D228549
2024-11-10 15:22:59 +00:00
David Shin
7cd59f67a3 Bug 1920160: Part 6 - Separate out computation of auto sizes in abs-positioned boxes. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D226532
2024-11-07 16:33:42 +00:00
Stanca Serban
487746bf1b Backed out 2 changesets (bug 1862256) for causing mochitests failures in test_native_key_bindings_mac.html. CLOSED TREE
Backed out changeset b23e836dc19b (bug 1862256)
Backed out changeset ccb29705b1d5 (bug 1862256)
2024-11-07 14:31:58 +02:00
Laura Hausmann
a52d3dad74 Bug 1862256 - Fix textarea home/end behavior r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D192724
2024-11-07 10:30:46 +00:00
Hiroyuki Ikezoe
16441b929d Bug 1923513 - Make ComputeClipForMaskItem return empty rect as it is rather than returning Nothing(). r=botond
There are two tests;

helper_fission_empty_clip.html is for this bug (bug 1923513), there's an
element covering over an OOP iframe but it has an empty clip-path, thus any
input event is not interefered by the element.

helper_fission_unresolved_clip.html is to make sure that this code change
doesn't regress unresolved clip cases, it's similar to above case but with an
unresolved clip-path, thus the OOP iframe isn't rendered, any input element
isn't reached to the iframe.

Differential Revision: https://phabricator.services.mozilla.com/D228116
2024-11-07 06:33:24 +00:00
Stanca Serban
97f84cfe33 Backed out 7 changesets (bug 1920160) for causing mochitests plain failures in test_videocontrols_vtt.html. CLOSED TREE
Backed out changeset 5d57a3a8d6aa (bug 1920160)
Backed out changeset d57f1f6f293b (bug 1920160)
Backed out changeset 8bfb6f9eab80 (bug 1920160)
Backed out changeset 45c61a69b9b8 (bug 1920160)
Backed out changeset b64bfe84e60a (bug 1920160)
Backed out changeset 26f7d594f6e0 (bug 1920160)
Backed out changeset 71d051b7857a (bug 1920160)
2024-11-05 04:11:47 +02:00
David Shin
361f850950 Bug 1920160: Part 6 - Separate out computation of auto sizes in abs-positioned boxes. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D226532
2024-11-05 00:44:44 +00:00
Timothy Nikkel
4f863bbf4d Bug 1924698. Avoid a few blockframe queryframes. r=jwatt
Saw these in the long tail of a profile of an sp3 test.

Differential Revision: https://phabricator.services.mozilla.com/D225633
2024-10-17 12:05:27 +00:00
Butkovits Atila
5c95919fb3 Backed out 2 changesets (bug 1924277) for causing failures at test_restyles.html. CLOSED TREE
Backed out changeset 491e19c84114 (bug 1924277)
Backed out changeset f612bcda5bdd (bug 1924277)
2024-10-17 13:21:58 +03:00
Timothy Nikkel
84d736b461 Bug 1924277. nsIFrame::IsScrolledOutOfView should intersect the rect with scroll frames that clip it. r=hiro,layout-reviewers,jwatt,emilio
Seems like we should be doing this as a frame that is clipped out fully but requires two scroll frames to fully clip it is just as visible as a frame where one scroll frame fully clips it.

Differential Revision: https://phabricator.services.mozilla.com/D225442
2024-10-17 08:43:37 +00:00
Timothy Nikkel
9ec78342f0 Bug 1924277. Fix small bug in IsFrameRectScrolledOutOfView. r=hiro,layout-reviewers,emilio
I don't think this can happen, but if we hit the top of the in process frame tree here then we should check if it's visible cross process. This is what we do at the actual place where we can hit the top of the frame tree (just above here).

Differential Revision: https://phabricator.services.mozilla.com/D225441
2024-10-17 08:43:36 +00:00
Timothy Nikkel
586457ec11 Bug 1923790. Skip checking for combine 3d in GetResultingTransformMatrix when we already know there is no combine 3d. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D225171
2024-10-16 09:52:04 +00:00
Timothy Nikkel
02d52a623b Bug 1923790. Skip checking for perspective in GetResultingTransformMatrix when we already know there is no perspective. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D225170
2024-10-16 09:52:04 +00:00
Timothy Nikkel
b085c602d2 Bug 1923790. Skip a matrix PostTranslate in GetResultingTransformMatrix when it's useless. r=gfx-reviewers,layout-reviewers,lsalzman,emilio
Differential Revision: https://phabricator.services.mozilla.com/D225169
2024-10-16 09:52:03 +00:00
Iulian Moraru
44d79db71d Backed out 4 changesets (bug 1923790) for causing mass assertion failures. CLOSED TREE
Backed out changeset c77fbdd69b94 (bug 1923790)
Backed out changeset f81a6af120f5 (bug 1923790)
Backed out changeset 776dcd89f572 (bug 1923790)
Backed out changeset d68b9d899217 (bug 1923790)
2024-10-14 16:49:58 +03:00
Timothy Nikkel
6d728046cb Bug 1923790. Skip checking for combine 3d in GetResultingTransformMatrix when we already know there is no combine 3d. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D225171
2024-10-14 10:43:06 +00:00
Timothy Nikkel
9fc4f164e5 Bug 1923790. Skip checking for perspective in GetResultingTransformMatrix when we already know there is no perspective. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D225170
2024-10-14 10:43:06 +00:00
Timothy Nikkel
8ceb94b19c Bug 1923790. Skip a matrix PostTranslate in GetResultingTransformMatrix when it's useless. r=gfx-reviewers,layout-reviewers,lsalzman,emilio
Differential Revision: https://phabricator.services.mozilla.com/D225169
2024-10-14 10:43:06 +00:00
Timothy Nikkel
966534ae2d Bug 1924276. Fix quadratic behaviour in nsIFrame::IsScrolledOutOfView. r=layout-reviewers,emilio
We walk up the frame tree looking for scroll frames, and then transform from the initial frame to the currently found scroll frame. The problem is that doing that transform walks between the initial frame and the current scroll frame again to get the transform, each time, and that operation is kind of slow even if we weren't doing all this extra work.

So instead we use the transformed rect and the current scroll frame so we don't have to compute the transform over those frames again as we walk up the frame tree.

Differential Revision: https://phabricator.services.mozilla.com/D225440
2024-10-13 08:24:48 +00:00
Emilio Cobos Álvarez
ddc243b63d Bug 1923334 - Sync window properties when root element style changes. r=jwatt
We sync window properties every time we reflow the viewport frame:

 * https://searchfox.org/mozilla-central/rev/7db217e3832e9a884be0c2300779e098f92be3fe/layout/base/PresShell.cpp#9978-9980

However that's not enough because some things that do affect the window
properties (like border-radius / background-color / color-scheme) don't
necessarily trigger reflow.

Do it whenever we set the root style, which is easier and catches all
those.

Bail out earlier in content processes because we can, puppet widgets
don't do any of that.

Differential Revision: https://phabricator.services.mozilla.com/D225153
2024-10-10 11:55:38 +00:00
Masayuki Nakano
1f32758228 Bug 1921705 - Make nsIFrame::PeekOffsetForCharacter treat non-editable frames as non-selectable r=emilio
When `PeekOffsetForCharacter` find a non-editable content, it should never
return the frame because user must want to move caret only in editable content
when the previous position is editable.  Additionally, when a non-selectable
frame is skipped, caret will be moved enough, so it should not skip any editable
content.  Finally, the found frame may cause a line break.  Therefore, this
patch overwrites the result of `SelectablePeekReport::PeekOffsetForCharacter`
from `FOUND` to `CONTINUE_UNSELECTABLE` when non-editable content is found.

The remaining failures of the new WPT should be handled in bug 449685 because
they are caused by no frame for invisible preceding/trailing white spaces around
the block element boundary.

Depends on D223909

Differential Revision: https://phabricator.services.mozilla.com/D224183
2024-10-03 02:39:21 +00:00
Ting-Yu Lin
5b35980bbe Bug 1919945 - Unify the logic that computes flex item's main axis. r=dholbert
We compute the size of non-replaced elements in `nsIFrame::ComputeSize()` and
replaced elements in `nsContainerFrame::ComputeSizeWithIntrinsicDimensions()`.
When computing a flex item's main-size, we need to skip applying min-main-size
and max-main-size at both functions.

While we still need to duplicate the code in both places, unifying the logic
should make the code easier to read and pave the way for unifying these
functions in the future.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D222905
2024-10-02 00:27:33 +00:00
David Shin
e52d21fa25 Bug 1900232: Part 5 - Add anchor-size() to sizing properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222534
2024-09-23 13:58:38 +00:00
David Shin
1fad4eeb43 Bug 1900232: Part 4 - Add anchor-size() to margin properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222533
2024-09-23 13:58:38 +00:00
David Shin
41f83d368b Bug 1900232: Part 2 - Create one place to shim inset getters. r=firefox-style-system-reviewers,emilio
... Instead of handling `anchor()` function at each site manually.

Differential Revision: https://phabricator.services.mozilla.com/D222531
2024-09-23 13:58:37 +00:00
Emilio Cobos Álvarez
e623bb8997 Bug 1919853 - Make InspectorUtils able to return CSSNestedDeclarations too. r=devtools-reviewers,nchevobbe,dshin
Rename getCSSStyleRules now that it can return something else, and
change getCSSStyleRules_starting_style.html to cover this again.

Unfortunately the asserts in ServoStyleRuleMap.cpp no longer hold,
because the style attribute and other declarations are expected not to
show up there.

Differential Revision: https://phabricator.services.mozilla.com/D222856
2024-09-20 15:59:53 +00:00
Ting-Yu Lin
838ee47525 Bug 1918576 Part 1 - Apply min & max constraints only if block-size is definite in ComputeBSizeValueAsPercentageBasis(). r=dholbert
That is, a definite max block-size and an auto block-size should not compute a
definite percentage basis in the block axis.

Note that we accidentally pass
`testing/web-platform/tests/css/css-sizing/intrinsic-percent-replaced-017.html`.
After applying this patch, the test starts to fail, but it will be fixed in the
next part.

Differential Revision: https://phabricator.services.mozilla.com/D222230
2024-09-16 21:55:39 +00:00
Ting-Yu Lin
aa389ab830 Bug 1917144 Part 2 - Add IntrinsicSizeInput::mContainingBlockSize. r=dholbert
Currently, only the grid container needs the containing block size to resolve
the transferred min and max sizes for `repeat()` function in
`nsGridContainerFrame::ComputeIntrinsicISize()`.

This patch is a preparation for Bug 1865438. `mContainingBlockSize` will be used
there, so it does not change any behavior yet.

Differential Revision: https://phabricator.services.mozilla.com/D221333
2024-09-11 18:01:40 +00:00
Ting-Yu Lin
07296da4c0 Bug 1917144 Part 1 - Rename mPercentageBasis to mPercentageBasisForChildren in IntrinsicSizeInput. r=dholbert
Rename `mPercentageBasis` to `mPercentageBasisForChildren` to clarify that the
percentage basis is intended for resolving the percentage sizes for child
frames.

Differential Revision: https://phabricator.services.mozilla.com/D221332
2024-09-11 18:01:39 +00:00
Emilio Cobos Álvarez
3ca9c49882 Bug 1917715 - Rename nsLayoutUtils::GetColor. r=longsonr,dholbert
It's suitable for foreground colors only.

Differential Revision: https://phabricator.services.mozilla.com/D221557
2024-09-09 23:12:05 +00:00
Ting-Yu Lin
0a5e62e315 Bug 1909761 Part 4 - Construct a percentage basis when computing children's intrinsic inline size contributions. r=dholbert
A percentage basis is needed to resolve percentage block size when computing
children's intrinsic inline size contributions. This is necessary for a child or
descendants with a preferred aspect-ratio so that the block size can transfer
through the aspect-ratio to become an intrinsic inline size.

The change in `nsFlexContainerFrame::ComputeIntrinsicISize()` is necessary to
keep us passing
`testing/web-platform/tests/css/css-flexbox/image-nested-within-definite-column-flexbox.html`.

The change in `nsPlaceholderFrame::AddFloatToIntrinsicISizeData()` is necessary
to keep us passing
`testing/web-platform/tests/css/css-sizing/intrinsic-percent-replaced-dynamic-010.html`.

`GetISizeInfo()` in BasicTableLayoutStrategy.cpp is modified to pass table cell
frame's bsize as percentage basis. Otherwise,
`layout/reftests/bugs/522632-1.html` fails. This is our current behavior, but it
is bug 1461852.

Differential Revision: https://phabricator.services.mozilla.com/D219523
2024-09-03 04:25:42 +00:00
Ting-Yu Lin
116ca76700 Bug 1909761 Part 3 - Use IntrinsicSizeInput for AddInlineMinISize() and AddInlinePrefISize(). r=dholbert
Another preparation patch in order to pass down a percentage basis when
computing intrinsic size.

Differential Revision: https://phabricator.services.mozilla.com/D219522
2024-09-03 04:25:42 +00:00
Ting-Yu Lin
6af05a0977 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.

When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-09-03 04:25:41 +00:00
Butkovits Atila
4d06404349 Backed out 6 changesets (bug 1909761) for causing failures at test_contextmenu_rtl.xhtml. CLOSED TREE
Backed out changeset 1e9f47784a54 (bug 1909761)
Backed out changeset d2dcf159185b (bug 1909761)
Backed out changeset 3f48c106bff9 (bug 1909761)
Backed out changeset 38d1e5eda09d (bug 1909761)
Backed out changeset 8de556490289 (bug 1909761)
Backed out changeset 4e7f22f43bb4 (bug 1909761)
2024-08-28 10:44:09 +03:00
Ting-Yu Lin
3ac03672b0 Bug 1909761 Part 4 - Construct a percentage basis when computing children's intrinsic inline size contributions. r=dholbert
A percentage basis is needed to resolve percentage block size when computing
children's intrinsic inline size contributions. This is necessary for a child or
descendants with a preferred aspect-ratio so that the block size can transfer
through the aspect-ratio to become an intrinsic inline size.

The change in `nsFlexContainerFrame::ComputeIntrinsicISize()` is necessary to
keep us passing
`testing/web-platform/tests/css/css-flexbox/image-nested-within-definite-column-flexbox.html`.

The change in `nsPlaceholderFrame::AddFloatToIntrinsicISizeData()` is necessary
to keep us passing
`testing/web-platform/tests/css/css-sizing/intrinsic-percent-replaced-dynamic-010.html`.

`GetISizeInfo()` in BasicTableLayoutStrategy.cpp is modified to pass table cell
frame's bsize as percentage basis. Otherwise,
`layout/reftests/bugs/522632-1.html` fails. This is our current behavior, but it
is bug 1461852.

Differential Revision: https://phabricator.services.mozilla.com/D219523
2024-08-28 06:18:45 +00:00