Bug 870022 - Part 5.2 - Add sizes/srcset to HTMLSourceElement. r=jst, sr=jst
authorJohn Schoenick <jschoenick@mozilla.com>
Wed, 23 Apr 2014 13:55:05 -0700
changeset 190815 5e4c6e158007512caac024fe2f78a8a2ecc29ec0
parent 190814 ea8a9d62826077910d0773acf5bcc6da2d207fe7
child 190816 34eebb890abd30f48806fe12fd7c011599d694ff
push id27016
push userkwierso@gmail.com
push dateThu, 26 Jun 2014 01:18:58 +0000
treeherdermozilla-central@464bca437658 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst, jst
bugs870022
milestone33.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 870022 - Part 5.2 - Add sizes/srcset to HTMLSourceElement. r=jst, sr=jst
content/html/content/src/HTMLSourceElement.cpp
content/html/content/src/HTMLSourceElement.h
dom/interfaces/html/nsIDOMHTMLSourceElement.idl
dom/webidl/HTMLSourceElement.webidl
--- a/content/html/content/src/HTMLSourceElement.cpp
+++ b/content/html/content/src/HTMLSourceElement.cpp
@@ -24,16 +24,18 @@ HTMLSourceElement::~HTMLSourceElement()
 NS_IMPL_ISUPPORTS_INHERITED(HTMLSourceElement, nsGenericHTMLElement,
                             nsIDOMHTMLSourceElement)
 
 NS_IMPL_ELEMENT_CLONE(HTMLSourceElement)
 
 
 NS_IMPL_URI_ATTR(HTMLSourceElement, Src, src)
 NS_IMPL_STRING_ATTR(HTMLSourceElement, Type, type)
+NS_IMPL_STRING_ATTR(HTMLSourceElement, Srcset, srcset)
+NS_IMPL_STRING_ATTR(HTMLSourceElement, Sizes, sizes)
 NS_IMPL_STRING_ATTR(HTMLSourceElement, Media, media)
 
 void
 HTMLSourceElement::GetItemValueText(nsAString& aValue)
 {
   GetSrc(aValue);
 }
 
--- a/content/html/content/src/HTMLSourceElement.h
+++ b/content/html/content/src/HTMLSourceElement.h
@@ -50,16 +50,34 @@ public:
   {
     GetHTMLAttr(nsGkAtoms::type, aType);
   }
   void SetType(const nsAString& aType, ErrorResult& rv)
   {
     SetHTMLAttr(nsGkAtoms::type, aType, rv);
   }
 
+  void GetSrcset(nsString& aSrcset)
+  {
+    GetHTMLAttr(nsGkAtoms::srcset, aSrcset);
+  }
+  void SetSrcset(const nsAString& aSrcset, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::srcset, aSrcset, rv);
+  }
+
+  void GetSizes(nsString& aSizes)
+  {
+    GetHTMLAttr(nsGkAtoms::sizes, aSizes);
+  }
+  void SetSizes(const nsAString& aSizes, mozilla::ErrorResult& rv)
+  {
+    SetHTMLAttr(nsGkAtoms::sizes, aSizes, rv);
+  }
+
   void GetMedia(nsString& aMedia)
   {
     GetHTMLAttr(nsGkAtoms::media, aMedia);
   }
   void SetMedia(const nsAString& aMedia, mozilla::ErrorResult& rv)
   {
     SetHTMLAttr(nsGkAtoms::media, aMedia, rv);
   }
--- a/dom/interfaces/html/nsIDOMHTMLSourceElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLSourceElement.idl
@@ -11,15 +11,17 @@
  * <source> element.
  *
  * For more information on this interface, please see
  * http://www.whatwg.org/specs/web-apps/current-work/#source
  *
  * @status UNDER_DEVELOPMENT
  */
 
-[uuid(7adbaf06-572d-4c99-bd59-ac673ddcca93)]
+[uuid(1deb68f8-2ed6-4a41-b8c8-e0f86510f799)]
 interface nsIDOMHTMLSourceElement : nsISupports
 {
            attribute DOMString src;
            attribute DOMString type;
+           attribute DOMString srcset;
+           attribute DOMString sizes;
            attribute DOMString media;
 };
--- a/dom/webidl/HTMLSourceElement.webidl
+++ b/dom/webidl/HTMLSourceElement.webidl
@@ -11,16 +11,23 @@
  * and create derivative works of this document.
  */
 
 interface HTMLSourceElement : HTMLElement {
            [SetterThrows]
            attribute DOMString src;
            [SetterThrows]
            attribute DOMString type;
+};
+
+partial interface HTMLSourceElement {
+           [SetterThrows, Pref="dom.image.picture.enabled"]
+           attribute DOMString srcset;
+           [SetterThrows, Pref="dom.image.picture.enabled"]
+           attribute DOMString sizes;
            [SetterThrows]
            attribute DOMString media;
 };
 
 // Encrypted Media Extensions
 partial interface HTMLSourceElement {
   [Pref="media.eme.enabled"]
   attribute DOMString keySystem;