Commit 5e14373e authored by aestes@apple.com's avatar aestes@apple.com

2011-03-25 Andy Estes <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        TestNetscapePlugIn needs to register support for an image MIME type so
        we can test that the embed tag prefers plug-ins to render image MIME
        types.

        * DumpRenderTree/TestNetscapePlugIn/mac/Info.plist: Register image/png.
        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
        (NP_GetMIMEDescription): Ditto.
        * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc: Ditto.
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        * fast/images/embed-image.html: Disable plug-ins to continue testing
        native image rendering with embed.
        * plugins/embed-prefers-plugins-for-images-expected.txt: Added.
        * plugins/embed-prefers-plugins-for-images.html: Added.
        * plugins/plugin-javascript-access-expected.txt: Updated to include the
        new MIME type registered by TestNetscapePlugIn.
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * src/FrameLoaderClientImpl.cpp:
        (WebKit::FrameLoaderClientImpl::objectContentType):
        * src/FrameLoaderClientImpl.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::objectContentType):
        * WebCoreSupport/FrameLoaderClientQt.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (WebKit::FrameLoaderClient::objectContentType):
        * WebCoreSupport/FrameLoaderClientGtk.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebFrame.cpp:
        (WebFrame::objectContentType):
        * WebFrame.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebKitSupport/FrameLoaderClientWx.cpp:
        (WebCore::FrameLoaderClientWx::objectContentType):
        * WebKitSupport/FrameLoaderClientWx.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::objectContentType):
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebCoreSupport/FrameLoaderClientHaiku.cpp:
        (WebCore::FrameLoaderClientHaiku::objectContentType):
        * WebCoreSupport/FrameLoaderClientHaiku.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebCoreSupport/FrameLoaderClientWinCE.cpp:
        (WebKit::FrameLoaderClientWinCE::objectContentType):
        * WebCoreSupport/FrameLoaderClientWinCE.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebCoreSupport/FrameLoaderClientEfl.cpp:
        (WebCore::FrameLoaderClientEfl::objectContentType):
        * WebCoreSupport/FrameLoaderClientEfl.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        AC_QuickTime.js uses the common <object>/<embed> paradigm to embed the 
        QuickTime plug-in in web pages. r70748 removed our mapping of classids 
        to MIME types, which causes WebKit to fall back from the object to the 
        embed tag when QuickTime is embedded by this script. The script emits 
        the following embed tag to embed a QuickTime movie with a poster frame: 

        <embed src="poster-frame.png" target="quicktimeplayer" href="movie.mov"> 

        The expectation is that a QuickTime plug-in is instantiated to display the 
        poster frame, since QuickTime registers for many common image MIME 
        types. This is how Gecko behaves for embed. However, WebKit prefers to 
        use its native image rendering for image embeds, in which case no movie 
        is played when the poster frame is clicked. 

        Fix this by changing embed to check for a plug-in that can handle the 
        image type before rendering the image natively. This matches Gecko. 

        Test: plugins/embed-prefers-plugins-for-images.html

        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::HTMLEmbedElement):
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::HTMLObjectElement):
        (WebCore::HTMLObjectElement::parametersForPlugin):
        * html/HTMLPlugInImageElement.cpp:
        (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
        (WebCore::HTMLPlugInImageElement::isImageType):
        (WebCore::HTMLPlugInImageElement::wouldLoadAsNetscapePlugin):
        * html/HTMLPlugInImageElement.h:
        (WebCore::HTMLPlugInImageElement::shouldPreferPlugInsForImages):
        * loader/EmptyClients.h:
        (WebCore::EmptyFrameLoaderClient::objectContentType):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::defaultObjectContentType):
        * loader/FrameLoader.h:
        * loader/FrameLoaderClient.h:
        * loader/SubframeLoader.cpp:
        (WebCore::SubframeLoader::resourceWillUsePlugin):
        (WebCore::SubframeLoader::requestPlugin):
        (WebCore::SubframeLoader::requestObject):
        (WebCore::SubframeLoader::shouldUsePlugin):
        * loader/SubframeLoader.h:
