Commit graph

257 commits

Author SHA1 Message Date
Andreas Pehrson
25a2508021 Bug 1344524 - Capture frames from a canvas while its refresh driver is throttled. r=jgilbert
Note that this is only triggered if the application is able to draw to the
canvas while the refresh driver is throttled.

Differential Revision: https://phabricator.services.mozilla.com/D136004
2022-01-24 15:31:15 +00:00
Andreas Pehrson
077549e08e Bug 1344524 - Change ContextCleanForFrameCapture flag to a Watchable FrameCaptureState. r=jgilbert
This allows the canvas element to be notified when a draw that would trigger
a captureStream-frame to be captured.

Differential Revision: https://phabricator.services.mozilla.com/D136003
2022-01-24 15:31:14 +00:00
Andrew Osmond
e1214d7409 Bug 1750980 - Fix UAF for OffscreenCanvas after its associated HTMLCanvasElement is destroyed. r=gfx-reviewers,jrmuizel
OffscreenCanvasDisplayHelper needs its Destroy method called when
HTMLCanvasElement is destroyed. This was missed during the initial
implementation. It holds a weak/raw pointer to the HTMLCanvasElement it
is bound to, so if the element is destroyed, we need to clear our
reference to prevent any UAFs.

This would be a security bug if not for the fact that this feature is
still currently disabled behind a pref and has not shipped out to any
release yet.

Differential Revision: https://phabricator.services.mozilla.com/D136371
2022-01-19 15:36:06 +00:00
Kagami Sascha Rosylight
615d28f913 Bug 1748874 - Part 1: Mark the decl of HTMLCanvasElement::CallPrintCallback as CAN_RUN_SCRIPT r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D135400
2022-01-11 11:52:26 +00:00
Andrew Osmond
a3573dc4d1 Bug 1747476 - Fix resizing errors with OffscreenCanvas. r=gfx-reviewers,kvark,mstange
When we attempt to resize an OffscreenCanvas, or an HTMLCanvasElement
with transferControlToOffscreen caled on it, we need to ensure we throw
the right error, and a message that is clear to the user. We also need
to propogate size changes to the placeholder
HTMLCanvasElement/OffscreenCanvas, when the OffscreenCanvas object on
the worker thread has its size changed.

Differential Revision: https://phabricator.services.mozilla.com/D134637
2021-12-28 16:47:02 +00:00
Andrew Osmond
7682c47325 Bug 1747520 - Ensure that OffscreenCanvas invalidation is in a consistent state. r=gfx-reviewers,kvark
This patch ensures that our invalidation is more consistent and less
frequent. It no longer queues an invalidation for each draw call. It now
combines the parameter update (e.g. width, height, opacity) with an
invalidation to ensure the contents of the canvas are consistent with
the advertised properties. It also ensures that if an explicit commit
occurs, any pending commits are cancelled.

Differential Revision: https://phabricator.services.mozilla.com/D134655
2021-12-24 17:04:39 +00:00
Andrew Osmond
66ef3cb3c9 Bug 1564784 - Allow drawing with HTMLCanvasElement paired with an OffscreenCanvas. r=gfx-reviewers,kvark
When CanvasRenderingContext2d.drawImage, or createImageBitmap are
called with an HTMLCanvasElement with an OffscreenCanvas gotten through
transferControlToOffscreen, we do not snapshot the underlying
OffscreenCanvas. This patch makes it so we do.

There are WPT tests for this, but they only run for canvas 2d.

Differential Revision: https://phabricator.services.mozilla.com/D134078
2021-12-24 15:54:36 +00:00
Andrew Osmond
c9cd74e2dc Bug 1746095 - Avoid crashing when we get memory pressure events with OffscreenCanvas. r=jgilbert
We will implement this properly in bug 1746260, but for now, let's spare
users with OffscreenCanvas turned on, who have low memory, a content
process crash. Handling it is somewhat complicated because we need to
shuttle over the message to the worker.

Differential Revision: https://phabricator.services.mozilla.com/D133939
2021-12-15 21:21:39 +00:00
Andrew Osmond
878275c3b6 Bug 1736177 - Part 11. Plumb in OffscreenCanvasDisplayHelper. r=jgilbert
This patch integrates OffscreenCanvasDisplayHelper with
HTMLCanvasElement, OffscreenCanvas and nsDisplayCanvas to allow
asynchronous display of an OffscreenCanvas.

