Bug 1310463 - Part 2: Simplify nsComputedDOMStyle::DoGetListStyleImage a little. r=xidorn
authorCameron McCormack <cam@mcc.id.au>
Thu, 03 Nov 2016 09:40:53 +0800
changeset 347508 0520d97879319abd9d1f6b10cd0ee092d6737888
parent 347507 5fd7c7cad7599f10bd1cc6d4b0d2db984eb45437
child 347509 be398e3e2b2039ff982b747b3573ea338dbc7d45
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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();
@@ -3499,23 +3499,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()