Bug 1427512 - Part 27: Remove nsIDOMCSSPrimitiveValue. r=xidorn,bz
authorCameron McCormack <cam@mcc.id.au>
Thu, 11 Jan 2018 16:17:57 +0800
changeset 453081 60084eb2fbf75fa0c49302e28e0044d2fc94ff5a
parent 453080 5fc7cb9158591e0009835a2434be79045a2d14bd
child 453082 c083618249737b91e821c3ae787f41097d1c1a04
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn, bz
bugs1427512
milestone59.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 1427512 - Part 27: Remove nsIDOMCSSPrimitiveValue. r=xidorn,bz MozReview-Commit-ID: IcGKAjPWacZ
accessible/interfaces/nsIAccessible.idl
dom/interfaces/base/domstubs.idl
dom/interfaces/css/moz.build
dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl
editor/libeditor/HTMLAbsPositionEditor.cpp
editor/libeditor/HTMLAnonymousNodeEditor.cpp
js/xpconnect/tests/mochitest/test_bug790732.html
layout/style/CSSValue.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsROCSSPrimitiveValue.cpp
layout/style/nsROCSSPrimitiveValue.h
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/accessible/interfaces/nsIAccessible.idl
+++ b/accessible/interfaces/nsIAccessible.idl
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 #include "nsIArray.idl"
 
 interface nsIPersistentProperties;
