Commit Graph

715 Commits

Author SHA1 Message Date
Andrew Osmond
6a5f7ab2d3 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
6fcdaed88b 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
a5a30fa776 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
Jonathan Kew
2f1b0578c6 Bug 1725297 - Remove expiring font telemetry probes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D124051
2021-08-31 13:48:51 +00:00
Andi-Bogdan Postelnicu
ac52a11dcd Bug 1519636 - Reformat recent changes to the Google coding style. r=emilio
Updated with clang-format version 12.0.1 (taskcluster-dNZqCRqWRTqa6cZxPKxh7Q)

Differential Revision: https://phabricator.services.mozilla.com/D122814
2021-08-23 09:30:23 +00:00
Jonathan Kew
b887626dcf Bug 1725940 - patch 2 - Move nsFontCache from the device context to the prescontext. r=emilio
To look up/instantiate platform fonts based on CSS font properties, we create a gfxFontGroup from an nsFont and other attributes; this is currently cached in an nsFontCache attached to the nsDeviceContext.

However, this assumes that the mapping to platform fonts will be the same for all documents using the given device context. In a world where visibility of platform fonts to the page may be restricted, and may depend on the individual document (e.g. if the user disables tracking protection for a particular site), the mapping represented by nsFontCache may vary, and determining how to resolve a given font request will need access to the requesting document in order to know what visibility it is allowed.

To support this, this patch moves the nsFontCache from nsDeviceContext to nsPresContext. In itself, this should cause no visible change in behavior, but it provides a basis for the patches that will follow in bug 1715501.

It's likely that this will have some effects on individual performance tests, depending on the exact content and sequencing of page loads, because of changed caching behavior. E.g. having a per-presContext cache may sometimes mean that we no longer take advantage of a cached gfxFontGroup that a previously-loaded page created; but on the other hand the caches will tend to be smaller and have faster lookups.

My testing so far suggests that we will see some apparent regressions, alongside some improvements, but that overall there should be little change. I'd like to get this change landed separately, before any of the actual font-visibility behavior changes, so that we can more clearly see and isolate any unexpected effects.

Differential Revision: https://phabricator.services.mozilla.com/D122715
2021-08-16 13:58:03 +00:00
Lee Salzman
3f183e49c5 Bug 1719886 - Support translated no-repeat patterns in canvas FillRect. r=jrmuizel
This is a bandaid designed to cope with a subset of the encountered transforms that
may be applied to a pattern inside FillRect. The existing code did not consider the
transform at all that might be applied to a pattern when it tried to manually clip
the geometry to a no-repeat pattern.

This manual clipping only seems to occur in FillRect, whereas no-repeat patterns
are not properly handled anywhere else in canvas entry-points. To fix this more
generally requires a clamp-to-transparent tile mode (like Skia's decal or Cairo's
none) which we can't currently rely upon with our D2D support. However, that is
much beyond the scope of this temporary workaround.

Differential Revision: https://phabricator.services.mozilla.com/D122186
2021-08-10 17:37:45 +00:00
Emilio Cobos Álvarez
6c9d03dd32 Bug 1723921 - Cleanup nsComputedDOMStyle and related APIs. r=layout-reviewers,jfkthame
This will make implementing the new behavior behind a pref
really straight-forward, and is generally nicer.

Depends on D121858

Differential Revision: https://phabricator.services.mozilla.com/D121705
2021-08-07 09:47:15 +00:00
Jan de Mooij
1279a55a8f Bug 1716622 - Limit ImageData typed array to 2 GB. r=edgar
After we enabled support for large ArrayBuffers on 64-bit platforms, we could
also create larger ImageData objects. WebIDL bindings check for large ArrayBuffer{View}s
but not when they're wrapped in an ImageData.

It seems safest to limit ImageData arrays to the old 2 GB for now until we need larger
buffers.

