Commit graph

322 commits

Author SHA1 Message Date
Andrew Osmond
8c7ef92da0 Bug 1888634 - Disallow captureStream with canvas transferred to DOM worker. r=gfx-reviewers,lsalzman
This behaviour has yet to be defined by the spec and/or WPT, see:

https://github.com/w3c/mediacapture-fromelement/issues/65
https://github.com/w3c/mediacapture-extensions/pull/26
https://github.com/web-platform-tests/wpt/issues/21102

Differential Revision: https://phabricator.services.mozilla.com/D207582
2024-04-17 12:57:56 +00:00
Sandor Molnar
51479c81df Backed out changeset fccadc284fd9 (bug 1753275) for causing perma mochitest failures @ dom/canvas/test/test_capture_throttled.html CLOSED TREE 2024-03-19 15:47:52 +02:00
Mathew Hodson
220634319e Bug 1753275 - Fix nits with captureStream. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D189708
2024-03-19 10:03:31 +00:00
Andrew Osmond
458224e190 Bug 1870957 - Part 4. Refactor canvas shutdown to be synchronized with CanvasManagerChild. r=lsalzman
Because we cannot control the ordering of shutdown notification from
WorkerRef, we need to choose one centralized point to begin shutdown of
the main thread or the owning DOM worker. Since there are other objects
owned by CanvasManagerChild, we also switch to a ThreadSafeWorkerRef.

Differential Revision: https://phabricator.services.mozilla.com/D195120
2023-12-20 13:01:19 +00:00
Narcis Beleuzu
272c5888a0 Merge central to autoland. CLOSED TREE 2023-12-19 17:39:20 +02:00
Noemi Erli
7b97e142d0 Backed out 12 changesets (bug 1795296, bug 1855742) as requested by aosmond a=backout
Backed out changeset 05b607c3bbe6 (bug 1795296)
Backed out changeset 7704291111b4 (bug 1855742)
Backed out changeset db60743295fb (bug 1855742)
Backed out changeset 8ed51e7d1c98 (bug 1855742)
Backed out changeset 40cba2c51b1c (bug 1855742)
Backed out changeset d4bfe15c07ec (bug 1855742)
Backed out changeset 2061271c53e8 (bug 1855742)
Backed out changeset 5b2a89a61f7f (bug 1855742)
Backed out changeset 2028c7018977 (bug 1855742)
Backed out changeset 13e806495fb8 (bug 1855742)
Backed out changeset 4bfa0d4913a2 (bug 1855742)
Backed out changeset 711b3f47e380 (bug 1855742)
2023-12-19 17:25:55 +02:00
Olli Pettay
b3adb188d5 Bug 1870780, mCaptureStream is null after unlinking, r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D196844
2023-12-19 14:55:37 +00:00
Andrew Osmond
696dee1a1a Bug 1855742 - Part 5. Refactor canvas shutdown to be synchronized with CanvasManagerChild. r=lsalzman
Because we cannot control the ordering of shutdown notification from
WorkerRef, we need to choose one centralized point to begin shutdown of
the main thread or the owning DOM worker. Since there are other objects
owned by CanvasManagerChild, we also switch to a ThreadSafeWorkerRef.

Differential Revision: https://phabricator.services.mozilla.com/D195120
2023-12-19 05:10:33 +00:00
Daniel Holbert
6e7af43939 Bug 1867604: Use regular refcounting macro (not threadsafe one) for RequestedFrameRefreshObserver, since it's only used on the main thread. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D195122
2023-11-30 18:46:05 +00:00
Tom Schuster
ea0560e8fe Bug 1847990 - Canvas fingerprinting detection heuristics. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D188340
2023-11-13 10:05:22 +00:00
Daniel Holbert
3a2501e3dc Bug 1859025: Add some profiler markers as guideposts for what's going on during long print operations. r=profiler-reviewers,canaltinova
This patch adds a new layout profiling sub-category "LAYOUT_Printing" for the
markers added here.