-interface nsIDOMCSSPrimitiveValue;
 interface nsIDOMNode;
 interface nsIAccessibleDocument;
 interface nsIAccessibleRelation;
 
 %{C++
 namespace mozilla {
 namespace a11y {
 class Accessible;
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -53,16 +53,15 @@ interface nsIDOMEventListener;
 
 // HTML
 interface nsIDOMHTMLElement;
 interface nsIDOMHTMLFormElement;
 interface nsIDOMHTMLHeadElement;
 
 // CSS
 interface nsIDOMCSSValue;
-interface nsIDOMCSSPrimitiveValue;
 interface nsIDOMCSSStyleDeclaration;
 
 // Range
 interface nsIDOMRange;
 
 // Crypto
 interface nsIDOMCrypto;
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -3,15 +3,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
 
 XPIDL_SOURCES += [
-    'nsIDOMCSSPrimitiveValue.idl',
     'nsIDOMCSSStyleDeclaration.idl',
     'nsIDOMCSSValue.idl',
 ]
 
 XPIDL_MODULE = 'dom_css'
 
deleted file mode 100644
--- a/dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIDOMCSSValue.idl"
-
-/**
- * The nsIDOMCSSPrimitiveValue interface is a datatype for a primitive
- * CSS value in the Document Object Model.
- *
- * For more information on this interface please see
- * http://www.w3.org/TR/DOM-Level-2-Style
- */
-
-[uuid(f6df7293-2dc9-4cb9-9531-778caf4370e0)]
-interface nsIDOMCSSPrimitiveValue : nsIDOMCSSValue
-{
-  // UnitTypes
-  const unsigned short      CSS_UNKNOWN                    = 0;
-  const unsigned short      CSS_NUMBER                     = 1;
-  const unsigned short      CSS_PERCENTAGE                 = 2;
-  const unsigned short      CSS_EMS                        = 3;
-  const unsigned short      CSS_EXS                        = 4;
-  const unsigned short      CSS_PX                         = 5;
-  const unsigned short      CSS_CM                         = 6;
-  const unsigned short      CSS_MM                         = 7;
-  const unsigned short      CSS_IN                         = 8;
-  const unsigned short      CSS_PT                         = 9;
-  const unsigned short      CSS_PC                         = 10;
-  const unsigned short      CSS_DEG                        = 11;
-  const unsigned short      CSS_RAD                        = 12;
-  const unsigned short      CSS_GRAD                       = 13;
-  const unsigned short      CSS_MS                         = 14;
-  const unsigned short      CSS_S                          = 15;
-  const unsigned short      CSS_HZ                         = 16;
-  const unsigned short      CSS_KHZ                        = 17;
-  const unsigned short      CSS_DIMENSION                  = 18;
-  const unsigned short      CSS_STRING                     = 19;
-  const unsigned short      CSS_URI                        = 20;
-  const unsigned short      CSS_IDENT                      = 21;
-  const unsigned short      CSS_ATTR                       = 22;
-  const unsigned short      CSS_COUNTER                    = 23;
-  const unsigned short      CSS_RECT                       = 24;
-  const unsigned short      CSS_RGBCOLOR                   = 25;
-
-  readonly attribute unsigned short   primitiveType;
-  void               setFloatValue(in unsigned short unitType, 
-                                   in float floatValue)
-                                        raises(DOMException);
-  float              getFloatValue(in unsigned short unitType)
-                                        raises(DOMException);
-  void               setStringValue(in unsigned short stringType, 
-                                    in DOMString stringValue)
-                                        raises(DOMException);
-  DOMString          getStringValue()
-                                        raises(DOMException);
-};
--- a/editor/libeditor/HTMLAbsPositionEditor.cpp
+++ b/editor/libeditor/HTMLAbsPositionEditor.cpp
@@ -8,16 +8,17 @@
 
 #include "HTMLEditorObjectResizerUtils.h"
 #include "HTMLEditRules.h"
 #include "HTMLEditUtils.h"
 #include "TextEditUtils.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEditRules.h"
+#include "mozilla/dom/CSSPrimitiveValueBinding.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
 #include "nsAlgorithm.h"
 #include "nsCOMPtr.h"
 #include "nsComputedDOMStyle.h"
 #include "nsDebug.h"
@@ -676,27 +677,27 @@ HTMLEditor::CheckPositionedElementBGandF
       // from these declarations, get the one we want and that one only
       ErrorResult error;
       RefPtr<dom::CSSValue> cssVal = cssDecl->GetPropertyCSSValue(NS_LITERAL_STRING("color"), error);
       NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
 
       nsROCSSPrimitiveValue* val = cssVal->AsPrimitiveValue();
       NS_ENSURE_TRUE(val, NS_ERROR_FAILURE);
 
-      if (nsIDOMCSSPrimitiveValue::CSS_RGBCOLOR == val->PrimitiveType()) {
+      if (CSSPrimitiveValueBinding::CSS_RGBCOLOR == val->PrimitiveType()) {
         nsDOMCSSRGBColor* rgbVal = val->GetRGBColorValue(error);
         NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         float r = rgbVal->Red()->
-          GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_NUMBER, error);
+          GetFloatValue(CSSPrimitiveValueBinding::CSS_NUMBER, error);
         NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         float g = rgbVal->Green()->
-          GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_NUMBER, error);
+          GetFloatValue(CSSPrimitiveValueBinding::CSS_NUMBER, error);
         NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         float b = rgbVal->Blue()->
-          GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_NUMBER, error);
+          GetFloatValue(CSSPrimitiveValueBinding::CSS_NUMBER, error);
         NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         if (r >= BLACK_BG_RGB_TRIGGER &&
             g >= BLACK_BG_RGB_TRIGGER &&
             b >= BLACK_BG_RGB_TRIGGER)
           aReturn.AssignLiteral("black");
         else
           aReturn.AssignLiteral("white");
         return NS_OK;
--- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp
+++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp
@@ -1,29 +1,27 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/HTMLEditor.h"
 
 #include "mozilla/Attributes.h"
+#include "mozilla/dom/CSSPrimitiveValueBinding.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"
 #include "nsComputedDOMStyle.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsID.h"
-#include "nsIDOMCSSPrimitiveValue.h"
-#include "nsIDOMCSSStyleDeclaration.h"
-#include "nsIDOMCSSValue.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMWindow.h"
 #include "nsIDocument.h"
 #include "nsIDocumentObserver.h"
 #include "nsIHTMLAbsPosEditor.h"
@@ -37,55 +35,60 @@
 #include "nsLiteralString.h"
 #include "nsPresContext.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nsUnicharUtils.h"
 #include "nscore.h"
 #include "nsContentUtils.h" // for nsAutoScriptBlocker
+#include "nsROCSSPrimitiveValue.h"
 
 class nsIDOMEventListener;
 class nsISelection;
 
 namespace mozilla {
 
 using namespace dom;
 
 // retrieve an integer stored into a CSS computed float value
-static int32_t GetCSSFloatValue(nsIDOMCSSStyleDeclaration * aDecl,
-                                const nsAString & aProperty)
+static int32_t GetCSSFloatValue(nsComputedDOMStyle* aComputedStyle,
+                                const nsAString& aProperty)
 {
-  MOZ_ASSERT(aDecl);
+  MOZ_ASSERT(aComputedStyle);
 
-  nsCOMPtr<nsIDOMCSSValue> value;
   // get the computed CSSValue of the property
-  nsresult rv = aDecl->GetPropertyCSSValue(aProperty, getter_AddRefs(value));
-  if (NS_FAILED(rv) || !value) {
+  ErrorResult rv;
+  RefPtr<CSSValue> value = aComputedStyle->GetPropertyCSSValue(aProperty, rv);
+  if (rv.Failed() || !value) {
     return 0;
   }
 
   // check the type of the returned CSSValue; we handle here only
   // pixel and enum types
-  nsCOMPtr<nsIDOMCSSPrimitiveValue> val = do_QueryInterface(value);
-  uint16_t type;
-  val->GetPrimitiveType(&type);
+  RefPtr<nsROCSSPrimitiveValue> val = value->AsPrimitiveValue();
+  uint16_t type = val->PrimitiveType();
 
   float f = 0;
   switch (type) {
-    case nsIDOMCSSPrimitiveValue::CSS_PX:
+    case CSSPrimitiveValueBinding::CSS_PX:
       // the value is in pixels, just get it
-      rv = val->GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_PX, &f);
-      NS_ENSURE_SUCCESS(rv, 0);
+      f = val->GetFloatValue(CSSPrimitiveValueBinding::CSS_PX, rv);
+      if (rv.Failed()) {
+        return 0;
+      }
       break;
-    case nsIDOMCSSPrimitiveValue::CSS_IDENT: {
+    case CSSPrimitiveValueBinding::CSS_IDENT: {
       // the value is keyword, we have to map these keywords into
       // numeric values
       nsAutoString str;
-      val->GetStringValue(str);
+      val->GetStringValue(str, rv);
+      if (rv.Failed()) {
+        return 0;
+      }
       if (str.EqualsLiteral("thin")) {
         f = 1;
       } else if (str.EqualsLiteral("medium")) {
         f = 3;
       } else if (str.EqualsLiteral("thick")) {
         f = 5;
       }
       break;
--- a/js/xpconnect/tests/mochitest/test_bug790732.html
+++ b/js/xpconnect/tests/mochitest/test_bug790732.html
@@ -18,17 +18,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   // Check each interface that we shim. We start by checking specific
   // constants for a couple of interfaces, and then once it's pretty clear that
   // it's working as intended we just check that the objects themselves are the
   // same.
   is(Ci.nsIXMLHttpRequest.HEADERS_RECEIVED, XMLHttpRequest.HEADERS_RECEIVED);
   is(Ci.nsIDOMDOMException.DATA_CLONE_ERR, DOMException.DATA_CLONE_ERR);
   is(Ci.nsIDOMNode.DOCUMENT_NODE, Node.DOCUMENT_NODE);
-  is(Ci.nsIDOMCSSPrimitiveValue.CSS_PX, CSSPrimitiveValue.CSS_PX);
   is(Ci.nsIDOMCSSValue.CSS_PRIMITIVE_VALUE, CSSValue.CSS_PRIMITIVE_VALUE);
   is(Ci.nsIDOMEvent.FOCUS, Event.FOCUS);
   is(Ci.nsIDOMNSEvent.CLICK, Event.CLICK);
   is(Ci.nsIDOMKeyEvent, KeyEvent);
   is(Ci.nsIDOMMouseEvent, MouseEvent);
   is(Ci.nsIDOMMouseScrollEvent, MouseScrollEvent);
   is(Ci.nsIDOMMutationEvent, MutationEvent);
   // XXX We can't test this here because it's only exposed to chrome
--- a/layout/style/CSSValue.h
+++ b/layout/style/CSSValue.h
@@ -32,16 +32,18 @@ public:
   virtual void SetCssText(const nsAString& aText, mozilla::ErrorResult& aRv) = 0;
   virtual uint16_t CssValueType() const = 0;
 
   // Downcasting
 
   /**
    * Return this as a nsROCSSPrimitiveValue* if its a primitive value, and null
    * otherwise.
+   *
+   * Defined in nsROCSSPrimitiveValue.h.
    */
-  nsROCSSPrimitiveValue *AsPrimitiveValue();
+  inline nsROCSSPrimitiveValue* AsPrimitiveValue();
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -7,17 +7,17 @@
 /* DOM object returned from element.getComputedStyle() */
 
 #include "nsComputedDOMStyle.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Preferences.h"
 
 #include "nsError.h"
-#include "nsIDOMCSSPrimitiveValue.h"
+#include "mozilla/dom/CSSPrimitiveValueBinding.h"
 #include "nsIFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsStyleContext.h"
 #include "nsIScrollableFrame.h"
 #include "nsContentUtils.h"
 #include "nsIContent.h"
 
 #include "nsDOMCSSRect.h"
@@ -1544,17 +1544,17 @@ nsComputedDOMStyle::DoGetContent()
         }
         val->SetURI(uri);
         break;
       }
       case eStyleContentType_Attr: {
         nsAutoString str;
         nsStyleUtil::AppendEscapedCSSIdent(
           nsDependentString(data.GetString()), str);
-        val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_ATTR);
+        val->SetString(str, CSSPrimitiveValueBinding::CSS_ATTR);
         break;
       }
       case eStyleContentType_Counter:
       case eStyleContentType_Counters: {
         /* FIXME: counters should really use an object */
         nsAutoString str;
         if (type == eStyleContentType_Counter) {
           str.AppendLiteral("counter(");
@@ -1569,17 +1569,17 @@ nsComputedDOMStyle::DoGetContent()
           nsStyleUtil::AppendEscapedCSSString(counters->mSeparator, str);
         }
         if (counters->mCounterStyle != CounterStyleManager::GetDecimalStyle()) {
           str.AppendLiteral(", ");
           AppendCounterStyle(counters->mCounterStyle, str);
         }
 
         str.Append(char16_t(')'));
-        val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_COUNTER);
+        val->SetString(str, CSSPrimitiveValueBinding::CSS_COUNTER);
         break;
       }
       case eStyleContentType_OpenQuote:
         val->SetIdent(eCSSKeyword_open_quote);
         break;
       case eStyleContentType_CloseQuote:
         val->SetIdent(eCSSKeyword_close_quote);
         break;
--- a/layout/style/nsROCSSPrimitiveValue.cpp
+++ b/layout/style/nsROCSSPrimitiveValue.cpp
@@ -11,50 +11,60 @@
 #include "mozilla/dom/CSSPrimitiveValueBinding.h"
 #include "nsPresContext.h"
 #include "nsStyleUtil.h"
 #include "nsDOMCSSRGBColor.h"
 #include "nsDOMCSSRect.h"
 #include "nsIURI.h"
 #include "nsError.h"
 
+// There is no CSS_TURN constant on the CSSPrimitiveValue interface,
+// since that unit is newer than DOM Level 2 Style, and CSS OM will
+// probably expose CSS values in some other way in the future.  We
+// use this value in mType for "turn"-unit angles, but we define it
+// here to avoid exposing it to content.
+#define CSS_TURN 30U
+// Likewise we have some internal aliases for CSS_NUMBER that we don't
+// want to expose.
+#define CSS_NUMBER_INT32 31U
+#define CSS_NUMBER_UINT32 32U
+
 using namespace mozilla;
 
 nsROCSSPrimitiveValue::nsROCSSPrimitiveValue()
-  : CSSValue(), mType(CSS_PX)
+  : CSSValue(), mType(CSSPrimitiveValueBinding::CSS_PX)
 {
   mValue.mAppUnits = 0;
 }
 
 
 nsROCSSPrimitiveValue::~nsROCSSPrimitiveValue()
 {
   Reset();
 }
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsROCSSPrimitiveValue)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsROCSSPrimitiveValue)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsROCSSPrimitiveValue)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsIDOMCSSPrimitiveValue)
   NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, CSSValue)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsROCSSPrimitiveValue)
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsROCSSPrimitiveValue)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsROCSSPrimitiveValue)
-  if (tmp->mType == CSS_URI) {
+  if (tmp->mType == CSSPrimitiveValueBinding::CSS_URI) {
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mValue.mURI)
-  } else if (tmp->mType == CSS_RGBCOLOR) {
+  } else if (tmp->mType == CSSPrimitiveValueBinding::CSS_RGBCOLOR) {
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mValue.mColor)
-  } else if (tmp->mType == CSS_RECT) {
+  } else if (tmp->mType == CSSPrimitiveValueBinding::CSS_RECT) {
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mValue.mRect)
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsROCSSPrimitiveValue)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
   tmp->Reset();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@@ -71,36 +81,36 @@ nsROCSSPrimitiveValue::WrapObject(JSCont
 NS_IMETHODIMP
 nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
 {
   nsAutoString tmpStr;
   aCssText.Truncate();
   nsresult result = NS_OK;
 
   switch (mType) {
-    case CSS_PX :
+    case CSSPrimitiveValueBinding::CSS_PX:
       {
         float val = nsPresContext::AppUnitsToFloatCSSPixels(mValue.mAppUnits);
         nsStyleUtil::AppendCSSNumber(val, tmpStr);
         tmpStr.AppendLiteral("px");
         break;
       }
-    case CSS_IDENT :
+    case CSSPrimitiveValueBinding::CSS_IDENT:
       {
         AppendUTF8toUTF16(nsCSSKeywords::GetStringValue(mValue.mKeyword),
                           tmpStr);
         break;
       }
-    case CSS_STRING :
-    case CSS_COUNTER : /* FIXME: COUNTER should use an object */
+    case CSSPrimitiveValueBinding::CSS_STRING:
+    case CSSPrimitiveValueBinding::CSS_COUNTER: /* FIXME: COUNTER should use an object */
       {
         tmpStr.Append(mValue.mString);
         break;
       }
-    case CSS_URI :
+    case CSSPrimitiveValueBinding::CSS_URI:
       {
         if (mValue.mURI) {
           nsAutoCString specUTF8;
           nsresult rv = mValue.mURI->GetSpec(specUTF8);
           NS_ENSURE_SUCCESS(rv, rv);
 
           tmpStr.AssignLiteral("url(");
           nsStyleUtil::AppendEscapedCSSString(NS_ConvertUTF8toUTF16(specUTF8),
@@ -110,69 +120,69 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
           // http://dev.w3.org/csswg/css3-values/#attr defines
           // 'about:invalid' as the default value for url attributes,
           // so let's also use it here as the default computed value
           // for invalid URLs.
           tmpStr.AssignLiteral(u"url(about:invalid)");
         }
         break;
       }
-    case CSS_ATTR :
+    case CSSPrimitiveValueBinding::CSS_ATTR:
       {
         tmpStr.AppendLiteral("attr(");
         tmpStr.Append(mValue.mString);
         tmpStr.Append(char16_t(')'));
         break;
       }
-    case CSS_PERCENTAGE :
+    case CSSPrimitiveValueBinding::CSS_PERCENTAGE:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat * 100, tmpStr);
         tmpStr.Append(char16_t('%'));
         break;
       }
-    case CSS_NUMBER :
+    case CSSPrimitiveValueBinding::CSS_NUMBER:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         break;
       }
-    case CSS_NUMBER_INT32 :
+    case CSS_NUMBER_INT32:
       {
         tmpStr.AppendInt(mValue.mInt32);
         break;
       }
-    case CSS_NUMBER_UINT32 :
+    case CSS_NUMBER_UINT32:
       {
         tmpStr.AppendInt(mValue.mUint32);
         break;
       }
-    case CSS_DEG :
+    case CSSPrimitiveValueBinding::CSS_DEG:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         tmpStr.AppendLiteral("deg");
         break;
       }
