Граф коммитов

19367 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez 482d8239cb Bug 1777135 - Part 2: Improve nsNativeTheme::IsDarkBackground by accounting for default bg color. r=dholbert
Since callers want just an effective color to compute whether it's dark,
we simplify the API a bit too.

This makes sure we find the dark background in plain text documents.

Differential Revision: https://phabricator.services.mozilla.com/D151018
2022-07-12 09:51:47 +00:00
Emilio Cobos Álvarez 1b27bde4b3 Bug 1778718 - Make filter/backdrop-filter wrapping work when ignoring a scroll frame. r=tnikkel
Factor the code to build the top layer and wrapping for filters into a
common function.

Differential Revision: https://phabricator.services.mozilla.com/D151475
2022-07-12 09:46:01 +00:00
criss a2b0dea609 Backed out 4 changesets (bug 1774537) for causing mochitest failures on test_group_scroll_snap.html
Backed out changeset 47bb66885515 (bug 1774537)
Backed out changeset 9bb536d111a7 (bug 1774537)
Backed out changeset e3ab56189fa0 (bug 1774537)
Backed out changeset 61b3c13db9ea (bug 1774537)
2022-07-12 08:59:19 +03:00
Hiroyuki Ikezoe fc6888c9f9 Bug 1774537 - Skip re-snapping if there's any async scroll is running. r=botond
Depends on D149497

Differential Revision: https://phabricator.services.mozilla.com/D150929
2022-07-12 03:01:14 +00:00
Hiroyuki Ikezoe db52d38a69 Bug 1774537 - Propagate snap target ids for async scroll operations triggered on the main-thread, but will be processed in APZ. r=botond
Ideally we can write a wpt for this case, but it doesn't work due to
bug 1674687 and ClampAndAlignWithPixels [1] in our code. In the wpt we can use
waitForScrollTo [2] to wait for the end of an async scroll operation, say
a scrollBy call with `behavior: smooth`, at some point where it's close to the
final scroll destination APZ reports a fractional scroll offset close to the
destination, it will be clamped and rounded to the final destination value, thus
waitForScrollTo considers it reached to the end of the scroll operation. At the
moment APZ considers the async scroll is still in progress, which mean the snap
target ids haven't yet been reported to back the main-thread unfortunately.

[1] https://searchfox.org/mozilla-central/rev/170f06a720ddabee44c728b05ad30b18b066acca/layout/generic/nsGfxScrollFrame.cpp#2847
[2] https://searchfox.org/mozilla-central/rev/170f06a720ddabee44c728b05ad30b18b066acca/testing/web-platform/tests/css/css-scroll-snap/support/common.js#84

Depends on D149496

Differential Revision: https://phabricator.services.mozilla.com/D149497
2022-07-12 03:01:14 +00:00
Hiroyuki Ikezoe 88f14ab50f Bug 1774537 - Propagate last snap target id(s) from APZ to the content. r=botond
Depends on D149495

Differential Revision: https://phabricator.services.mozilla.com/D149496
2022-07-12 03:01:13 +00:00
Emilio Cobos Álvarez 325be139ff Bug 1778718 - Clean-up some scroll frame DL building code. r=tnikkel
This doesn't change behavior but makes the next patch simpler, and makes
the ignore-scrollframe and non-ignore-scrollframe code-paths match.

Differential Revision: https://phabricator.services.mozilla.com/D151473
2022-07-11 20:18:35 +00:00
Emilio Cobos Álvarez f912244bff Bug 1778965 - Clean-up a bit alt text code. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D151482
2022-07-11 17:29:31 +00:00
Narcis Beleuzu 2d9fc73670 Backed out changeset 1861b83150d9 (bug 1774697) for wpt failure on user-select-on-input-and-contenteditable.html CLOSED TREE 2022-07-11 17:15:34 +03:00
Tiaan Louw 06b74d6d77 Bug 1774697 - Ignore the computed "user-select" on editable elements r=dholbert
Check for a text input or editable host first, because they always set
the used style to 'contain' (The spec actually requires 'contain', but
we implement the 'contain' behavior as a flavor of 'text')

https://drafts.csswg.org/css-ui-4/#content-selection

