Bug 847223. Part 10. Make the new code work when we have the image visibility analysis prefed off. r=mats
authorTimothy Nikkel <tnikkel@gmail.com>
Sat, 14 Sep 2013 19:05:06 -0500
changeset 147220 daa9550337ab
parent 147219 f2ff265af286
child 147251 1f7fddaf46fd
push id33809
push usertnikkel@gmail.com
push dateSun, 15 Sep 2013 00:05:34 +0000
treeherdermozilla-inbound@daa9550337ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs847223
milestone26.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 847223. Part 10. Make the new code work when we have the image visibility analysis prefed off. r=mats
content/base/src/nsImageLoadingContent.cpp
layout/base/nsLayoutUtils.cpp
layout/generic/nsImageFrame.cpp
layout/svg/nsSVGImageFrame.cpp
--- a/content/base/src/nsImageLoadingContent.cpp
+++ b/content/base/src/nsImageLoadingContent.cpp
@@ -237,18 +237,18 @@ nsImageLoadingContent::OnStopRequest(img
   if (shell && shell->IsVisible() &&
       (!shell->DidInitialize() || shell->IsPaintingSuppressed())) {
 
     // If we've gotten a frame and that frame has called FrameCreate and that
     // frame has been reflowed then we know that it checked it's own visibility
     // so we can trust our visible count and we don't start decode if we are not
     // visible.
     nsIFrame* f = GetOurPrimaryFrame();
-    if (!mFrameCreateCalled || !f ||
-        (f->GetStateBits() & NS_FRAME_FIRST_REFLOW) || mVisibleCount > 0) {
+    if (!mFrameCreateCalled || !f || (f->GetStateBits() & NS_FRAME_FIRST_REFLOW) ||
+        mVisibleCount > 0 || shell->AssumeAllImagesVisible()) {
       if (NS_SUCCEEDED(mCurrentRequest->StartDecoding())) {
         startedDecoding = true;
       }
     }
   }
 
   // We want to give the decoder a chance to find errors. If we haven't found
   // an error yet and we've started decoding, either from the above
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -5463,26 +5463,29 @@ nsLayoutUtils::GetBoxShadowRectForFrame(
 /* static */ void
 nsLayoutUtils::UpdateImageVisibilityForFrame(nsIFrame* aImageFrame)
 {
 #ifdef DEBUG
   nsIAtom* type = aImageFrame->GetType();
   MOZ_ASSERT(type == nsGkAtoms::imageFrame ||
              type == nsGkAtoms::imageControlFrame ||
              type == nsGkAtoms::svgImageFrame, "wrong type of frame");
-
-  NS_ASSERTION(!aImageFrame->PresContext()->PresShell()->AssumeAllImagesVisible(),
-               "shouldn't be in a doc where we assume all images are visible");
 #endif
 
   nsCOMPtr<nsIImageLoadingContent> content = do_QueryInterface(aImageFrame->GetContent());
   if (!content) {
     return;
   }
 
+  nsIPresShell* presShell = aImageFrame->PresContext()->PresShell();
+  if (presShell->AssumeAllImagesVisible()) {
+    presShell->EnsureImageInVisibleList(content);
+    return;
+  }
+
   bool visible = true;
   nsIFrame* f = aImageFrame->GetParent();
   nsRect rect = aImageFrame->GetContentRectRelativeToSelf();
   nsIFrame* rectFrame = aImageFrame;
   while (f) {
     nsIScrollableFrame* sf = do_QueryFrame(f);
     if (sf) {
       nsRect transformedRect =
@@ -5500,13 +5503,13 @@ nsLayoutUtils::UpdateImageVisibilityForF
       if (parent && parent->PresContext()->IsChrome()) {
         break;
       }
     }
     f = parent;
   }
 
   if (visible) {
-    aImageFrame->PresContext()->PresShell()->EnsureImageInVisibleList(content);
+    presShell->EnsureImageInVisibleList(content);
   } else {
-    aImageFrame->PresContext()->PresShell()->RemoveImageFromVisibleList(content);
-  }
-}
+    presShell->RemoveImageFromVisibleList(content);
+  }
+}
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -894,20 +894,18 @@ nsImageFrame::Reflow(nsPresContext*     
     static_assert(eOverflowType_LENGTH == 2, "Unknown overflow types?");
     nsRect& visualOverflow = aMetrics.VisualOverflow();
     visualOverflow.UnionRect(visualOverflow, altFeedbackSize);
   }
   FinishAndStoreOverflow(&aMetrics);
 
   if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) && !mReflowCallbackPosted) {
     nsIPresShell* shell = PresContext()->PresShell();
-    if (shell && !shell->AssumeAllImagesVisible()) {
-      mReflowCallbackPosted = true;
-      shell->PostReflowCallback(this);
-    }
+    mReflowCallbackPosted = true;
+    shell->PostReflowCallback(this);
   }
 
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                   ("exit nsImageFrame::Reflow: size=%d,%d",
                   aMetrics.width, aMetrics.height));
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
   return NS_OK;
 }
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -503,20 +503,18 @@ nsSVGImageFrame::ReflowSVG()
   if (mState & NS_FRAME_FIRST_REFLOW) {
     // Make sure we have our filter property (if any) before calling
     // FinishAndStoreOverflow (subsequent filter changes are handled off
     // nsChangeHint_UpdateEffects):
     nsSVGEffects::UpdateEffects(this);
 
     if (!mReflowCallbackPosted) {
       nsIPresShell* shell = PresContext()->PresShell();
-      if (shell && !shell->AssumeAllImagesVisible()) {
-        mReflowCallbackPosted = true;
-        shell->PostReflowCallback(this);
-      }
+      mReflowCallbackPosted = true;
+      shell->PostReflowCallback(this);
     }
   }
 
   nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
   nsOverflowAreas overflowAreas(overflow, overflow);
   FinishAndStoreOverflow(overflowAreas, mRect.Size());
 
   mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |