22789 Commits

Author SHA1 Message Date
Julien Wajsberg
f2cc927a5c Bug 1777473 - Rename the frame label for PresShell::Destroy and expose to javascript developers r=emilio
The existing frame label was reusing the function name, but we already
have it when using native stacks. Renaming it to a more understandable
name should make it easier for our javascript developers users without
impairing gecko developers.

Differential Revision: https://phabricator.services.mozilla.com/D150976
2022-07-06 14:02:05 +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
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
Jeff Muizelaar
b54167f8b0 Bug 1777380 - Get PrintHitTestInfoStatsInternal building again. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D150675
2022-06-30 15:15:09 +00:00
Nika Layzell
8f236832ff Bug 1758115 - Part 2: Streamline locking, initialization and shutdown for TimelineConsumers, r=smaug
The current implementation of TimelineConsumers contains some unnecessary
complexity due to how it is initialized as a singleton, and the need for it to
be initialized and used in a threadsafe way. This patch attempts to simplify it
by making all members static, and removing the need to explicitly observe
shutdown for cleanup.

In addition, this approach avoids the risk of the type being accessed from
off-main-thread during initialization or shutdown.

Depends on D150442

Differential Revision: https://phabricator.services.mozilla.com/D150443
2022-06-29 15:01:51 +00:00
Andrew Osmond
c9e5ad2c49 Bug 1771493 - Part 2. Merge FontFaceSetImpl and gfxUserFontSet into a single class. r=emilio
This patch merges FontFaceSetImpl and gfxUserFontSet into the same
class. This reduces the level of indirection and in theory makes it
easier to manage future threading issues.

Differential Revision: https://phabricator.services.mozilla.com/D147817
2022-06-28 21:47:00 +00:00
Andrew Osmond
e134d17fa0 Bug 1771493 - Part 1. Split FontFace(Set) into DOM facing and implementation classes. r=emilio
This patch aims to split the implementation details of FontFace(Set)
into FontFace(Set)Impl classes. The Impl variants have threadsafe
refcounting and are intended to be the basis for worker support for
FontFace(Set). We need threadsafe objects to pass around because parts
of the stack can only run on the main thread (network loading of font
data, graphics initialization of a font) even if the FontFace(Set)
itself lives on a DOM worker thread. Given the DOM facing objects are
cycle collected, we need additional indirection to support this use
case.

This patch should be a non-functional change.

Differential Revision: https://phabricator.services.mozilla.com/D147505
2022-06-28 21:46:59 +00:00
Marian-Vasile Laza
dfecbedace Backed out 5 changesets (bug 1771493) for causing bustages on FontFaceSetDocumentImpl.obj. CLOSED TREE
Backed out changeset 07513973391f (bug 1771493)
Backed out changeset 22f567c00af3 (bug 1771493)
Backed out changeset 609a5d93bf08 (bug 1771493)
Backed out changeset 1f5b0b087930 (bug 1771493)
Backed out changeset aa5527055ad1 (bug 1771493)
2022-06-28 22:21:00 +03:00
Emilio Cobos Álvarez
582414f8e7 Bug 1776858 - Cleanup and add some missing unit conversion methods. r=gfx-reviewers,jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D150465
2022-06-28 18:52:19 +00:00
Andrew Osmond
4dfc867556 Bug 1771493 - Part 2. Merge FontFaceSetImpl and gfxUserFontSet into a single class. r=emilio
This patch merges FontFaceSetImpl and gfxUserFontSet into the same
class. This reduces the level of indirection and in theory makes it
easier to manage future threading issues.

Differential Revision: https://phabricator.services.mozilla.com/D147817
2022-06-28 15:58:10 +00:00
Andrew Osmond
12b14bddea Bug 1771493 - Part 1. Split FontFace(Set) into DOM facing and implementation classes. r=emilio
This patch aims to split the implementation details of FontFace(Set)
into FontFace(Set)Impl classes. The Impl variants have threadsafe
refcounting and are intended to be the basis for worker support for
FontFace(Set). We need threadsafe objects to pass around because parts
of the stack can only run on the main thread (network loading of font
data, graphics initialization of a font) even if the FontFace(Set)
itself lives on a DOM worker thread. Given the DOM facing objects are
cycle collected, we need additional indirection to support this use
case.

This patch should be a non-functional change.

Differential Revision: https://phabricator.services.mozilla.com/D147505
2022-06-28 15:58:09 +00:00
smolnar
4a5728f275 Backed out changeset d1e0b50deab6 (bug 1776858) for causing crashtest assertion failures in nsAlgorithm CLOSED TREE 2022-06-28 18:57:04 +03:00
Bogdan Szekely
c94fbd38ae Backed out 4 changesets (bug 1771493) for causing build bustages on FontFaceSet.cpp CLOSED TREE
Backed out changeset 3f2605087550 (bug 1771493)
Backed out changeset 5e6bf07c9c27 (bug 1771493)
Backed out changeset fbfb5b7dfb30 (bug 1771493)
Backed out changeset 93b7e171c74a (bug 1771493)
2022-06-28 17:57:11 +03:00
Andrew Osmond
effce641e2 Bug 1771493 - Part 2. Merge FontFaceSetImpl and gfxUserFontSet into a single class. r=emilio
This patch merges FontFaceSetImpl and gfxUserFontSet into the same
class. This reduces the level of indirection and in theory makes it
easier to manage future threading issues.

Differential Revision: https://phabricator.services.mozilla.com/D147817
2022-06-28 14:27:21 +00:00
Andrew Osmond
87c60b39a6 Bug 1771493 - Part 1. Split FontFace(Set) into DOM facing and implementation classes. r=emilio
This patch aims to split the implementation details of FontFace(Set)
into FontFace(Set)Impl classes. The Impl variants have threadsafe
refcounting and are intended to be the basis for worker support for
FontFace(Set). We need threadsafe objects to pass around because parts
of the stack can only run on the main thread (network loading of font
data, graphics initialization of a font) even if the FontFace(Set)
itself lives on a DOM worker thread. Given the DOM facing objects are
cycle collected, we need additional indirection to support this use
case.

This patch should be a non-functional change.

Differential Revision: https://phabricator.services.mozilla.com/D147505
2022-06-28 14:27:20 +00:00
Emilio Cobos Álvarez
7c1b8169a2 Bug 1776858 - Cleanup and add some missing unit conversion methods. r=gfx-reviewers,jrmuizel
This also makes stuff like `CSSPixel::ToAppUnits(<integer>)` not do
floating point math, which should be slightly faster.

Differential Revision: https://phabricator.services.mozilla.com/D150465
2022-06-28 13:26:02 +00:00
Emilio Cobos Álvarez
575ef5e7bd Bug 1775797 - Make resizers use frame-relative coordinates. r=TYLin
We no longer use the same code to resize windows and so (bug 1694061),
so keeping screen-relative coordinates is not really needed.

Instead, keep the size of the resized element around and do the math in
frame-relative coordinates, which is better behavior in presence of CSS
transforms.

Differential Revision: https://phabricator.services.mozilla.com/D150058
2022-06-28 08:33:06 +00:00
Emilio Cobos Álvarez
5fd43eaab3 Bug 1776157 - Don't force chrome frames to be opaque. r=dholbert
It causes unnecessary flashes in some cases, like the sidebar which
intentionally loads about:blank.

Differential Revision: https://phabricator.services.mozilla.com/D150096
2022-06-24 00:04:18 +00:00
Daniel Holbert
834d608a51 Bug 1776289 part 2: Merge nsPrintJob::Initialize into the constructor. r=emilio
This patch doesn't change behavior; it's just collapsing logic from
nsPrintJob's Initialize method (which is now de-facto infallible) into the
constructor.

I'm also removing the "Methods needed by the DocViewer" header-comment since
it's clearly innacurate at this point. It's only surrounding this constructor
and GetSeqFrameAndCountSheets, which is silly since nsDocumentViewer uses more
of our API than that.

(I also placed TODO(dholbert) comments for a few things that looked odd, to
follow up on later. In particular, I noticed that nsDocumentViewer holds a
dedicated stack-owned RefPtr reference to nsPrintJob after creating it, which
superficially looks unnecessary. I don't want to risk changing behvior or
introducing a crash by removing that reference in this refactoring patch, so
I'm leaving that as-is and simply flagging it as suspicious.)

Depends on D150194

Differential Revision: https://phabricator.services.mozilla.com/D150195
2022-06-23 22:57:01 +00:00
Daniel Holbert
221e594b00 Bug 1776289 part 1: Change nsPrintJob::Initialize to take references instead of pointers, to avoid the need for unnecessary null-checks. r=emilio
This patch doesn't change behavior.

Depends on D150177

Differential Revision: https://phabricator.services.mozilla.com/D150194
2022-06-23 22:57:00 +00:00
Daniel Holbert
4685a0aa28 Bug 1776074 part 4: Use references instead of pointers for nsPrintObject::Init's Document and nsDocShell args (and in callers). r=emilio
This patch doesn't change behavior. It just changes to c++ reference types and
code-comments to indicate where we know that pointers have been null-checked
(and removes some null-checks that now become trivially-unnecessary).

I've added code-comments to justify why we know these args are non-null.
Generally, `nsPrintObject::Init`'s args are null-checked by the caller, except
in one case (in `nsPrintJob::DoCommonPrint`) where the Document* pointer in
question was _not_ directly null-checked by the caller. But fortunately, it is
null-checked earlier, higher up in the call-stack.  So, this patch simply
propagates the C++ reference type-conversion up to that point for additional
clarity.

Differential Revision: https://phabricator.services.mozilla.com/D150078
2022-06-23 22:56:59 +00:00
Martin Robinson
317f69f042 Bug 1776211 - Assertion failure: aNode (aNode cannot be nullptr!), at /layout/base/nsGenConList.h:83 r=emilio
Specifically handle empty lists in nsGenConList::BinarySearch. This
was hidden because the pre-existing caller also handles empty lists before
calling the binary search algorithm.

Differential Revision: https://phabricator.services.mozilla.com/D150132
2022-06-23 16:05:30 +00:00
Andrew Osmond
f29955e688 Bug 1776215 - Make font related prefs threadsafe. r=gfx-reviewers,jrmuizel
This allows us to access these prefs off the main thread, e.g. for DOM
workers using OffscreenCanvasRenderingContext2D's text methods.

Differential Revision: https://phabricator.services.mozilla.com/D150124
2022-06-23 15:21:25 +00:00
Jeff Muizelaar
3847a14838 Bug 1774849 - Always use sync decoding during reftests. r=aosmond
nsImageGeometryMixin is used to redraw images with sync decoding.  Without it,
if we paint an image with non-sync decoding, we won't know that it will be
drawn differently with sync decoding and so don't have a mechanism to include
it in the invalid region.

Currently the main situation where we draw images with non-sync decoding and
then with sync decoding is during reftests. If we unconditionally use sync
decoding during reftests we don't have to worry about the situation where we
switch. This will let us resolve the problems associated with nsImageGeometryMixin.

Differential Revision: https://phabricator.services.mozilla.com/D149657
2022-06-22 18:50:35 +00:00
Martin Robinson
f85b73bf84 Bug 1463600 - Implement CSS 'contain: style' r=emilio
Add an implementation of CSS `contain: style`. This introduces two new
data structures, the ContainStyleScope and ContainStyleScopeManager.

ContainStyleScope manages one `contain: style` "world" which has its own
counter and quote lists. The contents of these lists depend on their
parent scopes, but are not affected by their children.
ContainStyleScopeManager manages a tree of scopes starting at a root
scope which is outside of any `contain: style` element.

Scopes are stored in a hash table that is keyed off of the nsIContent
which establishes the `contain: style` scope. When modifying quote or
content lists, the ContainStyleScopeManager is responsible for finding
the appropriate `contain: style` scope to modify.

Perhaps the most complex part of this is that counters and quotes have
read access to the state of counters and quotes that are in ancestor
`contain: style` scopes. In the case of counters, USE nodes that are at
the beginning of counter lists might have a counter scope that starts in
an ancestor `contain: style` scope. When nsCounterNode::SetScope() is
called, the code may look upward in the `contain: style` scope tree to
find the start of the counter scope. In the case of quotes, the first
node in the quote list must look for the state of quotes in ancestor
`contain: style` scopes.

Differential Revision: https://phabricator.services.mozilla.com/D149508
2022-06-22 16:16:59 +00:00
Bogdan Szekely
b56ae513c7 Backed out changeset 86e9449aba35 (bug 1463600) for causing xpcshell failures on test_css-properties-db.js 2022-06-22 15:35:33 +03:00
Martin Robinson
83640bbee6 Bug 1463600 - Implement CSS 'contain: style' r=emilio
Add an implementation of CSS `contain: style`. This introduces two new
data structures, the ContainStyleScope and ContainStyleScopeManager.

ContainStyleScope manages one `contain: style` "world" which has its own
counter and quote lists. The contents of these lists depend on their
parent scopes, but are not affected by their children.
ContainStyleScopeManager manages a tree of scopes starting at a root
scope which is outside of any `contain: style` element.

Scopes are stored in a hash table that is keyed off of the nsIContent
which establishes the `contain: style` scope. When modifying quote or
content lists, the ContainStyleScopeManager is responsible for finding
the appropriate `contain: style` scope to modify.

Perhaps the most complex part of this is that counters and quotes have
read access to the state of counters and quotes that are in ancestor
`contain: style` scopes. In the case of counters, USE nodes that are at
the beginning of counter lists might have a counter scope that starts in
an ancestor `contain: style` scope. When nsCounterNode::SetScope() is
called, the code may look upward in the `contain: style` scope tree to
find the start of the counter scope. In the case of quotes, the first
node in the quote list must look for the state of quotes in ancestor
`contain: style` scopes.

Differential Revision: https://phabricator.services.mozilla.com/D149508
2022-06-22 10:42:34 +00:00
Emilio Cobos Álvarez
7829e5aab5 Bug 1774378 - Make select code harder to mess up. r=Gijs
Right now we rely on the menulist to be injected by hand in all the
relevant windows. Instead create it lazily, making the select code more
standalone.

The DevTools window was missing it, for example.

Differential Revision: https://phabricator.services.mozilla.com/D149620
2022-06-21 21:42:58 +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
Razvan Cojocaru
5b663ef76f Bug 1773387 - Change local variables of type gfxSize, which actually represent scales, to MatrixScalesDouble. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D149565
2022-06-20 19:17:14 +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
Botond Ballo
5d687c962b Bug 1771503 - Disable the 'two layers that scroll together' assertion for matrices with Inf or NaN elements. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D149466
2022-06-17 23:50:49 +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
Iulian Moraru
b9b91b3bba Backed out changeset ea2c1cabc853 (bug 1774849) for causing crashtest failures on 944353.jpg. 2022-06-17 22:56:46 +03:00
Jeff Muizelaar
e2ab641934 Bug 1774849 - Always use sync decoding during reftests. r=aosmond
nsImageGeometryMixin is used to redraw images with sync decoding.  Without it,
if we paint an image with non-sync decoding, we won't know that it will be
drawn differently with sync decoding and so don't have a mechanism to include
it in the invalid region.

Currently the main situation where we draw images with non-sync decoding and
then with sync decoding is during reftests. If we unconditionally use sync
decoding during reftests we don't have to worry about the situation where we
switch. This will let us resolve the problems associated with nsImageGeometryMixin.

Differential Revision: https://phabricator.services.mozilla.com/D149657
2022-06-17 18:57:07 +00:00
Emilio Cobos Álvarez
4ee33aab52 Bug 1730763 - Fix containment and body-to-root propagation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D149226
2022-06-17 10:42:52 +00:00
Mirko Brodesser
8d922ea417 Bug 1744524: part 1) Add JS code for the "Paste" menupopup to handle ClipboardReadTextPaste events created from the C++ side. r=edgar,Gijs
Implements showing a "Paste" popup at the last mouse position (which
overlapped the browser window) when a certain custom event is received.
Creating and dispatchting that event is implemented in one of the
following parts.

