Commit Graph

2964 Commits

Author SHA1 Message Date
Timothy Nikkel
e90c0fb0e0 Bug 1419608. Make SurfaceKey::SVGContext return a reference instead of a copy. r=decoder
MozReview-Commit-ID: Cuee03ukO0k

--HG--
extra : histedit_source : 6c94447e6864ae2a637c723461b707720ec9effc
2017-11-22 01:41:35 +01:00
Samael Wang
326d642792 Bug 1406253 - Part 1: Rename imgIRequest.currentURI to finalURI to prevent confusion. r=bz
The "current URL" in the spec:
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc
maps to imgIRequest.URI, not currentURI.

Rename imgIRequest.currentURI to finalURI to prevent such confusion.

MozReview-Commit-ID: CjBh2V4z8K9

--HG--
extra : rebase_source : 01277d16ef12845e12cc846f9dd4a21ceeca283b
2017-11-13 16:31:24 +08:00
Valentin Gosu
d2d8524673 Bug 1415205 - Add nsIURIMutator impls for all objects implementing nsIURI r=bagder
This also changes URIUtils.cpp:DeserializeURI() to use the mutator to instantiate new URIs, instead of using their default constructor.

MozReview-Commit-ID: JQOvIquuQAP

--HG--
extra : rebase_source : e146624c5ae423f7f69a738aaaafaa55dd0940d9
2017-11-20 17:11:30 +01:00
Noemi Erli
e90c67896c Backed out 3 changesets (bug 1406253)for build bustage in dom/base/nsCopySupport.cpp r=backout on a CLOSED TREE
Backed out changeset 284f3cc2880c (bug 1406253)
Backed out changeset aecb3d509a39 (bug 1406253)
Backed out changeset 9ce01198e8a1 (bug 1406253)
2017-11-20 13:34:29 +02:00
Samael Wang
a22b447e84 Bug 1406253 - Part 1: Rename imgIRequest.currentURI to finalURI to prevent confusion. r=bz
The "current URL" in the spec:
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-currentsrc
maps to imgIRequest.URI, not currentURI.

Rename imgIRequest.currentURI to finalURI to prevent such confusion.

MozReview-Commit-ID: CjBh2V4z8K9

--HG--
extra : rebase_source : d3047aed22f116ff9a74099b646a84e597388673
2017-11-13 16:31:24 +08:00
Andrew Osmond
19e321eb9e Bug 1366097 - Part 8. Improve image memory reports to include SVG context information. r=tnikkel 2017-11-17 14:08:52 -05:00
Andrew Osmond
2278b250dc Bug 1366097 - Part 7. VectorImage::Show should delegate to ImageResource::NotifyDrawingObservers. r=tnikkel 2017-11-17 14:08:52 -05:00
Andrew Osmond
b257c6e489 Bug 1366097 - Part 6. Restrict use of SVGImageContext in VectorImage::GetImageContainerAtSize to permitted URIs. r=tnikkel 2017-11-17 14:08:52 -05:00
Andrew Osmond
114b8069b3 Bug 1366097 - Part 5. Add an SVGImageContext parameter to imgIContainer::GetImageContainerAtSize. r=tnikkel 2017-11-17 14:08:52 -05:00
Andrew Osmond
c6bd7fcdf9 Bug 1366097 - Part 4. Mark VectorImage as surface as shared when used outside an image layer. r=tnikkel
This is important because it ensures we release the shared memory handle
(although not the data itself) for the underlying surface buffer when it
turns out we will probably never need to share it. If we do need to
share the surface data with the GPU process, it will reallocate a handle
if necessary, and close it when it is finished. On some platforms we
only have a finite number of handles, so if we don't need them, we
should close them.
2017-11-17 14:08:52 -05:00
Andrew Osmond
c94d4d3f78 Bug 1366097 - Part 3. Implement VectorImage::GetImageContainerAtSize and VectorImage::IsImageContainerAvailableAtSize. r=tnikkel
This is largely trivial because the meat of the implementation is
located in ImageResource and we already added GetFrameInternal.
Interestingly VectorImage::IsUnlocked does not actually check if the
image is locked, but instead only checks for animation consumers. This
is consistent with its historical behavior on when to issue an unlocked
draw event.

