Bug 1301245 - Part 1. Implement nsStyleImage::IsResolved. draft
authorcku <cku@mozilla.com>
Thu, 20 Jul 2017 01:02:17 +0800
changeset 615787 ccfb7f6380d0255c270854d5f1b270547c316181
parent 615492 9eddb0a92820c6445f9d1e680e4c239e888e93f0
child 615788 5dec40d18494f9b62f12147c032d87b70727c74f
push id70472
push userbmo:cku@mozilla.com
push dateWed, 26 Jul 2017 09:57:39 +0000
bugs1301245
milestone56.0a1
Bug 1301245 - Part 1. Implement nsStyleImage::IsResolved. We need this new API in the following patch. MozReview-Commit-ID: JSoCgzKWrfs
layout/style/nsStyleStruct.h
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -458,16 +458,19 @@ struct nsStyleImage
   }
   imgRequestProxy* GetImageData() const {
     return GetImageRequest()->get();
   }
   nsStyleGradient* GetGradientData() const {
     NS_ASSERTION(mType == eStyleImageType_Gradient, "Data is not a gradient!");
     return mGradient;
   }
+  bool IsResolved() const {
+    return mType != eStyleImageType_Image || GetImageRequest()->IsResolved();
+  }
   const nsIAtom* GetElementId() const {
     NS_ASSERTION(mType == eStyleImageType_Element, "Data is not an element!");
     return mElementId;
   }
   const mozilla::UniquePtr<nsStyleSides>& GetCropRect() const {
     NS_ASSERTION(mType == eStyleImageType_Image,
                  "Only image data can have a crop rect");
     return mCropRect;