mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1186780: Replace EnumerateRead with new iterators in ImageLoader. r=dbaron
This commit is contained in:
parent
e9b74b560d
commit
d40f03c413
@ -18,33 +18,6 @@
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
/* static */ PLDHashOperator
|
||||
ImageLoader::SetAnimationModeEnumerator(nsISupports* aKey, FrameSet* aValue,
|
||||
void* aClosure)
|
||||
{
|
||||
imgIRequest* request = static_cast<imgIRequest*>(aKey);
|
||||
|
||||
uint16_t* mode = static_cast<uint16_t*>(aClosure);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<imgIRequest> debugRequest = do_QueryInterface(aKey);
|
||||
NS_ASSERTION(debugRequest == request, "This is bad");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<imgIContainer> container;
|
||||
request->GetImage(getter_AddRefs(container));
|
||||
if (!container) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
// This can fail if the image is in error, and we don't care.
|
||||
container->SetAnimationMode(*mode);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
ImageLoader::DropDocumentReference()
|
||||
{
|
||||
@ -226,36 +199,47 @@ ImageLoader::SetAnimationMode(uint16_t aMode)
|
||||
aMode == imgIContainer::kLoopOnceAnimMode,
|
||||
"Wrong Animation Mode is being set!");
|
||||
|
||||
mRequestToFrameMap.EnumerateRead(SetAnimationModeEnumerator, &aMode);
|
||||
}
|
||||
|
||||
/* static */ PLDHashOperator
|
||||
ImageLoader::DeregisterRequestEnumerator(nsISupports* aKey, FrameSet* aValue,
|
||||
void* aClosure)
|
||||
{
|
||||
imgIRequest* request = static_cast<imgIRequest*>(aKey);
|
||||
for (auto iter = mRequestToFrameMap.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto request = static_cast<imgIRequest*>(iter.Key());
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<imgIRequest> debugRequest = do_QueryInterface(aKey);
|
||||
NS_ASSERTION(debugRequest == request, "This is bad");
|
||||
}
|
||||
{
|
||||
nsCOMPtr<imgIRequest> debugRequest = do_QueryInterface(key);
|
||||
NS_ASSERTION(debugRequest == request, "This is bad");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsPresContext* presContext = static_cast<nsPresContext*>(aClosure);
|
||||
if (presContext) {
|
||||
nsLayoutUtils::DeregisterImageRequest(presContext,
|
||||
request,
|
||||
nullptr);
|
||||
}
|
||||
nsCOMPtr<imgIContainer> container;
|
||||
request->GetImage(getter_AddRefs(container));
|
||||
if (!container) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
// This can fail if the image is in error, and we don't care.
|
||||
container->SetAnimationMode(aMode);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ImageLoader::ClearFrames(nsPresContext* aPresContext)
|
||||
{
|
||||
mRequestToFrameMap.EnumerateRead(DeregisterRequestEnumerator, aPresContext);
|
||||
for (auto iter = mRequestToFrameMap.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto request = static_cast<imgIRequest*>(iter.Key());
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<imgIRequest> debugRequest = do_QueryInterface(key);
|
||||
NS_ASSERTION(debugRequest == request, "This is bad");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aPresContext) {
|
||||
nsLayoutUtils::DeregisterImageRequest(aPresContext,
|
||||
request,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
mRequestToFrameMap.Clear();
|
||||
mFrameToRequestMap.Clear();
|
||||
}
|
||||
|
@ -93,14 +93,6 @@ private:
|
||||
|
||||
void DoRedraw(FrameSet* aFrameSet, bool aForcePaint);
|
||||
|
||||
static PLDHashOperator
|
||||
SetAnimationModeEnumerator(nsISupports* aKey, FrameSet* aValue,
|
||||
void* aClosure);
|
||||
|
||||
static PLDHashOperator
|
||||
DeregisterRequestEnumerator(nsISupports* aKey, FrameSet* aValue,
|
||||
void* aClosure);
|
||||
|
||||
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
||||
nsresult OnFrameComplete(imgIRequest* aRequest);
|
||||
nsresult OnImageIsAnimated(imgIRequest* aRequest);
|
||||
|
Loading…
Reference in New Issue
Block a user