Differential Revision: https://phabricator.services.mozilla.com/D135333
2022-06-16 14:43:40 +00:00
Marian-Vasile Laza
1d24f09b38 Backed out changeset d70914c7f1f3 (bug 1730763) for causing web-platform reftest failures on direction-propagation-body-contain-root.html. CLOSED TREE 2022-06-16 15:53:24 +03:00
Emilio Cobos Álvarez
34e23753e7 Bug 1730763 - Fix containment and body-to-root propagation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D149226
2022-06-16 08:08:08 +00:00
Iulian Moraru
9aa4db0c6d Backed out 2 changesets (bug 1730763) for causing multiple reftest failures. CLOSED TREE
Backed out changeset 350982d1a44d (bug 1730763)
Backed out changeset 392445118046 (bug 1730763)
2022-06-15 15:31:43 +03:00
Emilio Cobos Álvarez
f66447dead Bug 1730763 - Fix typo that causes some reftests to fail.
Adjust some tests that are not expected to pass until we implement style
containment.

MANUAL PUSH: Trivial typo fix CLOSED TREE
2022-06-15 13:29:43 +02:00
Emilio Cobos Álvarez
37f45fa980 Bug 1773924 - Simplify nsDeviceContext code dealing with DPI changes. r=jfkthame
This in-out parameter business used to be necessary (bug 1249279), but
we don't propagate the new widget scale to remote documents (which are
the common case now) and we seem to be doing just fine without that, so
I'm not sure why this would be needed anymore.

