Bug 987140 - Return width/height from the most recent image request. r=bz, a=sledru
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 26 Mar 2014 14:43:27 -0400
changeset 192349 8fac4b0aed5eaf790fd1bc6ea1075e1d5ddb40c2
parent 192348 0b7da273dda01a2453f575319dfa5146db7ddb8f
child 192350 0aba36b451a12f4119c6a754729b1888f034316f
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, sledru
bugs987140
milestone30.0a2
Bug 987140 - Return width/height from the most recent image request. r=bz, a=sledru
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -3260,17 +3260,17 @@ nsGenericHTMLElement::Properties()
 NS_IMETHODIMP
 nsGenericHTMLElement::GetProperties(nsISupports** aProperties)
 {
   NS_ADDREF(*aProperties = static_cast<nsIHTMLCollection*>(Properties()));
   return NS_OK;
 }
 
 nsSize
-nsGenericHTMLElement::GetWidthHeightForImage(imgIRequest *aImageRequest)
+nsGenericHTMLElement::GetWidthHeightForImage(nsRefPtr<imgRequestProxy>& aImageRequest)
 {
   nsSize size(0,0);
 
   nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
 
   if (frame) {
     size = frame->GetContentRect().Size();
 
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -315,18 +315,20 @@ public:
   virtual already_AddRefed<mozilla::dom::UndoManager> GetUndoManager();
   virtual bool UndoScope() MOZ_OVERRIDE;
   virtual void SetUndoScope(bool aUndoScope, mozilla::ErrorResult& aError) MOZ_OVERRIDE;
   // Callback for destructor of of dataset to ensure to null out weak pointer.
   nsresult ClearDataset();
 
   /**
    * Get width and height, using given image request if attributes are unset.
+   * Pass a reference to the image request, since the method may change the
+   * value and we want to use the updated value.
    */
-  nsSize GetWidthHeightForImage(imgIRequest *aImageRequest);
+  nsSize GetWidthHeightForImage(nsRefPtr<imgRequestProxy>& aImageRequest);
 
   // XPIDL methods
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   NS_IMETHOD GetId(nsAString& aId) MOZ_FINAL {
     mozilla::dom::Element::GetId(aId);