Commit 448848ff authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Use new downcast helper for blink::HTMLProgressElement

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

Bug: 891908
Change-Id: I7ee5385b2118582742a389815f8790a39e431c9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847455Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#704180}
parent a529449a
...@@ -305,7 +305,7 @@ static void AdjustStyleForHTMLElement(ComputedStyle& style, ...@@ -305,7 +305,7 @@ static void AdjustStyleForHTMLElement(ComputedStyle& style,
// See https://drafts.csswg.org/css-display/#unbox-html // See https://drafts.csswg.org/css-display/#unbox-html
// Some of these elements are handled with other adjustments above. // Some of these elements are handled with other adjustments above.
if (IsA<HTMLBRElement>(element) || IsHTMLWBRElement(element) || if (IsA<HTMLBRElement>(element) || IsHTMLWBRElement(element) ||
IsA<HTMLMeterElement>(element) || IsHTMLProgressElement(element) || IsA<HTMLMeterElement>(element) || IsA<HTMLProgressElement>(element) ||
IsA<HTMLCanvasElement>(element) || IsHTMLMediaElement(element) || IsA<HTMLCanvasElement>(element) || IsHTMLMediaElement(element) ||
IsHTMLInputElement(element) || IsHTMLTextAreaElement(element) || IsHTMLInputElement(element) || IsHTMLTextAreaElement(element) ||
IsHTMLSelectElement(element)) { IsHTMLSelectElement(element)) {
......
...@@ -104,7 +104,7 @@ bool ShouldIgnoreContents(const Node& node) { ...@@ -104,7 +104,7 @@ bool ShouldIgnoreContents(const Node& node) {
return (!element->ShouldSerializeEndTag() && !IsHTMLInputElement(*element)) || return (!element->ShouldSerializeEndTag() && !IsHTMLInputElement(*element)) ||
IsA<HTMLIFrameElement>(*element) || IsHTMLImageElement(*element) || IsA<HTMLIFrameElement>(*element) || IsHTMLImageElement(*element) ||
IsA<HTMLLegendElement>(*element) || IsA<HTMLMeterElement>(*element) || IsA<HTMLLegendElement>(*element) || IsA<HTMLMeterElement>(*element) ||
IsHTMLObjectElement(*element) || IsHTMLProgressElement(*element) || IsHTMLObjectElement(*element) || IsA<HTMLProgressElement>(*element) ||
(IsHTMLSelectElement(*element) && (IsHTMLSelectElement(*element) &&
ToHTMLSelectElement(*element).UsesMenuList()) || ToHTMLSelectElement(*element).UsesMenuList()) ||
IsHTMLStyleElement(*element) || IsHTMLScriptElement(*element) || IsHTMLStyleElement(*element) || IsHTMLScriptElement(*element) ||
......
...@@ -379,7 +379,7 @@ void TextIteratorAlgorithm<Strategy>::Advance() { ...@@ -379,7 +379,7 @@ void TextIteratorAlgorithm<Strategy>::Advance() {
IsA<HTMLLegendElement>(html_element) || IsA<HTMLLegendElement>(html_element) ||
IsHTMLImageElement(html_element) || IsHTMLImageElement(html_element) ||
IsA<HTMLMeterElement>(html_element) || IsA<HTMLMeterElement>(html_element) ||
IsHTMLProgressElement(html_element))))) { IsA<HTMLProgressElement>(html_element))))) {
HandleReplacedElement(); HandleReplacedElement();
} else { } else {
HandleNonTextNode(); HandleNonTextNode();
......
...@@ -41,7 +41,7 @@ ProgressShadowElement::ProgressShadowElement(Document& document) ...@@ -41,7 +41,7 @@ ProgressShadowElement::ProgressShadowElement(Document& document)
} }
HTMLProgressElement* ProgressShadowElement::ProgressElement() const { HTMLProgressElement* ProgressShadowElement::ProgressElement() const {
return ToHTMLProgressElement(OwnerShadowHost()); return To<HTMLProgressElement>(OwnerShadowHost());
} }
scoped_refptr<ComputedStyle> scoped_refptr<ComputedStyle>
......
...@@ -30,8 +30,8 @@ TEST_F(ProgressShadowElementTest, LayoutObjectIsNeeded) { ...@@ -30,8 +30,8 @@ TEST_F(ProgressShadowElementTest, LayoutObjectIsNeeded) {
<progress id='prog' style='-webkit-appearance:none' /> <progress id='prog' style='-webkit-appearance:none' />
)HTML"); )HTML");
HTMLProgressElement* progress = auto* progress =
ToHTMLProgressElement(GetDocument().getElementById("prog")); To<HTMLProgressElement>(GetDocument().getElementById("prog"));
ASSERT_TRUE(progress); ASSERT_TRUE(progress);
auto* shadow_element = To<Element>(progress->GetShadowRoot()->firstChild()); auto* shadow_element = To<Element>(progress->GetShadowRoot()->firstChild());
......
...@@ -105,7 +105,7 @@ void LayoutProgress::UpdateAnimationState() { ...@@ -105,7 +105,7 @@ void LayoutProgress::UpdateAnimationState() {
} }
HTMLProgressElement* LayoutProgress::ProgressElement() const { HTMLProgressElement* LayoutProgress::ProgressElement() const {
return ToHTMLProgressElement(GetNode()); return To<HTMLProgressElement>(GetNode());
} }
} // namespace blink } // namespace blink
...@@ -602,7 +602,7 @@ ax::mojom::Role AXNodeObject::NativeRoleIgnoringAria() const { ...@@ -602,7 +602,7 @@ ax::mojom::Role AXNodeObject::NativeRoleIgnoringAria() const {
if (IsA<HTMLMeterElement>(*GetNode())) if (IsA<HTMLMeterElement>(*GetNode()))
return ax::mojom::Role::kMeter; return ax::mojom::Role::kMeter;
if (IsHTMLProgressElement(*GetNode())) if (IsA<HTMLProgressElement>(*GetNode()))
return ax::mojom::Role::kProgressIndicator; return ax::mojom::Role::kProgressIndicator;
if (IsA<HTMLOutputElement>(*GetNode())) if (IsA<HTMLOutputElement>(*GetNode()))
......
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