Bug 1301245 - Part 5. (Stylo) Remove original code of triggering style image download. draft
authorcku <cku@mozilla.com>
Thu, 20 Jul 2017 11:54:06 +0800
changeset 612864 08410a5da2b3e90c96de36de5a5ea2f01ae85f49
parent 612863 c8bcc59c99b0dfd87530a2e45bbe17860c9b4726
child 638517 c125fbe0d7a7a60782aa4ab2d27ffef3da3f711e
push id69621
push userbmo:cku@mozilla.com
push dateFri, 21 Jul 2017 04:42:07 +0000
bugs1301245
milestone56.0a1
Bug 1301245 - Part 5. (Stylo) Remove original code of triggering style image download. MozReview-Commit-ID: L6eSUIFSZrh
layout/generic/nsFrame.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -844,41 +844,46 @@ AddAndRemoveImageAssociations(nsFrame* a
   // backgrounds from some other frame's style data, and we don't want
   // to clear those notifiers unless we have to.  (They'll be reset
   // when we paint, although we could miss a notification in that
   // interval.)
 
   if (aOldLayers) {
     NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, (*aOldLayers)) {
       // If there is an image in oldBG that's not in newBG, drop it.
+      const nsStyleImage& oldImage = aOldLayers->mLayers[i].mImage;
+      if (!oldImage.IsResolved()) {
+        continue;
+      }
       if (i >= aNewLayers->mImageCount ||
           !aOldLayers->mLayers[i].mImage.ImageDataEquals(
             aNewLayers->mLayers[i].mImage)) {
-        const nsStyleImage& oldImage = aOldLayers->mLayers[i].mImage;
         if (oldImage.GetType() != eStyleImageType_Image) {
           continue;
         }
 
         if (aFrame->HasImageRequest()) {
           if (imgRequestProxy* req = oldImage.GetImageData()) {
             imageLoader->DisassociateRequestFromFrame(req, aFrame);
           }
         }
       }
     }
   }
 
   NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, (*aNewLayers)) {
     // If there is an image in newBG that's not in oldBG, add it.
+    const nsStyleImage& newImage = aNewLayers->mLayers[i].mImage;
+    if (!newImage.IsResolved()) {
+      continue;
+    }
     if (!aOldLayers || i >= aOldLayers->mImageCount ||
         !aNewLayers->mLayers[i].mImage.ImageDataEquals(
           aOldLayers->mLayers[i].mImage)) {
-      const nsStyleImage& newImage = aNewLayers->mLayers[i].mImage;
-      if (newImage.GetType() != eStyleImageType_Image ||
-          !newImage.IsResolved()) {
+      if (newImage.GetType() != eStyleImageType_Image) {
         continue;
       }
 
       if (imgRequestProxy* req = newImage.GetImageData()) {
         imageLoader->AssociateRequestToFrame(req, aFrame);
       }
     }
   }
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1194,25 +1194,16 @@ nsStyleSVGReset::nsStyleSVGReset(const n
 void
 nsStyleSVGReset::Destroy(nsPresContext* aContext)
 {
   this->~nsStyleSVGReset();
   aContext->PresShell()->
     FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVGReset, this);
 }
 
-void
-nsStyleSVGReset::FinishStyle(nsPresContext* aPresContext)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aPresContext->StyleSet()->IsServo());
-
-  mMask.ResolveImages(aPresContext);
-}
-
 nsChangeHint
 nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
 {
   nsChangeHint hint = nsChangeHint(0);
 
   if (!mClipPath.DefinitelyEquals(aNewData.mClipPath)) {
     hint |= nsChangeHint_UpdateEffects |
             nsChangeHint_RepaintFrame;
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3679,20 +3679,17 @@ struct nsTArray_CopyChooser<nsStyleFilte
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
 {
   explicit nsStyleSVGReset(const nsPresContext* aContext);
   nsStyleSVGReset(const nsStyleSVGReset& aSource);
   ~nsStyleSVGReset();
 
-  // Resolves and tracks the images in mMask.  Only called with a Servo-backed
-  // style system, where those images must be resolved later than the OMT
-  // nsStyleSVGReset constructor call.
-  void FinishStyle(nsPresContext* aPresContext);
+  void FinishStyle(nsPresContext* aPresContext) {}
   const static bool kHasFinishStyle = true;
 
   void* operator new(size_t sz, nsStyleSVGReset* aSelf) { return aSelf; }
   void* operator new(size_t sz, nsPresContext* aContext) {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsStyleSVGReset, sz);
   }
   void Destroy(nsPresContext* aContext);