diff --git a/accessible/generic/LocalAccessible.cpp b/accessible/generic/LocalAccessible.cpp index f90a298131c5..11376fa539a5 100644 --- a/accessible/generic/LocalAccessible.cpp +++ b/accessible/generic/LocalAccessible.cpp @@ -622,27 +622,18 @@ nsRect LocalAccessible::ParentRelativeBounds() { result.MoveBy(frame->GetOffsetTo(boundingFrame)); } - if (nsLayoutUtils::GetNextContinuationOrIBSplitSibling(boundingFrame)) { - // Constructing a bounding box across a frame that has an IB split means - // the origin is likely be different from that of boundingFrame. - // Descendants will need their parent-relative bounds adjusted - // accordingly, since parent-relative bounds are constructed to the - // bounding box of the entire element and not each individual IB split - // frame. In the case that boundingFrame's rect is empty, - // GetAllInFlowRectsUnion might exclude its origin. For example, if - // boundingFrame is empty with an origin of (0, -840) but has a non-empty - // ib-split-sibling with (0, 0), the union rect will originate at (0, 0). - // This means the bounds returned for our parent Accessible might be - // offset from boundingFrame's rect. Since result is currently relative to - // boundingFrame's rect, we might need to adjust it to make it parent - // relative. + if (boundingFrame->GetRect().IsEmpty()) { + // boundingFrame might be the first in an ib-split-sibling chain. If its + // rect is empty, GetAllInFlowRectsUnion might exclude its origin. For + // example, if boundingFrame is empty with an origin of (0, -840) but + // has a non-empty ib-split-sibling with (0, 0), the union rect will + // originate at (0, 0). This means the bounds returned for our parent + // Accessible might be offset from boundingFrame's rect. Since result is + // currently relative to boundingFrame's rect, we might need to adjust it + // to make it parent relative. nsRect boundingUnion = nsLayoutUtils::GetAllInFlowRectsUnion(boundingFrame, boundingFrame); if (!boundingUnion.IsEmpty()) { - // The origin of boundingUnion is relative to boundingFrame, meaning - // when we call MoveBy on result with this value we're offsetting - // `result` by the distance boundingFrame's origin was moved to - // construct its bounding box. result.MoveBy(-boundingUnion.TopLeft()); } else { // Since GetAllInFlowRectsUnion returned an empty rect on our parent diff --git a/accessible/tests/browser/bounds/browser_position.js b/accessible/tests/browser/bounds/browser_position.js index bfba58be87e0..18de7d8a76a9 100644 --- a/accessible/tests/browser/bounds/browser_position.js +++ b/accessible/tests/browser/bounds/browser_position.js @@ -101,35 +101,3 @@ addAccessibleTask( }, { chrome: true, topLevel: true, remoteIframe: true } ); - -/** - * Test the bounds of items in an inline list with content that offsets the - * origin of the list's bounding box (creating an IB split within the UL frame). - */ -addAccessibleTask( - ` - -
List of information:
- `, - async function (browser, docAcc) { - await testBoundsWithContent(docAcc, "list", browser); - await testBoundsWithContent(docAcc, "one", browser); - await testBoundsWithContent(docAcc, "two", browser); - await testBoundsWithContent(docAcc, "three", browser); - await testBoundsWithContent(docAcc, "four", browser); - await testBoundsWithContent(docAcc, "five", browser); - }, - { - chrome: true, - topLevel: true, - iframe: true, - } -);