Bug 1326514 - Implement the CSSOM bits for CSSNamespaceRule. r?bz draft
authorXidorn Quan <me@upsuper.org>
Thu, 21 Dec 2017 12:17:37 +1100
changeset 713900 1bc0404c14945d05896467f58cb92ac6be6c7173
parent 713899 bad84713645ee80c52fa00baeda368c8f981316b
child 744472 4117fe936e02f6d5c67403cdd5094f11bd5cc503
push id93795
push userxquan@mozilla.com
push dateThu, 21 Dec 2017 07:36:49 +0000
reviewersbz
bugs1326514
milestone59.0a1
Bug 1326514 - Implement the CSSOM bits for CSSNamespaceRule. r?bz MozReview-Commit-ID: 5UpvH4osOfn
dom/webidl/CSSNamespaceRule.webidl
layout/style/CSSNamespaceRule.h
testing/web-platform/meta/css/cssom/CSSNamespaceRule.html.ini
testing/web-platform/meta/css/cssom/interfaces.html.ini
--- a/dom/webidl/CSSNamespaceRule.webidl
+++ b/dom/webidl/CSSNamespaceRule.webidl
@@ -4,13 +4,11 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  * https://drafts.csswg.org/cssom/#cssnamespacerule
  */
 
 // https://drafts.csswg.org/cssom/#cssnamespacerule
 interface CSSNamespaceRule : CSSRule {
-  // Not implemented yet.  <See
-  // https://bugzilla.mozilla.org/show_bug.cgi?id=1326514>.
-  //  readonly attribute DOMString namespaceURI;
-  //  readonly attribute DOMString prefix;
+  readonly attribute DOMString namespaceURI;
+  readonly attribute DOMString prefix;
 };
--- a/layout/style/CSSNamespaceRule.h
+++ b/layout/style/CSSNamespaceRule.h
@@ -31,16 +31,22 @@ public:
 
   virtual nsAtom* GetPrefix() const = 0;
   virtual void GetURLSpec(nsString& aURLSpec) const = 0;
 
   // WebIDL interfaces
   uint16_t Type() const final {
     return nsIDOMCSSRule::NAMESPACE_RULE;
   }
+  void GetNamespaceURI(nsString& aNamespaceURI) {
+    GetURLSpec(aNamespaceURI);
+  }
+  void GetPrefix(DOMString& aPrefix) {
+    aPrefix.SetOwnedAtom(GetPrefix(), DOMString::eNullNotExpected);
+  }
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const = 0;
 
   JSObject* WrapObject(JSContext* aCx,
                        JS::Handle<JSObject*> aGivenProto) final {
     return CSSNamespaceRuleBinding::Wrap(aCx, this, aGivenProto);
   }
 };
deleted file mode 100644
--- a/testing/web-platform/meta/css/cssom/CSSNamespaceRule.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[CSSNamespaceRule.html]
-  type: testharness
-  [CSSOM - CSSNamespaceRule interface]
-    expected: FAIL
-
--- a/testing/web-platform/meta/css/cssom/interfaces.html.ini
+++ b/testing/web-platform/meta/css/cssom/interfaces.html.ini
@@ -70,22 +70,16 @@
     expected: FAIL
 
   [CSSMarginRule interface: attribute name]
     expected: FAIL
 
   [CSSMarginRule interface: attribute style]
     expected: FAIL
 
-  [CSSNamespaceRule interface: attribute namespaceURI]
-    expected: FAIL
-
-  [CSSNamespaceRule interface: attribute prefix]
-    expected: FAIL
-
   [CSSStyleDeclaration interface: operation setPropertyValue(DOMString,DOMString)]
     expected: FAIL
 
   [CSSStyleDeclaration interface: operation setPropertyPriority(DOMString,DOMString)]
     expected: FAIL
 
   [CSSStyleDeclaration interface: attribute cssFloat]
     expected: FAIL
@@ -184,22 +178,16 @@
     expected: FAIL
 
   [CSSRule interface: style_element.sheet.cssRules[2\].cssRules[0\] must inherit property "parentRule" with the proper type]
     expected: FAIL
 
   [CSSRule interface: style_element.sheet.cssRules[2\].cssRules[0\] must inherit property "parentStyleSheet" with the proper type]
     expected: FAIL
 
-  [CSSNamespaceRule interface: style_element.sheet.cssRules[1\] must inherit property "namespaceURI" with the proper type]
-    expected: FAIL
-
-  [CSSNamespaceRule interface: style_element.sheet.cssRules[1\] must inherit property "prefix" with the proper type]
-    expected: FAIL
-
   [CSSRule interface: style_element.sheet.cssRules[1\] must inherit property "MARGIN_RULE" with the proper type]
     expected: FAIL
 
   [CSSStyleDeclaration interface: operation setPropertyValue(CSSOMString, CSSOMString)]
     expected: FAIL
 
   [CSSStyleDeclaration interface: operation setPropertyPriority(CSSOMString, CSSOMString)]
     expected: FAIL