-    case CSS_GRAD :
+    case CSSPrimitiveValueBinding::CSS_GRAD:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         tmpStr.AppendLiteral("grad");
         break;
       }
-    case CSS_RAD :
+    case CSSPrimitiveValueBinding::CSS_RAD:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         tmpStr.AppendLiteral("rad");
         break;
       }
-    case CSS_TURN :
+    case CSS_TURN:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         tmpStr.AppendLiteral("turn");
         break;
       }
-    case CSS_RECT :
+    case CSSPrimitiveValueBinding::CSS_RECT:
       {
         NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null");
         NS_NAMED_LITERAL_STRING(comma, ", ");
         nsAutoString sideValue;
         tmpStr.AssignLiteral("rect(");
         // get the top
         result = mValue.mRect->Top()->GetCssText(sideValue);
         if (NS_FAILED(result))
@@ -190,17 +200,17 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
         tmpStr.Append(sideValue + comma);
         // get the left
         result = mValue.mRect->Left()->GetCssText(sideValue);
         if (NS_FAILED(result))
           break;
         tmpStr.Append(sideValue + NS_LITERAL_STRING(")"));
         break;
       }
-    case CSS_RGBCOLOR :
+    case CSSPrimitiveValueBinding::CSS_RGBCOLOR:
       {
         NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null");
         ErrorResult error;
         NS_NAMED_LITERAL_STRING(comma, ", ");
         nsAutoString colorValue;
         if (mValue.mColor->HasAlpha())
           tmpStr.AssignLiteral("rgba(");
         else
@@ -231,34 +241,34 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
             break;
           tmpStr.Append(comma + colorValue);
         }
 
         tmpStr.Append(')');
 
         break;
       }
