Skip to content

Commit

Permalink
Bug 1780385 - Remove canvas hit region api. r=jrmuizel
Browse files Browse the repository at this point in the history
Add a pref for MouseEvent.region since that wasn't un-exposed. No other
browser supports it so we can probably safely remove it, but just in
case.

Differential Revision: https://phabricator.services.mozilla.com/D152274
  • Loading branch information
emilio committed Jul 20, 2022
1 parent 75e3960 commit 92c9ff2
Show file tree
Hide file tree
Showing 21 changed files with 7 additions and 664 deletions.
46 changes: 0 additions & 46 deletions accessible/generic/LocalAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,28 +652,6 @@ nsIFrame* LocalAccessible::FindNearestAccessibleAncestorFrame() {
nsRect LocalAccessible::ParentRelativeBounds() {
nsIFrame* frame = GetFrame();
if (frame && mContent) {
if (mContent->GetProperty(nsGkAtoms::hitregion) && mContent->IsElement()) {
// This is for canvas fallback content
// Find a canvas frame the found hit region is relative to.
nsIFrame* canvasFrame = frame->GetParent();
if (canvasFrame) {
canvasFrame = nsLayoutUtils::GetClosestFrameOfType(
canvasFrame, LayoutFrameType::HTMLCanvas);
}

if (canvasFrame) {
if (auto* canvas =
dom::HTMLCanvasElement::FromNode(canvasFrame->GetContent())) {
if (auto* context = canvas->GetCurrentContext()) {
nsRect bounds;
if (context->GetHitRegionRect(mContent->AsElement(), bounds)) {
return bounds;
}
}
}
}
}

nsIFrame* boundingFrame = FindNearestAccessibleAncestorFrame();
nsRect result = nsLayoutUtils::GetAllInFlowRectsUnion(frame, boundingFrame);

Expand Down Expand Up @@ -711,30 +689,6 @@ nsRect LocalAccessible::ParentRelativeBounds() {
nsRect LocalAccessible::RelativeBounds(nsIFrame** aBoundingFrame) const {
nsIFrame* frame = GetFrame();
if (frame && mContent) {
if (mContent->GetProperty(nsGkAtoms::hitregion) && mContent->IsElement()) {
// This is for canvas fallback content
// Find a canvas frame the found hit region is relative to.
nsIFrame* canvasFrame = frame->GetParent();
if (canvasFrame) {
canvasFrame = nsLayoutUtils::GetClosestFrameOfType(
canvasFrame, LayoutFrameType::HTMLCanvas);
}

// make the canvas the bounding frame
if (canvasFrame) {
*aBoundingFrame = canvasFrame;
if (auto* canvas =
dom::HTMLCanvasElement::FromNode(canvasFrame->GetContent())) {
if (auto* context = canvas->GetCurrentContext()) {
nsRect bounds;
if (context->GetHitRegionRect(mContent->AsElement(), bounds)) {
return bounds;
}
}
}
}
}

*aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
nsRect unionRect = nsLayoutUtils::GetAllInFlowRectsUnion(
frame, *aBoundingFrame, nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
Expand Down
4 changes: 0 additions & 4 deletions accessible/tests/browser/hittest/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ support-files =
!/accessible/tests/mochitest/letters.gif

[browser_test_browser.js]
[browser_test_canvas_hitregion.js]
skip-if =
os == "android"
apple_catalina && fission && !debug # high frequency intermittent, Bug 1714314
[browser_test_general.js]
[browser_test_shadowroot.js]
[browser_test_zoom_text.js]
Expand Down
92 changes: 0 additions & 92 deletions accessible/tests/browser/hittest/browser_test_canvas_hitregion.js

This file was deleted.

1 change: 0 additions & 1 deletion accessible/tests/mochitest/elm/a11y.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ support-files =
[test_listbox.xhtml]
[test_MathMLSpec.html]
[test_nsApplicationAcc.html]
[test_canvas.html]
[test_shadowroot.html]
support-files = test_shadowroot_subframe.html
55 changes: 0 additions & 55 deletions accessible/tests/mochitest/elm/test_canvas.html

This file was deleted.

2 changes: 0 additions & 2 deletions accessible/tests/mochitest/hittest/a11y.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ support-files = zoom_tree.xhtml
!/accessible/tests/mochitest/letters.gif

[test_browser.html]
[test_canvas_hitregion.html]
skip-if = (os == "android")
[test_general.html]
[test_menu.xhtml]
[test_shadowroot.html]
Expand Down
85 changes: 0 additions & 85 deletions accessible/tests/mochitest/hittest/test_canvas_hitregion.html

This file was deleted.

Loading

0 comments on commit 92c9ff2

Please sign in to comment.