Differential Revision: https://phabricator.services.mozilla.com/D121595
2021-08-06 14:23:24 +00:00
Kagami Sascha Rosylight
a00f02f0fc Bug 1723050 - Part 6: Replace typedef by using in dom/canvas/ r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D121298
2021-07-30 15:30:52 +00:00
Matt Woodrow
8964031845 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
Matt Woodrow
4df1e6d64a Bug 1721537 - Simplify nsIWidget::GetLayerManager by removing unused parameters. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D120439
2021-07-22 22:58:57 +00:00
Tooru Fujisawa
0986662ce6 Bug 1708448 - Move property and element functions into js/public/PropertyAndElement.h. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D119619
2021-07-13 11:52:42 +00:00
Emilio Cobos Álvarez
7f88046de7 Bug 1717381 - Deal with Uint8ClampedArray::Init failure in canvas code. r=smaug
See bug 1716641 comment 4 for a way this can happen.

I don't know what the best way to add a test for this is / whether it's
worth adding one?

Differential Revision: https://phabricator.services.mozilla.com/D118307
2021-06-21 10:00:26 +00:00
Emilio Cobos Álvarez
8b7d1120ed Bug 1716045 - Unify font-family storage. r=mats,jfkthame
This changes font-family storage to reuse the rust types, removing a
bunch of code while at it. This allows us to, for example, use a single
static font family for -moz-bullet and clone it, rather than creating a
lot of expensive copies.

Differential Revision: https://phabricator.services.mozilla.com/D118011
2021-06-18 19:35:50 +00:00
Sebastian Hengst
13941c2fc8 Backed out changeset 4ab352d967d9 (Bug 1701760) for causing flashes duing animations (bug 1708989). r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D114938
2021-06-01 17:31:12 +00:00
Emilio Cobos Álvarez
23241fdd3c Bug 1629381 - CanvasRenderingContext2D.drawImage shouldn't throw for e.g <video> if there's no valid surface to draw. r=sotaro
As per spec see comment.

Differential Revision: https://phabricator.services.mozilla.com/D103157
2021-05-25 10:39:51 +00:00
Emilio Cobos Álvarez
5fd1a4c829 Bug 1709622 - Apply EXIF resolution to SurfaceFromElement. r=tnikkel,jrmuizel,jgilbert
And make sure we return the surface of the right size for canvas, which
makes that assumption in a bunch of places.

Depends on D114686

Differential Revision: https://phabricator.services.mozilla.com/D114687
2021-05-10 23:39:05 +00:00
Emilio Cobos Álvarez
4992150e26 Bug 1709577 - Remove CORS_* constants from imgIRequest, use CORSMode instead. r=tnikkel
These don't have the same value, and is a bit confusing.

Differential Revision: https://phabricator.services.mozilla.com/D114352
2021-05-05 15:23:25 +00:00
Bob Owen
28fac9d8af Bug 1695725 p2: Guard against a failure to create sErrorTarget in CanvasRenderingContext2D. r=lsalzman
Depends on D112963

Differential Revision: https://phabricator.services.mozilla.com/D112964
2021-04-21 16:48:12 +00:00
Jeff Muizelaar
e0554f9bec Bug 1701760. Request sRGB images when drawing an image in Canvas. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D110331
2021-03-31 13:33:07 +00:00
Jonathan Kew
b6982c762e Bug 1699835 - Check that references in cached fontGroup match current presContext. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D109612
2021-03-30 16:02:24 +00:00
Bob Owen
53ec889d4e Bug 1697344 p3: Don't hold the GradientStops object on CanvasGradient. r=jrmuizel
In the DrawTargetRecording case we create new GradientStopsRecording each time
and holding onto them in the content process can mean they take a very large
amount of memory in the GPU process, if a script deliberately creates lots of
unique stops.
In the non-recording case then the GradientStops are cached in the content
process anyway.