Differential Revision: https://phabricator.services.mozilla.com/D149731
2022-07-11 11:45:22 +00:00
Hiroyuki Ikezoe 8037b62525 Bug 1768746 - Resolve scroll-snap-align with the targe element's writing mode if the size is larger than the snapport. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D151096
2022-07-10 23:38:27 +00:00
Ting-Yu Lin dc7ac912b3 Bug 1323517 Part 7 - Fix the placement of an orthogonal float with an auto block-size. r=jfkthame
The old code in AddFloat() used to call nsBlockFrame::ComputeFloatISize() to
compute a float's inline-size, compare it with current line's available
inline-size, and determine whether FlowAndPlaceFloat() should be called.
However, it doesn't handle an orthogonal float with an auto block-size.

Luckily, FlowAndPlaceFloat() already has logic dealing with orthogonal
floats (bug 1141867), so this patch defers the decision to place a float below
the current line until the float's margin inline-size is computed in
FlowAndPlaceFloat().

Differential Revision: https://phabricator.services.mozilla.com/D151209
2022-07-07 19:01:56 +00:00
Ting-Yu Lin b9cb8817f5 Bug 1323517 Part 6 - Change FlowAndPlaceFloat()'s return value to a tri-state enum. r=jfkthame
This patch is a preparation for the next part, and doesn't change the behavior
yet.

FlowAndPlaceFloat() is used to return true and false. This patch changes its
return value `true` to `PlaceFloatResult::Placed` and `false` to
`PlaceFloatResult::ShouldPlaceInNextContinuation`.

In the next part, we'll move the logic dealing with "below the current line
floats" into FlowAndPlaceFloat(), and make it return
`PlaceFloatResult::ShouldPlaceBelowCurrentLine`.

Differential Revision: https://phabricator.services.mozilla.com/D151208
2022-07-07 19:01:56 +00:00
Ting-Yu Lin 48a466967c Bug 1323517 Part 5 - Improve the available size computation for reflowing a float. r=jfkthame
First of all, `nsBlockFrame::AdjustFloatAvailableSpace()` is misleading. It
doesn't adjust the argument `aFloatAvailableSpace` at all, nor does it use any
fields in nsBlockFrame. It simply returns the available space in the parent
block's content area. Thus, I move it into BlockReflowState, and have it return
the available size rather than a rect because a size is sufficient for reflowing
a float.

Also, nsBlockFrame::ReflowFloat() only cares about the available size, but not
the position of the available space, so it is sufficient to pass a LogicalSize
computed by the new method ComputeAvailableSizeForFloat().

In FlowAndPlaceFloat(), there is a loop searching for a wide enough band to
place the float. We don't need to adjust availSize every time mBCoord is changed
in the loop. We can just call ComputeAvailableSizeForFloat() to get a new
available size before reflowing the float in the `!earlyFloatReflow` branch.

This patch shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151207
2022-07-07 19:01:56 +00:00
Ting-Yu Lin 70e03e7368 Bug 1323517 Part 4 - Pass a dummy rect into ReflowBlock() when reflowing a float. r=jfkthame
This is a preparation for the next part.

Differential Revision: https://phabricator.services.mozilla.com/D151206
2022-07-07 19:01:55 +00:00
Ting-Yu Lin 9727d0b740 Bug 1323517 Part 3 - Rename GetLowestFloatTop to LowestFloatBStart. r=jfkthame
Both the method's documentation and implementation already use logical
coordinate.

Differential Revision: https://phabricator.services.mozilla.com/D151205
2022-07-07 19:01:55 +00:00
Ting-Yu Lin 0b0c4753f9 Bug 1323517 Part 2 - Remove float debug log that requires manual #define. r=jfkthame
These are small printf statements that are not build by CI, which increase
maintenance burden.

Differential Revision: https://phabricator.services.mozilla.com/D151204
2022-07-07 19:01:54 +00:00
Ting-Yu Lin ed00bfdbb9 Bug 1323517 Part 1 - Remove a duplicate assertion, and assert a fresh reflow status in ReflowFloat(). r=jfkthame
In FlowAndPlaceFloat(), condense two identical assertions about float frame
parent into one.

FlowAndPlaceFloat() calls ReflowFloat() only once, either an early reflow (when
`earlyFloatReflow` is `true`) or a late reflow (when `earlyFloatReflow` is
`false`), so the reflow status is always fresh.

