Title: [154759] trunk/Source/WebKit/win
Revision
154759
Author
[email protected]
Date
2013-08-28 10:29:12 -0700 (Wed, 28 Aug 2013)

Log Message

[Windows] Loader is not properly determining supported MIME types
https://bugs.webkit.org/show_bug.cgi?id=120383

Reviewed by Eric Carlson.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::canShowMIMEType): Modify to ask WebView if it can
display the media type. Use new helper function to avoid converting a String
to BSTR, only to immediatly be converted from BSTR back to String.
(WebFrameLoaderClient::canShowMIMETypeAsHTML): Ditto.
* WebView.cpp:
(WebView::canShowMIMEType): Move logic to a new (similarly named) helper function.
(WebView::canShowMIMETypeAsHTML): Ditto.
* WebView.h: Add declaration for two new helper functions.

Modified Paths

Diff

Modified: trunk/Source/WebKit/win/ChangeLog (154758 => 154759)


--- trunk/Source/WebKit/win/ChangeLog	2013-08-28 17:11:59 UTC (rev 154758)
+++ trunk/Source/WebKit/win/ChangeLog	2013-08-28 17:29:12 UTC (rev 154759)
@@ -1,3 +1,20 @@
+2013-08-27  Brent Fulgham  <[email protected]>
+
+        [Windows] Loader is not properly determining supported MIME types
+        https://bugs.webkit.org/show_bug.cgi?id=120383
+
+        Reviewed by Eric Carlson.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::canShowMIMEType): Modify to ask WebView if it can
+        display the media type. Use new helper function to avoid converting a String
+        to BSTR, only to immediatly be converted from BSTR back to String.
+        (WebFrameLoaderClient::canShowMIMETypeAsHTML): Ditto.
+        * WebView.cpp:
+        (WebView::canShowMIMEType): Move logic to a new (similarly named) helper function.
+        (WebView::canShowMIMETypeAsHTML): Ditto.
+        * WebView.h: Add declaration for two new helper functions.
+
 2013-08-26  Ryosuke Niwa  <[email protected]>
 
         Another Windows build fix after r154658.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp (154758 => 154759)


--- trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2013-08-28 17:11:59 UTC (rev 154758)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2013-08-28 17:29:12 UTC (rev 154759)
@@ -923,16 +923,14 @@
     return WebView::canHandleRequest(request);
 }
 
-bool WebFrameLoaderClient::canShowMIMEType(const String& /*MIMEType*/) const
+bool WebFrameLoaderClient::canShowMIMEType(const String& mimeType) const
 {
-    notImplemented();
-    return true;
+    return m_webFrame->webView()->canShowMIMEType(mimeType);
 }
 
-bool WebFrameLoaderClient::canShowMIMETypeAsHTML(const String& /*MIMEType*/) const
+bool WebFrameLoaderClient::canShowMIMETypeAsHTML(const String& mimeType) const
 {
-    notImplemented();
-    return true;
+    return m_webFrame->webView()->canShowMIMETypeAsHTML(mimeType);
 }
 
 bool WebFrameLoaderClient::representationExistsForURLScheme(const String& /*URLScheme*/) const

Modified: trunk/Source/WebKit/win/WebView.cpp (154758 => 154759)


--- trunk/Source/WebKit/win/WebView.cpp	2013-08-28 17:11:59 UTC (rev 154758)
+++ trunk/Source/WebKit/win/WebView.cpp	2013-08-28 17:29:12 UTC (rev 154759)
@@ -111,6 +111,7 @@
 #include <WebCore/Logging.h>
 #include <WebCore/MIMETypeRegistry.h>
 #include <WebCore/MemoryCache.h>
+#include <WebCore/NotImplemented.h>
 #include <WebCore/Page.h>
 #include <WebCore/PageCache.h>
 #include <WebCore/PageGroup.h>
@@ -2530,39 +2531,51 @@
 
 // IWebView --------------------------------------------------------------------
 
-HRESULT STDMETHODCALLTYPE WebView::canShowMIMEType( 
-    /* [in] */ BSTR mimeType,
-    /* [retval][out] */ BOOL* canShow)
+HRESULT WebView::canShowMIMEType(/* [in] */ BSTR mimeType, /* [retval][out] */ BOOL* canShow)
 {
-    String mimeTypeStr = toString(mimeType);
-
     if (!canShow)
         return E_POINTER;
 
+    *canShow = canShowMIMEType(toString(mimeType));
+
+    return S_OK;
+}
+
+bool WebView::canShowMIMEType(const String& mimeType)
+{
     Frame* coreFrame = core(m_mainFrame);
     bool allowPlugins = coreFrame && coreFrame->loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
 
-    *canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeStr)
-        || MIMETypeRegistry::isSupportedNonImageMIMEType(mimeTypeStr);
+    bool canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeType)
+        || MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)
+        || MIMETypeRegistry::isSupportedMediaMIMEType(mimeType);
 
-    if (!*canShow && m_page) {
-        *canShow = (m_page->pluginData().supportsMimeType(mimeTypeStr, PluginData::AllPlugins) && allowPlugins)
-            || m_page->pluginData().supportsMimeType(mimeTypeStr, PluginData::OnlyApplicationPlugins);
+    if (!canShow && m_page) {
+        canShow = (m_page->pluginData().supportsMimeType(mimeType, PluginData::AllPlugins) && allowPlugins)
+            || m_page->pluginData().supportsMimeType(mimeType, PluginData::OnlyApplicationPlugins);
     }
 
-    if (!*canShow)
-        *canShow = shouldUseEmbeddedView(mimeTypeStr);
+    if (!canShow)
+        canShow = shouldUseEmbeddedView(mimeType);
 
+    return canShow;
+}
+
+HRESULT WebView::canShowMIMETypeAsHTML(/* [in] */ BSTR mimeType, /* [retval][out] */ BOOL* canShow)
+{
+    if (!canShow)
+        return E_POINTER;
+
+    *canShow = canShowMIMETypeAsHTML(toString(mimeType));
+
     return S_OK;
 }
 
-HRESULT STDMETHODCALLTYPE WebView::canShowMIMETypeAsHTML( 
-    /* [in] */ BSTR /*mimeType*/,
-    /* [retval][out] */ BOOL* canShow)
+bool WebView::canShowMIMETypeAsHTML(const String& /*mimeType*/)
 {
     // FIXME
-    *canShow = TRUE;
-    return S_OK;
+    notImplemented();
+    return true;
 }
 
 HRESULT STDMETHODCALLTYPE WebView::MIMETypesShownAsHTML( 

Modified: trunk/Source/WebKit/win/WebView.h (154758 => 154759)


--- trunk/Source/WebKit/win/WebView.h	2013-08-28 17:11:59 UTC (rev 154758)
+++ trunk/Source/WebKit/win/WebView.h	2013-08-28 17:29:12 UTC (rev 154759)
@@ -975,6 +975,9 @@
     WebCore::Element* fullScreenElement() const { return m_fullScreenElement.get(); }
 #endif
 
+    bool canShowMIMEType(const String& mimeType);
+    bool canShowMIMETypeAsHTML(const String& mimeType);
+
     // Used by TextInputController in DumpRenderTree
 
     HRESULT STDMETHODCALLTYPE setCompositionForTesting(
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to