Note that we do not implement the original GetImageContainer and
IsImageContainerAvailable APIs. This is because the former does not
accept an SVG context and it would be best to discourage its use in old
code lest we get incorrect/unexpected results.
2017-11-17 14:08:52 -05:00
Andrew Osmond
e4a6ddc142 Bug 1366097 - Part 2. Implement VectorImage::GetFrameInternal as required by ImageResource for image containers. r=tnikkel
No functional change aside from the implementation from
VectorImage::GetFrameAtSize being repurposed for GetFrameInternal and
returning an additional error code with the surface.
2017-11-17 14:08:52 -05:00
Andrew Osmond
3f61fdab9e Bug 1366097 - Part 1. VectorImage::GetFrameAtSize should not create a DrawTarget if using cached surface. r=tnikkel
Creating a DrawTarget can be an expensive operation. This is especially
true in this case because checking for a cached already decoded version
of the VectorImage is expected to be fast. Currently VectorImage::Draw
is the typical path to render these images, but in the future, getting
the frames directly or indirectly (through an ImageContainer) will
become more common.
2017-11-17 14:08:51 -05:00
Andrew Osmond
d9067a16fe Bug 1368776 - Part 17. Fix how we could reuse an incorrect image container instead of creating a new one. r=me 2017-11-17 07:54:50 -05:00
Andrew Osmond
5418665096 Bug 1368776 - Part 16. Ensure we more consistently pass the suggested size from SurfaceCache::LookupBestMatch. r=tnikkel
The suggested size is useful in more situations now that
GetImageContainerImpl requires it. It should be passed whenever we have
it available.
2017-11-17 06:45:28 -05:00
Andrew Osmond
0cfb7cd99e Bug 1368776 - Part 15. Cache flags passed to ImageResource::GetImageContainerImpl for consistency. r=tnikkel
When FLAG_HIGH_QUALITY_SCALING is used, we need to make sure we continue
using that flag when we update the container. We should also use it for
comparing whether or not an existing image container is equivalent.
2017-11-17 06:45:28 -05:00
Andrew Osmond
addb00a059 Bug 1368776 - Part 14. Make ImageResource::GetImageContainerImpl handle differing suggested sizes. r=tnikkel 2017-11-17 06:45:27 -05:00
Andrew Osmond
a1d47a973a Bug 1368776 - Part 13. Make ImageResource::GetFrameInternal also return the suggested size for the lookup. r=tnikkel 2017-11-17 06:45:27 -05:00
Andrew Osmond
2463bc3782 Bug 1368776 - Part 12. Add gtests for RasterImage::GetImageContainerAtSize. r=tnikkel 2017-11-17 06:45:27 -05:00
Andrew Osmond
8fa46b5099 Bug 1368776 - Part 11. Add ImageResource::GetImageContainerSize to determine the appropriate size for a requested container. r=tnikkel 2017-11-17 06:45:26 -05:00
Andrew Osmond
a594e125e0 Bug 1368776 - Part 10. Implement RasterImage::IsImageContainerAvailableAtSize and GetImageContainerAtSize. r=tnikkel 2017-11-17 06:45:26 -05:00
Andrew Osmond
d6a6987766 Bug 1368776 - Part 9. Expose getting an image container at a given size. r=tnikkel
This adds IsImageContainerAvailableAtSize and GetImageContainerAtSize to
the imgIContainer interface, as well as stubbing it for all of the
classes which implement it. The real implementations will follow for the
more complicated classes (RasterImage, VectorImage).
2017-11-17 06:45:26 -05:00
Andrew Osmond
5f57793c54 Bug 1368776 - Part 8. Fix ImageResource::GetImageContainerImpl assert to allow high quality scaling. r=tnikkel 2017-11-17 06:45:26 -05:00
Andrew Osmond
a01ef792f6 Bug 1368776 - Part 7. Remove size parameter from ImageResource::UpdateImageContainer. r=tnikkel 2017-11-17 06:45:25 -05:00
Andrew Osmond
634060f444 Bug 1368776 - Part 6. Add support for multiple differently-sized image containers for downscale-on-decode. r=tnikkel
Exposure of this functionality comes in a later patch in the set.
Experimental testing with WebRender and image layers enabled suggests
most of the time we are not using more than one image container per
image, hence why mImageContainers has room for one container without a
malloc.
2017-11-17 06:45:25 -05:00
Andrew Osmond
53cb3aad32 Bug 1368776 - Part 5. Refactor ImageResource::GetCurrentImage to reduce code duplication. r=tnikkel 2017-11-17 06:45:25 -05:00
Andrew Osmond
8dcbfe2c0b Bug 1368776 - Part 4. Handle all potential DrawResult values to make Image::GetImageContainerImpl more generic. r=tnikkel
RasterImage::GetCurrentImage can only return a subset of the DrawResult
values, and the original RasterImage::GetImageContainer implementation
relied upon this behavior. Now we handle them all to ensure that when
other image implementations reuse it, they may return any valid
DrawResult and get the expected results.
2017-11-17 06:45:25 -05:00
Andrew Osmond
0b4ae23fa1 Bug 1368776 - Part 3. Move RasterImage::GetCurrentImage to ImageResource. r=tnikkel
As part of the move, we add a IntSize parameter to
ImageResource::GetCurrentImage. This is because we don't have access to
the image's size (yet) from ImageResource, but additionally because we
will need this anyways when we support multiple image containers at
different sizes.
2017-11-17 06:45:24 -05:00
Andrew Osmond
6367b2724a Bug 1368776 - Part 2. Move RasterImage::GetImageContainer and UpdateImageContainer implementations to ImageResource. r=tnikkel
The only change to the moved implementation is that we no longer have
access to RasterImage::mHasSize and RasterImage::mSize. Thus we rely
upon imgIContainer::IsImageContainerAvailable to perform these checks.
2017-11-17 06:45:24 -05:00
Andrew Osmond
b43a2010d4 Bug 1368776 - Part 1. Move RasterImage's ImageContainer state to ImageResource. r=tnikkel
This state will eventually be used by VectorImage when it supports image
containers. For now, it is harmless beyond using slightly more memory
for SVGs.
2017-11-17 06:45:23 -05:00
Andrew Osmond
37395798ee Bug 1368776 - Part 0. Move RasterImage's NotifyDrawingObservers to ImageResource. r=tnikkel 2017-11-17 06:45:23 -05:00
Brindusan Cristian
d0a4ab96a0 Merge inbound to mozilla-central r=merge a=merge 2017-11-16 00:24:15 +02:00
Valentin Gosu
a77a5282f4 Bug 1416343 - Mark URI interfaces as [builtinclass] r=bagder
MozReview-Commit-ID: 4T0uCkHP1a6

