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

4618 Коммитов

Автор SHA1 Сообщение Дата
Timothy Nikkel 2a8ea92054 Bug 1846055. Fix color management of grayscale avif files. r=gfx-reviewers,lsalzman
Color management is usually handled in the SurfacePipe, but SurfacePipe is RGB(A) only, and qcms can only operator on grayscale images in grayscale format, not RGB(A). So we must handle the qcms operation in the decoder. This is the same as how the png decoder handles this same situation. One additional wrinkle is that gfx::ConvertYCbCrToRGB32 only outputs RGB even for grayscale input data so we have to create an intermediate grayscale copy of the data for qcms to work on.

Recording command lines here that were used to create the test in case it needs to be modified or extended in the future.

Convert png to grayscale or grayscale + alpha

ffmpeg -i file.png -pix_fmt gray file-gray.png
ffmpeg -i file.png -pix_fmt ya8 file-gray.png

Extract icc profile from png

exiftool -icc_profile -b -w icc file.png

Add icc profile to png

exiftool "-icc_profile<=profile.icc" file.png

Encode avif using provided icc profile in file

avifenc --icc profile.icc input.png output.avif

Differential Revision: https://phabricator.services.mozilla.com/D220101
2024-09-09 09:39:12 +00:00
Timothy Nikkel ae74e50baf Bug 1915543. Do color management on avifs on non-premultiplied alpha image data. r=gfx-reviewers,lsalzman
ConvertYCbCrToRGB32 was doing the premultiplied conversion, which happens before the surface pipe, which is where color management happens.

Differential Revision: https://phabricator.services.mozilla.com/D220517
2024-09-07 21:43:05 +00:00
Alexandra Borovova 536eac2c33 Bug 1884876 - Add notification about stylesheets loaded from CSSLoader cache. r=necko-reviewers,emilio,arai
Differential Revision: https://phabricator.services.mozilla.com/D220571
2024-09-06 14:47:23 +00:00
Timothy Nikkel 2398448e0b Bug 1910297. Handle repaint propagation to the root if the root is a table. r=layout-reviewers,emilio
The background image is associate to the table frame, but the table wrapper frame is the primary frame, thus IsPrimaryFrameOfRootOrBodyElement returns false and we don't propagate to the root when we should. So I changed IsPrimaryFrameOfRootOrBodyElement to handle this case and renamed it. I checked the other root element frame types, only table frames had this issue.

Differential Revision: https://phabricator.services.mozilla.com/D217923
2024-08-09 10:25:21 +00:00
Timothy Nikkel d76e069654 Bug 1910211. Error-out if an avif file specifies color space options that are not supported instead of asserting. r=gfx-reviewers,nical
The matrix coefficients field in the file is Identity, indicating this is RGB data, but the pixel layout field is "half width and half height". We don't support subsampling with RGB data, so we hit this

https://searchfox.org/mozilla-central/rev/fa55b33a4b56f392bc5a0c7616e0dfe055112cb5/gfx/ycbcr/yuv_convert.cpp#144

which makes ConvertYCbCrToRGB32 fail.

Differential Revision: https://phabricator.services.mozilla.com/D217906
2024-08-07 12:33:34 +00:00
Tooru Fujisawa 1abe447481 Bug 1907009 - Part 1: Add CacheExpirationTime type. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D217957
2024-08-06 05:38:23 +00:00
Emilio Cobos Álvarez e1ad6294bf Bug 1910698 - Remove nsIScriptError.sourceLine. r=smaug,devtools-reviewers,webdriver-reviewers,necko-reviewers,nchevobbe,kershaw,jdescottes,credential-management-reviewers,dimi
Afaict the source lines are not exposed anywhere in the UI.

Differential Revision: https://phabricator.services.mozilla.com/D218115
2024-08-01 17:12:48 +00:00
Andrew Osmond 874ce61a83 Bug 1901078 - Implement promise based anonymous image decoder. r=tnikkel
This bypasses any caching used on the display pipeline and is
intended to be used by layers that want asynchronous decoding
that fits well into the MozPromise style.

This also fixes an issue with the frame count metadata decoder in the
GIF decoder. The code only began being used with this patch, and the WPT
exposed an overflow bug caused by not clearing nsGIFDecoder2::mColormap
and nsGIFDecoder2::mColormapSize.

