Bug 878509 - Restore the HTMLImageElement.lowsrc, x, y attributes that were unintentionally removed. r=smaug, a=akeybl
authorMs2ger <ms2ger@gmail.com>
Sun, 02 Jun 2013 17:38:25 +0200
changeset 142808 beaa70e610245d2ca16e8b3b50d74614fcd3fd0f
parent 142807 7c64168fea7b2900cfa7a59aa7a58a3e007d9401
child 142809 3deda7a94d8085f0a06112f4c3cbfb80eb7a113a
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, akeybl
bugs878509
milestone23.0a2
Bug 878509 - Restore the HTMLImageElement.lowsrc, x, y attributes that were unintentionally removed. r=smaug, a=akeybl
content/html/content/src/HTMLImageElement.cpp
content/html/content/src/HTMLImageElement.h
dom/webidl/HTMLImageElement.webidl
--- a/content/html/content/src/HTMLImageElement.cpp
+++ b/content/html/content/src/HTMLImageElement.cpp
@@ -173,29 +173,39 @@ HTMLImageElement::GetXY()
   nsPoint origin(frame->GetOffsetTo(layer));
   // Convert to pixels using that scale
   point.x = nsPresContext::AppUnitsToIntCSSPixels(origin.x);
   point.y = nsPresContext::AppUnitsToIntCSSPixels(origin.y);
 
   return point;
 }
 
+int32_t
+HTMLImageElement::X()
+{
+  return GetXY().x;
+}
+
+int32_t
+HTMLImageElement::Y()
+{
+  return GetXY().y;
+}
+
 NS_IMETHODIMP
 HTMLImageElement::GetX(int32_t* aX)
 {
-  *aX = GetXY().x;
-
+  *aX = X();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLImageElement::GetY(int32_t* aY)
 {
-  *aY = GetXY().y;
-
+  *aY = Y();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLImageElement::GetHeight(uint32_t* aHeight)
 {
   *aHeight = Height();
 
--- a/content/html/content/src/HTMLImageElement.h
+++ b/content/html/content/src/HTMLImageElement.h
@@ -159,16 +159,24 @@ public:
   {
     SetHTMLAttr(nsGkAtoms::longdesc, aLongDesc, aError);
   }
   void SetBorder(const nsAString& aBorder, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::border, aBorder, aError);
   }
 
+  int32_t X();
+  int32_t Y();
+  // Uses XPCOM GetLowsrc.
+  void SetLowsrc(const nsAString& aLowsrc, ErrorResult& aError)
+  {
+    SetHTMLAttr(nsGkAtoms::lowsrc, aLowsrc, aError);
+  }
+
 protected:
   nsIntPoint GetXY();
   virtual void GetItemValueText(nsAString& text);
   virtual void SetItemValueText(const nsAString& text);
   virtual JSObject* WrapNode(JSContext *aCx,
                              JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 };
 
--- a/dom/webidl/HTMLImageElement.webidl
+++ b/dom/webidl/HTMLImageElement.webidl
@@ -50,16 +50,26 @@ partial interface HTMLImageElement {
            [SetterThrows]
            attribute unsigned long vspace;
            [SetterThrows]
            attribute DOMString longDesc;
 
   [TreatNullAs=EmptyString,SetterThrows] attribute DOMString border;
 };
 
+// Mozilla extensions.
+partial interface HTMLImageElement {
+           attribute DOMString lowsrc;
+
+  // These attributes are offsets from the closest view (to mimic
+  // NS4's "offset-from-layer" behavior).
+  readonly attribute long x;
+  readonly attribute long y;
+};
+
 [NoInterfaceObject]
 interface MozImageLoadingContent {
   // Mirrored chrome-only nsIImageLoadingContent methods.  Please make sure
   // to update this list if nsIImageLoadingContent changes.
   [ChromeOnly]
   const long UNKNOWN_REQUEST = -1;
   [ChromeOnly]
   const long CURRENT_REQUEST = 0;