Differential Revision: https://phabricator.services.mozilla.com/D130787
2021-12-10 02:57:55 +00:00
Andrew Osmond
7cfa51a0e9 Bug 1736177 - Part 8. Remove unused visibility observer from HTMLCanvasElement. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D130784
2021-12-10 02:57:54 +00:00
Andrew Osmond
50db73c113 Bug 1736177 - Part 1. Rename CanvasRenderingContextHelper::GetContext to GetOrCreateContext. r=jgilbert
This patch contains no functional changes but sets us up for refactoring
in a later part in this series. It also helps silence a bunch of
compiler warnings.

Differential Revision: https://phabricator.services.mozilla.com/D130777
2021-12-10 02:57:51 +00:00
Csoregi Natalia
1c7cae16d7 Backed out 17 changesets (bug 1738971, bug 1736177) for bp-hybrid failures and others. CLOSED TREE
Backed out changeset 828633114de2 (bug 1736177)
Backed out changeset 5be8557c4721 (bug 1736177)
Backed out changeset 49f8b4205a46 (bug 1736177)
Backed out changeset 2610d4464ad5 (bug 1736177)
Backed out changeset 6d6c78c31c28 (bug 1736177)
Backed out changeset d55f1ee88bb9 (bug 1736177)
Backed out changeset bf588f8ffcf1 (bug 1736177)
Backed out changeset 86f6f6d86c6c (bug 1736177)
Backed out changeset f400c75c5829 (bug 1736177)
Backed out changeset 4a34124d5f4e (bug 1736177)
Backed out changeset 70aff7fcd001 (bug 1736177)
Backed out changeset db2347ee8147 (bug 1736177)
Backed out changeset 3dde5ddb65e5 (bug 1738971)
Backed out changeset 894ba6b7b68f (bug 1738971)
Backed out changeset dc4503052cf1 (bug 1738971)
Backed out changeset d9aef3e9797e (bug 1738971)
Backed out changeset 562a1e8e5ac3 (bug 1738971)
2021-12-10 01:13:23 +02:00
Andrew Osmond
8e0ebe8c37 Bug 1736177 - Part 11. Plumb in OffscreenCanvasDisplayHelper. r=jgilbert
This patch integrates OffscreenCanvasDisplayHelper with
HTMLCanvasElement, OffscreenCanvas and nsDisplayCanvas to allow
asynchronous display of an OffscreenCanvas.

Differential Revision: https://phabricator.services.mozilla.com/D130787
2021-12-09 19:25:28 +00:00
Andrew Osmond
8cd6585103 Bug 1736177 - Part 8. Remove unused visibility observer from HTMLCanvasElement. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D130784
2021-12-09 19:25:27 +00:00
Andrew Osmond
607a0ed901 Bug 1736177 - Part 1. Rename CanvasRenderingContextHelper::GetContext to GetOrCreateContext. r=jgilbert
This patch contains no functional changes but sets us up for refactoring
in a later part in this series. It also helps silence a bunch of
compiler warnings.

Differential Revision: https://phabricator.services.mozilla.com/D130777
2021-12-09 19:25:24 +00:00
Jeff Muizelaar
f76f41feb4 Bug 1736236 - Remove obsolete LayerManager.h. r=gfx-reviewers,lsalzman
This adds a bunch of #include "WindowRenderer.h" in places
that were getting it implicitly before.

Differential Revision: https://phabricator.services.mozilla.com/D128687
2021-10-17 23:00:47 +00:00
Tetsuharu Ohzeki
5edbcffacb Bug 1733971 - Make nsIFrame::InvalidateLayer() return void. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D127460
2021-10-04 22:17:23 +00:00
Andrew Osmond
3a98545701 Bug 1728903 - Remove plumbing for CanvasLayer and ImageLayer. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D124406
2021-09-18 11:44:51 +00:00
Iulian Moraru
d7a06601a0 Backed out changeset 089962073382 (bug 1728903) for causing Bp-hybrid bustages on ImageBitmapRenderingContext.cpp. CLOSED TREE 2021-09-03 18:49:32 +03:00
Andrew Osmond
472ab1dfc3 Bug 1728903 - Remove plumbing for CanvasLayer and ImageLayer. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D124406
2021-09-03 12:52:05 +00:00
Noemi Erli
e5f5e8d032 Backed out changeset f12c6a6cd1a5 (bug 1728903) for causing build bustage in TestTextures.cpp CLOSED TREE 2021-09-03 05:16:59 +03:00
Andrew Osmond
4219d92daf Bug 1728903 - Remove plumbing for CanvasLayer and ImageLayer. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D124406
2021-09-03 01:48:17 +00:00
Matt Woodrow
8a447ade17 Bug 1724839 - Don't use BasicLayerManager for painting ImageBitmap <canvas> elements. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D122171
2021-08-10 03:38:40 +00:00
Matt Woodrow
912b7f8ef1 Bug 1721537 - Split out WindowRenderer base class from LayerManager. r=miko
Depends on D120439

Differential Revision: https://phabricator.services.mozilla.com/D120440
2021-07-22 22:58:57 +00:00
Emilio Cobos Álvarez
7f5364389c Bug 1700640 - Map width and height to aspect-ratio in <canvas>, <input type=image>, and <video>. r=boris
As per https://html.spec.whatwg.org/#attributes-for-embedded-content-and-images:

> The width and height attributes map to the aspect-ratio property on
> img, canvas, and video elements, and input elements with a type
> attribute in the Image Button state.

See https://github.com/whatwg/html/issues/6527 for the parsing issue
with canvas and zero. For now allow both behaviors in the tests.

We also remove the width-and-height-map-to-aspect-ratio pref, as it is
true everywhere and has been for a while.

Differential Revision: https://phabricator.services.mozilla.com/D109618
2021-03-24 22:18:55 +00:00
Gerald Squelart
2416d881e2 Bug 1691589 - Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Differential Revision: https://phabricator.services.mozilla.com/D104588
2021-02-16 04:44:19 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Sylvestre Ledru
fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila
964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Andreas Pehrson
8b6f27b098 Bug 1582294 - Implement MediaStreamTrackSource::HasAlpha for HTMLCanvasElement sources. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D92900
2020-10-16 19:20:20 +00:00
Kris Taeleman
6a63bb1d8a Bug 1656987 - Only cast and call CanvasLayer::Update() if the layer is a CanvasLayer. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D92160
2020-10-02 18:45:14 +00:00
Markus Stange
41c70bcd59 Bug 1666617 - Add an observer description argument to AddRefreshObserver. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D91082
2020-09-25 02:36:29 +00:00
Simon Giesecke
de7bab0f06 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82325
2020-09-23 15:17:15 +00:00
Emilio Cobos Álvarez
e3494dcc5d Bug 1663140 - Don't block on window.print() if there are print callbacks. r=smaug
Not really a fan of this, but I can't think of a better alternative
really... Ideas welcome :)

The main issue is that in bug 1662975 we made window.print() not return
until the user has closed the print / print preview dialog (as it is
needed for some use cases). This matches other browsers, too.

We use an nsAutoSyncOperation here, in order not to violate the
run-to-completion invariants, which turns off micro-tasks, timers,
etc... However we'd still want promises inside mozPrintCallback to
resolve and such, which is a bit contradictory. It is really awkward to
have this behavior change based on whether we have a print callback...

Differential Revision: https://phabricator.services.mozilla.com/D89298
2020-09-06 10:57:48 +00:00
Narcis Beleuzu
ace5336843 Backed out changeset 45df7207f4e1 (bug 1663140) for bc failure on browser_window_print.js 2020-09-06 05:43:56 +03:00
Emilio Cobos Álvarez
8e44628eb6 Bug 1663140 - Don't block on window.print() if there are print callbacks. r=smaug
Not really a fan of this, but I can't think of a better alternative
really... Ideas welcome :)

The main issue is that in bug 1662975 we made window.print() not return
until the user has closed the print / print preview dialog (as it is
needed for some use cases). This matches other browsers, too.

