Commit 605ddb09 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Use new downcast helper for blink::HTMLAudioElement

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

Bug: 891908
Change-Id: I787075e911bdbd7371b1827a017f5dcdc1abf0a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726430Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#682600}
parent de71c7ce
...@@ -195,7 +195,7 @@ bool CSSDefaultStyleSheets::EnsureDefaultStyleSheetsForElement( ...@@ -195,7 +195,7 @@ bool CSSDefaultStyleSheets::EnsureDefaultStyleSheetsForElement(
} }
if (!media_controls_style_sheet_ && HasMediaControlsStyleSheetLoader() && if (!media_controls_style_sheet_ && HasMediaControlsStyleSheetLoader() &&
(IsHTMLVideoElement(element) || IsHTMLAudioElement(element))) { (IsHTMLVideoElement(element) || IsA<HTMLAudioElement>(element))) {
// FIXME: We should assert that this sheet only contains rules for <video> // FIXME: We should assert that this sheet only contains rules for <video>
// and <audio>. // and <audio>.
media_controls_style_sheet_ = media_controls_style_sheet_ =
......
...@@ -108,7 +108,7 @@ bool ShouldIgnoreContents(const Node& node) { ...@@ -108,7 +108,7 @@ bool ShouldIgnoreContents(const Node& node) {
(IsHTMLSelectElement(*element) && (IsHTMLSelectElement(*element) &&
ToHTMLSelectElement(*element).UsesMenuList()) || ToHTMLSelectElement(*element).UsesMenuList()) ||
IsHTMLStyleElement(*element) || IsHTMLScriptElement(*element) || IsHTMLStyleElement(*element) || IsHTMLScriptElement(*element) ||
IsHTMLVideoElement(*element) || IsHTMLAudioElement(*element) || IsHTMLVideoElement(*element) || IsA<HTMLAudioElement>(*element) ||
(element->GetDisplayLockContext() && (element->GetDisplayLockContext() &&
!element->GetDisplayLockContext()->IsActivatable()); !element->GetDisplayLockContext()->IsActivatable());
} }
......
...@@ -2507,7 +2507,7 @@ void WebLocalFrameImpl::PerformMediaPlayerAction( ...@@ -2507,7 +2507,7 @@ void WebLocalFrameImpl::PerformMediaPlayerAction(
const WebMediaPlayerAction& action) { const WebMediaPlayerAction& action) {
HitTestResult result = HitTestResultForVisualViewportPos(location); HitTestResult result = HitTestResultForVisualViewportPos(location);
Node* node = result.InnerNode(); Node* node = result.InnerNode();
if (!IsHTMLVideoElement(*node) && !IsHTMLAudioElement(*node)) if (!IsHTMLVideoElement(*node) && !IsA<HTMLAudioElement>(*node))
return; return;
HTMLMediaElement* media_element = ToHTMLMediaElement(node); HTMLMediaElement* media_element = ToHTMLMediaElement(node);
......
...@@ -756,7 +756,7 @@ class CORE_EXPORT HTMLMediaElement ...@@ -756,7 +756,7 @@ class CORE_EXPORT HTMLMediaElement
}; };
inline bool IsHTMLMediaElement(const HTMLElement& element) { inline bool IsHTMLMediaElement(const HTMLElement& element) {
return IsHTMLAudioElement(element) || IsHTMLVideoElement(element); return IsA<HTMLAudioElement>(element) || IsHTMLVideoElement(element);
} }
DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
......
...@@ -159,7 +159,7 @@ void TextTrackContainer::UpdateDisplay(HTMLMediaElement& media_element, ...@@ -159,7 +159,7 @@ void TextTrackContainer::UpdateDisplay(HTMLMediaElement& media_element,
// 1. If the media element is an audio element, or is another playback // 1. If the media element is an audio element, or is another playback
// mechanism with no rendering area, abort these steps. There is nothing to // mechanism with no rendering area, abort these steps. There is nothing to
// render. // render.
if (IsHTMLAudioElement(media_element)) if (IsA<HTMLAudioElement>(media_element))
return; return;
// 2. Let video be the media element or other playback mechanism. // 2. Let video be the media element or other playback mechanism.
......
...@@ -277,7 +277,7 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame, ...@@ -277,7 +277,7 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame,
media_element)) media_element))
data.media_flags |= WebContextMenuData::kMediaPictureInPicture; data.media_flags |= WebContextMenuData::kMediaPictureInPicture;
} }
} else if (IsHTMLAudioElement(*media_element)) } else if (IsA<HTMLAudioElement>(*media_element))
data.media_type = WebContextMenuData::kMediaTypeAudio; data.media_type = WebContextMenuData::kMediaTypeAudio;
data.suggested_filename = media_element->title(); data.suggested_filename = media_element->title();
......
...@@ -599,7 +599,7 @@ ax::mojom::Role AXNodeObject::NativeRoleIgnoringAria() const { ...@@ -599,7 +599,7 @@ ax::mojom::Role AXNodeObject::NativeRoleIgnoringAria() const {
if (IsHTMLDListElement(*GetNode())) if (IsHTMLDListElement(*GetNode()))
return ax::mojom::Role::kDescriptionList; return ax::mojom::Role::kDescriptionList;
if (IsHTMLAudioElement(*GetNode())) if (IsA<HTMLAudioElement>(*GetNode()))
return ax::mojom::Role::kAudio; return ax::mojom::Role::kAudio;
if (IsHTMLVideoElement(*GetNode())) if (IsHTMLVideoElement(*GetNode()))
return ax::mojom::Role::kVideo; return ax::mojom::Role::kVideo;
......
...@@ -2007,7 +2007,7 @@ void MediaControlsImpl::UpdateActingAsAudioControls() { ...@@ -2007,7 +2007,7 @@ void MediaControlsImpl::UpdateActingAsAudioControls() {
} }
bool MediaControlsImpl::ShouldShowAudioControls() const { bool MediaControlsImpl::ShouldShowAudioControls() const {
return (MediaElement().IsHTMLAudioElement() || is_acting_as_audio_controls_); return IsA<HTMLAudioElement>(MediaElement()) || is_acting_as_audio_controls_;
} }
bool MediaControlsImpl::ShouldShowVideoControls() const { bool MediaControlsImpl::ShouldShowVideoControls() const {
......
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