I'm adding an "interval"-type marker ("AUTO_PROFILER_MARKER_TEXT") for the
function-calls that seem likely to occupy measurable amounts of time (due to
touching the filesystem or printer driver), vs. single-point-in-time markers
("PROFILER_MARKER_TEXT") for functions whose duration isn't particularly long
or interesting, or whose durations we're already measuring with other
closely-associated interval-markers.

Differential Revision: https://phabricator.services.mozilla.com/D191001
2023-10-18 05:34:50 +00:00
Andrew Osmond
0329c1aaba Bug 1850871 - Resize canvas in ImageBitmapRenderingContext::TransferFromImageBitmap. r=gfx-reviewers,lsalzman
This patch makes it so that when a new ImageBitmap is provided to an
ImageBitmapRenderingContext, we resize its owning canvas rather than
crop or scale the given ImageBitmap to fit inside the canvas dimensions.

See discussion in https://github.com/whatwg/html/issues/7833.

Differential Revision: https://phabricator.services.mozilla.com/D188126
2023-10-16 11:23:43 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Andrew Osmond
671dd060ab Bug 1804746 - Make HTMLCanvasElement's toBlob to work with OffscreenCanvas. r=gfx-reviewers,lsalzman
Depends on D130788

Differential Revision: https://phabricator.services.mozilla.com/D188546
2023-09-19 11:58:11 +00:00
Andrew Osmond
d6408cb8f7 Bug 1744854 - Make HTMLCanvasElement's toDataURL to work with OffscreenCanvas. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D130788
2023-09-19 11:58:11 +00:00
Andrew Osmond
94fef446bd Bug 1837070 - Ensure we flush OffscreenCanvas when the display list is recreated. r=lsalzman
When we recreate the display list, e.g. after tabbing away, we need to
ensure we flush the OffscreenCanvas because our resource handles will be
invalidated. This requires the OffscreenCanvasDisplayHelper to know
which OffscreenCanvas it belongs to, and a worker reference if necessary
to do the dispatching for the flush. Otherwise we would require the
canvas to be updated manually by the web application to repaint.

Differential Revision: https://phabricator.services.mozilla.com/D184324
2023-07-23 20:42:41 +00:00
Andrew Osmond
71792018b4 Bug 1833876. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D179483
2023-07-18 16:29:47 +00:00
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Emilio Cobos Álvarez
7bddcf9e5a Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 17:22:03 +00:00
Cristian Tuns
6957543e5e Backed out changeset a3e55d5f9f13 (bug 1839223) for causing multiple failures in Document.cpp CLOSED TREE 2023-06-22 11:34:15 -04:00
Emilio Cobos Álvarez
2c6de5f038 Bug 1839223 - Remove nsMappedAttributes. r=smaug
Instead, lazily schedule evaluation of them before styling, much like we
were doing for SVG.

A subtle tweak is that we only remain scheduled while in the document.
This allows us to use the "in document" bit plus the "mapped attributes
dirty" bit to know our scheduled status. It also prevents doing silly
work for disconnected elements, and having to do hashmap lookups on
adoption and node destruction.

Differential Revision: https://phabricator.services.mozilla.com/D181549
2023-06-22 14:31:16 +00:00
Brad Werth
13bfef14a1 Bug 1836824 Part 1: Make HTMLCanvasElement re-register its frame refresh driver when a context is updated. r=jgilbert
Since HTMLCanvasElement has a lazily-created context, and the
RequestedFrameRefreshObserver will fail to watch the state when the
context is null, this patch adds a hook to try to re-register when
UpdateContext is called. The superclass calls UpdateContext after the
context is initially created.

Differential Revision: https://phabricator.services.mozilla.com/D181149
2023-06-16 21:13:00 +00:00
Nika Layzell
bfebcdae69 Bug 1837090 - Support [NeedsSubjectPrincipal] on workers, r=peterv
We've supported nsIPrincipal off-main-thread since bug 1443925, and
nsIPrincipal has been used as the JSPrincipals on workers and worklets
since bug 1804093.