Differential Revision: https://phabricator.services.mozilla.com/D151203
2022-07-07 19:01:54 +00:00
James Graham b57989d24a Bug 1773696 - Make wheel event IPC depend on test_events_async_enabled, r=smaug
The `widget->DispatchInputEvent` codepath only works in gecko CI
configurations, so to allow this to be used for e.g. WebDriver
implement a path that doesn't go via the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D150632
2022-07-06 19:55:12 +00:00
Ting-Yu Lin 291489917d Bug 1778178 - Convert ReflowInput's available size write-accessors to setters. r=layout-reviewers,jfkthame
This patch rewrites some callers, but they shouldn't change the behavior.

Differential Revision: https://phabricator.services.mozilla.com/D151042
2022-07-06 17:39:57 +00:00
Mirko Brodesser 0225cd5e0d Bug 1778286: declare `aEvent` of `nsIFrame::GetContentForEvent` `const`. r=emilio
Simplifies reasoning about it.

Differential Revision: https://phabricator.services.mozilla.com/D151118
2022-07-06 10:22:30 +00:00
Ting-Yu Lin 0cf9b03af3 Bug 1777627 Part 3 - Improve BlockReflowState::mBorderPadding's documentation. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D150833
2022-07-05 23:43:52 +00:00
Ting-Yu Lin 8197bd4fb0 Bug 1777627 Part 2 - Remove aIsAdjacentWithBStart argument on nsBlockReflowContext::ReflowBlock(). r=emilio
aIsAdjacentWithBStart is used to clear the mIsTopOfPage bit for the ReflowInput
argument `aFrameRI`. However, ReflowBlock() already has aState argument to query
IsAdjacentWithBStart(), so there's no need for aIsAdjacentWithBStart argument.

Differential Revision: https://phabricator.services.mozilla.com/D150832
2022-07-05 23:43:52 +00:00
Ting-Yu Lin 6e0a1ac033 Bug 1777627 Part 1 - Improve BlockReflowState::IsAdjacentWithTop(). r=emilio
I rename and add a comment to the helper, and rewrite it to make it closer to
what the comment describes. The behavior is the same because `mBCoord` and
`mContentArea.BStart(wm)` are both initialized as `mBorderPadding.BStart(wm)`
[1].

Note `isAdjacentWithTop` local variable in ReflowFloat() is not changed because
it's going to be removed in the next patch.

[1] https://searchfox.org/mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b/layout/generic/BlockReflowState.cpp#142

Differential Revision: https://phabricator.services.mozilla.com/D150831
2022-07-05 23:43:51 +00:00
Jonathan Kew 2f7b62ff61 Bug 1777209 - Use DrawSurface rather than FillRect to paint <canvas>, and don't use EXTEND_PAD when writing to PDF. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D150601
2022-07-05 07:55:56 +00:00
Csoregi Natalia da06c30fac Backed out changeset 1b43d3f38946 (bug 1777209) for causing reftest failures e.g. 602200-4.html. CLOSED TREE 2022-07-04 19:27:42 +03:00
Jonathan Kew c94cf2c2a7 Bug 1777209 - Use DrawSurface rather than FillRect to paint <canvas>, and don't use EXTEND_PAD when writing to PDF. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D150601
2022-07-04 14:08:16 +00:00
Hiroyuki Ikezoe 22c71836b8 Bug 1777652 - Minor followup fixes for bug 1530253. r=botond
*

Differential Revision: https://phabricator.services.mozilla.com/D150848
2022-07-01 04:47:09 +00:00
Hiroyuki Ikezoe 5e0384e16d Bug 1530253 - Trigger resnap on scroll-snap-type or scroll-snap-align changes. r=emilio
Depends on D148863

Differential Revision: https://phabricator.services.mozilla.com/D148864
2022-07-01 01:35:33 +00:00
Hiroyuki Ikezoe 77f616cdaf Bug 1530253 - Trigger re-snap on reflows and in RecomputePosition. r=botond,emilio
The basic machinery to trigger re-snap is same as what scroll anchoring does,
queueing a triggering request and flush the queued requests after reflows
finished.

Depends on D148862