2011-03-25  Andy Estes  <aestes@apple.com>

        Reviewed by Adele Peterson.

        REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
        https://bugs.webkit.org/show_bug.cgi?id=49016

        Update objectContentType() implementation to handle the
        shouldPreferPlugInsForImages flag.

        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebKit::WebFrameLoaderClient::objectContentType):
        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@82001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent effd0831
2011-03-25 Andy Estes <aestes@apple.com>
Reviewed by Adele Peterson.
REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
https://bugs.webkit.org/show_bug.cgi?id=49016
* fast/images/embed-image.html: Disable plug-ins to continue testing
native image rendering with embed.
* plugins/embed-prefers-plugins-for-images-expected.txt: Added.
* plugins/embed-prefers-plugins-for-images.html: Added.
* plugins/plugin-javascript-access-expected.txt: Updated to include the
new MIME type registered by TestNetscapePlugIn.
2011-03-25 Vincent Scheib <scheib@chromium.org>
fast/forms/input-file-directory-upload.html timing out.
......
<script>
if (window.layoutTestController)
layoutTestController.setPluginsEnabled(false);
</script>
<embed src="../borders/resources/Balloon_8107502.tiff" width="38" height="24" type="image/tiff"></embed>
CONSOLE MESSAGE: line 0: PLUGIN: src: image.png
PASS
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function logSuccess()
{
document.getElementById("console").innerHTML = "PASS";
}
</script>
<div id="console">FAIL</div>
<embed name="plugin" src="image.png" logSrc="1">
<script>
if (plugin.testCallback)
plugin.testCallback("logSuccess");
if (window.layoutTestController)
layoutTestController.notifyDone();
</script>
\ No newline at end of file
......@@ -13,6 +13,17 @@ Description: test netscape content
Suffixes: testnetscape
Plugin.item() works.
Plugin.namedItem() works.
Type: image/png
Description: PNG image
Suffixes: png
Plugin.item() works.
Plugin.namedItem() works.
......
2011-03-25 Andy Estes <aestes@apple.com>
Reviewed by Adele Peterson.
REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
https://bugs.webkit.org/show_bug.cgi?id=49016
AC_QuickTime.js uses the common <object>/<embed> paradigm to embed the
QuickTime plug-in in web pages. r70748 removed our mapping of classids
to MIME types, which causes WebKit to fall back from the object to the
embed tag when QuickTime is embedded by this script. The script emits
the following embed tag to embed a QuickTime movie with a poster frame:
<embed src="poster-frame.png" target="quicktimeplayer" href="movie.mov">
The expectation is that a QuickTime plug-in is instantiated to display the
poster frame, since QuickTime registers for many common image MIME
types. This is how Gecko behaves for embed. However, WebKit prefers to
use its native image rendering for image embeds, in which case no movie
is played when the poster frame is clicked.
Fix this by changing embed to check for a plug-in that can handle the
image type before rendering the image natively. This matches Gecko.
Test: plugins/embed-prefers-plugins-for-images.html
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::HTMLEmbedElement):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::HTMLObjectElement):
(WebCore::HTMLObjectElement::parametersForPlugin):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
(WebCore::HTMLPlugInImageElement::isImageType):
(WebCore::HTMLPlugInImageElement::wouldLoadAsNetscapePlugin):
* html/HTMLPlugInImageElement.h:
(WebCore::HTMLPlugInImageElement::shouldPreferPlugInsForImages):
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::objectContentType):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::defaultObjectContentType):
* loader/FrameLoader.h:
* loader/FrameLoaderClient.h:
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::resourceWillUsePlugin):
(WebCore::SubframeLoader::requestPlugin):
(WebCore::SubframeLoader::requestObject):
(WebCore::SubframeLoader::shouldUsePlugin):
* loader/SubframeLoader.h:
2011-03-23 Jer Noble <jer.noble@apple.com>
Reviewed by Eric Carlson.
......@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
* Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
......@@ -46,7 +46,7 @@ namespace WebCore {
using namespace HTMLNames;
inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* document, bool createdByParser)
: HTMLPlugInImageElement(tagName, document, createdByParser)
: HTMLPlugInImageElement(tagName, document, createdByParser, ShouldPreferPlugInsForImages)
{
ASSERT(hasTagName(embedTag));
}
......
......@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
......@@ -48,7 +48,7 @@ namespace WebCore {
using namespace HTMLNames;
inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
: HTMLPlugInImageElement(tagName, document, createdByParser)
: HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages)
, FormAssociatedElement(form)
, m_docNamedItem(true)
, m_useFallbackContent(false)
......@@ -217,7 +217,7 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S
// if we know that resource points to a plug-in.
if (url.isEmpty() && !urlParameter.isEmpty()) {
SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
if (loader->resourceWillUsePlugin(urlParameter, serviceType))
if (loader->resourceWillUsePlugin(urlParameter, serviceType, shouldPreferPlugInsForImages()))
url = urlParameter;
}
}
......
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -25,6 +25,7 @@
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
#include "Image.h"
#include "Page.h"
#include "RenderEmbeddedObject.h"
......@@ -32,13 +33,14 @@
namespace WebCore {
HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document* document, bool createdByParser)
HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document* document, bool createdByParser, PreferPlugInsForImagesOption preferPlugInsForImagesOption)
: HTMLPlugInElement(tagName, document)
// m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay
// widget updates until after all children are parsed. For HTMLEmbedElement
// this delay is unnecessary, but it is simpler to make both classes share
// the same codepath in this class.
, m_needsWidgetUpdate(!createdByParser)
, m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPreferPlugInsForImages)
{
}
......@@ -58,7 +60,7 @@ bool HTMLPlugInImageElement::isImageType()
if (Frame* frame = document()->frame()) {
KURL completedURL = frame->loader()->completeURL(m_url);
return frame->loader()->client()->objectContentType(completedURL, m_serviceType) == ObjectContentImage;
return frame->loader()->client()->objectContentType(completedURL, m_serviceType, shouldPreferPlugInsForImages()) == ObjectContentImage;
}
return Image::supportsType(m_serviceType);
......@@ -99,7 +101,7 @@ bool HTMLPlugInImageElement::wouldLoadAsNetscapePlugin(const String& url, const
if (!url.isEmpty())
completedURL = frameLoader->completeURL(url);
if (frameLoader->client()->objectContentType(completedURL, serviceType) == ObjectContentNetscapePlugin)
if (frameLoader->client()->objectContentType(completedURL, serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin)
return true;
return false;
}
......
/*
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -33,6 +33,11 @@ enum PluginCreationOption {
CreateAnyWidgetType,
CreateOnlyNonNetscapePlugins,
};
enum PreferPlugInsForImagesOption {
ShouldPreferPlugInsForImages,
ShouldNotPreferPlugInsForImages
};
// Base class for HTMLObjectElement and HTMLEmbedElement
class HTMLPlugInImageElement : public HTMLPlugInElement {
......@@ -43,9 +48,10 @@ public:
const String& serviceType() const { return m_serviceType; }
const String& url() const { return m_url; }
bool shouldPreferPlugInsForImages() const { return m_shouldPreferPlugInsForImages; }
protected:
HTMLPlugInImageElement(const QualifiedName& tagName, Document*, bool createdByParser);
HTMLPlugInImageElement(const QualifiedName& tagName, Document*, bool createdByParser, PreferPlugInsForImagesOption);
bool isImageType();
......@@ -75,6 +81,7 @@ private:
virtual bool useFallbackContent() const { return false; }
bool m_needsWidgetUpdate;
bool m_shouldPreferPlugInsForImages;
};
} // namespace WebCore
......
/*
* Copyright (C) 2006 Eric Seidel (eric@webkit.org)
* Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
......@@ -370,7 +370,7 @@ public:
virtual void showMediaPlayerProxyPlugin(Widget*) { }
#endif
virtual ObjectContentType objectContentType(const KURL&, const String&) { return ObjectContentType(); }
virtual ObjectContentType objectContentType(const KURL&, const String&, bool) { return ObjectContentType(); }
virtual String overrideMediaType() const { return String(); }
virtual void redirectDataToPlugin(Widget*) { }
......
/*
* Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2008 Alp Toker <alp@atoker.com>
......@@ -983,7 +983,7 @@ void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive)
}
#endif // ENABLE(WEB_ARCHIVE)
ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeTypeIn)
ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeTypeIn, bool shouldPreferPlugInsForImages)
{
String mimeType = mimeTypeIn;
String extension = url.path().substring(url.path().reverseFind('.') + 1);
......@@ -1000,13 +1000,17 @@ ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const S
if (mimeType.isEmpty())
return ObjectContentFrame; // Go ahead and hope that we can display the content.
#if !PLATFORM(MAC) && !PLATFORM(CHROMIUM) && !PLATFORM(EFL) // Mac has no PluginDatabase, nor does Chromium or EFL
bool plugInSupportsMIMEType = PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType);
#else
bool plugInSupportsMIMEType = false;
#endif
if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
return WebCore::ObjectContentImage;
return shouldPreferPlugInsForImages && plugInSupportsMIMEType ? WebCore::ObjectContentNetscapePlugin : WebCore::ObjectContentImage;
#if !PLATFORM(MAC) && !PLATFORM(CHROMIUM) && !PLATFORM(EFL) // Mac has no PluginDatabase, nor does Chromium or EFL
if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType))
if (plugInSupportsMIMEType)
return WebCore::ObjectContentNetscapePlugin;
#endif
if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
return WebCore::ObjectContentFrame;
......
/*
* Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) Research In Motion Limited 2009. All rights reserved.
*
......@@ -323,7 +323,7 @@ public:
bool suppressOpenerInNewFrame() const { return m_suppressOpenerInNewFrame; }
static ObjectContentType defaultObjectContentType(const KURL& url, const String& mimeType);
static ObjectContentType defaultObjectContentType(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages);
void clear(bool clearWindowProperties = true, bool clearScriptObjects = true, bool clearFrameView = true);
......
/*
* Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -259,7 +259,7 @@ namespace WebCore {
virtual void showMediaPlayerProxyPlugin(Widget*) = 0;
#endif
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0;
virtual ObjectContentType objectContentType(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages) = 0;
virtual String overrideMediaType() const = 0;
virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*) = 0;
......
/*
* Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2008 Alp Toker <alp@atoker.com>
......@@ -88,17 +88,35 @@ bool SubframeLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const Str
return true;
}
bool SubframeLoader::resourceWillUsePlugin(const String& url, const String& mimeType)
bool SubframeLoader::resourceWillUsePlugin(const String& url, const String& mimeType, bool shouldPreferPlugInsForImages)
{
KURL completedURL;
if (!url.isEmpty())
completedURL = completeURL(url);
bool useFallback;
return shouldUsePlugin(completedURL, mimeType, false, useFallback);
return shouldUsePlugin(completedURL, mimeType, shouldPreferPlugInsForImages, false, useFallback);
}
bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const String& url, const AtomicString& frameName,
const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
bool SubframeLoader::requestPlugin(HTMLPlugInImageElement* ownerElement, const KURL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)
{
Settings* settings = m_frame->settings();
if ((!allowPlugins(AboutToInstantiatePlugin)
// Application plug-ins are plug-ins implemented by the user agent, for example Qt plug-ins,
// as opposed to third-party code such as Flash. The user agent decides whether or not they are
// permitted, rather than WebKit.
&& !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))
|| (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
return false;
if (m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(SandboxPlugins))
return false;
ASSERT(ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag));
return loadPlugin(ownerElement, url, mimeType, paramNames, paramValues, useFallback);
}
bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const String& url, const AtomicString& frameName, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
if (url.isEmpty() && mimeType.isEmpty())
return false;
......@@ -114,23 +132,8 @@ bool SubframeLoader::requestObject(HTMLPlugInImageElement* ownerElement, const S
completedURL = completeURL(url);
bool useFallback;
if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback)) {
Settings* settings = m_frame->settings();
if ((!allowPlugins(AboutToInstantiatePlugin)
// Application plugins are plugins implemented by the user agent, for example Qt plugins,
// as opposed to third-party code such as flash. The user agent decides whether or not they are
// permitted, rather than WebKit.
&& !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))
|| (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
return false;
if (m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(SandboxPlugins))
return false;
ASSERT(ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag));
HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(ownerElement);
return loadPlugin(pluginElement, completedURL, mimeType, paramNames, paramValues, useFallback);
}
if (shouldUsePlugin(completedURL, mimeType, ownerElement->shouldPreferPlugInsForImages(), renderer->hasFallbackContent(), useFallback))
return requestPlugin(ownerElement, completedURL, mimeType, paramNames, paramValues, useFallback);
// If the plug-in element already contains a subframe, loadOrRedirectSubframe will re-use it. Otherwise,
// it will create a new frame and set it as the RenderPart's widget, causing what was previously
......@@ -289,7 +292,7 @@ bool SubframeLoader::allowPlugins(ReasonForCallingAllowPlugins reason)
return allowed;
}
bool SubframeLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback)
bool SubframeLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages, bool hasFallback, bool& useFallback)
{
if (m_frame->loader()->client()->shouldUsePluginDocument(mimeType)) {
useFallback = false;
......@@ -305,7 +308,7 @@ bool SubframeLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bo
return true;
}
ObjectContentType objectType = m_frame->loader()->client()->objectContentType(url, mimeType);
ObjectContentType objectType = m_frame->loader()->client()->objectContentType(url, mimeType, shouldPreferPlugInsForImages);
// If an object's content can't be handled and it has no fallback, let
// it be handled as a plugin to show the broken plugin icon.
useFallback = objectType == ObjectContentNone && hasFallback;
......
/*
* Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) Research In Motion Limited 2009. All rights reserved.
*
......@@ -77,15 +77,16 @@ public:
bool containsPlugins() const { return m_containsPlugins; }
bool resourceWillUsePlugin(const String& url, const String& mimeType);
bool resourceWillUsePlugin(const String& url, const String& mimeType, bool shouldPreferPlugInsForImages);
private:
bool requestPlugin(HTMLPlugInImageElement*, const KURL&, const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback);
Frame* loadOrRedirectSubframe(HTMLFrameOwnerElement*, const KURL&, const AtomicString& frameName, bool lockHistory, bool lockBackForwardList);
Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer);
bool loadPlugin(HTMLPlugInImageElement*, const KURL&, const String& mimeType,
const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback);
bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback);
bool shouldUsePlugin(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages, bool hasFallback, bool& useFallback);
Document* document() const;
......
2011-03-25 Andy Estes <aestes@apple.com>
Reviewed by Adele Peterson.
REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
https://bugs.webkit.org/show_bug.cgi?id=49016
Update objectContentType() implementation to handle the
shouldPreferPlugInsForImages flag.
* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::objectContentType):
* src/FrameLoaderClientImpl.h:
2011-03-25 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by David Levin.
......
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......@@ -1479,7 +1480,8 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget(
ObjectContentType FrameLoaderClientImpl::objectContentType(
const KURL& url,
const String& explicitMimeType)
const String& explicitMimeType,
bool shouldPreferPlugInsForImages)
{
// This code is based on Apple's implementation from
// WebCoreSupport/WebFrameBridge.mm.
......@@ -1503,12 +1505,14 @@ ObjectContentType FrameLoaderClientImpl::objectContentType(
return ObjectContentFrame;
}
if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
return ObjectContentImage;
// If Chrome is started with the --disable-plugins switch, pluginData is 0.
PluginData* pluginData = m_webFrame->frame()->page()->pluginData();
if (pluginData && pluginData->supportsMimeType(mimeType))
bool plugInSupportsMIMEType = pluginData && pluginData->supportsMimeType(mimeType);
if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
return shouldPreferPlugInsForImages && plugInSupportsMIMEType ? ObjectContentNetscapePlugin : ObjectContentImage;
if (plugInSupportsMIMEType)
return ObjectContentNetscapePlugin;
if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
......
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......@@ -197,7 +198,7 @@ public:
const Vector<WTF::String>& paramNames,
const Vector<WTF::String>& paramValues);
virtual WebCore::ObjectContentType objectContentType(
const WebCore::KURL& url, const WTF::String& mimeType);
const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages);
virtual WTF::String overrideMediaType() const;
virtual void didPerformFirstNavigation() const;
virtual void registerForIconNotification(bool listen = true);
......
2011-03-25 Andy Estes <aestes@apple.com>
Reviewed by Adele Peterson.
REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
https://bugs.webkit.org/show_bug.cgi?id=49016
Update objectContentType() implementation to handle the
shouldPreferPlugInsForImages flag.
* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::objectContentType):
* WebCoreSupport/FrameLoaderClientEfl.h:
2011-03-24 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Reviewed by Antonio Gomes.
......
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008 Collabora Ltd. All rights reserved.
* Copyright (C) 2008 Holger Hans Peter Freyther
......@@ -399,8 +399,12 @@ PassRefPtr<Widget> FrameLoaderClientEfl::createJavaAppletWidget(const IntSize&,
return 0;
}
ObjectContentType FrameLoaderClientEfl::objectContentType(const KURL& url, const String& mimeType)
ObjectContentType FrameLoaderClientEfl::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages)
{
// FIXME: once plugin support is enabled, this method needs to correctly handle the 'shouldPreferPlugInsForImages' flag. See
// WebCore::FrameLoader::defaultObjectContentType() for an example.
UNUSED_PARAM(shouldPreferPlugInsForImages);
if (url.isEmpty() && mimeType.isEmpty())
return ObjectContentNone;
......
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Collabora Ltd. All rights reserved.
* Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
* Copyright (C) 2009-2010 ProFUSION embedded systems
......@@ -149,7 +149,7 @@ class FrameLoaderClientEfl : public FrameLoaderClient {
virtual void registerForIconNotification(bool);
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
virtual ObjectContentType objectContentType(const KURL&, const String& mimeType, bool shouldPreferPlugInsForImages);
virtual void setMainFrameDocumentReady(bool);
......
2011-03-25 Andy Estes <aestes@apple.com>
Reviewed by Adele Peterson.
REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js
https://bugs.webkit.org/show_bug.cgi?id=49016
Update objectContentType() implementation to handle the
shouldPreferPlugInsForImages flag.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::objectContentType):
* WebCoreSupport/FrameLoaderClientGtk.h:
2011-03-25 Priit Laes <plaes@plaes.org>
Reviewed by Martin Robinson.
......
......@@ -6,6 +6,7 @@
* Copyright (C) 2009, 2010 Gustavo Noronha Silva <gns@gnome.org>
* Copyright (C) Research In Motion Limited 2009. All rights reserved.
* Copyright (C) 2010 Igalia S.L.
* Copyright (C) 2011 Apple Inc. All rights reserved.
*