Also simplify some unit conversions while at it.

Differential Revision: https://phabricator.services.mozilla.com/D149032
2022-06-15 09:57:38 +00:00
Emilio Cobos Álvarez
662e5dc678 Bug 1730763 - Fix containment and body-to-root propagation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D149226
2022-06-15 09:56:34 +00:00
Emilio Cobos Álvarez
10e96ff14e Bug 1773633 - Allow configuring OS zoom behavior. r=tnikkel
This is reasonably straight-forward and should allow us change the
desired behavior on platforms if / when we need.

Also, this adds tests for the feature by using the relevant float pref
(though we can't easily assert the full-zoom behavior because it changes
the size of the reftest window itself).

Differential Revision: https://phabricator.services.mozilla.com/D148902
2022-06-13 11:38:43 +00:00
Csoregi Natalia
b5e25cb54f Backed out 2 changesets (bug 1773633) for causing failures on 1773633.html . CLOSED TREE
Backed out changeset a3f117c8f671 (bug 1773633)
Backed out changeset 5df8a7315ddb (bug 1773633)
2022-06-13 06:05:36 +03:00
Emilio Cobos Álvarez
3514929e87 Bug 1773633 - Allow configuring OS zoom behavior. r=tnikkel
This is reasonably straight-forward and should allow us change the
desired behavior on platforms if / when we need.

Also, this adds tests for the feature by using the relevant float pref
(though we can't easily assert the full-zoom behavior because it changes
the size of the reftest window itself).

Differential Revision: https://phabricator.services.mozilla.com/D148902
2022-06-13 00:05:00 +00:00
Emily McDonough
190b75c8f6 Bug 1769161 Part 4 - Add test for unwriteable margin scaling with page-size mismatches r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D146603
2022-06-10 19:37:23 +00:00
Molnar Sandor
8b6a566d1f Backed out 4 changesets (bug 1769161) for causing mochitest failures in layout/base/tests/chrome/test_printpreview.xhtml CLOSED TREE
Backed out changeset d376decbcba0 (bug 1769161)
Backed out changeset a821b6bc4a18 (bug 1769161)
Backed out changeset 4ffac65dfc17 (bug 1769161)
Backed out changeset 616392cd1725 (bug 1769161)
2022-06-10 07:45:32 +03:00
Emily McDonough
674b8193c6 Bug 1769161 Part 4 - Add test for unwriteable margin scaling with page-size mismatches r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D146603
2022-06-09 23:51:08 +00:00
Emilio Cobos Álvarez
40b88fe3ed Bug 1773342 - Treat text scale factor as an additional zoom factor, on both GTK and Windows. r=stransky,handyman
GTK already did this, sorta, in a platform-specific way: by hacking in the
scale factor in the CSS screen code. I think this is cleaner, since we have a
centralized place to compute the full zoom in nsPresContext, and that code path
is fairly well tested.

This also would make it trivial to make this text zoom rather than full zoom in
the future, if we wanted (which is probably _technically_ more correct, even
though less pretty less pretty).

This also allows us to remove some hacks where we were undoing the text scale
factor on Linux (since stuff like scrollbars already ignore full zoom).

Depends on D148675

Differential Revision: https://phabricator.services.mozilla.com/D148676
2022-06-09 23:02:11 +00:00