Backed out 7 changesets (bug 966591) for mochitest leaks on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 21 Feb 2014 10:39:15 -0500
changeset 170258 fb8597ff68eaa59c1f61542b0caebd871fafb220
parent 170257 6ce5b0f27bd593b3c6789a0fc6bc58175ab99dbd
child 170259 00d8b2e04b15f34735f1879c416e8c9f79182e34
child 170284 4818975084a1e420c151028994128b06d96bf9df
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs966591
milestone30.0a1
backs outb44289e756fc6d47cb6dbde058b0dc027d58868f
c428b424ef95c6915256592b79521f83ba8761cf
9ac56da106462eec6ea78bbd5d335c181b74ac67
81ba9bddd84e9ff432d81b4a4bf82f26d4e573bb
0c66968c2edde8fee83222f4b39f26033fabf64e
261a1ca9045cc6ca3379fcd0e6d8fc1bc7938db3
895728963f16b6c51a7ed5c2f8fd0abe6d57fed4
Backed out 7 changesets (bug 966591) for mochitest leaks on a CLOSED TREE. Backed out changeset b44289e756fc (bug 966591) Backed out changeset c428b424ef95 (bug 966591) Backed out changeset 9ac56da10646 (bug 966591) Backed out changeset 81ba9bddd84e (bug 966591) Backed out changeset 0c66968c2edd (bug 966591) Backed out changeset 261a1ca9045c (bug 966591) Backed out changeset 895728963f16 (bug 966591)
accessible/src/generic/Accessible.cpp
accessible/tests/mochitest/elm/a11y.ini
accessible/tests/mochitest/elm/test_canvas.html
content/base/src/nsGkAtomList.h
content/canvas/src/CanvasRenderingContext2D.cpp
content/canvas/src/CanvasRenderingContext2D.h
content/canvas/test/test_canvas.html
dom/webidl/CanvasRenderingContext2D.webidl
modules/libpref/src/init/all.js
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -914,37 +914,17 @@ Accessible::GetDeepestChildAtPoint(int32
   NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDeepestChild));
   return NS_OK;
 }
 
 void
 Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame)
 {
   nsIFrame* frame = GetFrame();
-  if (frame && mContent) {
-    nsRect* hitRegionRect = static_cast<nsRect*>(mContent->GetProperty(nsGkAtoms::hitregion));
-
-    if (hitRegionRect) {
-      // This is for canvas fallback content
-      // Find a canvas frame the found hit region is relative to.
-      nsIFrame* canvasFrame = frame->GetParent();
-      while (canvasFrame && (canvasFrame->GetType() != nsGkAtoms::HTMLCanvasFrame))
-        canvasFrame = canvasFrame->GetParent();
-
-      // make the canvas the bounding frame
-      if (canvasFrame) {
-        *aBoundingFrame = canvasFrame;
-
-        nsPresContext* presContext = mDoc->PresContext();
-        aTotalBounds = *hitRegionRect;
-
-        return;
-      }
-    }
-
+  if (frame) {
     *aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
     aTotalBounds = nsLayoutUtils::
       GetAllInFlowRectsUnion(frame, *aBoundingFrame,
                              nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
   }
 }
 
 /* void getBounds (out long x, out long y, out long width, out long height); */
--- a/accessible/tests/mochitest/elm/a11y.ini
+++ b/accessible/tests/mochitest/elm/a11y.ini
@@ -1,8 +1,7 @@
 [DEFAULT]
 
 [test_HTMLSpec.html]
 [test_figure.html]
 [test_listbox.xul]
 [test_nsApplicationAcc.html]
 [test_plugin.html]
-[test_canvas.html]
deleted file mode 100644
--- a/accessible/tests/mochitest/elm/test_canvas.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title>Accessible boundaries for hit regions</title>
-  <link rel="stylesheet" type="text/css"
-        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-
-  <script type="application/javascript"
-          src="../common.js"></script>
-  <script type="application/javascript"
-          src="../role.js"></script>
-  <script type="application/javascript"
-          src="../layout.js"></script>
-
-  <script type="application/javascript">
-  SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
-
-    function doTest()
-    {
-      var canv = document.getElementById("c");
-      var context = canv.getContext('2d');
-      var element = document.getElementById("showA");
-      context.beginPath();
-      context.rect(10, 10, 150, 100);
-      context.addHitRegion({control: element});
-      var input = getAccessible("showA");
-      var input = getAccessible("showA");
-      var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv);
-      var [accX, accY, accWidth, accHeight] = getBounds(input);
-      is(accX, cnvX + 10, "accX should be 10 and not " + accX);
-      is(accY, cnvY + 10, "accY should be 10 and not " + accY);
-      is(accWidth, 150, "accWidth should be 150 and not " + accWidth);
-      is(accHeight, 100, "accHeight should be 100 and not " + accHeight);
-
-      SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
-      SimpleTest.finish();
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    addA11yLoadEvent(doTest);
-  </script>
-</head>
-<body>
-
-  <canvas id="c">
-    <input id="showA" type="checkbox"><label for="showA"> Show As </label>
-  </canvas>
-
-</body>
-</html>
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -2156,17 +2156,16 @@ GK_ATOM(containerLiveRole, "container-li
 GK_ATOM(containerRelevant, "container-relevant")
 GK_ATOM(cycles, "cycles")
 GK_ATOM(datatable, "datatable")
 GK_ATOM(directory, "directory")
 GK_ATOM(eventFromInput, "event-from-input")
 GK_ATOM(grammar, "grammar")
 GK_ATOM(gridcell, "gridcell")
 GK_ATOM(heading, "heading")
-GK_ATOM(hitregion, "hitregion")
 GK_ATOM(InlineBlockFrame, "InlineBlockFrame")
 GK_ATOM(inlinevalue, "inline")
 GK_ATOM(invalid, "invalid")
 GK_ATOM(item, "item")
 GK_ATOM(itemset, "itemset")
 GK_ATOM(lineNumber, "line-number")
 GK_ATOM(linkedPanel, "linkedpanel")
 GK_ATOM(live, "live")
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -2350,88 +2350,16 @@ CanvasRenderingContext2D::MeasureText(co
   error = DrawOrMeasureText(rawText, 0, 0, maxWidth, TEXT_DRAW_OPERATION_MEASURE, &width);
   if (error.Failed()) {
     return nullptr;
   }
 
   return new TextMetrics(width);
 }
 
-// Callback function, for freeing hit regions bounds values stored in property table
-static void
-ReleaseBBoxPropertyValue(void*    aObject,       /* unused */
-                            nsIAtom* aPropertyName, /* unused */
-                            void*    aPropertyValue,
-                            void*    aData          /* unused */)
-{
-  nsRect* valPtr =
-    static_cast<nsRect*>(aPropertyValue);
-  delete valPtr;
-}
-
-void
-CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorResult& error)
-{
-  // remove old hit region first
-  RemoveHitRegion(options.mId);
-
-  // for now, we require a fallback element
-  if (options.mControl == NULL) {
-    error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
-    return;
-  }
-
-  // check if the control is a descendant of our canvas
-  HTMLCanvasElement* canvas = GetCanvas();
-  bool isDescendant = true;
-  if (!canvas || !nsContentUtils::ContentIsDescendantOf(options.mControl, canvas)) {
-    isDescendant = false;
-  }
-
-  // check if the path is valid
-  EnsureUserSpacePath(CanvasWindingRule::Nonzero);
-  if(!mPath) {
-    error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
-    return;
-  }
-
-  // get the bounds of the current path. They are relative to the canvas
-  mgfx::Rect bounds(mPath->GetBounds(mTarget->GetTransform()));
-  if ((bounds.width == 0) || (bounds.height == 0) || !bounds.IsFinite()) {
-    // The specified region has no pixels.
-    error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
-    return;
-  }
-
-  if (isDescendant) {
-    nsRect* nsBounds = new nsRect();
-    gfxRect rect(bounds.x, bounds.y, bounds.width, bounds.height);
-    *nsBounds = nsLayoutUtils::RoundGfxRectToAppRect(rect, AppUnitsPerCSSPixel());
-    options.mControl->SetProperty(nsGkAtoms::hitregion, nsBounds,
-                                  ReleaseBBoxPropertyValue, true);
-  }
-
-  // finally, add the region to the list if it has an ID
-  if (options.mId.Length() != 0) {
-    mHitRegionsOptions.PutEntry(options.mId)->mElement = options.mControl;
-  }
-}
-
-void
-CanvasRenderingContext2D::RemoveHitRegion(const nsAString& id)
-{
-  RegionInfo* info = mHitRegionsOptions.GetEntry(id);
-  if (!info) {
-    return;
-  }
-
-  info->mElement->UnsetProperty(nsGkAtoms::hitregion);
-  mHitRegionsOptions.RemoveEntry(id);
-}
-
 /**
  * Used for nsBidiPresUtils::ProcessText
  */
 struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcessor
 {
   typedef CanvasRenderingContext2D::ContextState ContextState;
 
   virtual void SetText(const char16_t* text, int32_t length, nsBidiDirection direction)
--- a/content/canvas/src/CanvasRenderingContext2D.h
+++ b/content/canvas/src/CanvasRenderingContext2D.h
@@ -181,19 +181,16 @@ public:
                 const Optional<double>& maxWidth,
                 mozilla::ErrorResult& error);
   void StrokeText(const nsAString& text, double x, double y,
                   const Optional<double>& maxWidth,
                   mozilla::ErrorResult& error);
   TextMetrics*
     MeasureText(const nsAString& rawText, mozilla::ErrorResult& error);
 
-  void AddHitRegion(const HitRegionOptions& options, mozilla::ErrorResult& error);
-  void RemoveHitRegion(const nsAString& id);
-
   void DrawImage(const HTMLImageOrCanvasOrVideoElement& image,
                  double dx, double dy, mozilla::ErrorResult& error)
   {
     DrawImage(image, 0.0, 0.0, 0.0, 0.0, dx, dy, 0.0, 0.0, 0, error);
   }
 
   void DrawImage(const HTMLImageOrCanvasOrVideoElement& image,
                  double dx, double dy, double dw, double dh,
@@ -680,36 +677,16 @@ protected:
 
   /**
     * Number of times we've invalidated before calling redraw
     */
   uint32_t mInvalidateCount;
   static const uint32_t kCanvasMaxInvalidateCount = 100;
 
   /**
-    * State information for hit regions
-    */
-
-  struct RegionInfo : public nsStringHashKey
-  {
-    RegionInfo(const nsAString& aKey) :
-      nsStringHashKey(&aKey)
-    {
-    }
-    RegionInfo(const nsAString *aKey) :
-      nsStringHashKey(aKey)
-    {
-    }
-
-    nsRefPtr<Element> mElement;
-  };
-
-  nsTHashtable<RegionInfo> mHitRegionsOptions;
-
-  /**
     * Returns true if a shadow should be drawn along with a
     * drawing operation.
     */
   bool NeedToDrawShadow()
   {
     const ContextState& state = CurrentState();
 
     // The spec says we should not draw shadows if the operator is OVER.
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -3,17 +3,16 @@
 <script src="/tests/SimpleTest/SimpleTest.js"></script>
 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
 <body>
 <script>
 
 SimpleTest.waitForExplicitFinish();
 const Cc = SpecialPowers.Cc;
 const Cr = SpecialPowers.Cr;
-SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
 
 function IsD2DEnabled() {
     var enabled = false;
 
     try {
         enabled = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).D2DEnabled;
     } catch(e) {}
     
@@ -21573,56 +21572,16 @@ function test_linedash() {
   isPixel(ctx, 120, 25, 0, 255, 0, 255, 0);
   isPixel(ctx, 115, 40, 0, 0, 0, 0, 0);
   isPixel(ctx, 105, 40, 0, 255, 0, 255, 0);
   isPixel(ctx, 90, 35, 0, 0, 0, 0, 0);
   isPixel(ctx, 90, 25, 0, 255, 0, 255, 0);
 }
 </script>
 
-<p>Canvas test: hit regions</p>
-<canvas id="c688" width="150" height="50">
-  <a id="c688_a"></a>
-</canvas>
-<a id="c688_b"></a>
-
-<script type="text/javascript">
-
-function test_hitregions() {
-  var c = document.getElementById("c688");
-  var d = document.getElementById("c688_a");
-  var e = document.getElementById("c688_b");
-
-  var ctx = c.getContext("2d");
-  var _thrown_outer = false;
-  try {
-    ctx.rect(10,10,100,100);
-    ctx.addHitRegion({control: d});
-    ctx.addHitRegion({control: e});
-    ctx.addHitRegion({id: "a", control: d});
-    ctx.addHitRegion({id: "a", control: d});
-    
-    ctx.removeHitRegion("a");
-    ctx.removeHitRegion("a");
-    ctx.removeHitRegion("b");
-  } catch (e) {
-      _thrown_outer = true;
-  }
-  ok(!_thrown_outer, ctx.canvas.id + ' should not throw exception');
-
-  var _thrown = undefined; try {
-    ctx.beginPath();
-    ctx.addHitRegion({control: d});
-  } catch (ex) { _thrown = ex };
-
-  ok(_thrown && _thrown.name == "NotSupportedError", "should throw NotSupportedError");
-
-}
-</script>
-
 <script>
 
 function asyncTestsDone() {
 	if (isDone_test_2d_drawImage_animated_apng &&
 		isDone_test_2d_drawImage_animated_gif) {
 		SimpleTest.finish();
 	} else {
 		setTimeout(asyncTestsDone, 500);
@@ -24910,22 +24869,16 @@ function runTests() {
  }
  try {
   test_linedash();
  } catch(e) {
   throw e;
   ok(false, "unexpected exception thrown in: test_linedash");
  }
  try {
-  test_hitregions();
- } catch(e) {
-  throw e;
-  ok(false, "unexpected exception thrown in: test_linedash");
- }
- try {
   // run this test last since it replaces the getContext method
   test_type_replace();
  } catch (e) {
   ok(false, "unexpected exception thrown in: test_type_replace");
  }
  
  //run the asynchronous tests
  try {
@@ -24935,14 +24888,13 @@ function runTests() {
  }
  try {
   test_2d_drawImage_animated_gif();
  } catch (e) {
   ok(false, "unexpected exception thrown in: test_2d_drawImage_animated_gif");
  }
  
  setTimeout(asyncTestsDone, 500);
- SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
 }
 
 addLoadEvent(runTests);
 
 </script>
--- a/dom/webidl/CanvasRenderingContext2D.webidl
+++ b/dom/webidl/CanvasRenderingContext2D.webidl
@@ -6,28 +6,25 @@
  * The origin of this IDL file is
  * http://www.whatwg.org/specs/web-apps/current-work/
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
+interface HitRegionOptions;
+
 enum CanvasWindingRule { "nonzero", "evenodd" };
 
 dictionary ContextAttributes2D {
   // whether or not we're planning to do a lot of readback operations
   boolean willReadFrequently = false;
 };
 
-dictionary HitRegionOptions {
-  DOMString id = "";
-  Element? control = null;
-};
-
 interface CanvasRenderingContext2D {
 
   // back-reference to the canvas.  Might be null if we're not
   // associated with a canvas.
   readonly attribute HTMLCanvasElement? canvas;
 
   // state
   void save(); // push state on state stack
@@ -111,18 +108,17 @@ interface CanvasRenderingContext2D {
   [Throws, LenientFloat]
   void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double dx, double dy);
   [Throws, LenientFloat]
   void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double dx, double dy, double dw, double dh);
   [Throws, LenientFloat]
   void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
 
   // hit regions
-  [Pref="canvas.hitregions.enabled", Throws] void addHitRegion(optional HitRegionOptions options);
-  [Pref="canvas.hitregions.enabled"] void removeHitRegion(DOMString id);
+// NOT IMPLEMENTED  void addHitRegion(HitRegionOptions options);
 
   // pixel manipulation
   [NewObject, Throws]
   ImageData createImageData(double sw, double sh);
   [NewObject, Throws]
   ImageData createImageData(ImageData imagedata);
   [NewObject, Throws]
   ImageData getImageData(double sx, double sy, double sw, double sh);
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -427,17 +427,16 @@ pref("ui.scrollToClick", 0);
 #else
 // Only on mac tabfocus is expected to handle UI widgets as well as web content
 pref("accessibility.tabfocus_applies_to_xul", true);
 #endif
 
 // provide ability to turn on support for canvas focus rings
 pref("canvas.focusring.enabled", false);
 pref("canvas.customfocusring.enabled", false);
-pref("canvas.hitregions.enabled", false);
 
 // We want the ability to forcibly disable platform a11y, because
 // some non-a11y-related components attempt to bring it up.  See bug
 // 538530 for details about Windows; we have a pref here that allows it
 // to be disabled for performance and testing resons.
 // See bug 761589 for the crossplatform aspect.
 //
 // This pref is checked only once, and the browser needs a restart to