--HG--
extra : rebase_source : fa720f35df16985bcd929a98aeeaf9fbc759c1e6
2017-11-15 13:34:23 +01:00
Margareta Eliza Balazs
3edf7872fb Backed out changeset cfe4b1e6be9b (bug 1416343) for ESlint failing in modules/test/browser/browser_SitePermissions_tab_urls.js:38:14 r=backout on a CLOSED TREE 2017-11-15 13:46:07 +02:00
Valentin Gosu
ba207f8c8c Bug 1416343 - Mark URI interfaces as [builtinclass] r=bagder
MozReview-Commit-ID: 4T0uCkHP1a6

--HG--
extra : rebase_source : 89c283360bc0b30aad34641b4cdce8f5c49615b3
2017-11-13 20:18:46 +01:00
Andrew Osmond
a230c70963 Bug 1416774 - Ensure that imgRequestProxy::CancelAndForgetObserver removes itself from the cache validator. r=tnikkel
An imgRequestProxy may defer notifications when it needs to block on an
imgCacheValidator. It may also be cancelled before the validator has
completed its operation, but before this change, we did not remove the
request from the set of proxies, imgCacheValidator::mProxies. When the
deferral was completed, it would assert to ensure each proxy was still
expecting a deferral before issuing the notifications. Cancelling a
request can actually reset that state, which means we fail the assert.

Failing the assert is actually harmless; in release we suffer no
negative consequences as a result of this sequence of events. Now we
just remove the proxy from the validator set to avoid asserting.
2017-11-14 12:02:59 -05:00
Kartikaya Gupta
00ef028ed3 Bug 1416267 - Update gfxContext matrix functions to avoid flip-flopping between float and double matrices. r=jrmuizel
The core of this change is in gfxContext.*:
- change gfxContext::CurrentMatrix() and gfxContext::SetMatrix() to
  return and take a Matrix respectively, instead of converting to
  and from a gfxMatrix (which uses doubles). These functions therefore
  will now match the native representation of the transform in gfxContext.
- add two new functions CurrentMatrixDouble() and SetMatrixDouble() that
  do what the old CurrentMatrix() and SetMatrix() used to do, i.e.
  convert between the float matrix and the double matrix.

The rest of the change is just updating the call sites to avoid round-
tripping between floats and doubles where possible. Call sites that are
hard to fix are migrated to the new XXXDouble functions which preserves
the existing behaviour.

