Bug 1686220 - Invalidate paint on image load, not on size available. r=tnikkel
Invalidating paint on size available is too soon (we can't decode the image anyways). Bullet frames didn't use to do this and just reflowed. Scheduling a paint causes us to do layout way too soon when there's more important stuff to do for the load of the page. This is a big improvement on load times and visual metrics in a variety of websites: https://treeherder.mozilla.org/perfherder/compare?originalProject=try&originalRevision=3e012dad47b7f4b22741faa46153e940d079a260&newProject=try&newRevision=ce14456c07318eb3fc8d94d9cff9f41d9d122752&framework=13 Differential Revision: https://phabricator.services.mozilla.com/D104065
This commit is contained in:
@@ -31,8 +31,7 @@
|
|||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla::css {
|
||||||
namespace css {
|
|
||||||
|
|
||||||
// This is a singleton observer which looks in the `GlobalRequestTable` to look
|
// This is a singleton observer which looks in the `GlobalRequestTable` to look
|
||||||
// at which loaders to notify.
|
// at which loaders to notify.
|
||||||
@@ -719,9 +718,6 @@ void ImageLoader::OnSizeAvailable(imgIRequest* aRequest,
|
|||||||
fwf.mFrame->PresShell()->FrameNeedsReflow(
|
fwf.mFrame->PresShell()->FrameNeedsReflow(
|
||||||
fwf.mFrame, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
|
fwf.mFrame, IntrinsicDirty::StyleChange, NS_FRAME_IS_DIRTY);
|
||||||
}
|
}
|
||||||
if (fwf.mFrame->StyleVisibility()->IsVisible()) {
|
|
||||||
fwf.mFrame->SchedulePaint();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -794,23 +790,28 @@ void ImageLoader::OnLoadComplete(imgIRequest* aRequest) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t status = 0;
|
||||||
|
if (NS_FAILED(aRequest->GetImageStatus(&status))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
|
FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
|
||||||
if (!frameSet) {
|
if (!frameSet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if aRequest has an error state. If it does, we need to unblock
|
for (FrameWithFlags& fwf : *frameSet) {
|
||||||
// Document onload for all the frames associated with this request that
|
if (status & imgIRequest::STATUS_ERROR) {
|
||||||
// have blocked onload. This is what happens in a CORS mode violation, and
|
// Check if aRequest has an error state. If it does, we need to unblock
|
||||||
// may happen during other network events.
|
// Document onload for all the frames associated with this request that
|
||||||
uint32_t status = 0;
|
// have blocked onload. This is what happens in a CORS mode violation, and
|
||||||
if (NS_SUCCEEDED(aRequest->GetImageStatus(&status)) &&
|
// may happen during other network events.
|
||||||
status & imgIRequest::STATUS_ERROR) {
|
|
||||||
for (FrameWithFlags& fwf : *frameSet) {
|
|
||||||
UnblockOnloadIfNeeded(fwf);
|
UnblockOnloadIfNeeded(fwf);
|
||||||
}
|
}
|
||||||
|
if (fwf.mFrame->StyleVisibility()->IsVisible()) {
|
||||||
|
fwf.mFrame->SchedulePaint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace css
|
} // namespace mozilla::css
|
||||||
} // namespace mozilla
|
|
||||||
|
|||||||
Reference in New Issue
Block a user