diff --git a/accessible/src/generic/Accessible.cpp b/accessible/src/generic/Accessible.cpp index 25bbae43777e..d8792bd45cde 100644 --- a/accessible/src/generic/Accessible.cpp +++ b/accessible/src/generic/Accessible.cpp @@ -919,27 +919,7 @@ void Accessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame) { nsIFrame* frame = GetFrame(); - if (frame && mContent) { - nsRect* hitRegionRect = static_cast(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, diff --git a/accessible/tests/mochitest/elm/a11y.ini b/accessible/tests/mochitest/elm/a11y.ini index 749cb4f4deb5..318dee0d1d45 100644 --- a/accessible/tests/mochitest/elm/a11y.ini +++ b/accessible/tests/mochitest/elm/a11y.ini @@ -5,4 +5,3 @@ [test_listbox.xul] [test_nsApplicationAcc.html] [test_plugin.html] -[test_canvas.html] diff --git a/accessible/tests/mochitest/elm/test_canvas.html b/accessible/tests/mochitest/elm/test_canvas.html deleted file mode 100644 index d1245ba1bbea..000000000000 --- a/accessible/tests/mochitest/elm/test_canvas.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - Accessible boundaries for hit regions - - - - - - - - - - - - - - - - - - - diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 40d93a130f07..fc58fbac8b78 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -2161,7 +2161,6 @@ 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") diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index d6f88d51fbd0..82c8dc52c56f 100755 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -2355,78 +2355,6 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText, 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(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 */ diff --git a/content/canvas/src/CanvasRenderingContext2D.h b/content/canvas/src/CanvasRenderingContext2D.h index 314ab5e2be13..f39b1658acbf 100644 --- a/content/canvas/src/CanvasRenderingContext2D.h +++ b/content/canvas/src/CanvasRenderingContext2D.h @@ -186,9 +186,6 @@ public: 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) { @@ -684,26 +681,6 @@ protected: 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 mElement; - }; - - nsTHashtable mHitRegionsOptions; - /** * Returns true if a shadow should be drawn along with a * drawing operation. diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 1402fb7b5953..c73a4ac20032 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -8,7 +8,6 @@ SimpleTest.waitForExplicitFinish(); const Cc = SpecialPowers.Cc; const Cr = SpecialPowers.Cr; -SpecialPowers.setBoolPref("canvas.hitregions.enabled", true); function IsD2DEnabled() { var enabled = false; @@ -21578,46 +21577,6 @@ function test_linedash() { } -

Canvas test: hit regions

- - - - - - -