Differential Revision: https://phabricator.services.mozilla.com/D212833
2024-07-24 03:16:16 +00:00
Noemi Erli 8feec14eb7 Backed out 3 changesets (bug 1901078, bug 1749048) for causing bustages in ImageDecoder.cpp
Backed out changeset 40ba80bacf94 (bug 1749048)
Backed out changeset 6aa4e953e922 (bug 1749048)
Backed out changeset 3fce5dcfc9c6 (bug 1901078)
2024-07-24 03:48:51 +03:00
Sean Feng 57bdf0a7d7 Bug 1874756 - Simplify and reduce the number of hashtable lookups for LCP implementation r=emilio
Two changes are introduced:

* LCP has a hashtable called `ContentIdentifiersForLCP` to store
(element, image) pairs to avoid processing the same pair multiple
times. Instead of using weak pointers for elements, this patch changes
it to use raw pointers for better performance. Also, makes the
hashtable to use element alone as the key, so that the entry
can be quickly removed when nsINode::LastRelease is called.

* Another change to make imgRequestProxy stores the
timestamps for LCP, so we can create LCP entries when the size
is available, instead of creating one temporarily and updating it
later. This allows us to eliminate a hashtable called
`mImageLCPEntryMap` for better performance.

Differential Revision: https://phabricator.services.mozilla.com/D214315
2024-07-23 20:42:40 +00:00
Andrew Osmond ced3221cfb Bug 1901078 - Implement promise based anonymous image decoder. r=tnikkel
This bypasses any caching used on the display pipeline and is
intended to be used by layers that want asynchronous decoding
that fits well into the MozPromise style.

This also fixes an issue with the frame count metadata decoder in the
GIF decoder. The code only began being used with this patch, and the WPT
exposed an overflow bug caused by not clearing nsGIFDecoder2::mColormap
and nsGIFDecoder2::mColormapSize.

Differential Revision: https://phabricator.services.mozilla.com/D212833
2024-07-23 19:32:47 +00:00
Stanca Serban b3c85ac11d Backed out 3 changesets (bug 1901078, bug 1749048) for causing interface related mochitests failures. CLOSED TREE
Backed out changeset 0c7ce075a24f (bug 1749048)
Backed out changeset 0b609b8fcff3 (bug 1749048)
Backed out changeset 18ce2638e512 (bug 1901078)
2024-07-23 21:50:08 +03:00
Andrew Osmond 5cbcce5595 Bug 1901078 - Implement promise based anonymous image decoder. r=tnikkel
This bypasses any caching used on the display pipeline and is
intended to be used by layers that want asynchronous decoding
that fits well into the MozPromise style.

This also fixes an issue with the frame count metadata decoder in the
GIF decoder. The code only began being used with this patch, and the WPT
exposed an overflow bug caused by not clearing nsGIFDecoder2::mColormap
and nsGIFDecoder2::mColormapSize.

Differential Revision: https://phabricator.services.mozilla.com/D212833
2024-07-23 16:25:35 +00:00
Chun-Min Chang 6b09aea19f Bug 1907121 - Move YCbCrUtils API assertions to caller side r=gfx-reviewers,nical
Initially, the YCbCrUtils and yuv_convert APIs asserted success
internally. With recent changes, those assertions were removed. This
patch reintroduces those assertions on the caller's side instead, except
the `ConvertToRGBA` in ImageConversion.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D216191
2024-07-18 21:02:33 +00:00
Andrew Osmond d70025073e Bug 1901077 - Switch GIF decoder to yield new frames at terminating block. r=tnikkel
Originally we would yield a new frame when the next frame was available,
or the decoder finished. This is problematic for some WPTs used by
WebCodecs image decoding. There should be no functional difference
besides yielding a new frame slightly earlier.

Differential Revision: https://phabricator.services.mozilla.com/D212832
2024-07-17 11:39:13 +00:00
Sylvestre Ledru 45030f6970 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio,necko-reviewers,geckoview-reviewers,application-update-reviewers,media-playback-reviewers,devtools-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,migration-reviewers,padenot,mconley,nchevobbe,kershaw,gstoll,mstange,bytesized,m_kato
This new version of clang 17 also slightly changed the formatting.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D215914
2024-07-17 11:15:31 +00:00
Chun-Min Chang 62a44d9679 Bug 1906720 - Simplify nsAVIFDecoder by using ConvertYCbCrToRGB32 exclusively r=gfx-reviewers,nical
This patch simplifies the code path in `nsAVIFDecoder`. Previously,
`nsAVIFDecoder` relied on both `ConvertYCbCrToRGB` and
`ConvertYCbCrToRGB32` to convert YUV data to BGRX or BGRA, depending on
the presence of an alpha channel. With recent changes, `nsAVIFDecoder`
can now use `ConvertYCbCrToRGB32` exclusively to streamline the
conversion process.

