Title: [152614] trunk/Source
Revision
152614
Author
[email protected]
Date
2013-07-14 01:55:49 -0700 (Sun, 14 Jul 2013)

Log Message

Introduce toHTMLVideoElement
https://bugs.webkit.org/show_bug.cgi?id=118582

Reviewed by Ryosuke Niwa.

To avoid direct use of static_cast, this patch introduces toHTMLVideoElement.

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::getPluginProxyParams):
* html/HTMLVideoElement.h:
(WebCore::toHTMLVideoElement):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::descendentVideoElement):
(WebCore::ancestorVideoElement):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::enterFullscreenForVideo):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::videoElement):

Source/WebKit/qt:

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::mediaContentUrlByElementId):
* WebCoreSupport/FullScreenVideoQt.cpp:
(WebCore::FullScreenVideoQt::enterFullScreenForNode):
(WebCore::FullScreenVideoQt::exitFullScreenForNode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152613 => 152614)


--- trunk/Source/WebCore/ChangeLog	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/ChangeLog	2013-07-14 08:55:49 UTC (rev 152614)
@@ -1,3 +1,27 @@
+2013-07-14  Kangil Han  <[email protected]>
+
+        Introduce toHTMLVideoElement
+        https://bugs.webkit.org/show_bug.cgi?id=118582
+
+        Reviewed by Ryosuke Niwa.
+
+        To avoid direct use of static_cast, this patch introduces toHTMLVideoElement.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::getPluginProxyParams):
+        * html/HTMLVideoElement.h:
+        (WebCore::toHTMLVideoElement):
+        * html/MediaDocument.cpp:
+        (WebCore::MediaDocumentParser::createDocumentStructure):
+        (WebCore::descendentVideoElement):
+        (WebCore::ancestorVideoElement):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::enterFullscreenForVideo):
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::videoElement):
+
 2013-07-13  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r151978.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (152613 => 152614)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -4308,7 +4308,7 @@
     Frame* frame = document()->frame();
 
     if (isVideo()) {
-        HTMLVideoElement* video = static_cast<HTMLVideoElement*>(this);
+        HTMLVideoElement* video = toHTMLVideoElement(this);
         KURL posterURL = video->posterImageURL();
         if (!posterURL.isEmpty() && frame && frame->loader()->willLoadMediaElementURL(posterURL)) {
             names.append(ASCIILiteral("_media_element_poster_"));

Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (152613 => 152614)


--- trunk/Source/WebCore/html/HTMLVideoElement.h	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h	2013-07-14 08:55:49 UTC (rev 152614)
@@ -98,6 +98,12 @@
     AtomicString m_defaultPosterURL;
 };
 
+inline HTMLVideoElement* toHTMLVideoElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::videoTag));
+    return static_cast<HTMLVideoElement*>(node);
+}
+
 } //namespace
 
 #endif

Modified: trunk/Source/WebCore/html/MediaDocument.cpp (152613 => 152614)


--- trunk/Source/WebCore/html/MediaDocument.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/html/MediaDocument.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -85,7 +85,7 @@
 
     RefPtr<Element> mediaElement = document()->createElement(videoTag, false);
 
-    m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get());
+    m_mediaElement = toHTMLVideoElement(mediaElement.get());
     m_mediaElement->setAttribute(controlsAttr, "");
     m_mediaElement->setAttribute(autoplayAttr, "");
 
@@ -140,12 +140,12 @@
     ASSERT(node);
 
     if (node->hasTagName(videoTag))
-        return static_cast<HTMLVideoElement*>(node);
+        return toHTMLVideoElement(node);
 
     RefPtr<NodeList> nodeList = node->getElementsByTagNameNS(videoTag.namespaceURI(), videoTag.localName());
    
     if (nodeList.get()->length() > 0)
-        return static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
+        return toHTMLVideoElement(nodeList.get()->item(0));
 
     return 0;
 }
