Commit 525d07d9 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Use new downcast helper for blink::HTMLDetailsElement

This CL has two goals,
1. Use To<HTMLDetailsElement> and DynamicTo<HTMLDetailsElement> as new
   downcast helper.
2. Use IsA<HTMLDetailsElement>(element) in place of
   IsHTMLDetailsElement(element)

Bug: 891908
Change-Id: Ib7d9bc62aced8df6158c3e04610e006996e9b28a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738456Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#684355}
parent 1305ac4d
......@@ -272,7 +272,7 @@ bool DefinitelyNewFormattingContext(const Node& node,
// type, though, and may end up disregarding the display type and just
// create block containers. And those don't necessarily create a formatting
// context.
if (!IsHTMLDetailsElement(node) && !IsHTMLSummaryElement(node))
if (!IsA<HTMLDetailsElement>(node) && !IsHTMLSummaryElement(node))
return true;
}
if (!style.IsOverflowVisible())
......
......@@ -22,7 +22,7 @@ namespace blink {
namespace {
bool ShouldAssignToCustomSlot(const Node& node) {
if (IsHTMLDetailsElement(node.parentElement()))
if (IsA<HTMLDetailsElement>(node.parentElement()))
return HTMLDetailsElement::IsFirstSummary(node);
if (IsHTMLSelectElement(node.parentElement()))
return HTMLSelectElement::CanAssignToSelectSlot(node);
......
......@@ -54,7 +54,7 @@ HTMLDetailsElement::~HTMLDetailsElement() = default;
// static
bool HTMLDetailsElement::IsFirstSummary(const Node& node) {
DCHECK(IsHTMLDetailsElement(node.parentElement()));
DCHECK(IsA<HTMLDetailsElement>(node.parentElement()));
if (!IsHTMLSummaryElement(node))
return false;
return node.parentElement() &&
......
......@@ -67,9 +67,9 @@ void HTMLSummaryElement::DidAddUserAgentShadowRoot(ShadowRoot& root) {
}
HTMLDetailsElement* HTMLSummaryElement::DetailsElement() const {
if (auto* details = ToHTMLDetailsElementOrNull(parentNode()))
if (auto* details = DynamicTo<HTMLDetailsElement>(parentNode()))
return details;
if (auto* details = ToHTMLDetailsElementOrNull(OwnerShadowHost()))
if (auto* details = DynamicTo<HTMLDetailsElement>(OwnerShadowHost()))
return details;
return nullptr;
}
......
......@@ -498,7 +498,7 @@ ax::mojom::Role AXNodeObject::NativeRoleIgnoringAria() const {
ContainerNode* parent = LayoutTreeBuilderTraversal::Parent(*GetNode());
if (parent && IsHTMLSlotElement(parent))
parent = LayoutTreeBuilderTraversal::Parent(*parent);
if (parent && IsHTMLDetailsElement(parent))
if (parent && IsA<HTMLDetailsElement>(parent))
return ax::mojom::Role::kDisclosureTriangle;
return ax::mojom::Role::kUnknown;
}
......@@ -1223,7 +1223,7 @@ AccessibilityExpanded AXNodeObject::IsExpanded() const {
if (GetNode() && IsHTMLSummaryElement(*GetNode())) {
if (GetNode()->parentNode() &&
IsHTMLDetailsElement(GetNode()->parentNode()))
IsA<HTMLDetailsElement>(GetNode()->parentNode()))
return To<Element>(GetNode()->parentNode())->hasAttribute(kOpenAttr)
? kExpandedExpanded
: kExpandedCollapsed;
......
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