Depends on D215985

Differential Revision: https://phabricator.services.mozilla.com/D216228
2024-07-12 21:45:19 +00:00
Chun-Min Chang b7d05ecda0 Bug 1906720 - Replace ConvertYCbCrAToARGB with ConvertYCbCrToRGB32 in nsAVIFDecoder r=gfx-reviewers,nical
This patch replaces `ConvertYCbCrAToARGB` with `ConvertYCbCrToRGB32` in
`nsAVIFDecoder`, as image scaling is not required.

Differential Revision: https://phabricator.services.mozilla.com/D215985
2024-07-12 21:45:18 +00:00
Ting-Yu Lin 9ad26d34a9 Bug 1906716 - Remove MaybeIntSize that is used by only one caller. r=gfx-reviewers,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D215947
2024-07-08 20:38:03 +00:00
Nika Layzell 19d2b08163 Bug 1728331 - Part 5: Respect AppType in ImageCacheKey, r=emilio
This attribute is not used in Gecko, but exists for use by other
applications. Specifically, the APP_TYPE_EDITOR type is given permission
to load privileged images as tested by browser_docshell_type_editor.js.
Before these changes, that test passed because the docshell was loaded
in a different process, so the cache was empty when each load occurred,
but after my changes the process ends up being re-used, so the image
cache bypasses this check.

This changes the image cache key to also include the app type
information so that it will be compared before re-using the entry.

Differential Revision: https://phabricator.services.mozilla.com/D126557
2024-06-24 23:19:29 +00:00
Andrew Osmond fa360dba1b Bug 1901076 - Part 2. Expose frame count variant of metadata decoders. r=tnikkel
It is useful/necessary for WebCodecs image decoding support to be able
to calculate a frame count for the encoded image without actually
decoding every frame. It needs to be able to provide results without the
complete buffer as well.

Differential Revision: https://phabricator.services.mozilla.com/D212831
2024-06-24 22:44:30 +00:00
Andrew Osmond cd691461e5 Bug 1901076 - Part 1. Include animated images loop count in metadata decoding results. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D212830
2024-06-24 22:44:30 +00:00
Sandor Molnar 5b0ee75cfc Backed out 2 changesets (bug 1901076) for causing assertion failures @ image/RasterImage.cpp CLOSED TREE
Backed out changeset de52938146cd (bug 1901076)
Backed out changeset 79fece25d231 (bug 1901076)
2024-06-24 23:19:52 +03:00
Andrew Osmond 6fa0ded86a Bug 1901076 - Part 2. Expose frame count variant of metadata decoders. r=tnikkel
It is useful/necessary for WebCodecs image decoding support to be able
to calculate a frame count for the encoded image without actually
decoding every frame. It needs to be able to provide results without the
complete buffer as well.

Differential Revision: https://phabricator.services.mozilla.com/D212831
2024-06-24 17:59:49 +00:00
Andrew Osmond ae67966c25 Bug 1901076 - Part 1. Include animated images loop count in metadata decoding results. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D212830
2024-06-24 17:59:48 +00:00
Tom Schuster 6613ec7689 Bug 1904004 - Use OriginAttributes::IsPrivateBrowsing instead of open coding PBM checks. r=timhuang,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,necko-reviewers,kershaw,dom-storage-reviewers,janv,canaltinova,dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214532
2024-06-24 11:06:18 +00:00
Aron Cseh a18d79db16 Backed out 9 changesets (bug 1901851, bug 1728331) for causing remote worker crashes. a=backout
Backed out changeset 30bbda0eb197 (bug 1728331)
Backed out changeset dabd7d6836c8 (bug 1728331)
Backed out changeset 9e04f49c926e (bug 1728331)
Backed out changeset 779ac735736c (bug 1728331)
Backed out changeset 1d413fe340a0 (bug 1728331)
Backed out changeset 15608efcbeb6 (bug 1901851)
Backed out changeset f711bbec11b2 (bug 1901851)
Backed out changeset 8bb1d267d08f (bug 1901851)
Backed out changeset b29282956a04 (bug 1901851)
2024-06-22 00:52:24 +03:00
Nika Layzell 1f14a3324e Bug 1728331 - Part 5: Respect AppType in ImageCacheKey, r=emilio
This attribute is not used in Gecko, but exists for use by other
applications. Specifically, the APP_TYPE_EDITOR type is given permission
to load privileged images as tested by browser_docshell_type_editor.js.
Before these changes, that test passed because the docshell was loaded
in a different process, so the cache was empty when each load occurred,
but after my changes the process ends up being re-used, so the image
cache bypasses this check.

