Commit 79bedf9a authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Use EnsureComputedStyle instead of StyleForElement in AX.

StyleForElement doesn't create ancestor computed styles as necessary to
do inheritance correctly. Noticed the listed TEST would trigger a sanity
DCHECK in StyleForElement() for another CL. Without this change we would
inherit styles from initial styles instead of the parent element.

TEST=accessibility/name-calc-visibility.html
TEST=inspector-protocol/accessibility/accessibility-nameSources-visiblity.js

Change-Id: Icd6d669b0ff04f97fcdd637530f56619e8b1f3f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789233Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694481}
parent 573c3ecf
......@@ -1605,8 +1605,7 @@ bool AXObject::IsHiddenForTextAlternativeCalculation() const {
if (Node* node = GetNode()) {
auto* element = DynamicTo<Element>(node);
if (element && node->isConnected()) {
scoped_refptr<ComputedStyle> style =
document->EnsureStyleResolver().StyleForElement(element);
const ComputedStyle* style = element->EnsureComputedStyle();
return style->Display() == EDisplay::kNone ||
style->Visibility() != EVisibility::kVisible;
}
......
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