We use an nsAutoSyncOperation here, in order not to violate the
run-to-completion invariants, which turns off micro-tasks, timers,
etc... However we'd still want promises inside mozPrintCallback to
resolve and such, which is a bit contradictory. It is really awkward to
have this behavior change based on whether we have a print callback...

Differential Revision: https://phabricator.services.mozilla.com/D89298
2020-09-06 00:54:08 +00:00
Hiroyuki Ikezoe
ab59636fca Bug 1663053 - Bail out from HTMLCanvasElement::CallPrintCallback is mPrintState has already destroyed. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D89264
2020-09-03 22:53:40 +00:00
Emilio Cobos Álvarez
97ac4d259f Bug 1662456 - Remove HTMLCanvasElement::CountContexts and related code. r=nical
Canvas only has one context, and that assumption is pretty baked into
the code, so having an API that pretends otherwise is silly.

Differential Revision: https://phabricator.services.mozilla.com/D88990
2020-09-02 14:20:50 +00:00
Simon Giesecke
cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Kris Maglione
ca3f481eb2 Bug 1646481: Stop walking in-process-parent-document chain in RegisterFrameCaptureListener. r=emilio
GetRootPresContext essentially does this anyway.

Differential Revision: https://phabricator.services.mozilla.com/D80066
2020-06-30 20:46:41 +00:00
Jeff Gilbert
a97c615de2 Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-15 18:25:55 +00:00
Dorel Luca
255f146f14 Backed out 7 changesets (bug 1632249) for Gtest perma chrash in [@ mozilla::BlockingResourceBase::CheckAcquire()]. CLOSED TREE
Backed out changeset 4ff99aab3ee8 (bug 1632249)
Backed out changeset d5b7fe789001 (bug 1632249)
Backed out changeset 64fbb616a0f3 (bug 1632249)
Backed out changeset 6f19f43e0a0b (bug 1632249)
Backed out changeset 073302d26c5e (bug 1632249)
Backed out changeset 7c94d37c446e (bug 1632249)
Backed out changeset 204b899f436d (bug 1632249)
2020-06-11 19:44:20 +03:00
Jeff Gilbert
cf3c8fedea Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-11 06:37:35 +00:00
Mihai Alexandru Michis
59ad7ed333 Backed out 6 changesets (bug 1632249) for causing bustages in CanvasRenderingContext2D.cpp
CLOSED TREE

Backed out changeset c93972b05d4f (bug 1632249)
Backed out changeset 04f5127c85d5 (bug 1632249)
Backed out changeset b15d91e64a25 (bug 1632249)
Backed out changeset 71ad2ed8e9ba (bug 1632249)
Backed out changeset 6e9a89ead3a5 (bug 1632249)
Backed out changeset dd00e2da3a0f (bug 1632249)
2020-06-11 02:43:35 +03:00
Jeff Gilbert
9b09e54345 Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-10 22:21:02 +00:00
Dorel Luca
7289b66d6f Backed out 4 changesets (bug 1632249) for Build bustages and mda failures. CLOSED TREE
Backed out changeset cdaa8a4e9e36 (bug 1632249)
Backed out changeset 9ff26bcc580c (bug 1632249)
Backed out changeset 16d84439756f (bug 1632249)
Backed out changeset bbfe23c61add (bug 1632249)
2020-06-09 03:19:48 +03:00
Jeff Gilbert
de6377896c Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-08 20:34:15 +00:00
Simon Giesecke
13502cf27c Bug 1642991 - Use RemoveElementsBy where easily possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78055
2020-06-08 09:01:48 +00:00
sanketh
d66dab82a7 Bug 1621433 - In RFP mode, turn canvas image extraction into a random 'poison pill' for fingerprinters r=tjr,jrmuizel
In RFP mode, canvas image extraction leads to an all-white image, replace that
with a random (sample 32 bytes of randomness and fill the buffer with that)
'poison pill'. This helps defeat naive fingerprinters by producing a random
image on every try. This feature is toggled using a new, default on, pref
`privacy.resistFingerprinting.randomDataOnCanvasExtract`.

Updated `browser_canvas_fingerprinting_resistance.js` to test this new feature
as well.

Updates and replaces D66308.

Differential Revision: https://phabricator.services.mozilla.com/D72716
2020-05-14 13:56:55 +00:00