Bug 1478388, Remove now unused nsScriptableRegion.cpp and nsIScriptableRegion, r=mattwoodrow
authorNeil Deakin <neil@mozilla.com>
Mon, 27 Aug 2018 10:57:04 -0400
changeset 488639 e4521c7a8ade622bf979a2eb7f76992f02a3c0c9
parent 488638 14926b250441f89308f971dbcaa2b03ac99dafda
child 488640 ba637657bbf8a6b52fa42a565ec8555997ccd936
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1478388
milestone63.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 1478388, Remove now unused nsScriptableRegion.cpp and nsIScriptableRegion, r=mattwoodrow
gfx/src/moz.build
gfx/src/nsIScriptableRegion.idl
gfx/src/nsScriptableRegion.cpp
gfx/src/nsScriptableRegion.h
gfx/src/nsThebesGfxFactory.cpp
gfx/tests/moz.build
gfx/tests/unit/.eslintrc.js
gfx/tests/unit/test_nsIScriptableRegion.js
gfx/tests/unit/xpcshell.ini
--- a/gfx/src/moz.build
+++ b/gfx/src/moz.build
@@ -1,17 +1,16 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
     'nsIFontEnumerator.idl',
-    'nsIScriptableRegion.idl',
 ]
 
 XPIDL_MODULE = 'gfx'
 
 DEFINES['MOZ_APP_VERSION'] = '"%s"' % CONFIG['MOZ_APP_VERSION']
 
 EXPORTS += [
     'DriverCrashGuard.h',
@@ -63,17 +62,16 @@ UNIFIED_SOURCES += [
     'FilterSupport.cpp',
     'gfxCrashReporterUtils.cpp',
     'gfxTelemetry.cpp',
     'nsColor.cpp',
     'nsFont.cpp',
     'nsFontMetrics.cpp',
     'nsRect.cpp',
     'nsRegion.cpp',
-    'nsScriptableRegion.cpp',
     'nsThebesFontEnumerator.cpp',
     'nsThebesGfxFactory.cpp',
     'nsTransform2D.cpp',
     'TiledRegion.cpp',
 ]
 
 # nsDeviceContext.cpp cannot be built in unified mode because it pulls in OS X system headers.
 SOURCES += [
deleted file mode 100644
--- a/gfx/src/nsIScriptableRegion.idl
+++ /dev/null
@@ -1,176 +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 "nsISupports.idl"
-
-%{C++
-#include "nsRegionFwd.h"
-%}
-
-native nsIntRegion(nsIntRegion);
-
-
-[scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)]
-interface nsIScriptableRegion : nsISupports
-{
-  void init ( ) ;
-
-  /**
-  * copy operator equivalent that takes another region
-  *
-  * @param      region to copy
-  * @return     void
-  *
-  **/
-
-  void setToRegion ( in nsIScriptableRegion aRegion );
-
-  /**
-  * copy operator equivalent that takes a rect
-  *
-  * @param      aX xoffset of rect to set region to
-  * @param      aY yoffset of rect to set region to
-  * @param      aWidth width of rect to set region to
-  * @param      aHeight height of rect to set region to
-  * @return     void
-  *
-  **/
-
-  void setToRect ( in long aX, in long aY, in long aWidth, in long aHeight );
-
-  /**
-  * destructively intersect another region with this one
-  *
-  * @param      region to intersect
-  * @return     void
-  *
-  **/
-
-  void intersectRegion ( in nsIScriptableRegion aRegion ) ;
-
-  /**
-  * destructively intersect a rect with this region
-  *
-  * @param      aX xoffset of rect to intersect with region
-  * @param      aY yoffset of rect to intersect with region
-  * @param      aWidth width of rect to intersect with region
-  * @param      aHeight height of rect to intersect with region
-  * @return     void
-  *
-  **/
-
-  void intersectRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
-
-  /**
-  * destructively union another region with this one
-  *
-  * @param      region to union
-  * @return     void
-  *
-  **/
-
-  void unionRegion ( in nsIScriptableRegion aRegion ) ;
-
-  /**
-  * destructively union a rect with this region
-  *
-  * @param      aX xoffset of rect to union with region
-  * @param      aY yoffset of rect to union with region
-  * @param      aWidth width of rect to union with region
-  * @param      aHeight height of rect to union with region
-  * @return     void
-  *
-  **/
-
-  void unionRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
-
-  /**
-  * destructively subtract another region with this one
-  *
-  * @param      region to subtract
-  * @return     void
-  *
-  **/
-
-  void subtractRegion ( in nsIScriptableRegion aRegion ) ;
-
-  /**
-  * destructively subtract a rect from this region
-  *
-  * @param      aX xoffset of rect to subtract with region
-  * @param      aY yoffset of rect to subtract with region
-  * @param      aWidth width of rect to subtract with region
-  * @param      aHeight height of rect to subtract with region
-  * @return     void
-  *
-  **/
-
-  void subtractRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
-  
-  /**
-  * is this region empty? i.e. does it contain any pixels
-  *
-  * @param      none
-  * @return     returns whether the region is empty
-  *
-  **/
-
-  boolean isEmpty ( ) ;
-
-  /**
-  * == operator equivalent i.e. do the regions contain exactly
-  * the same pixels
-  *
-  * @param      region to compare
-  * @return     whether the regions are identical
-  *
-  **/
-
-  boolean isEqualRegion ( in nsIScriptableRegion aRegion ) ;
-
-  /**
-  * returns the bounding box of the region i.e. the smallest
-  * rectangle that completely contains the region.        
-  *
-  * @param      aX out parameter for xoffset of bounding rect for region
-  * @param      aY out parameter for yoffset of bounding rect for region
-  * @param      aWidth out parameter for width of bounding rect for region
-  * @param      aHeight out parameter for height of bounding rect for region
-  * @return     void
-  *
-  **/
-  void getBoundingBox ( out long aX, out long aY, out long aWidth, out long aHeight ) ;
-
-  /**
-  * offsets the region in x and y
-  *
-  * @param  xoffset  pixel offset in x
-  * @param  yoffset  pixel offset in y
-  * @return          void
-  *
-  **/
-  void offset ( in long aXOffset, in long aYOffset ) ;
-
-  /**
-   * @return null if there are no rects,
-   * @return flat array of rects,ie [x1,y1,width1,height1,x2...].
-   * The result will contain bogus data if values don't fit in 31 bit
-   **/
-  [implicit_jscontext] jsval getRects();
-
-  /**
-  * does the region intersect the rectangle?
-  *
-  * @param      rect to check for containment
-  * @return     true if the region intersects the rect
-  *
-  **/
-
-  boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
-  
-  [noscript] readonly attribute nsIntRegion region;
-  
-};
deleted file mode 100644
--- a/gfx/src/nsScriptableRegion.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "nsScriptableRegion.h"
-#include <stdint.h>                     // for uint32_t
-#include <sys/types.h>                  // for int32_t
-#include "js/RootingAPI.h"              // for Rooted
-#include "js/Value.h"                   // for INT_TO_JSVAL, etc
-#include "jsapi.h"                      // for JS_DefineElement, etc
-#include "mozilla/Assertions.h"         // for MOZ_ASSERT_HELPER2
-#include "nsError.h"                    // for NS_OK, NS_ERROR_FAILURE, etc
-#include "nsID.h"
-#include "nsRect.h"                     // for mozilla::gfx::IntRect
-#include "nscore.h"                     // for NS_IMETHODIMP
-
-class JSObject;
-struct JSContext;
-
-nsScriptableRegion::nsScriptableRegion()
-{
-}
-
-NS_IMPL_ISUPPORTS(nsScriptableRegion, nsIScriptableRegion)
-
-NS_IMETHODIMP nsScriptableRegion::Init()
-{
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::SetToRegion(nsIScriptableRegion *aRegion)
-{
-  aRegion->GetRegion(&mRegion);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::SetToRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
-{
-  mRegion = mozilla::gfx::IntRect(aX, aY, aWidth, aHeight);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::IntersectRegion(nsIScriptableRegion *aRegion)
-{
-  nsIntRegion region;
-  aRegion->GetRegion(&region);
-  mRegion.And(mRegion, region);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::IntersectRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
-{
-  mRegion.And(mRegion, mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::UnionRegion(nsIScriptableRegion *aRegion)
-{
-  nsIntRegion region;
-  aRegion->GetRegion(&region);
-  mRegion.Or(mRegion, region);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::UnionRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
-{
-  mRegion.Or(mRegion, mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::SubtractRegion(nsIScriptableRegion *aRegion)
-{
-  nsIntRegion region;
-  aRegion->GetRegion(&region);
-  mRegion.Sub(mRegion, region);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::SubtractRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight)
-{
-  mRegion.Sub(mRegion, mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::IsEmpty(bool *isEmpty)
-{
-  *isEmpty = mRegion.IsEmpty();
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::IsEqualRegion(nsIScriptableRegion *aRegion, bool *isEqual)
-{
-  nsIntRegion region;
-  aRegion->GetRegion(&region);
-  *isEqual = mRegion.IsEqual(region);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::GetBoundingBox(int32_t *aX, int32_t *aY, int32_t *aWidth, int32_t *aHeight)
-{
-  mozilla::gfx::IntRect boundRect = mRegion.GetBounds();
-  boundRect.GetRect(aX, aY, aWidth, aHeight);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::Offset(int32_t aXOffset, int32_t aYOffset)
-{
-  mRegion.MoveBy(aXOffset, aYOffset);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::ContainsRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool *containsRect)
-{
-  *containsRect = mRegion.Contains(mozilla::gfx::IntRect(aX, aY, aWidth, aHeight));
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP nsScriptableRegion::GetRegion(nsIntRegion* outRgn)
-{
-  *outRgn = mRegion;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::MutableHandle<JS::Value> aRects)
-{
-  uint32_t numRects = mRegion.GetNumRects();
-
-  if (!numRects) {
-    aRects.setNull();
-    return NS_OK;
-  }
-
-  JS::Rooted<JSObject*> destArray(aCx, JS_NewArrayObject(aCx, numRects * 4));
-  if (!destArray) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  aRects.setObject(*destArray);
-
-  uint32_t n = 0;
-  for (auto iter = mRegion.RectIter(); !iter.Done(); iter.Next()) {
-    const mozilla::gfx::IntRect& rect = iter.Get();
-    if (!JS_DefineElement(aCx, destArray, n, rect.X(), JSPROP_ENUMERATE) ||
-        !JS_DefineElement(aCx, destArray, n + 1, rect.Y(), JSPROP_ENUMERATE) ||
-        !JS_DefineElement(aCx, destArray, n + 2, rect.Width(), JSPROP_ENUMERATE) ||
-        !JS_DefineElement(aCx, destArray, n + 3, rect.Height(), JSPROP_ENUMERATE)) {
-      return NS_ERROR_FAILURE;
-    }
-    n += 4;
-  }
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/gfx/src/nsScriptableRegion.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef nsScriptableRegion_h
-#define nsScriptableRegion_h
-
-#include "nsIScriptableRegion.h"
-#include "nsISupports.h"
-#include "nsRegion.h"
-#include "mozilla/Attributes.h"
-
-class nsScriptableRegion final : public nsIScriptableRegion {
-public:
-	nsScriptableRegion();
-
-	NS_DECL_ISUPPORTS
-
-	NS_DECL_NSISCRIPTABLEREGION
-
-private:
-        ~nsScriptableRegion() {}
-	nsIntRegion mRegion;
-};
-
-#endif
--- a/gfx/src/nsThebesGfxFactory.cpp
+++ b/gfx/src/nsThebesGfxFactory.cpp
@@ -9,50 +9,30 @@
 #include "mozilla/Attributes.h"         // for final
 #include "mozilla/Module.h"             // for Module, Module::CIDEntry, etc
 #include "mozilla/ModuleUtils.h"
 #include "mozilla/mozalloc.h"           // for operator new
 #include "nsCOMPtr.h"                   // for nsCOMPtr
 #include "nsError.h"                    // for NS_ERROR_NO_AGGREGATION, etc
 #include "nsGfxCIID.h"                  // for NS_FONT_ENUMERATOR_CID, etc
 #include "nsID.h"                       // for NS_DEFINE_NAMED_CID, etc
-#include "nsIScriptableRegion.h"        // for nsIScriptableRegion
 #include "nsISupports.h"                // for NS_DECL_ISUPPORTS, etc
-#include "nsScriptableRegion.h"         // for nsScriptableRegion
 #include "nsThebesFontEnumerator.h"     // for nsThebesFontEnumerator
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator)
 
-static nsresult
-nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
-{
-  if (!aResult) {
-    return NS_ERROR_NULL_POINTER;
-  }
-  *aResult = nullptr;
-  if (aOuter) {
-    return NS_ERROR_NO_AGGREGATION;
-  }
-
-  nsCOMPtr<nsIScriptableRegion> scriptableRgn = new nsScriptableRegion();
-  return scriptableRgn->QueryInterface(aIID, aResult);
-}
-
 NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID);
-NS_DEFINE_NAMED_CID(NS_SCRIPTABLE_REGION_CID);
 
 static const mozilla::Module::CIDEntry kThebesCIDs[] = {
     { &kNS_FONT_ENUMERATOR_CID, false, nullptr, nsThebesFontEnumeratorConstructor },
-    { &kNS_SCRIPTABLE_REGION_CID, false, nullptr, nsScriptableRegionConstructor },
     { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kThebesContracts[] = {
     { "@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID },
-    { "@mozilla.org/gfx/region;1", &kNS_SCRIPTABLE_REGION_CID },
     { nullptr }
 };
 
 static const mozilla::Module kThebesModule = {
     mozilla::Module::kVersion,
     kThebesCIDs,
     kThebesContracts,
     nullptr,
--- a/gfx/tests/moz.build
+++ b/gfx/tests/moz.build
@@ -1,10 +1,9 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
 MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
-MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
\ No newline at end of file
+MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
deleted file mode 100644
--- a/gfx/tests/unit/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/xpcshell-test"
-  ]
-};
deleted file mode 100644
--- a/gfx/tests/unit/test_nsIScriptableRegion.js
+++ /dev/null
@@ -1,10 +0,0 @@
-function run_test()
-{
-  let rgn = Cc["@mozilla.org/gfx/region;1"].createInstance(Ci.nsIScriptableRegion);
-  Assert.ok (rgn.getRects() === null)
-  rgn.unionRect(0,0,80,60);
-  Assert.ok (rgn.getRects().toString() == "0,0,80,60")
-  rgn.unionRect(90,70,1,1);
-  Assert.ok (rgn.getRects().toString() == "0,0,80,60,90,70,1,1")
-}
-
deleted file mode 100644
--- a/gfx/tests/unit/xpcshell.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[DEFAULT]
-head = 
-
-[test_nsIScriptableRegion.js]