Bug 1325297. Use the return value of StartDecoding to determine if an image finished decoding during painting. r=aosmond
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 19 Dec 2016 19:01:53 -0600
changeset 372178 95f052c8d95aba668a4d1caca16674f374fa1e59
parent 372177 3382306ba5c5903ca6f72f2dc6f3a9b7097ede49
child 372179 5220313f87ff01514458b17cf4bc5c7e8ac7a42e
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond
bugs1325297
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1325297. Use the return value of StartDecoding to determine if an image finished decoding during painting. r=aosmond This saves us from having to do another paint for an image that is already decoded.
layout/painting/nsCSSRendering.cpp
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -5283,23 +5283,23 @@ nsImageRenderer::PrepareImage()
 {
   if (mImage->IsEmpty()) {
     mPrepareResult = DrawResult::BAD_IMAGE;
     return false;
   }
 
   if (!mImage->IsComplete()) {
     // Make sure the image is actually decoding.
-    mImage->StartDecoding();
+    bool frameComplete = mImage->StartDecoding();
 
     // Check again to see if we finished.
     // We cannot prepare the image for rendering if it is not fully loaded.
     // Special case: If we requested a sync decode and the image has loaded, push
     // on through because the Draw() will do a sync decode then.
-    if (!mImage->IsComplete() &&
+    if (!(frameComplete || mImage->IsComplete()) &&
         !ShouldTreatAsCompleteDueToSyncDecode(mImage, mFlags)) {
       mPrepareResult = DrawResult::NOT_READY;
       return false;
     }
   }
 
   switch (mType) {
     case eStyleImageType_Image: {