Bug 1310463 - Part 2: Simplify nsComputedDOMStyle::DoGetListStyleImage a little. r=xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Sun, 16 Oct 2016 11:03:30 +0800
changeset 425805 954274fc77c18bb99d24eb128395f547a173cd23
parent 425804 e6bdc00f01c7ae8df39b99b48510545e437b8cd7
child 425806 5787d0c9abc29f0647a3bb1082ed6eaaab5305a8
push id32513
push userbmo:cam@mcc.id.au
push dateMon, 17 Oct 2016 05:26:21 +0000
reviewersxidorn
bugs1310463
milestone52.0a1
Bug 1310463 - Part 2: Simplify nsComputedDOMStyle::DoGetListStyleImage a little. r=xidorn MozReview-Commit-ID: Kxbxu8mZcQs
layout/style/nsComputedDOMStyle.cpp
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -2081,17 +2081,17 @@ nsComputedDOMStyle::SetValueToStyleImage
 {
   switch (aStyleImage.GetType()) {
     case eStyleImageType_Image:
     {
       imgIRequest* req = aStyleImage.GetImageData();
       if (!req) {
         // XXXheycam If we had some problem resolving the imgRequestProxy,
         // maybe we should just use the URL stored in the nsStyleImage's
-        // mImageValue?
+        // mImageValue?  (Similarly in DoGetListStyleImage.)
         aValue->SetIdent(eCSSKeyword_none);
         break;
       }
 
       nsCOMPtr<nsIURI> uri;
       req->GetURI(getter_AddRefs(uri));
 
       const UniquePtr<nsStyleSides>& cropRect = aStyleImage.GetCropRect();
@@ -3498,23 +3498,26 @@ nsComputedDOMStyle::DoGetZIndex()
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetListStyleImage()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   const nsStyleList* list = StyleList();
 
-  if (!list->GetListStyleImage()) {
+  // XXXheycam As in SetValueToStyleImage, we might want to use the
+  // URL stored in the nsStyleImageRequest's mImageValue if we
+  // failed to resolve the imgRequestProxy.
+
+  imgRequestProxy* image = list->GetListStyleImage();
+  if (!image) {
     val->SetIdent(eCSSKeyword_none);
   } else {
     nsCOMPtr<nsIURI> uri;
-    if (list->GetListStyleImage()) {
-      list->GetListStyleImage()->GetURI(getter_AddRefs(uri));
-    }
+    image->GetURI(getter_AddRefs(uri));
     val->SetURI(uri);
   }
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetListStylePosition()