Skip to content

Commit

Permalink
Bug 1782550 - Don't treat list bullets as block items. r=Jamie
Browse files Browse the repository at this point in the history
  • Loading branch information
eeejay committed Aug 2, 2022
1 parent 53df39b commit 92afd6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
7 changes: 1 addition & 6 deletions accessible/base/TextLeafRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion accessible/generic/HyperTextAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions accessible/tests/mochitest/text/test_paragraphboundary.html
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 92afd6d

Please sign in to comment.