зеркало из https://github.com/mozilla/gecko-dev.git
Bug 847223. Part 8. Use a bool to track if FrameCreate has been called. r=mats
This commit is contained in:
Родитель
1233198e23
Коммит
3d82406836
|
@ -89,6 +89,7 @@ nsImageLoadingContent::nsImageLoadingContent()
|
|||
mStateChangerDepth(0),
|
||||
mCurrentRequestRegistered(false),
|
||||
mPendingRequestRegistered(false),
|
||||
mFrameCreateCalled(false),
|
||||
mVisibleCount(0)
|
||||
{
|
||||
if (!nsContentUtils::GetImgLoaderForChannel(nullptr)) {
|
||||
|
@ -422,15 +423,15 @@ nsImageLoadingContent::FrameCreated(nsIFrame* aFrame)
|
|||
{
|
||||
NS_ASSERTION(aFrame, "aFrame is null");
|
||||
|
||||
mFrameCreateCalled = true;
|
||||
|
||||
if (aFrame->HasAnyStateBits(NS_FRAME_IN_POPUP)) {
|
||||
// Assume all images in popups are visible.
|
||||
IncrementVisibleCount();
|
||||
}
|
||||
|
||||
// We pass the SKIP_FRAME_CHECK flag to TrackImage here because our primary
|
||||
// frame pointer hasn't been setup yet when this is caled.
|
||||
TrackImage(mCurrentRequest, SKIP_FRAME_CHECK);
|
||||
TrackImage(mPendingRequest, SKIP_FRAME_CHECK);
|
||||
TrackImage(mCurrentRequest);
|
||||
TrackImage(mPendingRequest);
|
||||
|
||||
// We need to make sure that our image request is registered, if it should
|
||||
// be registered.
|
||||
|
@ -451,6 +452,8 @@ nsImageLoadingContent::FrameDestroyed(nsIFrame* aFrame)
|
|||
{
|
||||
NS_ASSERTION(aFrame, "aFrame is null");
|
||||
|
||||
mFrameCreateCalled = false;
|
||||
|
||||
// We need to make sure that our image request is deregistered.
|
||||
if (mCurrentRequest) {
|
||||
nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(),
|
||||
|
@ -1277,7 +1280,7 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
}
|
||||
|
||||
void
|
||||
nsImageLoadingContent::TrackImage(imgIRequest* aImage, uint32_t aFlags /* = 0 */)
|
||||
nsImageLoadingContent::TrackImage(imgIRequest* aImage)
|
||||
{
|
||||
if (!aImage)
|
||||
return;
|
||||
|
@ -1286,7 +1289,7 @@ nsImageLoadingContent::TrackImage(imgIRequest* aImage, uint32_t aFlags /* = 0 */
|
|||
"Why haven't we heard of this request?");
|
||||
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc && ((aFlags & SKIP_FRAME_CHECK) || GetOurPrimaryFrame()) &&
|
||||
if (doc && (mFrameCreateCalled || GetOurPrimaryFrame()) &&
|
||||
(mVisibleCount > 0)) {
|
||||
if (aImage == mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
|
||||
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
|
||||
|
|
|
@ -328,16 +328,10 @@ protected:
|
|||
*
|
||||
* No-op if aImage is null.
|
||||
*
|
||||
* SKIP_FRAME_CHECK passed to TrackImage means we skip the check if we have a
|
||||
* frame, there is only one valid use of this: when calling from FrameCreated.
|
||||
*
|
||||
* REQUEST_DISCARD passed to UntrackImage means we request the discard of the
|
||||
* decoded data of the image.
|
||||
*/
|
||||
enum {
|
||||
SKIP_FRAME_CHECK = 0x1
|
||||
};
|
||||
void TrackImage(imgIRequest* aImage, uint32_t aFlags = 0);
|
||||
void TrackImage(imgIRequest* aImage);
|
||||
enum {
|
||||
REQUEST_DISCARD = 0x1
|
||||
};
|
||||
|
@ -419,6 +413,9 @@ private:
|
|||
bool mCurrentRequestRegistered;
|
||||
bool mPendingRequestRegistered;
|
||||
|
||||
// True when FrameCreate has been called but FrameDestroy has not.
|
||||
bool mFrameCreateCalled;
|
||||
|
||||
uint32_t mVisibleCount;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче