Bug 1427512 - Part 25: Remove nsIDOMRect. r=xidorn,bz draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 02 Jan 2018 20:26:58 +1100
changeset 717726 0bafa141fecb81fd922f77900d83b78dedb5d4da
parent 717725 1d6e33efe9fb3efe6c34aedf735f033d4bdef5b0
child 717727 ddd758612be88c6c512ace3a19b9c684e4df4eb2
push id94746
push userbmo:cam@mcc.id.au
push dateTue, 09 Jan 2018 10:21:54 +0000
reviewersxidorn, bz
bugs1427512
milestone59.0a1
Bug 1427512 - Part 25: Remove nsIDOMRect. r=xidorn,bz Although this is changing nsIDOMCSSPrimitiveValue, that interface will go away a couple of patches later. MozReview-Commit-ID: GSisnYWZhHy
dom/interfaces/base/domstubs.idl
dom/interfaces/css/moz.build
dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl
dom/interfaces/css/nsIDOMRect.idl
layout/style/nsDOMCSSRect.cpp
layout/style/nsDOMCSSRect.h
layout/style/nsROCSSPrimitiveValue.cpp
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -55,15 +55,14 @@ interface nsIDOMEventListener;
 interface nsIDOMHTMLElement;
 interface nsIDOMHTMLFormElement;
 interface nsIDOMHTMLHeadElement;
 
 // CSS
 interface nsIDOMCSSValue;
 interface nsIDOMCSSPrimitiveValue;
 interface nsIDOMCSSStyleDeclaration;
-interface nsIDOMRect;
 
 // Range
 interface nsIDOMRange;
 
 // Crypto
 interface nsIDOMCrypto;
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -7,13 +7,12 @@
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
 
 XPIDL_SOURCES += [
     'nsIDOMCSSPrimitiveValue.idl',
     'nsIDOMCSSStyleDeclaration.idl',
     'nsIDOMCSSValue.idl',
     'nsIDOMCSSValueList.idl',
-    'nsIDOMRect.idl',
 ]
 
 XPIDL_MODULE = 'dom_css'
 
--- a/dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl
+++ b/dom/interfaces/css/nsIDOMCSSPrimitiveValue.idl
@@ -50,11 +50,9 @@ interface nsIDOMCSSPrimitiveValue : nsID
                                         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);
-  nsIDOMRect         getRectValue()
-                                        raises(DOMException);
 };
deleted file mode 100644
--- a/dom/interfaces/css/nsIDOMRect.idl
+++ /dev/null
@@ -1,15 +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 "domstubs.idl"
-
-[uuid(71735f62-ac5c-4236-9a1f-5ffb280d531c)]
-interface nsIDOMRect : nsISupports
-{
-  readonly attribute nsIDOMCSSPrimitiveValue  top;
-  readonly attribute nsIDOMCSSPrimitiveValue  right;
-  readonly attribute nsIDOMCSSPrimitiveValue  bottom;
-  readonly attribute nsIDOMCSSPrimitiveValue  left;
-};
--- a/layout/style/nsDOMCSSRect.cpp
+++ b/layout/style/nsDOMCSSRect.cpp
@@ -21,59 +21,22 @@ nsDOMCSSRect::nsDOMCSSRect(nsROCSSPrimit
 {
 }
 
 nsDOMCSSRect::~nsDOMCSSRect(void)
 {
 }
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSRect)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMRect)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSRect)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSRect)
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMCSSRect, mTop, mBottom, mLeft, mRight)
 
 JSObject*
 nsDOMCSSRect::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
 {
  return dom::RectBinding::Wrap(cx, this, aGivenProto);
 }
