Bug 1429979 Part 3 - Use nsClassHashtable::Get() which directly returns the value.
MozReview-Commit-ID: 7yVbVxMqEde
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -428,18 +428,18 @@ ImageLoader::OnSizeAvailable(imgIRequest
{
nsPresContext* presContext = GetPresContext();
if (!presContext) {
return NS_OK;
}
aImage->SetAnimationMode(presContext->ImageAnimationMode());
- FrameSet* frameSet = nullptr;
- if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+ FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+ if (!frameSet) {
return NS_OK;
}
for (nsIFrame* frame : *frameSet) {
if (frame->StyleVisibility()->IsVisible()) {
frame->MarkNeedsDisplayItemRebuild();
}
}
@@ -449,18 +449,18 @@ ImageLoader::OnSizeAvailable(imgIRequest
nsresult
ImageLoader::OnImageIsAnimated(imgIRequest* aRequest)
{
if (!mDocument) {
return NS_OK;
}
- FrameSet* frameSet = nullptr;
- if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+ FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+ if (!frameSet) {
return NS_OK;
}
// Register with the refresh driver now that we are aware that
// we are animated.
nsPresContext* presContext = GetPresContext();
if (presContext) {
nsLayoutUtils::RegisterImageRequest(presContext,
@@ -473,45 +473,41 @@ ImageLoader::OnImageIsAnimated(imgIReque
nsresult
ImageLoader::OnFrameComplete(imgIRequest* aRequest)
{
if (!mDocument || mInClone) {
return NS_OK;
}
- FrameSet* frameSet = nullptr;
- if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+ FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+ if (!frameSet) {
return NS_OK;
}
- NS_ASSERTION(frameSet, "This should never be null!");
-
// Since we just finished decoding a frame, we always want to paint, in case
// we're now able to paint an image that we couldn't paint before (and hence
// that we don't have retained data for).
DoRedraw(frameSet, /* aForcePaint = */ true);
return NS_OK;
}
nsresult
ImageLoader::OnFrameUpdate(imgIRequest* aRequest)
{
if (!mDocument || mInClone) {
return NS_OK;
}
- FrameSet* frameSet = nullptr;
- if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+ FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+ if (!frameSet) {
return NS_OK;
}
- NS_ASSERTION(frameSet, "This should never be null!");
-
DoRedraw(frameSet, /* aForcePaint = */ false);
return NS_OK;
}
void
ImageLoader::FlushUseCounters()
{