@@ -155,7 +155,7 @@
     while (node && !node->hasTagName(videoTag))
         node = node->parentOrShadowHostNode();
 
-    return static_cast<HTMLVideoElement*>(node);
+    return toHTMLVideoElement(node);
 }
 
 void MediaDocument::defaultEventHandler(Event* event)

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (152613 => 152614)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -1238,7 +1238,7 @@
         return;
 
     // 2. Let video be the media element or other playback mechanism.
-    HTMLVideoElement* video = static_cast<HTMLVideoElement*>(mediaElement);
+    HTMLVideoElement* video = toHTMLVideoElement(mediaElement);
 
     // 3. Let output be an empty list of absolutely positioned CSS block boxes.
     Vector<RefPtr<HTMLDivElement> > output;

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (152613 => 152614)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -429,7 +429,7 @@
 #if ENABLE(VIDEO)
     HTMLMediaElement* mediaElt(mediaElement());
     if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
-        HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt);
+        HTMLVideoElement* videoElt = toHTMLVideoElement(mediaElt);
         if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen()) {
             UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
             videoElt->enterFullscreen();

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (152613 => 152614)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -230,8 +230,7 @@
     
 HTMLVideoElement* RenderVideo::videoElement() const
 {
-    ASSERT(node()->hasTagName(videoTag));
-    return static_cast<HTMLVideoElement*>(node()); 
+    return toHTMLVideoElement(node()); 
 }
 
 void RenderVideo::updateFromElement()

Modified: trunk/Source/WebKit/qt/ChangeLog (152613 => 152614)


--- trunk/Source/WebKit/qt/ChangeLog	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebKit/qt/ChangeLog	2013-07-14 08:55:49 UTC (rev 152614)
@@ -1,3 +1,18 @@
+2013-07-14  Kangil Han  <[email protected]>
+
+        Introduce toHTMLVideoElement
+        https://bugs.webkit.org/show_bug.cgi?id=118582
+
+        Reviewed by Ryosuke Niwa.
+
+        To avoid direct use of static_cast, this patch introduces toHTMLVideoElement.
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::mediaContentUrlByElementId):
+        * WebCoreSupport/FullScreenVideoQt.cpp:
+        (WebCore::FullScreenVideoQt::enterFullScreenForNode):
+        (WebCore::FullScreenVideoQt::exitFullScreenForNode):
+
 2013-07-01  Jochen Eisinger  <[email protected]>
 
         Remove support for consumable user gestures

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp (152613 => 152614)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -720,7 +720,7 @@
     if (!coreNode)
         return res;
 
-    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(coreNode);
+    HTMLVideoElement* videoElement = toHTMLVideoElement(coreNode);
     PlatformMedia platformMedia = videoElement->platformMedia();
     if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
         return res;

Modified: trunk/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp (152613 => 152614)


--- trunk/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp	2013-07-14 06:12:03 UTC (rev 152613)
+++ trunk/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp	2013-07-14 08:55:49 UTC (rev 152614)
@@ -113,11 +113,11 @@
 void FullScreenVideoQt::enterFullScreenForNode(Node* node)
 {
     Q_ASSERT(node);
-    m_videoElement = static_cast<HTMLVideoElement*>(node);
+    m_videoElement = toHTMLVideoElement(node);
 
 #if USE(QT_MULTIMEDIA)
     Q_ASSERT(m_FullScreenVideoHandler);
-    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
+    HTMLVideoElement* videoElement = toHTMLVideoElement(node);
     PlatformMedia platformMedia = videoElement->platformMedia();
 
     ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
@@ -143,7 +143,7 @@
     Q_ASSERT(node);
 
 #if USE(QT_MULTIMEDIA)
-    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
+    HTMLVideoElement* videoElement = toHTMLVideoElement(node);
     PlatformMedia platformMedia = videoElement->platformMedia();
 
     ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to