-
-NS_IMETHODIMP
-nsDOMCSSRect::GetTop(nsIDOMCSSPrimitiveValue** aTop)
-{
-  NS_ENSURE_TRUE(mTop, NS_ERROR_NOT_INITIALIZED);
-  *aTop = mTop;
-  NS_ADDREF(*aTop);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMCSSRect::GetRight(nsIDOMCSSPrimitiveValue** aRight)
-{
-  NS_ENSURE_TRUE(mRight, NS_ERROR_NOT_INITIALIZED);
-  *aRight = mRight;
-  NS_ADDREF(*aRight);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMCSSRect::GetBottom(nsIDOMCSSPrimitiveValue** aBottom)
-{
-  NS_ENSURE_TRUE(mBottom, NS_ERROR_NOT_INITIALIZED);
-  *aBottom = mBottom;
-  NS_ADDREF(*aBottom);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMCSSRect::GetLeft(nsIDOMCSSPrimitiveValue** aLeft)
-{
-  NS_ENSURE_TRUE(mLeft, NS_ERROR_NOT_INITIALIZED);
-  *aLeft = mLeft;
-  NS_ADDREF(*aLeft);
-  return NS_OK;
-}
--- a/layout/style/nsDOMCSSRect.h
+++ b/layout/style/nsDOMCSSRect.h
@@ -5,34 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* DOM object representing rectangle values in DOM computed style */
 
 #ifndef nsDOMCSSRect_h_
 #define nsDOMCSSRect_h_
 
 #include "mozilla/Attributes.h"
-#include "nsIDOMRect.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsWrapperCache.h"
 
 class nsROCSSPrimitiveValue;
 
-class nsDOMCSSRect final : public nsIDOMRect,
+class nsDOMCSSRect final : public nsISupports,
                            public nsWrapperCache
 {
 public:
   nsDOMCSSRect(nsROCSSPrimitiveValue* aTop,
                nsROCSSPrimitiveValue* aRight,
                nsROCSSPrimitiveValue* aBottom,
                nsROCSSPrimitiveValue* aLeft);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_NSIDOMRECT
-
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSRect)
 
   nsROCSSPrimitiveValue* Top() const { return mTop; }
   nsROCSSPrimitiveValue* Right() const { return mRight; }
   nsROCSSPrimitiveValue* Bottom() const { return mBottom; }
   nsROCSSPrimitiveValue* Left() const { return mLeft; }
 
   nsISupports* GetParentObject() const { return nullptr; }
--- a/layout/style/nsROCSSPrimitiveValue.cpp
+++ b/layout/style/nsROCSSPrimitiveValue.cpp
@@ -166,48 +166,35 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
         nsStyleUtil::AppendCSSNumber(mValue.mFloat, tmpStr);
         tmpStr.AppendLiteral("turn");
         break;
       }
     case CSS_RECT :
       {
         NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null");
         NS_NAMED_LITERAL_STRING(comma, ", ");
-        nsCOMPtr<nsIDOMCSSPrimitiveValue> sideCSSValue;
         nsAutoString sideValue;
         tmpStr.AssignLiteral("rect(");
         // get the top
-        result = mValue.mRect->GetTop(getter_AddRefs(sideCSSValue));
-        if (NS_FAILED(result))
-          break;
-        result = sideCSSValue->GetCssText(sideValue);
+        result = mValue.mRect->Top()->GetCssText(sideValue);
         if (NS_FAILED(result))
           break;
         tmpStr.Append(sideValue + comma);
         // get the right
-        result = mValue.mRect->GetRight(getter_AddRefs(sideCSSValue));
-        if (NS_FAILED(result))
-          break;
-        result = sideCSSValue->GetCssText(sideValue);
+        result = mValue.mRect->Right()->GetCssText(sideValue);
         if (NS_FAILED(result))
           break;
         tmpStr.Append(sideValue + comma);
         // get the bottom
-        result = mValue.mRect->GetBottom(getter_AddRefs(sideCSSValue));
-        if (NS_FAILED(result))
-          break;
-        result = sideCSSValue->GetCssText(sideValue);
+        result = mValue.mRect->Bottom()->GetCssText(sideValue);
         if (NS_FAILED(result))
           break;
         tmpStr.Append(sideValue + comma);
         // get the left
-        result = mValue.mRect->GetLeft(getter_AddRefs(sideCSSValue));
-        if (NS_FAILED(result))
-          break;
-        result = sideCSSValue->GetCssText(sideValue);
+        result = mValue.mRect->Left()->GetCssText(sideValue);
         if (NS_FAILED(result))
           break;
         tmpStr.Append(sideValue + NS_LITERAL_STRING(")"));
         break;
       }
     case CSS_RGBCOLOR :
       {
         NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null");
@@ -494,24 +481,16 @@ nsROCSSPrimitiveValue::GetRectValue(Erro
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return nullptr;
   }
 
   NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null");
   return mValue.mRect;
 }
 
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::GetRectValue(nsIDOMRect** aRect)
-{
-  ErrorResult error;
-  NS_IF_ADDREF(*aRect = GetRectValue(error));
-  return error.StealNSResult();
-}
-
 nsDOMCSSRGBColor*
 nsROCSSPrimitiveValue::GetRGBColorValue(ErrorResult& aRv)
 {
   if (mType != CSS_RGBCOLOR) {
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return nullptr;
   }
 
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -59,17 +59,16 @@
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNotifyPaintEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsIDOMPaintRequest.h"
 #include "nsIDOMParser.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMRect.h"
 #include "nsIDOMScreen.h"
 #include "nsIDOMScrollAreaEvent.h"
 #include "nsIDOMSerializer.h"
 #include "nsIDOMSimpleGestureEvent.h"
 #include "nsIDOMSVGElement.h"
 #include "nsIDOMSVGLength.h"
 #include "nsIDOMText.h"
 #include "nsIDOMTimeEvent.h"
@@ -302,17 +301,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(Node),
   DEFINE_SHIM(NotifyPaintEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMNSEvent, Event),
   DEFINE_SHIM(OfflineResourceList),
   DEFINE_SHIM(PaintRequest),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser),
   DEFINE_SHIM(ProcessingInstruction),
   DEFINE_SHIM(Range),
-  DEFINE_SHIM(Rect),
   DEFINE_SHIM(Screen),
   DEFINE_SHIM(ScrollAreaEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIScrollBoxObject, ScrollBoxObject),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
   DEFINE_SHIM(SimpleGestureEvent),
   DEFINE_SHIM(SVGElement),
   DEFINE_SHIM(SVGLength),
   DEFINE_SHIM(Text),