Bug 1782550 - Don't treat list bullets as block items. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D153371
This commit is contained in:
Eitan Isaacson 2022-08-02 16:27:31 +00:00
parent 53df39bb4d
commit 92afd6db93
3 changed files with 6 additions and 10 deletions

View File

@ -391,12 +391,7 @@ class BlockRule : public PivotRule {
public:
virtual uint16_t Match(Accessible* aAcc) override {
if (RefPtr<nsAtom>(aAcc->DisplayStyle()) == nsGkAtoms::block ||
aAcc->IsHTMLListItem() ||
// XXX Bullets are inline-block, but the old local implementation treats
// them as block because IsBlockFrame() returns true. Semantically,
// they shouldn't be treated as blocks, so this should be removed once
// we only have a single implementation to deal with.
(aAcc->IsText() && aAcc->Role() == roles::LISTITEM_MARKER)) {
aAcc->IsHTMLListItem()) {
return nsIAccessibleTraversalRule::FILTER_MATCH;
}
return nsIAccessibleTraversalRule::FILTER_IGNORE;

View File

@ -95,7 +95,8 @@ class ParagraphBoundaryRule : public PivotRule {
// Now, deal with the case that we encounter a new block level accessible.
// This also means a new paragraph boundary start.
nsIFrame* frame = acc->GetFrame();
if (frame && frame->IsBlockFrame()) {
if (frame && frame->IsBlockFrame() &&
acc->Role() != roles::LISTITEM_MARKER) {
result |= nsIAccessibleTraversalRule::FILTER_MATCH;
return result;
}

View File

@ -56,12 +56,12 @@
[[0, 0, kEmbedChar, 0, 1],
[1, 2, kEmbedChar, 1, 2]]);
testTextAtOffset("li1", BOUNDARY_PARAGRAPH,
[[0, 0, "• ", 0, 2], [2, 3, "a", 2, 3]]);
[[0, 3, "• a", 0, 3]]);
testTextAtOffset("li2", BOUNDARY_PARAGRAPH,
[[0, 0, "• ", 0, 2], [2, 3, "a", 2, 3]]);
[[0, 3, "• a", 0, 3]]);
// Test a list item containing multiple text leaf nodes.
testTextAtOffset("liMultiLeaf", BOUNDARY_PARAGRAPH,
[[0, 0, "• ", 0, 2], [2, 4, "ab", 2, 4]]);
[[0, 4, "• ab", 0, 4]]);
// Test line breaks in a textarea.
testTextAtOffset("textarea", BOUNDARY_PARAGRAPH,