Differential Revision: https://phabricator.services.mozilla.com/D109792
2021-03-29 12:12:21 +00:00
Tomislav Jovanovic
92e6f0ec90 Bug 1696976 - Log a deprecation warning for extension use of canvas drawWindow r=baku,rpl
Differential Revision: https://phabricator.services.mozilla.com/D107582
2021-03-15 12:30:54 +00:00
Mihai Alexandru Michis
184d105f57 Backed out 3 changesets (bug 1629381) for causing failures in test_eme_canvas_blocked.html
CLOSED TREE

Backed out changeset 12ee10496a34 (bug 1629381)
Backed out changeset b0eba102423a (bug 1629381)
Backed out changeset 383fec2e815c (bug 1629381)
2021-01-29 03:18:25 +02:00
Emilio Cobos Álvarez
7ea26136cf Bug 1629381 - CanvasRenderingContext2D.drawImage shouldn't throw for e.g <video> if there's no valid surface to draw. r=sotaro
As per spec see comment.

Differential Revision: https://phabricator.services.mozilla.com/D103157
2021-01-28 22:20:05 +00:00
Butkovits Atila
0162493c2a Backed out changeset ab82c7e299f4 (bug 1629381) for causing failures on test_eme_canvas_blocked.html. 2021-01-28 07:09:15 +02:00
Emilio Cobos Álvarez
a01e9c1b3f Bug 1629381 - CanvasRenderingContext2D.drawImage shouldn't throw for e.g <video> if there's no valid surface to draw. r=sotaro
As per spec see comment.

Differential Revision: https://phabricator.services.mozilla.com/D103157
2021-01-27 23:55:11 +00:00
Butkovits Atila
339aca29f3 Backed out changeset d9b7bed96428 (bug 1629381) for causing failures on test_reset_src.html. CLOSED TREE 2021-01-28 00:28:11 +02:00
Emilio Cobos Álvarez
7970bcb267 Bug 1629381 - CanvasRenderingContext2D.drawImage shouldn't throw for e.g <video> if there's no valid surface to draw. r=sotaro
As per spec see comment.

Differential Revision: https://phabricator.services.mozilla.com/D103157
2021-01-27 20:09:25 +00:00
Emilio Cobos Álvarez
36fa4e2008 Bug 1684711 - Fix canvas ImageData signatures to match the spec. r=nical
Spec: https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createimagedata (and friends)

See https://github.com/whatwg/html/issues/6262 about [EnforceRange],
which isn't technically on the spec but matches all browsers' behavior.

This simplifies a bit the code, moving some conversions to WebIDL, fixes
a few WPT tests, and should throw better error messages too.

Differential Revision: https://phabricator.services.mozilla.com/D100608
2021-01-04 17:48:32 +00:00
Aryan Agal
29e533a9dd Bug 1684689 - Check for 0 size after clamping in CanvasRenderingContext2D.createImageData r=emilio
Shifted the zero-check after width and height are clamped to int32_t. Fixes the use case where width and height are floats > 0 but < 1. These values are clamped to 0, but no error is thrown, as opposed to the desired behavior. Deleted corresponding test ini file, since it is now expected to PASS.

Now also fixes a test that started failing and checked something against the spec, (credit to @emilio)

Differential Revision: https://phabricator.services.mozilla.com/D100597
2021-01-03 20:58:32 +00:00
Butkovits Atila
82482df013 Backed out 2 changesets (bug 1684689) for causing damp failures. CLOSED TREE
Backed out changeset f70abb51ec6d (bug 1684689)
Backed out changeset 636bed8f02dc (bug 1684689)
2021-01-03 03:45:02 +02:00
Aryan Agal
cfdc06a7e0 Bug 1684689 - Check for 0 size after clamping in CanvasRenderingContext2D.createImageData r=emilio
Shifted the zero-check after width and height are clamped to int32_t. Fixes the
use case where width and height are floats > 0 but < 1. These values are clamped
to 0, but no error is thrown, as opposed to the desired behavior. Deleted
corresponding test ini file, since it is now expected to PASS.

