Title: [173969] trunk/Source/WebCore
Revision
173969
Author
[email protected]
Date
2014-09-25 10:23:21 -0700 (Thu, 25 Sep 2014)

Log Message

Minor refactoring to mediaType/presentationType
https://bugs.webkit.org/show_bug.cgi?id=137085

Reviewed by Eric Carlson.

Add overloads for presentationType for the audio and video
HTML elements so that we don't have to explicity check the
tag name (via string comparison) to identify the type of
element.

No new tests. Should create no change in behavior.

* html/HTMLAudioElement.h: Overload presentationType to always
indicate audio type.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaType): Use the presentationType
method implementation, rather than duplicating that code.
* html/HTMLVideoElement.h: Overload presentationType to always
return video type.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173968 => 173969)


--- trunk/Source/WebCore/ChangeLog	2014-09-25 16:17:45 UTC (rev 173968)
+++ trunk/Source/WebCore/ChangeLog	2014-09-25 17:23:21 UTC (rev 173969)
@@ -1,3 +1,25 @@
+2014-09-25  Brent Fulgham  <[email protected]>
+
+        Minor refactoring to mediaType/presentationType
+        https://bugs.webkit.org/show_bug.cgi?id=137085
+
+        Reviewed by Eric Carlson.
+
+        Add overloads for presentationType for the audio and video
+        HTML elements so that we don't have to explicity check the
+        tag name (via string comparison) to identify the type of
+        element.
+
+        No new tests. Should create no change in behavior.
+
+        * html/HTMLAudioElement.h: Overload presentationType to always
+        indicate audio type.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaType): Use the presentationType
+        method implementation, rather than duplicating that code.
+        * html/HTMLVideoElement.h: Overload presentationType to always
+        return video type.
+
 2014-09-25  Javier Fernandez  <[email protected]>
 
         ASSERTION FAILED: columnCount in WebCore::CSSParser::parseGridTemplateAreasRow

Modified: trunk/Source/WebCore/html/HTMLAudioElement.h (173968 => 173969)


--- trunk/Source/WebCore/html/HTMLAudioElement.h	2014-09-25 16:17:45 UTC (rev 173968)
+++ trunk/Source/WebCore/html/HTMLAudioElement.h	2014-09-25 17:23:21 UTC (rev 173969)
@@ -41,6 +41,8 @@
 
 private:
     HTMLAudioElement(const QualifiedName&, Document&, bool);
+
+    virtual MediaSession::MediaType presentationType() const override { return MediaSession::Audio; }
 };
 
 } //namespace

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (173968 => 173969)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-09-25 16:17:45 UTC (rev 173968)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-09-25 17:23:21 UTC (rev 173969)
@@ -5914,10 +5914,7 @@
     if (m_player && m_readyState >= HAVE_METADATA)
         return hasVideo() ? MediaSession::Video : MediaSession::Audio;
 
-    if (hasTagName(HTMLNames::videoTag))
-        return MediaSession::Video;
-
-    return MediaSession::Audio;
+    return presentationType();
 }
 
 MediaSession::MediaType HTMLMediaElement::presentationType() const

Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (173968 => 173969)


--- trunk/Source/WebCore/html/HTMLVideoElement.h	2014-09-25 16:17:45 UTC (rev 173968)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h	2014-09-25 17:23:21 UTC (rev 173969)
@@ -97,6 +97,8 @@
     virtual void didMoveToNewDocument(Document* oldDocument) override;
     virtual void setDisplayMode(DisplayMode) override;
 
+    virtual MediaSession::MediaType presentationType() const override { return MediaSession::Video; }
+
     std::unique_ptr<HTMLImageLoader> m_imageLoader;
 
     AtomicString m_defaultPosterURL;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to