MozReview-Commit-ID: 5sbBpLUus3U
2017-11-10 21:14:09 -05:00
Jonathan Watt
7c5d39a558 Bug 1417021 - Fix various non-unified build errors in imagelib. r=aosmond 2017-10-24 23:22:55 +01:00
David Anderson
9575a22267 Remove trivial calls to DataSourceSurface::Stride. (bug 1405390 part 3, r=bas)
--HG--
extra : rebase_source : 7700599ef497a2abadc7970af5ea26b48061966e
2017-11-09 00:43:30 -08:00
David Anderson
32e1584385 Remove easily-removed cases of DataSourceSurface::GetData(). (bug 1405390 part 1, r=bas)
--HG--
extra : rebase_source : cc0d8001240efb530daa9845bc126e5026682340
2017-11-09 00:43:29 -08:00
Mats Palmgren
1c2b8c222e Bug 1414666 part 1 - Add nsIFrame::PresShell() for convenient access to the shell. r=emilio
MozReview-Commit-ID: 8FPTPKWyVtY
2017-11-09 03:00:48 +01:00
Andrew Osmond
1068bf07ec Bug 1415085 - Make CachedSurface::GetSurfaceKey return a reference instead of a copy. r=decoder 2017-11-07 08:10:01 -05:00
Andrew Osmond
a6578c65f6 Bug 1414762 - imgRequestProxy::CancelAndForgetObserver should always force load group removal to dispatch. r=tnikkel
imgRequestProxy::CancelAndForgetObserver was intended to always dispatch
any load group removals due to reentracy conflicts with the callers.
However in bug 1404422 the fact that imgRequest::RemoveProxy can
indirectly trigger a load group removal through completing an
incompleted request.
2017-11-07 06:42:47 -05:00
Ursula Sarracini
df4f8ff8c2 Bug 1373258 - Convert PageThumbsProtocol.js to PageThumbsProtocol.cpp r=adw
MozReview-Commit-ID: tdNee2EPdV

--HG--
extra : rebase_source : 436ef616173f22b6d8386b8e7b3f482f1acabca4
2017-06-05 10:04:06 -04:00
Andrew Osmond
95ee2e55dc Bug 1404422 - Part 4. Remove imgIOnloadBlocker and related from tree as redundant. r=tnikkel 2017-11-01 06:59:10 -04:00
Andrew Osmond
3e3c2a5bca Bug 1404422 - Part 3. Disable triggering imgIOnloadBlocker block/unblock events. r=tnikkel 2017-11-01 06:59:10 -04:00
Andrew Osmond
c57b395b1a Bug 1404422 - Part 1d. Ensure imgRequestProxy::PerformClone consistently adds the clone to the expected load group. r=tnikkel
Historically imgRequestProxy::PerformClone would only add the cloned
request to the (original proxy's) document's load group if the request
was still being validated. Now it adds the cloned request to the given
document's load group before requesting the notifications, unless the
request has already been completed. We ensure that any removals from
the load group occur outside the current execution context.

Legacy listeners may use imgRequestProxy::SyncClone to request
notifications on the image state. Ideally they would not, but they do
not work as expected with the asynchronous notifications all new callers
must use. While in theory this would suggest their code is re-entrant,
not all of it is. In particular we need to be sensitive about when we
remove a request from a load group.
2017-11-01 06:59:10 -04:00
Andrew Osmond
920629550f Bug 1404422 - Part 1c. Refactor how an imgRequestProxy is added/removed from its load group. r=tnikkel
There should be no functional change here, but we rely upon the new
structure in the next patch in the series. This separates out the
notions of removing a request from the load group (which is always
final, and must be executed outside of synchronous calls from the owner
of the imgRequestProxy) and wanting to readd a request to the load group
as a background request (for multipart images).

The most important addition is mForceDispatchLoadGroup which if true
when imgRequestProxy::RemoveFromLoadGroup is called, will dispatch the
removal from the load group instead of executing it inline. This ensures
safety for any callers (e.g. to CancelAndForgetObserver) as above.
2017-11-01 06:59:10 -04:00
Andrew Osmond
b8832c3e1b Bug 1404422 - Part 1b. Make imgRequestProxy::SetLoadGroup return an error if changing the load group. r=tnikkel
imgRequestProxy::SetLoadGroup did not have a predictable effect and
it appears to be unused. It is somewhat complicated to support given
we must be sensitive about what context we execute removing the
request from the original load group.
2017-11-01 06:59:09 -04:00
Andrew Osmond
b62d4a8ea4 Bug 1404422 - Part 1a. Ensure imgLoader::LoadImage(WithChannel) adds the request to the expected load group. r=tnikkel
imgLoader::LoadImage now asserts in debug builds that the load group
given as a parameter matches that of the given document (if any). If
they mismatch, then we won't be blocking the document's load event as we
expect with the future removal of the imgIOnloadBlocker.

imgLoader::LoadImageWithChannel never actually added the request to the
load group at all, unless it was done as part of the validator. Now it
will consistently add the request to the channel's load group as
expected. Additionally it also asserts in debug builds that the
channel's load group matches that of the given document, as in
LoadImage.
2017-11-01 06:59:09 -04:00