Differential Revision: https://phabricator.services.mozilla.com/D100597
2021-01-02 16:26:07 +00:00
Aryan Agal
f593fcd6ca Bug 1627014 - Implement CanvasRenderingContext2D.createConicGradient r=emilio
Added an option to use ConicGradient API as a preference and removed the
corresponding expected FAILing test, over @ntim's implementation.

Differential Revision: https://phabricator.services.mozilla.com/D100554
2021-01-01 01:50:52 +00:00
Emilio Cobos Álvarez
fe2b95e111 Bug 1682003 - Avoid UTF-8 -> UTF-16 conversion during CSSOM serialization. r=heycam
This lifts a bunch of string conversions higher up the stack, but allows
us to make the servo code use utf-8 unconditionally, and seemed faster
in my benchmarking (see comment 0).

It should also make a bunch of attribute setters faster too (like
setting .cssText), now that we use UTF8String for them (we couldn't
because we couldn't specify different string types for the getter and
setters).

Differential Revision: https://phabricator.services.mozilla.com/D99590
2020-12-17 14:04:35 +00:00
Emilio Cobos Álvarez
cde8edbbc8 Bug 1681418 - Throw some more useful errors in canvas code. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D99265
2020-12-10 17:06:46 +00:00
Emilio Cobos Álvarez
c31bb1447e Bug 1681418 - Throw a more useful error when a broken image is passed to drawImage. r=nical
Much like we do for createPattern().

Differential Revision: https://phabricator.services.mozilla.com/D99260
2020-12-10 17:08:02 +00:00
Simon Giesecke
b1b15dcb38 Bug 1676357 - Avoid including Layers.h in header files. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D96538

Depends on D96537
2020-11-23 16:09:05 +00:00
Simon Giesecke
7ec2cfd4b4 Bug 1676356 - Avoid including PresShell.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D96534

Depends on D95184
2020-11-23 16:08:23 +00:00
Simon Giesecke
eae3689379 Bug 1673931 - Avoid including Document.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95046

Depends on D95045
2020-11-23 16:07:43 +00:00
coderboncuk
3e2d5b4708 Bug 1676299 - Removed the xMajor parameter from BaseMatrix::ScaleFactors() r=botond
Differential Revision: https://phabricator.services.mozilla.com/D97449
2020-11-18 18:53:01 +00:00
Jonathan Kew
ebfcc747c0 Bug 1674340 - Separate out language from gfxFontStyle and pass it separately to shaping processes that need it. r=lsalzman
This allows us to avoid instantiating separate gfxFont objects when content is tagged
with different 'lang' attributes, yet ends up using the same fonts (e.g. Wikipedia may
use a default font such as Arial for language names/links that are tagged with several
dozen different languages).

Differential Revision: https://phabricator.services.mozilla.com/D96978
2020-11-13 13:15:39 +00:00
Sylvestre Ledru
68b806d604 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
a6e7dcc53f Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
8f709b39e8 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
3badd5f5ca Bug 1631476 - Don't let CanvasRenderingContext2D::EnsureTarget lead to frame capture. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D93066
2020-10-19 20:26:55 +00:00
Tooru Fujisawa
2f07a4bbe2 Bug 1669090 - Do not throw when sw/sh of drawImage is zero. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D94418
2020-10-23 00:28:36 +00:00
smolnar
0b461b74e4 Backed out 2 changesets (bug 1631476) for causing reftest failures. CLOSED TREE
Backed out changeset 22d52c012fd0 (bug 1631476)
Backed out changeset ca9c321d4225 (bug 1631476)
2020-10-19 14:54:05 +03:00
Andreas Pehrson
5d8df1e542 Bug 1631476 - Don't let CanvasRenderingContext2D::EnsureTarget lead to frame capture. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D93066
2020-10-19 07:48:32 +00:00