Commit e87e675a authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Chromium LUCI CQ

Guard flag CSSAtRuleCounterStyle properly in AXLayoutObject::GetListStyle

A previous patch crrev.com/c/2629991 has a bug that it always enters a
code path that should be entered only when CSSAtRuleCounterStyle is
enabled.

This patch handles the flag properly.

Bug: 1167596
Change-Id: I15dcdae0d70a716185e5ab376a0c08bcb5f134dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636378
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844767}
parent 1683f26e
...@@ -914,7 +914,8 @@ ax::mojom::blink::ListStyle AXLayoutObject::GetListStyle() const { ...@@ -914,7 +914,8 @@ ax::mojom::blink::ListStyle AXLayoutObject::GetListStyle() const {
if (counter_style_name == "decimal-leading-zero") { if (counter_style_name == "decimal-leading-zero") {
// 'decimal-leading-zero' may be overridden by custom counter styles. We // 'decimal-leading-zero' may be overridden by custom counter styles. We
// return kNumeric only when we are using the predefined counter style. // return kNumeric only when we are using the predefined counter style.
if (&ListMarker::GetCounterStyle(*GetDocument(), *computed_style) == if (!RuntimeEnabledFeatures::CSSAtRuleCounterStyleEnabled() ||
&ListMarker::GetCounterStyle(*GetDocument(), *computed_style) ==
&CounterStyleMap::GetUACounterStyleMap() &CounterStyleMap::GetUACounterStyleMap()
->FindCounterStyleAcrossScopes("decimal-leading-zero")) ->FindCounterStyleAcrossScopes("decimal-leading-zero"))
return ax::mojom::blink::ListStyle::kNumeric; return ax::mojom::blink::ListStyle::kNumeric;
......
...@@ -166,4 +166,54 @@ TEST_F(AXLayoutObjectTest, AccessibilityHitTestShadowDOM) { ...@@ -166,4 +166,54 @@ TEST_F(AXLayoutObjectTest, AccessibilityHitTestShadowDOM) {
run_test(ShadowRootType::kClosed); run_test(ShadowRootType::kClosed);
} }
// https://crbug.com/1167596
TEST_F(AXLayoutObjectTest, GetListStyleDecimalLeadingZero) {
ScopedCSSAtRuleCounterStyleForTest scope(false);
using ListStyle = ax::mojom::blink::ListStyle;
SetBodyInnerHTML(R"HTML(
<ul>
<li id="target" style="list-style-type: decimal-leading-zero"></li>
</ul>
)HTML");
EXPECT_EQ(ListStyle::kNumeric,
GetAXObjectByElementId("target")->GetListStyle());
}
// https://crbug.com/1167596
TEST_F(AXLayoutObjectTest, GetListStyleDecimalLeadingZeroAsCustomCounterStyle) {
ScopedCSSAtRuleCounterStyleForTest scope(true);
using ListStyle = ax::mojom::blink::ListStyle;
SetBodyInnerHTML(R"HTML(
<ul>
<li id="target" style="list-style-type: decimal-leading-zero"></li>
</ul>
)HTML");
EXPECT_EQ(ListStyle::kNumeric,
GetAXObjectByElementId("target")->GetListStyle());
}
// https://crbug.com/1167596
TEST_F(AXLayoutObjectTest, GetListStyleOverriddenDecimalLeadingZero) {
ScopedCSSAtRuleCounterStyleForTest scope(true);
using ListStyle = ax::mojom::blink::ListStyle;
SetBodyInnerHTML(R"HTML(
<style>
@counter-style decimal-leading-zero { system: extends upper-roman; }
</style>
<ul>
<li id="target" style="list-style-type: decimal-leading-zero"></li>
</ul>
)HTML");
EXPECT_EQ(ListStyle::kOther,
GetAXObjectByElementId("target")->GetListStyle());
}
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment