Bug 987140 - Return width/height from the most recent image request. r=bz
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 26 Mar 2014 14:43:27 -0400
changeset 175551 4ede230e093817914194f52455e41a9b38b9406f
parent 175550 731a5c2dc6dd62c1b64c159109b2aef0c6b69fb6
child 175552 becd60bbd3834b7b9eef152db27e816bdc63e4ce
push id26492
push userryanvm@gmail.com
push dateThu, 27 Mar 2014 00:57:51 +0000
treeherdermozilla-central@441f5fd256e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs987140
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 987140 - Return width/height from the most recent image request. r=bz
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
@@ -3206,17 +3206,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
@@ -308,18 +308,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);