This change updates the signature of these methods to match the main
thread, and provides the subject principal off-main-thread as well as on
the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D180158
2023-06-07 15:58:51 +00:00
Brad Werth
0e2033fa95 Bug 1834049: Permit canvas captureStream without initializing the context. r=lsalzman
The spec does not seem to require a current context, so there's no reason
to require it here. If later calls within
`HTMLCanvasElement::CaptureStream` need a current context, they'll have
their own failure messages which will hopefully clarify where exactly we
need the context to exist.

Differential Revision: https://phabricator.services.mozilla.com/D178985
2023-05-27 16:23:27 +00:00
Cristian Tuns
f8d5019d88 Backed out changeset 6d4600975de9 (bug 1834049) for causing wpt failures in MediaStreamTrack-contentHint.html CLOSED TREE 2023-05-25 14:17:38 -04:00
Brad Werth
5bc65aa678 Bug 1834049: Permit canvas captureStream without initializing the context. r=lsalzman
The spec does not seem to require a current context, so there's no reason
to require it here. If later calls within
`HTMLCanvasElement::CaptureStream` need a current context, they'll have
their own failure messages which will hopefully clarify where exactly we
need the context to exist.

Differential Revision: https://phabricator.services.mozilla.com/D178985
2023-05-25 16:08:29 +00:00
Tim Huang
07cbc511d5 Bug 1816189 - Part 4: Add random noise when extracting data from canvas element when canvas randomization is enabled. r=tjr,lsalzman
This patch introduces random noises to data extraction functions of
canvas element and offscreen canvas. The random noise is based on the
random key of the cookieJarSettings and the image data itself.

The random noises would interfere the ability of fingerprinters that
use canvas data to fingerprint users. The random noise will make unique
canvas finerprint to for every browsing session. Therefore, fingerprinter
cannot use canvas fingerprint to tracker individuals across browsing
sessions.

Differential Revision: https://phabricator.services.mozilla.com/D175499
2023-05-08 14:04:35 +00:00
Emilio Cobos Álvarez
51758cfc9b Bug 1829189 - Make OnAttrSetButNotChanged and AfterSetAttr infallible. r=smaug
Same rg + sed shenanigans as the first patch.

There were two that could fail, both due to OOM:

 * HTMLInputElement::AfterSetAttr: If we fail (only in the type=range
   case) we end up with an old value without it being clamped by
   min/max/step.

 * HTMLBodyElement::AfterSetAttr: If we fail we won't peek up the
   DocShell's frame margins and styling could be incorrect.

That seems better than having to deal with broken states after we've
already set the attribute.

Depends on D176069

Differential Revision: https://phabricator.services.mozilla.com/D176070
2023-04-21 08:56:27 +00:00
sotaro
954c16acec Bug 1805209 - Use RemoteTexture for WebGPU r=gfx-reviewers,lsalzman
WebGPU uses CompositableInProcessManager to push TextureHost directly from WebGPUParent to WebRender. But CompositableInProcessManager plumbing has a problem and caused Bug 1805209.

gecko already has a similar mechanism, called RemoteTextureMap. It is used in oop WebGL. If WebGPU uses RemoteTextureMap instead of CompositableInProcessManager, both WebGPU and oop WebGL use same mechanism.

WebGPUParent pushes a new texture to RemoteTextureMap. The RemoteTextureMap notifies the pushed texture to WebRenderImageHost.

Before the change, only one TextureHost is used for one swap chain. With the change, multiple TextureHosts are used for one swap chain with recycling.

The changes are followings.

- Use RemoteTextureMap instead of CompositableInProcessManager.
- Use RemoteTextureOwnerId instead of CompositableHandle.
- Use WebRenderCanvasData instead of WebRenderInProcessImageData.
- Add remote texture pushed callback functionality to RemoteTextureMap. With it, RemoteTextureMap notifies a new pushed remote texture to WebRenderImageHost.
- Remove CompositableInProcessManager.

Differential Revision: https://phabricator.services.mozilla.com/D164890
2022-12-23 20:41:02 +00:00
Andrew McCreight
ce28c41da0 Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.

Differential Revision: https://phabricator.services.mozilla.com/D164829
2022-12-15 19:45:01 +00:00
Andreas Pehrson
2ed52d6125 Bug 1796069 - Annotate MediaStreamTrackSources with a tracking id and apply it to CopyVideoStages. r=padenot
This will allow time consuming tasks (copies, capture, etc.) along the pipe to
be grouped per-track-source when visualizing profiler markers.

Differential Revision: https://phabricator.services.mozilla.com/D160754
2022-12-01 09:52:46 +00:00
Botond Ballo
68c71a503c Bug 1802225 - Remove Layers.{h,cpp}. r=tnikkel,geckoview-reviewers,jgilbert,media-playback-reviewers,padenot,m_kato
Where appropriate, `#include "Layers.h"` is replaced with
more specific inclusions.

Differential Revision: https://phabricator.services.mozilla.com/D162934
2022-11-29 01:52:03 +00:00
Lee Salzman
f73a41e1ac Bug 1800581 - Use optimized snapshots for drawImage if canvases share internal context. r=aosmond
By default, BorrowSnapshot is pessimistic and forces DrawTargetWebgl to return a data snapshot on
the assumption that the snapshot might be used off thread. However, if we actually know the DrawTarget
we're going to be drawing the snapshot to, then we can check if they're both DrawTargetWebgls with
the same internal SharedContext. In that case, we can use a SourceSurfaceWebgl snapshot which can
pass through a GPU texture to the target. This requires us to plumb the DrawTarget down through
SurfaceFromElement all the way to DrawTargetWebgl to make this decision.

Differential Revision: https://phabricator.services.mozilla.com/D162176
2022-11-17 03:07:18 +00:00
Kelsey Gilbert
4e7b4b5647 Bug 1794956 - TransferToImageBitmap should reset bitmap but not state. r=gfx-reviewers,lsalzman
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D159346
2022-10-16 22:52:40 +00:00
Iulian Moraru
b3fd738eb1 Backed out 2 changesets (bug 1794956) for causing wpt failures on offscreencanvas.transfer.to.imagebitmap.html. CLOSED TREE
Backed out changeset 7b3067b086e6 (bug 1794956)
Backed out changeset 3abcf6ccf88a (bug 1794956)
2022-10-15 19:09:01 +03:00
Kelsey Gilbert
4253cbe5b3 Bug 1794956 - TransferToImageBitmap should reset bitmap but not state. r=gfx-reviewers,lsalzman
s/Reset/ResetBitmap/ and implement for WebGL and WebGPU.

Differential Revision: https://phabricator.services.mozilla.com/D159346
2022-10-15 09:01:46 +00:00
Kelsey Gilbert
61dc37049b Bug 1795193 - Remove unused chrome-only API MozGetIPCContext. r=gfx-reviewers,jrmuizel,emilio
And also remove SetIsIPC.

Differential Revision: https://phabricator.services.mozilla.com/D159351
2022-10-14 18:02:28 +00:00
Emilio Cobos Álvarez
92c9ff22dc Bug 1780385 - Remove canvas hit region api. r=jrmuizel
Add a pref for MouseEvent.region since that wasn't un-exposed. No other
browser supports it so we can probably safely remove it, but just in
case.

Differential Revision: https://phabricator.services.mozilla.com/D152274
2022-07-20 16:52:47 +00:00
Kagami Sascha Rosylight
b1653a09c7 Bug 1767996 - Apply readability-make-member-function-const on dom/html r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D145627
2022-05-13 05:35:25 +00:00
Kagami Sascha Rosylight
73f6c1e217 Bug 1619574 - Remove HTMLCanvasElement::MozGetAsFile r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D144815
2022-04-27 16:13:14 +00:00
Andrew Osmond
3fe3f7ca98 Bug 1753302 - Part 1. Integrate WebGPU with OffscreenCanvas plumbing. r=gfx-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D141491
2022-04-04 16:42:02 +00:00
Andrew Osmond
f557ac0ff0 Bug 1760907 - Avoid mutex contention on display list updates for OffscreenCanvas. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D141811
2022-03-23 11:50:12 +00:00
Andrew Osmond
8574aa2078 Bug 1756864 - Fix several WPT failures surrounding neutered/no context OffscreenCanvas. r=gfx-reviewers,lsalzman
Mostly changing whether we throw, not throw, or throw a specific
exception.

