Bug 1238337. If the intrinsic size of the image hasn't changed then we don't need to do a new predictive image decode. r=mats

nsImageFrame::OnSizeAvailable will update the intrinsic ratio and ask for a reflow. Then nsImageFrame::NotifyNewCurrentRequest will be called when the image is finished loading. It previously would do a predictive decode if the intrinsic size hadn't changed.

This was a mistake in http://hg.mozilla.org/mozilla-central/rev/146f1bea4147 (bug 1151359).

OnSizeAvailable has this structure:

  if (intrinsicSizeChanged && gotInitialReflow) {
    if (!sizeConstrained) {
      requestReflow();
    }
  }

NotifyNewCurrentRequest has this structure:

  if (gotInitialReflow) {
    if (!sizeConstrained && intrinsicSizeChanged) {
      requestReflow();
    }
  }

Bug 1151359 added a predictive decode in a new else branch to both inner if statements. The meaning of this is obviously quite different.
This commit is contained in:
Timothy Nikkel 2016-02-02 16:51:52 -06:00
Родитель 6bfd7f95ab
Коммит a1bd256618
1 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -681,7 +681,8 @@ nsImageFrame::NotifyNewCurrentRequest(imgIRequest *aRequest,
}
if (mState & IMAGE_GOTINITIALREFLOW) { // do nothing if we haven't gotten the initial reflow yet
if (!(mState & IMAGE_SIZECONSTRAINED) && intrinsicSizeChanged) {
if (intrinsicSizeChanged) {
if (!(mState & IMAGE_SIZECONSTRAINED)) {
nsIPresShell *presShell = PresContext()->GetPresShell();
if (presShell) {
presShell->FrameNeedsReflow(this, nsIPresShell::eStyleChange,
@ -692,6 +693,7 @@ nsImageFrame::NotifyNewCurrentRequest(imgIRequest *aRequest,
// so we're ready to request a decode.
MaybeDecodeForPredictedSize();
}
}
// Update border+content to account for image change
InvalidateFrame();
}