Title: [158211] branches/safari-537.73-branch/Source/WebKit/win
Revision
158211
Author
[email protected]
Date
2013-10-29 12:49:31 -0700 (Tue, 29 Oct 2013)

Log Message

Merge r154759

    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.

Modified Paths

Diff

Modified: branches/safari-537.73-branch/Source/WebKit/win/ChangeLog (158210 => 158211)


--- branches/safari-537.73-branch/Source/WebKit/win/ChangeLog	2013-10-29 19:43:29 UTC (rev 158210)
+++ branches/safari-537.73-branch/Source/WebKit/win/ChangeLog	2013-10-29 19:49:31 UTC (rev 158211)
@@ -1,3 +1,24 @@
+2013-10-29  Brent Fulgham  <[email protected]>
+
+        Merge r154759
+
+    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-10-28  Lucas Forschler  <[email protected]>
 
         Merge r156433

Modified: branches/safari-537.73-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp (158210 => 158211)


--- branches/safari-537.73-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2013-10-29 19:43:29 UTC (rev 158210)
+++ branches/safari-537.73-branch/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2013-10-29 19:49:31 UTC (rev 158211)
@@ -928,16 +928,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: branches/safari-537.73-branch/Source/WebKit/win/WebView.cpp (158210 => 158211)


--- branches/safari-537.73-branch/Source/WebKit/win/WebView.cpp	2013-10-29 19:43:29 UTC (rev 158210)
+++ branches/safari-537.73-branch/Source/WebKit/win/WebView.cpp	2013-10-29 19:49:31 UTC (rev 158211)
@@ -110,6 +110,7 @@
 #include <WebCore/KeyboardEvent.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>
@@ -2552,39 +2553,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 && m_page->pluginData()) {
-        *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: branches/safari-537.73-branch/Source/WebKit/win/WebView.h (158210 => 158211)


--- branches/safari-537.73-branch/Source/WebKit/win/WebView.h	2013-10-29 19:43:29 UTC (rev 158210)
+++ branches/safari-537.73-branch/Source/WebKit/win/WebView.h	2013-10-29 19:49:31 UTC (rev 158211)
@@ -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