-    case CSS_S :
+    case CSSPrimitiveValueBinding::CSS_S:
       {
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         tmpStr.Append('s');
         break;
       }
-    case CSS_CM :
-    case CSS_MM :
-    case CSS_IN :
-    case CSS_PT :
-    case CSS_PC :
-    case CSS_UNKNOWN :
-    case CSS_EMS :
-    case CSS_EXS :
-    case CSS_MS :
-    case CSS_HZ :
-    case CSS_KHZ :
-    case CSS_DIMENSION :
+    case CSSPrimitiveValueBinding::CSS_CM:
+    case CSSPrimitiveValueBinding::CSS_MM:
+    case CSSPrimitiveValueBinding::CSS_IN:
+    case CSSPrimitiveValueBinding::CSS_PT:
+    case CSSPrimitiveValueBinding::CSS_PC:
+    case CSSPrimitiveValueBinding::CSS_UNKNOWN:
+    case CSSPrimitiveValueBinding::CSS_EMS:
+    case CSSPrimitiveValueBinding::CSS_EXS:
+    case CSSPrimitiveValueBinding::CSS_MS:
+    case CSSPrimitiveValueBinding::CSS_HZ:
+    case CSSPrimitiveValueBinding::CSS_KHZ:
+    case CSSPrimitiveValueBinding::CSS_DIMENSION:
       NS_ERROR("We have a bogus value set.  This should not happen");
       return NS_ERROR_DOM_INVALID_ACCESS_ERR;
   }
 
   if (NS_SUCCEEDED(result)) {
     aCssText.Assign(tmpStr);
   }
 