Differential Revision: https://phabricator.services.mozilla.com/D148863
2022-07-01 01:35:32 +00:00
Hiroyuki Ikezoe b3f8eec3ae Bug 1530253 - Implement the logic to choose the best snap point for re-snap. r=botond
Depends on D148861

Differential Revision: https://phabricator.services.mozilla.com/D148862
2022-07-01 01:35:32 +00:00
Hiroyuki Ikezoe 539894373e Bug 1530253 - Store the last snap target ids in the case of instant scroll oparations on the main-thread. r=botond,emilio
Depends on D148860

Differential Revision: https://phabricator.services.mozilla.com/D148861
2022-07-01 01:35:31 +00:00
Hiroyuki Ikezoe e61d931bb9 Bug 1530253 - Give the snap target ids to ScrollToWithOrigin. r=botond
The snap targt ids will be the last snap target ids we use for re-snapping.

Depends on D148859

Differential Revision: https://phabricator.services.mozilla.com/D148860
2022-07-01 01:35:31 +00:00
Hiroyuki Ikezoe 7369e5e99a Bug 1530253 - Add a wrapper struct representing various arguments for ScrollToWithOrigin. r=botond
Depends on D148858

Differential Revision: https://phabricator.services.mozilla.com/D148859
2022-07-01 01:35:30 +00:00
Hiroyuki Ikezoe 02531dcb21 Bug 1530253 - Replace internal ScrollFrameHelper::ScrollTo calls with ScrollFrameHelper::ScrollToWithOrigin. r=botond
There are some call sites of ScrollTo involving will a GetSnapPointForDestination
call. For re-snapping, we need to inform not only the snap point but also the
snap target id(s). To do it, in subsequent patches in this commit series, we will
change only ScrollToWithOrigin arguments rather than both ScrollTo and
ScrollToWithOrigin.

Depends on D148857

Differential Revision: https://phabricator.services.mozilla.com/D148858
2022-07-01 01:35:30 +00:00
Hiroyuki Ikezoe ce73d6bd80 Bug 1530253 - Make GetSnapPointForDestination return the last snapped target id(s). r=botond
Depends on D148856

Differential Revision: https://phabricator.services.mozilla.com/D148857
2022-07-01 01:35:30 +00:00
Hiroyuki Ikezoe e176812c3d Bug 1530253 - Assign an id to each scroll snap target for tracking the last snapped element. r=botond,emilio
Depends on D148855

Differential Revision: https://phabricator.services.mozilla.com/D148856
2022-07-01 01:35:29 +00:00
Hiroyuki Ikezoe 76e0bb9d9b Bug 1530253 - Introduce a new struct wrapping various varibles in CalcSnapPoints. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D148855
2022-07-01 01:35:29 +00:00
Jonathan Kew dc0cb583a8 Bug 1774851 - Apply the proper directionality when creating the hyphenate-character textrun. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D150318
2022-06-28 12:40:18 +00:00
Ting-Yu Lin 8274aa5608 Bug 1758757 - Remove two ReflowInput::ApplyRelativePositioning methods that require ReflowInput instance. r=emilio
See bug 1758757 comment 0 for the rationale.

Note: the old code in nsTableRowGroupFrame::SlideChild() is bogus because it
calls ApplyRelativePositioning() via the nsTableRowGroupFrame's ReflowInput
instance. That is, it applies relative positioning to nsTableRowGroupFrame, but
not to the aKidFrame (nsTableRowFrame).

While I'm here, I expand `SlideChild` in its only caller, and simplify it.

Differential Revision: https://phabricator.services.mozilla.com/D150323
2022-06-27 20:49:59 +00:00
Ting-Yu Lin cbdc83f787 Bug 1776079 - Delete SharedFlexData() only if there's no flex container's next-in-flow. r=dholbert
nsGridContainerFrame has the same logic.
https://searchfox.org/mozilla-central/rev/6d0ba065e3d41822337c708c8c0aca334ddd9218/layout/generic/nsGridContainerFrame.cpp#9116