This changes the image cache key to also include the app type
information so that it will be compared before re-using the entry.

Differential Revision: https://phabricator.services.mozilla.com/D126557
2024-06-20 19:24:52 +00:00
Timothy Nikkel b7a308a6b2 Bug 1899180. If a channel is not nsIPrivateBrowsingChannel and has no load context, use the private browsing field from it's origin attributes. r=necko-reviewers,anti-tracking-reviewers,valentin
If the channel is not a nsIPrivateBrowsingChannel, and it also has no load context (eg inside svg images) then we will over write a non-zero mPrivateBrowsingId on the OriginAttributes of the channel with 0, making NS_UsePrivateBrowsing return false for the channel.

Differential Revision: https://phabricator.services.mozilla.com/D212083
2024-06-12 10:24:22 +00:00
Ryan VanderMeulen 2ab1103c1f Bug 1898606 - Add crashtest. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D212149
2024-06-08 16:42:55 +00:00
Joel Maher 1af5989f0e Bug 1901251 - Adjust moz-icon-blank reftest expectations for new graphics card on windows. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D212931
2024-06-08 11:33:29 +00:00
Nika Layzell 855d5761c0 Bug 196078 - Part 2: Support displaying arbitrary text/* MIME types as plain text, r=smaug,necko-reviewers,valentin
This patch refactors how we check for text formats when deciding how to handle
resources, such that more text MIME types will be rendered in-browser, rather
than downloaded.

This change requires us to move more away from using the Gecko-Content-Viewers
category in the category manager for this decision, as we need to handle an
unlimited number of MIME types behind the scenes.

Support for Gecko-Content-Viewers was left in for both the in-tree use for
application/http-index-format and dynamically determining whether image/avif
and image/jxl are supported, as well as for the message/rfc822 type used by
Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D212078
2024-06-05 00:05:58 +00:00
Norisz Fay f31e183290 Backed out 3 changesets (bug 1718673, bug 196078) for causing wpt failures on report-frame-ancestors-with-x-frame-options.sub.html CLOSED TREE
Backed out changeset 6a54aa5039e7 (bug 196078)
Backed out changeset 0582d2fa1401 (bug 196078)
Backed out changeset d8d9a0fe366b (bug 1718673)
2024-06-01 03:33:07 +03:00
Nika Layzell 58ee355a1b Bug 196078 - Part 2: Support displaying arbitrary text/* MIME types as plain text, r=smaug,necko-reviewers,valentin
This patch refactors how we check for text formats when deciding how to handle
resources, such that more text MIME types will be rendered in-browser, rather
than downloaded.

This change requires us to move more away from using the Gecko-Content-Viewers
category in the category manager for this decision, as we need to handle an
unlimited number of MIME types behind the scenes.

Support for Gecko-Content-Viewers was left in for both the in-tree use for
application/http-index-format and dynamically determining whether image/avif
and image/jxl are supported, as well as for the message/rfc822 type used by
Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D212078
2024-05-31 17:30:23 +00:00
Timothy Nikkel 0220614e37 Bug 1892643. Allow checking for shutdown in the image decode pool after the decode pool has been cleared. r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D208086
2024-05-25 09:45:37 +00:00
Timothy Nikkel 8b707bc1b5 Bug 1894284. Give image gtests a threadsafe way to wait for decodes in the decode thread pool to finish. r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D209510
2024-05-22 03:29:18 +00:00
Timothy Nikkel 21823adb7d Bug 1885209. Sanity check pixel format of internal icon type images. r=gfx-reviewers,nical
The page has

  <link rel="shortcut icon" type="image/x-icon" href="data:image/icon;base64,__png_data__">

When the Favicon service tries to decode that is passes "image/icon" as the mimetype to choose the decoder type and so we try to decode it as our internal icon format (not a format used in the wild, only used internal to get pass around icon data we retrieved from the OS). This passes in an invalid format type and hits the assert. In a non-debug build we fail to create the surface pipe later when we can't find a swizzle function. We only ever create these icon files with formats R8G8B8A8, OS_RGBA, or B8G8R8A8. The favicon still gets displayed so the favicon service must be trying something more complicated if that fails.

In the normal content image loading path we prefer to sniff the content type from the image data and if that fails fall back to the specified content type. So the test had be careful not to look like png (or any other) image format so that we actually tried to decode it as an icon.

Differential Revision: https://phabricator.services.mozilla.com/D204732
2024-05-21 00:41:56 +00:00
Valentin Gosu 85d2c1bf9d Bug 1711622 - Update tests r=necko-reviewers,devtools-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D203115
2024-05-20 15:35:29 +00:00
Iulian Moraru 7af8c65261 Backed out 2 changesets (bug 1711622) for causing reftest failures on accept-image-catchall.html. CLOSED TREE
Backed out changeset 877d9c37605a (bug 1711622)
Backed out changeset c315e89b6e4b (bug 1711622)
2024-05-20 16:59:04 +03:00
Valentin Gosu d4e1eb0d58 Bug 1711622 - Update tests r=necko-reviewers,devtools-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D203115
2024-05-20 11:53:58 +00:00
Timothy Nikkel 767a362808 Bug 1895211. Get the image in imgRequest::OnStopRequest after calling OnDataAvailable because that might create the image. r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D209522
2024-05-17 23:26:18 +00:00
Tooru Fujisawa a127747b14 Bug 1893402 - Part 2: Use minimum cache expiration time in image cache. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D208979
2024-05-17 11:20:59 +00:00
Tamas Szentpeteri 86dcf9e3dc Backed out 2 changesets (bug 1893402) for causing mochitest failures regarding nsGlobalWindowInner. CLOSED TREE
Backed out changeset e909b94c1280 (bug 1893402)
Backed out changeset beef636e1562 (bug 1893402)
2024-05-17 00:16:25 +03:00
Tooru Fujisawa 64388946b4 Bug 1893402 - Part 2: Use minimum cache expiration time in image cache. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D208979
2024-05-16 15:40:41 +00:00
Timothy Nikkel 446eaaa15c Bug 1897055. Assert SVGDocumentWrapper::DestroyViewer is called on main thread. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D210603
2024-05-16 08:22:31 +00:00
Valentin Gosu 7cdfe9baad Bug 1784496 - The necko consumers should use the priority's incremental flag r=necko-reviewers,kershaw
This patch sets the incremental flag on document and image channels

Differential Revision: https://phabricator.services.mozilla.com/D209235
2024-05-15 08:18:42 +00:00
Lee Salzman 65c2a6379d Bug 1890216 - Fix Skia API usage in Gecko for m125 update. r=aosmond
A number of public APIs in Skia have changed since the update to m125,
so various places in Gecko need to be updated to track it.

Differential Revision: https://phabricator.services.mozilla.com/D209821
2024-05-15 01:57:52 +00:00
Iulian Moraru fcee835d59 Backed out 4 changesets (bug 1890216) for causing multiple new permafailures. CLOSED TREE
Backed out changeset 31ffc16da37b (bug 1890216)
Backed out changeset 9da95cf34386 (bug 1890216)
Backed out changeset 9e684b8096fc (bug 1890216)
Backed out changeset 9014c3f367eb (bug 1890216)
2024-05-10 19:01:50 +03:00
Lee Salzman 69890c6a53 Bug 1890216 - Fix Skia API usage in Gecko for m125 update. r=aosmond
A number of public APIs in Skia have changed since the update to m125,
so various places in Gecko need to be updated to track it.

Differential Revision: https://phabricator.services.mozilla.com/D209821
2024-05-10 03:49:34 +00:00
Ryan VanderMeulen 0e07c8c08e Bug 1806946 - Skip GTests which fail when run under TSAN. r=profiler-reviewers,dom-storage-reviewers,tnikkel,xpcom-reviewers,ipc-reviewers,mccr8,janv,webrtc-reviewers,pehrsons,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D209175
2024-05-02 13:09:07 +00:00