@@ -293,222 +303,183 @@ nsROCSSPrimitiveValue::GetCssValueType(u
 }
 
 uint16_t
 nsROCSSPrimitiveValue::CssValueType() const
 {
   return nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
 }
 
-
-// nsIDOMCSSPrimitiveValue
-
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::GetPrimitiveType(uint16_t* aPrimitiveType)
-{
-  NS_ENSURE_ARG_POINTER(aPrimitiveType);
-  *aPrimitiveType = PrimitiveType();
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::SetFloatValue(uint16_t aUnitType, float aFloatValue)
-{
-  return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
-}
-
 void
 nsROCSSPrimitiveValue::SetFloatValue(uint16_t aType, float aVal,
                                      ErrorResult& aRv)
 {
-  aRv = SetFloatValue(aType, aVal);
+  aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
 }
 
 float
 nsROCSSPrimitiveValue::GetFloatValue(uint16_t aUnitType, ErrorResult& aRv)
 {
   switch(aUnitType) {
-    case CSS_PX :
-      if (mType == CSS_PX) {
+    case CSSPrimitiveValueBinding::CSS_PX:
+      if (mType == CSSPrimitiveValueBinding::CSS_PX) {
         return nsPresContext::AppUnitsToFloatCSSPixels(mValue.mAppUnits);
       }
 
       break;
-    case CSS_CM :
-      if (mType == CSS_PX) {
+    case CSSPrimitiveValueBinding::CSS_CM:
+      if (mType == CSSPrimitiveValueBinding::CSS_PX) {
         return mValue.mAppUnits * CM_PER_INCH_FLOAT /
           nsPresContext::AppUnitsPerCSSInch();
       }
 
       break;
-    case CSS_MM :
-      if (mType == CSS_PX) {
+    case CSSPrimitiveValueBinding::CSS_MM:
+      if (mType == CSSPrimitiveValueBinding::CSS_PX) {
         return mValue.mAppUnits * MM_PER_INCH_FLOAT /
           nsPresContext::AppUnitsPerCSSInch();
       }
 
       break;
-    case CSS_IN :
-      if (mType == CSS_PX) {
+    case CSSPrimitiveValueBinding::CSS_IN:
+      if (mType == CSSPrimitiveValueBinding::CSS_PX) {
         return mValue.mAppUnits / nsPresContext::AppUnitsPerCSSInch();
       }
 
       break;
-    case CSS_PT :
-      if (mType == CSS_PX) {
+    case CSSPrimitiveValueBinding::CSS_PT:
+      if (mType == CSSPrimitiveValueBinding::CSS_PX) {
         return mValue.mAppUnits * POINTS_PER_INCH_FLOAT /
           nsPresContext::AppUnitsPerCSSInch();
       }
 
       break;
-    case CSS_PC :
-      if (mType == CSS_PX) {
+    case CSSPrimitiveValueBinding::CSS_PC:
+      if (mType == CSSPrimitiveValueBinding::CSS_PX) {
         return mValue.mAppUnits * 6.0f /
           nsPresContext::AppUnitsPerCSSInch();
       }
 
       break;
-    case CSS_PERCENTAGE :
-      if (mType == CSS_PERCENTAGE) {
+    case CSSPrimitiveValueBinding::CSS_PERCENTAGE:
+      if (mType == CSSPrimitiveValueBinding::CSS_PERCENTAGE) {
         return mValue.mFloat * 100;
       }
 
       break;
-    case CSS_NUMBER :
-      if (mType == CSS_NUMBER) {
+    case CSSPrimitiveValueBinding::CSS_NUMBER:
+      if (mType == CSSPrimitiveValueBinding::CSS_NUMBER) {
         return mValue.mFloat;
       }
       if (mType == CSS_NUMBER_INT32) {
         return mValue.mInt32;
       }
       if (mType == CSS_NUMBER_UINT32) {
         return mValue.mUint32;
       }
 
       break;
-    case CSS_UNKNOWN :
-    case CSS_EMS :
-    case CSS_EXS :
-    case CSS_DEG :
-    case CSS_RAD :
-    case CSS_GRAD :
-    case CSS_MS :
-    case CSS_S :
-    case CSS_HZ :
-    case CSS_KHZ :
-    case CSS_DIMENSION :
-    case CSS_STRING :
-    case CSS_URI :
-    case CSS_IDENT :
-    case CSS_ATTR :
-    case CSS_COUNTER :
-    case CSS_RECT :
-    case CSS_RGBCOLOR :
+    case CSSPrimitiveValueBinding::CSS_UNKNOWN:
+    case CSSPrimitiveValueBinding::CSS_EMS:
+    case CSSPrimitiveValueBinding::CSS_EXS:
+    case CSSPrimitiveValueBinding::CSS_DEG:
+    case CSSPrimitiveValueBinding::CSS_RAD:
+    case CSSPrimitiveValueBinding::CSS_GRAD:
+    case CSSPrimitiveValueBinding::CSS_MS:
+    case CSSPrimitiveValueBinding::CSS_S:
+    case CSSPrimitiveValueBinding::CSS_HZ:
+    case CSSPrimitiveValueBinding::CSS_KHZ:
+    case CSSPrimitiveValueBinding::CSS_DIMENSION:
+    case CSSPrimitiveValueBinding::CSS_STRING:
+    case CSSPrimitiveValueBinding::CSS_URI:
+    case CSSPrimitiveValueBinding::CSS_IDENT:
+    case CSSPrimitiveValueBinding::CSS_ATTR:
+    case CSSPrimitiveValueBinding::CSS_COUNTER:
+    case CSSPrimitiveValueBinding::CSS_RECT:
+    case CSSPrimitiveValueBinding::CSS_RGBCOLOR:
       break;
   }
 
   aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
   return 0;
 }
 
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::GetFloatValue(uint16_t aType, float *aVal)
-{
-  ErrorResult rv;
-  *aVal = GetFloatValue(aType, rv);
-  return rv.StealNSResult();
-}
-
-
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::SetStringValue(uint16_t aStringType,
-                                      const nsAString& aStringValue)
-{
-  return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
-}
-
 void
 nsROCSSPrimitiveValue::SetStringValue(uint16_t aType, const nsAString& aString,
                                       mozilla::ErrorResult& aRv)
 {
   aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
 }
 
-
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::GetStringValue(nsAString& aReturn)
+void
+nsROCSSPrimitiveValue::GetStringValue(nsString& aReturn, ErrorResult& aRv)
 {
   switch (mType) {
-    case CSS_IDENT:
+    case CSSPrimitiveValueBinding::CSS_IDENT:
       CopyUTF8toUTF16(nsCSSKeywords::GetStringValue(mValue.mKeyword), aReturn);
       break;
-    case CSS_STRING:
-    case CSS_ATTR:
+    case CSSPrimitiveValueBinding::CSS_STRING:
+    case CSSPrimitiveValueBinding::CSS_ATTR:
       aReturn.Assign(mValue.mString);
       break;
-    case CSS_URI: {
+    case CSSPrimitiveValueBinding::CSS_URI: {
       nsAutoCString spec;
       if (mValue.mURI) {
         nsresult rv = mValue.mURI->GetSpec(spec);
-        NS_ENSURE_SUCCESS(rv, rv);
+        if (NS_FAILED(rv)) {
+          aRv.Throw(rv);
+          return;
+        }
       }
       CopyUTF8toUTF16(spec, aReturn);
       break;
     }
     default:
       aReturn.Truncate();
-      return NS_ERROR_DOM_INVALID_ACCESS_ERR;
+      aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
+      return;
   }
-  return NS_OK;
 }
 
 void
 nsROCSSPrimitiveValue::GetCounterValue(ErrorResult& aRv)
 {
   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
 }
 
-void
-nsROCSSPrimitiveValue::GetStringValue(nsString& aString, ErrorResult& aRv)
-{
-  aRv = GetStringValue(aString);
-}
-
 nsDOMCSSRect*
 nsROCSSPrimitiveValue::GetRectValue(ErrorResult& aRv)
 {
-  if (mType != CSS_RECT) {
+  if (mType != CSSPrimitiveValueBinding::CSS_RECT) {
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return nullptr;
   }
 
   NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null");
   return mValue.mRect;
 }
 
 nsDOMCSSRGBColor*
 nsROCSSPrimitiveValue::GetRGBColorValue(ErrorResult& aRv)
 {
-  if (mType != CSS_RGBCOLOR) {
+  if (mType != CSSPrimitiveValueBinding::CSS_RGBCOLOR) {
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return nullptr;
   }
 
   NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null");
   return mValue.mColor;
 }
 
 void
 nsROCSSPrimitiveValue::SetNumber(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
-  mType = CSS_NUMBER;
+  mType = CSSPrimitiveValueBinding::CSS_NUMBER;
 }
 
 void
 nsROCSSPrimitiveValue::SetNumber(int32_t aValue)
 {
   Reset();
   mValue.mInt32 = aValue;
   mType = CSS_NUMBER_INT32;
@@ -522,171 +493,186 @@ nsROCSSPrimitiveValue::SetNumber(uint32_
   mType = CSS_NUMBER_UINT32;
 }
 
 void
 nsROCSSPrimitiveValue::SetPercent(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
-  mType = CSS_PERCENTAGE;
+  mType = CSSPrimitiveValueBinding::CSS_PERCENTAGE;
 }
 
 void
 nsROCSSPrimitiveValue::SetDegree(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
-  mType = CSS_DEG;
+  mType = CSSPrimitiveValueBinding::CSS_DEG;
 }
 
 void
 nsROCSSPrimitiveValue::SetGrad(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
-  mType = CSS_GRAD;
+  mType = CSSPrimitiveValueBinding::CSS_GRAD;
 }
 
 void
 nsROCSSPrimitiveValue::SetRadian(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
-  mType = CSS_RAD;
+  mType = CSSPrimitiveValueBinding::CSS_RAD;
 }
 
 void
 nsROCSSPrimitiveValue::SetTurn(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
   mType = CSS_TURN;
 }
 
 void
 nsROCSSPrimitiveValue::SetAppUnits(nscoord aValue)
 {
   Reset();
   mValue.mAppUnits = aValue;
-  mType = CSS_PX;
+  mType = CSSPrimitiveValueBinding::CSS_PX;
 }
 
 void
 nsROCSSPrimitiveValue::SetAppUnits(float aValue)
 {
   SetAppUnits(NSToCoordRound(aValue));
 }
 
 void
 nsROCSSPrimitiveValue::SetIdent(nsCSSKeyword aKeyword)
 {
   NS_PRECONDITION(aKeyword != eCSSKeyword_UNKNOWN &&
                   0 <= aKeyword && aKeyword < eCSSKeyword_COUNT,
                   "bad keyword");
   Reset();
   mValue.mKeyword = aKeyword;
-  mType = CSS_IDENT;
+  mType = CSSPrimitiveValueBinding::CSS_IDENT;
 }
 
 // FIXME: CSS_STRING should imply a string with "" and a need for escaping.
 void
 nsROCSSPrimitiveValue::SetString(const nsACString& aString, uint16_t aType)
 {
   Reset();
   mValue.mString = ToNewUnicode(aString);
   if (mValue.mString) {
     mType = aType;
   } else {
     // XXXcaa We should probably let the caller know we are out of memory
-    mType = CSS_UNKNOWN;
+    mType = CSSPrimitiveValueBinding::CSS_UNKNOWN;
   }
 }
 
 // FIXME: CSS_STRING should imply a string with "" and a need for escaping.
 void
 nsROCSSPrimitiveValue::SetString(const nsAString& aString, uint16_t aType)
 {
   Reset();
   mValue.mString = ToNewUnicode(aString);
   if (mValue.mString) {
     mType = aType;
   } else {
     // XXXcaa We should probably let the caller know we are out of memory
-    mType = CSS_UNKNOWN;
+    mType = CSSPrimitiveValueBinding::CSS_UNKNOWN;
   }
 }
 
 void
 nsROCSSPrimitiveValue::SetURI(nsIURI *aURI)
 {
   Reset();
   mValue.mURI = aURI;
   NS_IF_ADDREF(mValue.mURI);
-  mType = CSS_URI;
+  mType = CSSPrimitiveValueBinding::CSS_URI;
 }
 
 void
 nsROCSSPrimitiveValue::SetColor(nsDOMCSSRGBColor* aColor)
 {
   NS_PRECONDITION(aColor, "Null RGBColor being set!");
   Reset();
   mValue.mColor = aColor;
   if (mValue.mColor) {
     NS_ADDREF(mValue.mColor);
-    mType = CSS_RGBCOLOR;
+    mType = CSSPrimitiveValueBinding::CSS_RGBCOLOR;
   }
   else {
-    mType = CSS_UNKNOWN;
+    mType = CSSPrimitiveValueBinding::CSS_UNKNOWN;
   }
 }
 
 void
 nsROCSSPrimitiveValue::SetRect(nsDOMCSSRect* aRect)
 {
   NS_PRECONDITION(aRect, "Null rect being set!");
   Reset();
   mValue.mRect = aRect;
   if (mValue.mRect) {
     NS_ADDREF(mValue.mRect);
-    mType = CSS_RECT;
+    mType = CSSPrimitiveValueBinding::CSS_RECT;
   }
   else {
-    mType = CSS_UNKNOWN;
+    mType = CSSPrimitiveValueBinding::CSS_UNKNOWN;
   }
 }
 
 void
 nsROCSSPrimitiveValue::SetTime(float aValue)
 {
   Reset();
   mValue.mFloat = aValue;
-  mType = CSS_S;
+  mType = CSSPrimitiveValueBinding::CSS_S;
 }
 
 void
 nsROCSSPrimitiveValue::Reset()
 {
   switch (mType) {
-    case CSS_IDENT:
+    case CSSPrimitiveValueBinding::CSS_IDENT:
       break;
-    case CSS_STRING:
-    case CSS_ATTR:
-    case CSS_COUNTER: // FIXME: Counter should use an object
+    case CSSPrimitiveValueBinding::CSS_STRING:
+    case CSSPrimitiveValueBinding::CSS_ATTR:
+    case CSSPrimitiveValueBinding::CSS_COUNTER: // FIXME: Counter should use an object
       NS_ASSERTION(mValue.mString, "Null string should never happen");
       free(mValue.mString);
       mValue.mString = nullptr;
       break;
-    case CSS_URI:
+    case CSSPrimitiveValueBinding::CSS_URI:
       NS_IF_RELEASE(mValue.mURI);
       break;
-    case CSS_RECT:
+    case CSSPrimitiveValueBinding::CSS_RECT:
       NS_ASSERTION(mValue.mRect, "Null Rect should never happen");
       NS_RELEASE(mValue.mRect);
       break;
-    case CSS_RGBCOLOR:
+    case CSSPrimitiveValueBinding::CSS_RGBCOLOR:
       NS_ASSERTION(mValue.mColor, "Null RGBColor should never happen");
       NS_RELEASE(mValue.mColor);
       break;
   }
 
-  mType = CSS_UNKNOWN;
+  mType = CSSPrimitiveValueBinding::CSS_UNKNOWN;
 }
+
+uint16_t
+nsROCSSPrimitiveValue::PrimitiveType()
+{
+  // New value types were introduced but not added to CSS OM.
+  // Return CSS_UNKNOWN to avoid exposing CSS_TURN to content.
+  if (mType > CSSPrimitiveValueBinding::CSS_RGBCOLOR) {
+    if (mType == CSS_NUMBER_INT32 ||
+        mType == CSS_NUMBER_UINT32) {
+      return CSSPrimitiveValueBinding::CSS_NUMBER;
+    }
+    return CSSPrimitiveValueBinding::CSS_UNKNOWN;
+  }
+  return mType;
+}
--- a/layout/style/nsROCSSPrimitiveValue.h
+++ b/layout/style/nsROCSSPrimitiveValue.h
@@ -5,72 +5,49 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* DOM object representing values in DOM computed style */
 
 #ifndef nsROCSSPrimitiveValue_h___
 #define nsROCSSPrimitiveValue_h___
 
 #include "nsIDOMCSSValue.h"
-#include "nsIDOMCSSPrimitiveValue.h"
+#include "mozilla/dom/CSSPrimitiveValueBinding.h"
+#include "mozilla/dom/CSSValueBinding.h"
+
 #include "nsCSSKeywords.h"
 #include "CSSValue.h"
 #include "nsCOMPtr.h"
 #include "nsCoord.h"
 
 class nsIURI;
 class nsDOMCSSRect;
 class nsDOMCSSRGBColor;
 
-// There is no CSS_TURN constant on the CSSPrimitiveValue interface,
-// since that unit is newer than DOM Level 2 Style, and CSS OM will
-// probably expose CSS values in some other way in the future.  We
-// use this value in mType for "turn"-unit angles, but we define it
-// here to avoid exposing it to content.
-#define CSS_TURN 30U
-// Likewise we have some internal aliases for CSS_NUMBER that we don't
-// want to expose.
-#define CSS_NUMBER_INT32 31U
-#define CSS_NUMBER_UINT32 32U
-
 /**
  * Read-only CSS primitive value - a DOM object representing values in DOM
  * computed style.
  */
 class nsROCSSPrimitiveValue final : public mozilla::dom::CSSValue,
-                                    public nsIDOMCSSPrimitiveValue
+                                    public nsIDOMCSSValue
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsROCSSPrimitiveValue, mozilla::dom::CSSValue)
 
-  // nsIDOMCSSPrimitiveValue
-  NS_DECL_NSIDOMCSSPRIMITIVEVALUE
-
   // nsIDOMCSSValue
   NS_DECL_NSIDOMCSSVALUE
 
   // CSSValue
   virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) override final;
   virtual void SetCssText(const nsAString& aText, mozilla::ErrorResult& aRv) override final;
   virtual uint16_t CssValueType() const override final;
 
   // CSSPrimitiveValue
-  uint16_t PrimitiveType()
-  {
-    // New value types were introduced but not added to CSS OM.
-    // Return CSS_UNKNOWN to avoid exposing CSS_TURN to content.
-    if (mType > CSS_RGBCOLOR) {
-      if (mType == CSS_NUMBER_INT32 || mType == CSS_NUMBER_UINT32) {
-        return CSS_NUMBER;
-      }
-      return CSS_UNKNOWN;
-    }
-    return mType;
-  }
+  uint16_t PrimitiveType();
   void SetFloatValue(uint16_t aUnitType, float aValue,
                      mozilla::ErrorResult& aRv);
   float GetFloatValue(uint16_t aUnitType, mozilla::ErrorResult& aRv);
   void GetStringValue(nsString& aString, mozilla::ErrorResult& aRv);
   void SetStringValue(uint16_t aUnitType, const nsAString& aString,
                       mozilla::ErrorResult& aRv);
   void GetCounterValue(mozilla::ErrorResult& aRv);
   nsDOMCSSRect* GetRectValue(mozilla::ErrorResult& aRv);
@@ -86,19 +63,23 @@ public:
   void SetDegree(float aValue);
   void SetGrad(float aValue);
   void SetRadian(float aValue);
   void SetTurn(float aValue);
   void SetAppUnits(nscoord aValue);
   void SetAppUnits(float aValue);
   void SetIdent(nsCSSKeyword aKeyword);
   // FIXME: CSS_STRING should imply a string with "" and a need for escaping.
-  void SetString(const nsACString& aString, uint16_t aType = CSS_STRING);
+  void SetString(
+      const nsACString& aString,
+      uint16_t aType = mozilla::dom::CSSPrimitiveValueBinding::CSS_STRING);
   // FIXME: CSS_STRING should imply a string with "" and a need for escaping.
-  void SetString(const nsAString& aString, uint16_t aType = CSS_STRING);
+  void SetString(
+      const nsAString& aString,
+      uint16_t aType = mozilla::dom::CSSPrimitiveValueBinding::CSS_STRING);
   void SetURI(nsIURI *aURI);
   void SetColor(nsDOMCSSRGBColor* aColor);
   void SetRect(nsDOMCSSRect* aRect);
   void SetTime(float aValue);
   void Reset();
 
   nsISupports* GetParentObject() const
   {
@@ -121,16 +102,16 @@ private:
     nsDOMCSSRGBColor* MOZ_OWNING_REF mColor;
     nsDOMCSSRect* MOZ_OWNING_REF mRect;
     char16_t*      mString;
     nsIURI* MOZ_OWNING_REF mURI;
     nsCSSKeyword    mKeyword;
   } mValue;
 };
 
-inline nsROCSSPrimitiveValue *mozilla::dom::CSSValue::AsPrimitiveValue()
+inline nsROCSSPrimitiveValue*
+mozilla::dom::CSSValue::AsPrimitiveValue()
 {
-  return CssValueType() == nsIDOMCSSValue::CSS_PRIMITIVE_VALUE ?
+  return CssValueType() == CSSValueBinding::CSS_PRIMITIVE_VALUE ?
     static_cast<nsROCSSPrimitiveValue*>(this) : nullptr;
 }
 
 #endif /* nsROCSSPrimitiveValue_h___ */
-
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -14,17 +14,16 @@
 #include "nsIDOMCanvasRenderingContext2D.h"
 #include "nsIDOMCDATASection.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMClientRect.h"
 #include "nsIDOMClientRectList.h"
 #include "nsIDOMClipboardEvent.h"
 #include "nsIDOMCommandEvent.h"
 #include "nsIDOMComment.h"
-#include "nsIDOMCSSPrimitiveValue.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsIDOMCSSValue.h"
 #include "nsIDOMCustomEvent.h"
 #ifdef MOZ_WEBRTC
 #include "nsIDOMDataChannel.h"
 #endif
 #include "nsIDOMDataTransfer.h"
 #include "nsIDOMDOMCursor.h"
@@ -252,17 +251,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(CDATASection),
   DEFINE_SHIM(CharacterData),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRect, DOMRectReadOnly),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRectList, DOMRectList),
   DEFINE_SHIM(ClipboardEvent),
   DEFINE_SHIM(CommandEvent),
   DEFINE_SHIM(Comment),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIContainerBoxObject, ContainerBoxObject),
-  DEFINE_SHIM(CSSPrimitiveValue),
   DEFINE_SHIM(CSSStyleDeclaration),
   DEFINE_SHIM(CSSValue),
   DEFINE_SHIM(CustomEvent),
 #ifdef MOZ_WEBRTC
   DEFINE_SHIM(DataChannel),
 #endif
   DEFINE_SHIM(DataTransfer),
   DEFINE_SHIM(DOMCursor),