Differential Revision: https://phabricator.services.mozilla.com/D150157
2022-06-24 05:00:07 +00:00
Ting-Yu Lin e6e61d19e4 Bug 1758824 - Prevent integer overflow in nsFloatManager::ShapeInfo::XInterceptAtY(). r=emilio
`aY * aY` or `aRadiusY * aRadiusY` can lead to 32-bit integer overflow,
resulting a negative number. Then `sqrt()` will produce a `nan` on a negative
number.

We should compute the `y/radiusY` division, and then square the result.

Differential Revision: https://phabricator.services.mozilla.com/D149951
2022-06-24 04:59:29 +00:00
Hiroyuki Ikezoe 41c2d38055 Bug 1772640 - Use NSCoordSaturatingMultiply to avoid overflowing nscoord. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D149838
2022-06-22 01:30:29 +00:00
Ting-Yu Lin 46965e75de Bug 847368 - Reset floating first letter's reflow status before checking break-inside:avoid. r=emilio
As the comment in the moved hunk said, a floating first letter frame's
incomplete status means that there is more content to be reflowed on the line.
If the block containing the floating first letter has `break-inside:avoid`
style, the old code would call `SetInlineLineBreakBeforeAndReset()`, and the
block's parent frame would misinterpret the status as "this block needs to be
push to the next fragment" even if we are *not* in a paginated environment.
Hence the assertion "Shouldn't be incomplete if availableBSize is
UNCONSTRAINED."

To fix this bug, we can reset the float's reflow status for a first letter frame
before checking `ShouldAvoidBreakInside`.

Differential Revision: https://phabricator.services.mozilla.com/D149712
2022-06-20 23:04:50 +00:00
Ting-Yu Lin 5598d191a9 Bug 1774904 - Remove SetTruncated in ReflowInput.h. r=dholbert
SetTruncated was moved into nsReflowStatus in Bug 775624 Part 10a
https://hg.mozilla.org/mozilla-central/rev/3ea22e82b7a1b493f2f31e52ed310e6288fd9a91,
so let's remove the unused declarations in ReflowInput.h.

Differential Revision: https://phabricator.services.mozilla.com/D149686
2022-06-18 18:40:02 +00:00
Daniel Holbert 92b1de01bb Bug 1774879 part 3: Add 'const' to local var ComputedStyle pointers that we pass to DetermineBackgroundColor and IsTransparent (which now accept const). r=emilio
This patch does not affect behavior; it's just a const-correctness fix.

Differential Revision: https://phabricator.services.mozilla.com/D149676
2022-06-18 00:45:20 +00:00
Daniel Holbert cdb88a2da1 Bug 1774261 part 2: Simplify nsCSSRendering::FindBackgroundFrame to directly return its result instead of using an outparam. r=emilio
This patch doesn't change behavior.

This is similar to the previous patch in this series, but now for
FindBackgroundFrame().

Differential Revision: https://phabricator.services.mozilla.com/D149338
2022-06-17 21:55:21 +00:00
Daniel Holbert e4309c976e Bug 1774261 part 1: Simplify nsCSSRendering::FindBackground to directly return its result instead of using an outparam. r=emilio
This patch doesn't change behavior.

Before this patch, the FindBackground API returns a bool to indicate
success/failure, and sets its outparam to a non-null pointer-value on success.

This patch simplifies the API by just promoting the promoting the outparam to
be the actual return value, with nullptr as a sentinel value to indicate
failure.

(This patch adds some braces to affected/contextual if statements, too, to
match our coding style guide.)

Differential Revision: https://phabricator.services.mozilla.com/D149337
2022-06-17 21:55:20 +00:00
Butkovits Atila f89aab0331 Backed out changeset d6ee5bae41b8 (bug 1773121) for causing Wr failures. CLOSED TREE 2022-06-15 21:18:46 +03:00
David Shin 6f8ed3fabe Bug 1773121 - If an element is relatively positioned, report overflow area that is a union of relative and static position. r=dholbert
With this, a relatively positioned element e.g. being offset to the left
should not decrease the scrollport size. For this, overflow area calculation
for relatively positioned elements must behave like
`nsIFrame::GetActualAndNormalOverflowAreasRelativeToParent`. We aren't
using the function directly since it's meant to be called post-reflow, and
we want to report it correctly during reflow in the first place.

Differential Revision: https://phabricator.services.mozilla.com/D149156
2022-06-15 17:39:05 +00:00