Differential Revision: https://phabricator.services.mozilla.com/D139516
2022-02-28 16:12:47 +00:00
Andrew Osmond
917fa4c58a Bug 1755698 - Ensure we destroy HTMLCanvasElement's members during cycle collection unlinking. r=gfx-reviewers,lsalzman
OffscreenCanvasDisplayHelper may call back into HTMLCanvasElement after
it has been unlinked and violate our assumption that
HTMLCanvasElement::InvalidateCanvasPlaceholder is only called when we
have an OffscreenCanvas member. This patch makes it so that we clear the
relevant references during unlinking so that we don't make this mistake.

Differential Revision: https://phabricator.services.mozilla.com/D139380
2022-02-23 00:20:01 +00:00
Andrew Osmond
5f8b07ff0f Bug 1756186 - Fix Canvas2D CreatePattern and DrawImage with no context OffscreenCanvas. r=lsalzman
This patch ensures we return an empty surface as per the spec when
the OffscreenCanvas passed into CreatePattern and DrawImage has no
context bound to it.

Differential Revision: https://phabricator.services.mozilla.com/D139127
2022-02-22 21:16:16 +00:00
Andrew Osmond
c18a944c15 Bug 1754978 - Part 2. Switch WebGPU to use async image pipelines for display. r=kvark
This patch removes more main thread dependencies from the content side
of WebGPU. Instead of issuing a resource update for an external image,
we now use an async image pipeline in conjunction with
CompositableInProcessManager from part 1. This allows us to update the
HTMLCanvasElement bound to the WebGPU device without having to go
through the main thread, or even the content process after the swap
chain update / readback has been requested.

Differential Revision: https://phabricator.services.mozilla.com/D138887
2022-02-18 15:59:13 +00:00
Iulian Moraru
3dbfe82835 Backed out 2 changesets (bug 1754978) for causing valgrind bustages.
Backed out changeset 491a985fc34a (bug 1754978)
Backed out changeset 98983bf9eaed (bug 1754978)
2022-02-18 00:36:31 +02:00
Andrew Osmond
a18bf8a50c Bug 1754978 - Part 2. Switch WebGPU to use async image pipelines for display. r=kvark
This patch removes more main thread dependencies from the content side
of WebGPU. Instead of issuing a resource update for an external image,
we now use an async image pipeline in conjunction with
CompositableInProcessManager from part 1. This allows us to update the
HTMLCanvasElement bound to the WebGPU device without having to go
through the main thread, or even the content process after the swap
chain update / readback has been requested.

Differential Revision: https://phabricator.services.mozilla.com/D138887
2022-02-16 22:23:20 +00:00
Emily McDonough
83fc8a7c79 Bug 1755408 - Update comment still referencing nsSimplePageSequenceFrame::PrePrintNextPage r=dholbert DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D138739
2022-02-15 00:58:37 +00:00
Andrew Osmond
5e0eefe182 Bug 1754556 - Update WebGPU external image resource only after present is complete. r=kvark
This patch ensures that we only update the external image resource for
WebGPU when there has been an actual change for the resource. In order
to guarantee this, we wait for the present to complete, and only then
issue the update. WebRenderBridgeChild::SendResourceUpdates will also
trigger a frame generation if any resources were changed, which means we
don't need to trigger a paint on the frame itself anymore.

Note that we still have a race condition when we write into the
MemoryTextureHost while in PresentCallback, and the renderer thread may
be accessing the pixel data to upload to the GPU.

Differential Revision: https://phabricator.services.mozilla.com/D138349
2022-02-11 01:26:42 +00:00