diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebCore/plugins | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore/plugins')
32 files changed, 255 insertions, 873 deletions
diff --git a/Source/WebCore/plugins/DOMMimeType.cpp b/Source/WebCore/plugins/DOMMimeType.cpp index f906c1b1a..2a4962952 100644 --- a/Source/WebCore/plugins/DOMMimeType.cpp +++ b/Source/WebCore/plugins/DOMMimeType.cpp @@ -21,6 +21,7 @@ #include "DOMPlugin.h" #include "Frame.h" +#include "FrameLoader.h" #include "FrameLoaderClient.h" #include "Page.h" #include "PluginData.h" diff --git a/Source/WebCore/plugins/DOMMimeType.h b/Source/WebCore/plugins/DOMMimeType.h index 1906484af..d3cf0a5cb 100644 --- a/Source/WebCore/plugins/DOMMimeType.h +++ b/Source/WebCore/plugins/DOMMimeType.h @@ -20,7 +20,6 @@ #ifndef DOMMimeType_h #define DOMMimeType_h -#include "Frame.h" #include "FrameDestructionObserver.h" #include "PluginData.h" diff --git a/Source/WebCore/plugins/DOMMimeTypeArray.idl b/Source/WebCore/plugins/DOMMimeTypeArray.idl index 0c24c5b20..9ce52b4f0 100644 --- a/Source/WebCore/plugins/DOMMimeTypeArray.idl +++ b/Source/WebCore/plugins/DOMMimeTypeArray.idl @@ -19,13 +19,11 @@ */ [ - JSGenerateIsReachable=ImplFrame, - NamedGetter, - IndexedGetter, + GenerateIsReachable=ImplFrame, InterfaceName=MimeTypeArray ] interface DOMMimeTypeArray { readonly attribute unsigned long length; - DOMMimeType item(in [Optional=DefaultIsUndefined] unsigned long index); - DOMMimeType namedItem(in [Optional=DefaultIsUndefined] DOMString name); + getter DOMMimeType item([Default=Undefined] optional unsigned long index); + getter DOMMimeType namedItem([Default=Undefined] optional DOMString name); }; diff --git a/Source/WebCore/plugins/DOMPlugin.idl b/Source/WebCore/plugins/DOMPlugin.idl index 523cebd41..08e4a8463 100644 --- a/Source/WebCore/plugins/DOMPlugin.idl +++ b/Source/WebCore/plugins/DOMPlugin.idl @@ -19,15 +19,13 @@ */ [ - NamedGetter, - IndexedGetter, InterfaceName=Plugin ] interface DOMPlugin { readonly attribute DOMString name; readonly attribute DOMString filename; readonly attribute DOMString description; readonly attribute unsigned long length; - DOMMimeType item(in [Optional=DefaultIsUndefined] unsigned long index); - DOMMimeType namedItem(in [Optional=DefaultIsUndefined] DOMString name); + getter DOMMimeType item([Default=Undefined] optional unsigned long index); + getter DOMMimeType namedItem([Default=Undefined] optional DOMString name); }; diff --git a/Source/WebCore/plugins/DOMPluginArray.idl b/Source/WebCore/plugins/DOMPluginArray.idl index ef4708b8f..4b3a4ad71 100644 --- a/Source/WebCore/plugins/DOMPluginArray.idl +++ b/Source/WebCore/plugins/DOMPluginArray.idl @@ -19,14 +19,12 @@ */ [ - JSGenerateIsReachable=ImplFrame, - NamedGetter, - IndexedGetter, + GenerateIsReachable=ImplFrame, InterfaceName=PluginArray ] interface DOMPluginArray { readonly attribute unsigned long length; - DOMPlugin item(in [Optional=DefaultIsUndefined] unsigned long index); - DOMPlugin namedItem(in [Optional=DefaultIsUndefined] DOMString name); - void refresh(in [Optional=DefaultIsUndefined] boolean reload); + getter DOMPlugin item([Default=Undefined] optional unsigned long index); + getter DOMPlugin namedItem([Default=Undefined] optional DOMString name); + void refresh([Default=Undefined] optional boolean reload); }; diff --git a/Source/WebCore/plugins/IFrameShimSupport.cpp b/Source/WebCore/plugins/IFrameShimSupport.cpp index 826576511..991677f3d 100644 --- a/Source/WebCore/plugins/IFrameShimSupport.cpp +++ b/Source/WebCore/plugins/IFrameShimSupport.cpp @@ -133,7 +133,7 @@ void getPluginOcclusions(Element* element, Widget* parentWidget, const IntRect& if (!parentWidget->isFrameView()) return; - FrameView* parentFrameView = static_cast<FrameView*>(parentWidget); + FrameView* parentFrameView = toFrameView(parentWidget); const HashSet<RefPtr<Widget> >* children = parentFrameView->children(); for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != children->end(); ++it) { @@ -141,7 +141,7 @@ void getPluginOcclusions(Element* element, Widget* parentWidget, const IntRect& if (!(*it)->isFrameView()) continue; - const FrameView* frameView = static_cast<const FrameView*>((*it).get()); + const FrameView* frameView = toFrameView((*it).get()); // Check to make sure we can get both the element and the RenderObject // for this FrameView, if we can't just move on to the next object. if (!frameView->frame() || !frameView->frame()->ownerElement() diff --git a/Source/WebCore/plugins/PluginData.cpp b/Source/WebCore/plugins/PluginData.cpp index ccdf10d68..6dd4eaadb 100644 --- a/Source/WebCore/plugins/PluginData.cpp +++ b/Source/WebCore/plugins/PluginData.cpp @@ -24,10 +24,8 @@ #include "config.h" #include "PluginData.h" -#if USE(PLATFORM_STRATEGIES) #include "PlatformStrategies.h" #include "PluginStrategy.h" -#endif namespace WebCore { @@ -44,11 +42,12 @@ PluginData::PluginData(const Page* page) } } -bool PluginData::supportsMimeType(const String& mimeType) const +bool PluginData::supportsMimeType(const String& mimeType, const AllowedPluginTypes allowedPluginTypes) const { - for (unsigned i = 0; i < m_mimes.size(); ++i) - if (m_mimes[i].type == mimeType) + for (unsigned i = 0; i < m_mimes.size(); ++i) { + if (m_mimes[i].type == mimeType && (allowedPluginTypes == AllPlugins || m_plugins[m_mimePluginIndices[i]].isApplicationPlugin)) return true; + } return false; } @@ -78,7 +77,6 @@ String PluginData::pluginFileForMimeType(const String& mimeType) const return String(); } -#if USE(PLATFORM_STRATEGIES) void PluginData::refresh() { platformStrategies()->pluginStrategy()->refreshPlugins(); @@ -90,6 +88,5 @@ void PluginData::initPlugins(const Page* page) platformStrategies()->pluginStrategy()->getPluginInfo(page, m_plugins); } -#endif } diff --git a/Source/WebCore/plugins/PluginData.h b/Source/WebCore/plugins/PluginData.h index bec83ad2e..fec7ace74 100644 --- a/Source/WebCore/plugins/PluginData.h +++ b/Source/WebCore/plugins/PluginData.h @@ -33,16 +33,6 @@ struct MimeClassInfo { String type; String desc; Vector<String> extensions; - - MimeClassInfo isolatedCopy() const - { - MimeClassInfo clone; - clone.type = type.isolatedCopy(); - clone.desc = desc.isolatedCopy(); - for (unsigned i = 0; i < extensions.size(); ++i) - clone.extensions.append(extensions[i].isolatedCopy()); - return clone; - } }; inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b) @@ -55,17 +45,7 @@ struct PluginInfo { String file; String desc; Vector<MimeClassInfo> mimes; - - PluginInfo isolatedCopy() const - { - PluginInfo clone; - clone.name = name.isolatedCopy(); - clone.file = file.isolatedCopy(); - clone.desc = desc.isolatedCopy(); - for (unsigned i = 0; i < mimes.size(); ++i) - clone.mimes.append(mimes[i].isolatedCopy()); - return clone; - } + bool isApplicationPlugin; }; // FIXME: merge with PluginDatabase in the future @@ -76,8 +56,13 @@ public: const Vector<PluginInfo>& plugins() const { return m_plugins; } const Vector<MimeClassInfo>& mimes() const { return m_mimes; } const Vector<size_t>& mimePluginIndices() const { return m_mimePluginIndices; } - - bool supportsMimeType(const String& mimeType) const; + + enum AllowedPluginTypes { + AllPlugins, + OnlyApplicationPlugins + }; + + bool supportsMimeType(const String& mimeType, const AllowedPluginTypes) const; String pluginNameForMimeType(const String& mimeType) const; String pluginFileForMimeType(const String& mimeType) const; diff --git a/Source/WebCore/plugins/PluginDatabase.cpp b/Source/WebCore/plugins/PluginDatabase.cpp index 4452afe1e..2d17abc26 100644 --- a/Source/WebCore/plugins/PluginDatabase.cpp +++ b/Source/WebCore/plugins/PluginDatabase.cpp @@ -198,7 +198,7 @@ PluginPackage* PluginDatabase::pluginForMIMEType(const String& mimeType) String key = mimeType.lower(); PluginSet::const_iterator end = m_plugins.end(); - PluginPackage* preferredPlugin = m_preferredPlugins.get(key).get(); + PluginPackage* preferredPlugin = m_preferredPlugins.get(key); if (preferredPlugin && preferredPlugin->isEnabled() && preferredPlugin->mimeToDescriptions().contains(key)) { @@ -248,7 +248,7 @@ String PluginDatabase::MIMETypeForExtension(const String& extension) const for (MIMEToExtensionsMap::const_iterator mime_it = (*it)->mimeToExtensions().begin(); mime_it != mime_end; ++mime_it) { mimeType = mime_it->key; - PluginPackage* preferredPlugin = m_preferredPlugins.get(mimeType).get(); + PluginPackage* preferredPlugin = m_preferredPlugins.get(mimeType); const Vector<String>& extensions = mime_it->value; bool foundMapping = false; for (unsigned i = 0; i < extensions.size(); i++) { @@ -312,11 +312,20 @@ void PluginDatabase::setPreferredPluginForMIMEType(const String& mimeType, Plugi m_preferredPlugins.set(mimeType.lower(), plugin); } +bool PluginDatabase::fileExistsAndIsNotDisabled(const String& filePath) const +{ + // Skip plugin files that are disabled by filename. + if (m_disabledPluginFiles.contains(pathGetFileName(filePath))) + return false; + + return fileExists(filePath); +} + void PluginDatabase::getDeletedPlugins(PluginSet& plugins) const { PluginSet::const_iterator end = m_plugins.end(); for (PluginSet::const_iterator it = m_plugins.begin(); it != end; ++it) { - if (!fileExists((*it)->path())) + if (!fileExistsAndIsNotDisabled((*it)->path())) plugins.add(*it); } } @@ -360,6 +369,20 @@ void PluginDatabase::clear() #endif } +bool PluginDatabase::removeDisabledPluginFile(const String& fileName) +{ + if (!m_disabledPluginFiles.contains(fileName)) + return false; + + m_disabledPluginFiles.remove(fileName); + return true; +} + +bool PluginDatabase::addDisabledPluginFile(const String& fileName) +{ + return m_disabledPluginFiles.add(fileName).isNewEntry; +} + #if (!OS(WINCE)) && (!OS(WINDOWS) || !ENABLE(NETSCAPE_PLUGIN_API)) // For Safari/Win the following three methods are implemented // in PluginDatabaseWin.cpp, but if we can use WebCore constructs @@ -370,7 +393,7 @@ Vector<String> PluginDatabase::defaultPluginDirectories() Vector<String> paths; // Add paths specific to each platform -#if defined(XP_UNIX) +#if defined(XP_UNIX) && !PLATFORM(BLACKBERRY) String userPluginPath = homeDirectoryPath(); userPluginPath.append(String("/.mozilla/plugins")); paths.append(userPluginPath); @@ -405,7 +428,9 @@ Vector<String> PluginDatabase::defaultPluginDirectories() Vector<String> mozPaths; String mozPath(getenv("MOZ_PLUGIN_PATH")); mozPath.split(UChar(':'), /* allowEmptyEntries */ false, mozPaths); - paths.append(mozPaths); + paths.appendVector(mozPaths); +#elif PLATFORM(BLACKBERRY) + paths.append(BlackBerry::Platform::Settings::instance()->applicationPluginDirectory().c_str()); #elif defined(XP_MACOSX) String userPluginPath = homeDirectoryPath(); userPluginPath.append(String("/Library/Internet Plug-Ins")); @@ -422,7 +447,7 @@ Vector<String> PluginDatabase::defaultPluginDirectories() Vector<String> qtPaths; String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").constData()); qtPath.split(UChar(':'), /* allowEmptyEntries */ false, qtPaths); - paths.append(qtPaths); + paths.appendVector(qtPaths); #endif return paths; @@ -432,10 +457,10 @@ bool PluginDatabase::isPreferredPluginDirectory(const String& path) { String preferredPath = homeDirectoryPath(); -#if PLATFORM(BLACKBERRY) - preferredPath = BlackBerry::Platform::Settings::instance()->applicationPluginDirectory().c_str(); -#elif defined(XP_UNIX) +#if defined(XP_UNIX) && !PLATFORM(BLACKBERRY) preferredPath.append(String("/.mozilla/plugins")); +#elif PLATFORM(BLACKBERRY) + preferredPath = BlackBerry::Platform::Settings::instance()->applicationPluginDirectory().c_str(); #elif defined(XP_MACOSX) preferredPath.append(String("/Library/Internet Plug-Ins")); #elif defined(XP_WIN) @@ -462,7 +487,7 @@ void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const Vector<String> pluginPaths = listDirectory(*dIt, fileNameFilter); Vector<String>::const_iterator pluginsEnd = pluginPaths.end(); for (Vector<String>::const_iterator pIt = pluginPaths.begin(); pIt != pluginsEnd; ++pIt) { - if (!fileExists(*pIt)) + if (!fileExistsAndIsNotDisabled(*pIt)) continue; paths.add(*pIt); diff --git a/Source/WebCore/plugins/PluginDatabase.h b/Source/WebCore/plugins/PluginDatabase.h index a1c44bc5b..6fae5f08a 100644 --- a/Source/WebCore/plugins/PluginDatabase.h +++ b/Source/WebCore/plugins/PluginDatabase.h @@ -75,6 +75,8 @@ namespace WebCore { m_pluginDirectories = directories; } + bool removeDisabledPluginFile(const String& fileName); + bool addDisabledPluginFile(const String& fileName); static Vector<String> defaultPluginDirectories(); Vector<String> pluginDirectories() const { return m_pluginDirectories; } @@ -89,6 +91,7 @@ namespace WebCore { private: void getPluginPathsInDirectories(HashSet<String>&) const; void getDeletedPlugins(PluginSet&) const; + bool fileExistsAndIsNotDisabled(const String&) const; // Returns whether the plugin was actually added or not (it won't be added if it's a duplicate of an existing plugin). bool add(PassRefPtr<PluginPackage>); @@ -98,6 +101,7 @@ namespace WebCore { void updatePersistentMetadataCache(); #endif + HashSet<String> m_disabledPluginFiles; Vector<String> m_pluginDirectories; HashSet<String> m_registeredMIMETypes; PluginSet m_plugins; diff --git a/Source/WebCore/plugins/PluginStrategy.h b/Source/WebCore/plugins/PluginStrategy.h index 9d8a7b52f..05d199f20 100644 --- a/Source/WebCore/plugins/PluginStrategy.h +++ b/Source/WebCore/plugins/PluginStrategy.h @@ -26,8 +26,6 @@ #ifndef PluginStrategy_h #define PluginStrategy_h -#if USE(PLATFORM_STRATEGIES) - #include "PluginData.h" namespace WebCore { @@ -45,6 +43,4 @@ protected: } // namespace WebCore -#endif // USE(PLATFORM_STRATEGIES) - #endif // PluginStrategy_h diff --git a/Source/WebCore/plugins/PluginView.cpp b/Source/WebCore/plugins/PluginView.cpp index cdf8a78bb..74fd5d79a 100644 --- a/Source/WebCore/plugins/PluginView.cpp +++ b/Source/WebCore/plugins/PluginView.cpp @@ -28,9 +28,7 @@ #include "config.h" #include "PluginView.h" -#if USE(JSC) #include "BridgeJSC.h" -#endif #include "Chrome.h" #include "CookieJar.h" #include "Document.h" @@ -38,6 +36,7 @@ #include "Element.h" #include "FocusController.h" #include "Frame.h" +#include "FrameLoadRequest.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" #include "FrameTree.h" @@ -46,6 +45,8 @@ #include "HTMLNames.h" #include "HTMLPlugInElement.h" #include "Image.h" +#include "JSDOMBinding.h" +#include "JSDOMWindow.h" #include "KeyboardEvent.h" #include "MIMETypeRegistry.h" #include "MouseEvent.h" @@ -59,11 +60,17 @@ #include "ProxyServer.h" #include "RenderBox.h" #include "RenderObject.h" +#include "ScriptController.h" #include "ScriptValue.h" #include "SecurityOrigin.h" #include "Settings.h" +#include "UserGestureIndicator.h" #include "WheelEvent.h" +#include "c_instance.h" #include "npruntime_impl.h" +#include "runtime_root.h" +#include <runtime/JSCJSValue.h> +#include <runtime/JSLock.h> #include <wtf/ASCIICType.h> #include <wtf/text/WTFString.h> @@ -71,19 +78,10 @@ #include "PluginMessageThrottlerWin.h" #endif -#if USE(JSC) -#include "JSDOMBinding.h" -#include "JSDOMWindow.h" -#include "c_instance.h" -#include "runtime_root.h" -#include <runtime/JSLock.h> -#include <runtime/JSValue.h> - using JSC::ExecState; using JSC::JSLock; using JSC::JSObject; using JSC::JSValue; -#endif #if ENABLE(NETSCAPE_PLUGIN_API) @@ -158,6 +156,11 @@ void PluginView::frameRectsChanged() updatePluginWidget(); } +void PluginView::clipRectChanged() +{ + updatePluginWidget(); +} + void PluginView::handleEvent(Event* event) { if (!m_plugin || m_isWindowed) @@ -244,9 +247,7 @@ bool PluginView::start() NPError npErr; { PluginView::setCurrentPluginView(this); -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); npErr = m_plugin->pluginFuncs()->newp((NPMIMEType)m_mimeType.utf8().data(), m_instance, m_mode, m_paramCount, m_paramNames, m_paramValues, NULL); setCallingPlugin(false); @@ -303,8 +304,6 @@ PluginView::~PluginView() stop(); - deleteAllValues(m_requests); - freeStringArray(m_paramNames, m_paramCount); freeStringArray(m_paramValues, m_paramCount); @@ -334,9 +333,7 @@ void PluginView::stop() m_isStarted = false; -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); #if ENABLE(NETSCAPE_PLUGIN_API) #if defined(XP_WIN) && !PLATFORM(GTK) @@ -433,6 +430,8 @@ void PluginView::performRequest(PluginRequest* request) KURL requestURL = request->frameLoadRequest().resourceRequest().url(); String jsString = scriptStringIfJavaScriptURL(requestURL); + UserGestureIndicator gestureIndicator(request->shouldAllowPopups() ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture); + if (jsString.isNull()) { // if this is not a targeted request, create a stream for it. otherwise, // just pass it off to the loader @@ -453,9 +452,7 @@ void PluginView::performRequest(PluginRequest* request) // FIXME: <rdar://problem/4807469> This should be sent when the document has finished loading if (request->sendNotification()) { PluginView::setCurrentPluginView(this); -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->urlnotify(m_instance, requestURL.string().utf8().data(), NPRES_DONE, request->notifyData()); setCallingPlugin(false); @@ -476,11 +473,7 @@ void PluginView::performRequest(PluginRequest* request) if (targetFrameName.isNull()) { String resultString; -#if USE(JSC) ScriptState* scriptState = m_parentFrame->script()->globalObject(pluginWorld())->globalExec(); -#elif USE(V8) - ScriptState* scriptState = 0; // Not used with V8 -#endif CString cstr; if (result.getString(scriptState, resultString)) cstr = resultString.utf8(); @@ -494,22 +487,21 @@ void PluginView::performRequest(PluginRequest* request) void PluginView::requestTimerFired(Timer<PluginView>* timer) { ASSERT_UNUSED(timer, timer == &m_requestTimer); - ASSERT(m_requests.size() > 0); + ASSERT(!m_requests.isEmpty()); ASSERT(!m_isJavaScriptPaused); - PluginRequest* request = m_requests[0]; + OwnPtr<PluginRequest> request = m_requests[0].release(); m_requests.remove(0); // Schedule a new request before calling performRequest since the call to // performRequest can cause the plugin view to be deleted. - if (m_requests.size() > 0) + if (!m_requests.isEmpty()) m_requestTimer.startOneShot(0); - performRequest(request); - delete request; + performRequest(request.get()); } -void PluginView::scheduleRequest(PluginRequest* request) +void PluginView::scheduleRequest(PassOwnPtr<PluginRequest> request) { m_requests.append(request); @@ -545,8 +537,7 @@ NPError PluginView::load(const FrameLoadRequest& frameLoadRequest, bool sendNoti } else if (!m_parentFrame->document()->securityOrigin()->canDisplay(url)) return NPERR_GENERIC_ERROR; - PluginRequest* request = new PluginRequest(frameLoadRequest, sendNotification, notifyData, arePopupsAllowed()); - scheduleRequest(request); + scheduleRequest(adoptPtr(new PluginRequest(frameLoadRequest, sendNotification, notifyData, arePopupsAllowed()))); return NPERR_NO_ERROR; } @@ -623,7 +614,7 @@ NPError PluginView::destroyStream(NPStream* stream, NPReason reason) void PluginView::status(const char* message) { if (Page* page = m_parentFrame->page()) - page->chrome()->setStatusbarText(m_parentFrame.get(), String::fromUTF8(message)); + page->chrome().setStatusbarText(m_parentFrame.get(), String::fromUTF8(message)); } NPError PluginView::setValue(NPPVariable variable, void* value) @@ -734,9 +725,7 @@ NPObject* PluginView::npObject() NPError npErr; { PluginView::setCurrentPluginView(this); -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); npErr = m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginScriptableNPObject, &object); setCallingPlugin(false); @@ -750,7 +739,6 @@ NPObject* PluginView::npObject() } #endif -#if USE(JSC) PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance() { #if ENABLE(NETSCAPE_PLUGIN_API) @@ -775,7 +763,6 @@ PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance() return 0; #endif } -#endif void PluginView::disconnectStream(PluginStream* stream) { @@ -891,11 +878,10 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p void PluginView::focusPluginElement() { - // Focus the plugin if (Page* page = m_parentFrame->page()) - page->focusController()->setFocusedNode(m_element, m_parentFrame); + page->focusController()->setFocusedElement(m_element, m_parentFrame); else - m_parentFrame->document()->setFocusedNode(m_element); + m_parentFrame->document()->setFocusedElement(m_element); } void PluginView::didReceiveResponse(const ResourceResponse& response) @@ -1356,7 +1342,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value) NPObject* pluginScriptObject = 0; if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag)) - pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject(); + pluginScriptObject = m_element->getNPObject(); // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html> if (pluginScriptObject) @@ -1507,9 +1493,7 @@ void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) return; PluginView::setCurrentPluginView(this); -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); NPBool value = privateBrowsingEnabled; setValue(m_instance, NPNVprivateModeBool, &value); diff --git a/Source/WebCore/plugins/PluginView.h b/Source/WebCore/plugins/PluginView.h index 361c286db..a81bd0ad4 100644 --- a/Source/WebCore/plugins/PluginView.h +++ b/Source/WebCore/plugins/PluginView.h @@ -47,7 +47,7 @@ #include "npruntime_internal.h" #endif -#if OS(WINDOWS) && (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX)) +#if OS(WINDOWS) && (PLATFORM(GTK) || PLATFORM(QT)) typedef struct HWND__* HWND; typedef HWND PlatformPluginWidget; #else @@ -72,13 +72,11 @@ QT_END_NAMESPACE typedef struct _GtkSocket GtkSocket; #endif -#if USE(JSC) namespace JSC { namespace Bindings { class Instance; } } -#endif namespace WebCore { class Frame; @@ -153,9 +151,7 @@ namespace WebCore { #if ENABLE(NETSCAPE_PLUGIN_API) NPObject* npObject(); #endif -#if USE(JSC) PassRefPtr<JSC::Bindings::Instance> bindingInstance(); -#endif PluginStatus status() const { return m_status; } @@ -207,6 +203,7 @@ namespace WebCore { virtual void show(); virtual void hide(); virtual void paint(GraphicsContext*, const IntRect&); + virtual void clipRectChanged() OVERRIDE; // This method is used by plugins on all platforms to obtain a clip rect that includes clips set by WebCore, // e.g., in overflow:auto sections. The clip rects coordinates are in the containing window's coordinate space. @@ -217,7 +214,7 @@ namespace WebCore { virtual void setParent(ScrollView*); virtual void setParentVisible(bool); - virtual bool isPluginView() const { return true; } + virtual bool isPluginView() const OVERRIDE { return true; } Frame* parentFrame() const { return m_parentFrame.get(); } @@ -308,7 +305,7 @@ namespace WebCore { Vector<IntRect> m_invalidRects; void performRequest(PluginRequest*); - void scheduleRequest(PluginRequest*); + void scheduleRequest(PassOwnPtr<PluginRequest>); void requestTimerFired(Timer<PluginView>*); void invalidateTimerFired(Timer<PluginView>*); Timer<PluginView> m_requestTimer; @@ -366,7 +363,7 @@ namespace WebCore { Vector<bool, 4> m_popupStateStack; HashSet<RefPtr<PluginStream> > m_streams; - Vector<PluginRequest*> m_requests; + Vector<OwnPtr<PluginRequest> > m_requests; bool m_isWindowed; bool m_isTransparent; @@ -386,7 +383,7 @@ namespace WebCore { bool m_haveUpdatedPluginWidget; #endif -#if ((PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX)) && OS(WINDOWS)) || PLATFORM(EFL) +#if ((PLATFORM(GTK) || PLATFORM(QT)) && OS(WINDOWS)) || PLATFORM(EFL) // On Mac OSX and Qt/Windows the plugin does not have its own native widget, // but is using the containing window as its reference for positioning/painting. PlatformPluginWidget m_window; @@ -454,6 +451,21 @@ private: static PluginView* s_currentPluginView; }; +inline PluginView* toPluginView(Widget* widget) +{ + ASSERT(!widget || widget->isPluginView()); + return static_cast<PluginView*>(widget); +} + +inline const PluginView* toPluginView(const Widget* widget) +{ + ASSERT(!widget || widget->isPluginView()); + return static_cast<const PluginView*>(widget); +} + +// This will catch anyone doing an unnecessary cast. +void toPluginView(const PluginView*); + } // namespace WebCore #endif diff --git a/Source/WebCore/plugins/PluginViewBase.h b/Source/WebCore/plugins/PluginViewBase.h index f71306a32..54014d17a 100644 --- a/Source/WebCore/plugins/PluginViewBase.h +++ b/Source/WebCore/plugins/PluginViewBase.h @@ -30,16 +30,11 @@ #include "Widget.h" #include <wtf/text/WTFString.h> -#if USE(V8) -struct NPObject; -#endif -#if USE(JSC) namespace JSC { class ExecState; class JSGlobalObject; class JSObject; } -#endif namespace WebCore { @@ -53,12 +48,7 @@ public: virtual PlatformLayer* platformLayer() const { return 0; } #endif -#if USE(V8) - virtual NPObject* scriptableObject() { return 0; } -#endif -#if USE(JSC) virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; } -#endif virtual void storageBlockingStateChanged() { } virtual void privateBrowsingStateChanged(bool) { } virtual bool getFormValue(String&) { return false; } @@ -73,13 +63,33 @@ public: virtual bool supportsKeyboardFocus() const { return false; } virtual bool canProcessDrag() const { return false; } + virtual bool shouldAlwaysAutoStart() const { return false; } + virtual void beginSnapshottingRunningPlugin() { } + + virtual bool shouldAllowNavigationFromDrags() const { return false; } + + virtual bool isPluginViewBase() const { return true; } + virtual bool shouldNotAddLayer() const { return false; } + protected: explicit PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { } - -private: - virtual bool isPluginViewBase() const { return true; } }; +inline PluginViewBase* toPluginViewBase(Widget* widget) +{ + ASSERT(!widget || widget->isPluginViewBase()); + return static_cast<PluginViewBase*>(widget); +} + +inline const PluginViewBase* toPluginViewBase(const Widget* widget) +{ + ASSERT(!widget || widget->isPluginViewBase()); + return static_cast<const PluginViewBase*>(widget); +} + +// This will catch anyone doing an unnecessary cast. +void toPluginViewBase(const PluginViewBase*); + } // namespace WebCore #endif // PluginWidget_h diff --git a/Source/WebCore/plugins/PluginViewNone.cpp b/Source/WebCore/plugins/PluginViewNone.cpp index 93cc6cfb5..0c945fb64 100644 --- a/Source/WebCore/plugins/PluginViewNone.cpp +++ b/Source/WebCore/plugins/PluginViewNone.cpp @@ -26,10 +26,8 @@ #include "config.h" #include "PluginView.h" -#if USE(JSC) #include "BridgeJSC.h" #include <runtime/JSObject.h> -#endif using namespace WTF; @@ -134,19 +132,17 @@ void PluginView::handleFocusOutEvent() // ports using PluginView, but until then, if new functions like this are // added, please make sure they have the proper platform #ifs so that changes // do not break ports who compile both this file and PluginView.cpp. -#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(EFL) || (OS(WINCE) && !PLATFORM(QT)) || (PLATFORM(QT) && !OS(WINCE)) +#if PLATFORM(MAC) || PLATFORM(EFL) || (OS(WINCE) && !PLATFORM(QT)) || (PLATFORM(QT) && !OS(WINCE)) #if ENABLE(NETSCAPE_PLUGIN_API) void PluginView::keepAlive(NPP) { } #endif -#if USE(JSC) PassRefPtr<JSC::Bindings::Instance> PluginView::bindingInstance() { return 0; } -#endif void PluginView::privateBrowsingStateChanged(bool) { diff --git a/Source/WebCore/plugins/blackberry/NPCallbacksBlackBerry.cpp b/Source/WebCore/plugins/blackberry/NPCallbacksBlackBerry.cpp index d122ef6a9..ad0a46b4b 100644 --- a/Source/WebCore/plugins/blackberry/NPCallbacksBlackBerry.cpp +++ b/Source/WebCore/plugins/blackberry/NPCallbacksBlackBerry.cpp @@ -65,7 +65,7 @@ void npSetHolePunchHandler(void* holePunchData) { OwnPtr<HolePunchData> data = adoptPtr(static_cast<HolePunchData*>(holePunchData)); if (data->layer) - data->layer->setHolePunchRect(IntRect(data->x, data->y, data->w, data->h)); + static_cast<PluginLayerWebKitThread*>(data->layer.get())->setHolePunchRect(IntRect(data->x, data->y, data->w, data->h)); } #endif diff --git a/Source/WebCore/plugins/blackberry/PluginDataBlackBerry.cpp b/Source/WebCore/plugins/blackberry/PluginDataBlackBerry.cpp deleted file mode 100644 index 4746616de..000000000 --- a/Source/WebCore/plugins/blackberry/PluginDataBlackBerry.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2011 Research In Motion Limited. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "PluginData.h" - -#include "PluginDatabase.h" -#include "PluginPackage.h" - -namespace WebCore { - -void PluginData::initPlugins(const Page*) -{ - PluginDatabase* db = PluginDatabase::installedPlugins(); - const Vector<PluginPackage*>& plugins = db->plugins(); - - for (unsigned i = 0; i < plugins.size(); ++i) { - PluginPackage* package = plugins[i]; - - PluginInfo info; - info.name = package->name(); - info.file = package->fileName(); - info.desc = package->description(); - - const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions(); - MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); - for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { - MimeClassInfo mime; - mime.type = it->key; - mime.desc = it->value; - mime.extensions = package->mimeToExtensions().get(mime.type); - info.mimes.append(mime); - } - m_plugins.append(info); - } -} - -void PluginData::refresh() -{ - PluginDatabase* db = PluginDatabase::installedPlugins(); - db->refresh(); -} - -} // namespace WebCore diff --git a/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp b/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp index 9acaa4ccc..cc3ae8b58 100644 --- a/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp +++ b/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp @@ -43,7 +43,6 @@ #include "NPCallbacksBlackBerry.h" #include "NotImplemented.h" #include "Page.h" -#include "PlatformContextSkia.h" #include "PlatformKeyboardEvent.h" #include "PluginDebug.h" #include "PluginMainThreadScheduler.h" @@ -67,8 +66,8 @@ #include <BlackBerryPlatformIntRectRegion.h> #include <BlackBerryPlatformWindow.h> +#include <runtime/JSCJSValue.h> #include <runtime/JSLock.h> -#include <runtime/JSValue.h> #include <sys/keycodes.h> #include <vector> @@ -101,15 +100,18 @@ void PluginView::updatePluginWidget() return; ASSERT(parent()->isFrameView()); - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); IntRect oldWindowRect = m_windowRect; IntRect oldClipRect = m_clipRect; m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size()); + ScrollView* theRoot = root(); + if (!theRoot) + return; // ASSERT(parent()->isFrameView()) should prevent this but check just in case // Map rect to content coordinate space of main frame. - m_windowRect.move(root()->scrollOffset()); + m_windowRect.move(theRoot->scrollOffset()); m_clipRect = calculateClipRect(); @@ -176,7 +178,7 @@ void PluginView::updateBuffer(const IntRect& bufferRect) // Update the zoom factor here, it happens right before setNPWindowIfNeeded // ensuring that the plugin has every opportunity to get the zoom factor before // it paints anything. - if (FrameView* frameView = static_cast<FrameView*>(parent())) + if (FrameView* frameView = toFrameView(parent())) m_private->setZoomFactor(frameView->hostWindow()->platformPageClient()->currentZoomFactor()); setNPWindowIfNeeded(); @@ -194,11 +196,11 @@ void PluginView::updateBuffer(const IntRect& bufferRect) std::vector<BlackBerry::Platform::IntRect> exposedRects = exposedRegion.rects(); for (unsigned i = 0; i < exposedRects.size(); ++i) { NPDrawEvent draw; + NPRect tempRect = toNPRect(exposedRects.at(i)); draw.pluginRect = toNPRect(m_windowRect); draw.clipRect = toNPRect(m_clipRect); - draw.drawRect = (NPRect*)alloca(sizeof(NPRect)); + draw.drawRect = &tempRect; draw.drawRectCount = 1; - *draw.drawRect = toNPRect(exposedRects.at(i)); draw.zoomFactor = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->zoomFactor; NPEvent npEvent; @@ -221,7 +223,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) // Update the zoom factor here, it happens right before setNPWindowIfNeeded // ensuring that the plugin has every opportunity to get the zoom factor before // it paints anything. - if (FrameView* frameView = static_cast<FrameView*>(parent())) + if (FrameView* frameView = toFrameView(parent())) m_private->setZoomFactor(frameView->hostWindow()->platformPageClient()->currentZoomFactor()); if (context->paintingDisabled()) @@ -243,146 +245,6 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) exposedRect.move(-frameRect().x(), -frameRect().y()); updateBuffer(exposedRect); - - PthreadReadLocker frontLock(&m_private->m_frontBufferRwLock); - - BlackBerry::Platform::Graphics::Buffer* frontBuffer = - m_private->m_pluginBuffers[m_private->m_pluginFrontBuffer]; - - // Don't paint anything if there is no buffer. - if (!frontBuffer) - return; - - const BlackBerry::Platform::Graphics::BackingImage* backingImage = - BlackBerry::Platform::Graphics::lockBufferBackingImage(frontBuffer, - BlackBerry::Platform::Graphics::ReadAccess); - if (!backingImage) - return; - - // Draw the changed buffer contents to the screen. - context->save(); - - const SkBitmap& pluginImage = *backingImage; - PlatformGraphicsContext* graphics = context->platformContext(); - ASSERT(graphics); - SkCanvas* canvas = graphics->canvas(); - - // Source rectangle we will draw to the screen. - SkIRect skSrcRect; - skSrcRect.set(exposedRect.x(), exposedRect.y(), - exposedRect.x() + exposedRect.width(), - exposedRect.y() + exposedRect.height()); - - // Prepare the hole punch rectangle. - SkIRect unclippedHolePunchRect; - unclippedHolePunchRect.set(m_private->m_holePunchRect.x(), - m_private->m_holePunchRect.y(), - m_private->m_holePunchRect.x() + m_private->m_holePunchRect.width(), - m_private->m_holePunchRect.y() + m_private->m_holePunchRect.height()); - - // holePunchRect is clipped. - SkIRect holePunchRect; - - // All source rectangles are scaled by the zoom factor because the source bitmap may be a - // higher resolution than the 1:1 page. This allows the flash player to scale the content - // it is drawing to match the scale of the page. - double zoomFactorH = static_cast<double>(m_private->m_pluginBufferSize.width()) / static_cast<double>(frameRect().width()); - double zoomFactorW = static_cast<double>(m_private->m_pluginBufferSize.height()) / static_cast<double>(frameRect().height()); - double zoomFactor = (zoomFactorH + zoomFactorW) / 2.0; - - // This method draws a hole if specified. - if (!m_private->m_holePunchRect.isEmpty() - && holePunchRect.intersect(unclippedHolePunchRect, skSrcRect)) { - - // Draw the top chunk if needed. - if (holePunchRect.fTop > skSrcRect.fTop) { - SkIRect srcRect; - srcRect.set(skSrcRect.fLeft * zoomFactor, skSrcRect.fTop * zoomFactor, - skSrcRect.fRight * zoomFactor, holePunchRect.fTop * zoomFactor); - - SkRect dstRect; - dstRect.set(skSrcRect.fLeft, skSrcRect.fTop, - skSrcRect.fRight, holePunchRect.fTop); - dstRect.offset(frameRect().x(), frameRect().y()); - - canvas->drawBitmapRect(pluginImage, &srcRect, dstRect); - } - - // Draw the left chunk if needed. - if (holePunchRect.fLeft > skSrcRect.fLeft) { - SkIRect srcRect; - srcRect.set(skSrcRect.fLeft * zoomFactor, holePunchRect.fTop * zoomFactor, - holePunchRect.fLeft * zoomFactor, holePunchRect.fBottom * zoomFactor); - - SkRect dstRect; - dstRect.set(skSrcRect.fLeft, holePunchRect.fTop, - holePunchRect.fLeft, holePunchRect.fBottom); - dstRect.offset(frameRect().x(), frameRect().y()); - - canvas->drawBitmapRect(pluginImage, &srcRect, dstRect); - } - - // Draw the hole chunk. - { - SkPaint paint; - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - - SkIRect srcRect; - srcRect.set(holePunchRect.fLeft * zoomFactor, holePunchRect.fTop * zoomFactor, - holePunchRect.fRight * zoomFactor, holePunchRect.fBottom * zoomFactor); - - SkRect dstRect; - dstRect.set(holePunchRect.fLeft, holePunchRect.fTop, - holePunchRect.fRight, holePunchRect.fBottom); - dstRect.offset(frameRect().x(), frameRect().y()); - - canvas->drawBitmapRect(pluginImage, &srcRect, dstRect, &paint); - } - - // Draw the right chunk if needed. - if (holePunchRect.fRight < skSrcRect.fRight) { - SkIRect srcRect; - srcRect.set(holePunchRect.fRight * zoomFactor, holePunchRect.fTop * zoomFactor, - skSrcRect.fRight * zoomFactor, holePunchRect.fBottom * zoomFactor); - - SkRect dstRect; - dstRect.set(holePunchRect.fRight, holePunchRect.fTop, skSrcRect.fRight, holePunchRect.fBottom); - dstRect.offset(frameRect().x(), frameRect().y()); - - canvas->drawBitmapRect(pluginImage, &srcRect, dstRect); - } - - // Draw the bottom chunk if needed. - if (holePunchRect.fBottom < skSrcRect.fBottom) { - SkIRect srcRect; - srcRect.set(skSrcRect.fLeft * zoomFactor, holePunchRect.fBottom * zoomFactor, - skSrcRect.fRight * zoomFactor, skSrcRect.fBottom * zoomFactor); - - SkRect dstRect; - dstRect.set(skSrcRect.fLeft, holePunchRect.fBottom, - skSrcRect.fRight, skSrcRect.fBottom); - dstRect.offset(frameRect().x(), frameRect().y()); - - canvas->drawBitmapRect(pluginImage, &srcRect, dstRect); - } - } else { - SkIRect srcRect; - srcRect.set(skSrcRect.fLeft * zoomFactor, skSrcRect.fTop * zoomFactor, - skSrcRect.fRight * zoomFactor, skSrcRect.fBottom * zoomFactor); - - // Calculate the destination rectangle. - SkRect dstRect; - dstRect.set(rectClip.x(), rectClip.y(), - rectClip.x() + rectClip.width(), - rectClip.y() + rectClip.height()); - - // Don't punch a hole. - canvas->drawBitmapRect(pluginImage, &srcRect, dstRect); - } - - context->restore(); - - BlackBerry::Platform::Graphics::releaseBufferBackingImage(frontBuffer); } @@ -402,7 +264,7 @@ bool PluginView::dispatchNPEvent(NPEvent& event) return false; PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); bool accepted = m_plugin->pluginFuncs()->event(m_instance, &event); @@ -618,7 +480,7 @@ void PluginView::handleResumeEvent() void PluginView::handleScrollEvent() { - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); // As a special case, if the frameView extent in either dimension is // empty, then send an on screen event. This is important for sites like @@ -636,7 +498,7 @@ void PluginView::handleScrollEvent() IntRect PluginView::calculateClipRect() const { - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); bool visible = frameView && isVisible(); if (visible && frameView->width() && frameView->height()) { @@ -744,7 +606,7 @@ void PluginView::handleFullScreenAllowedEvent() npEvent.type = NP_FullScreenReadyEvent; npEvent.data = 0; - if (FrameView* frameView = static_cast<FrameView*>(parent())) { + if (FrameView* frameView = toFrameView(parent())) { frameView->hostWindow()->platformPageClient()->didPluginEnterFullScreen(this, m_private->m_pluginUniquePrefix.c_str()); if (!dispatchNPEvent(npEvent)) @@ -765,7 +627,7 @@ void PluginView::handleFullScreenExitEvent() dispatchNPEvent(npEvent); - if (FrameView* frameView = static_cast<FrameView*>(parent())) + if (FrameView* frameView = toFrameView(parent())) frameView->hostWindow()->platformPageClient()->didPluginExitFullScreen(this, m_private->m_pluginUniquePrefix.c_str()); m_private->m_isFullScreen = false; @@ -857,7 +719,7 @@ void PluginView::setParent(ScrollView* parentWidget) { // If parentWidget is 0, lets unregister the plugin with the current parent. if (m_private && (!parentWidget || parentWidget != parent())) { - if (FrameView* frameView = static_cast<FrameView*>(parent())) { + if (FrameView* frameView = toFrameView(parent())) { if (m_private->m_isBackgroundPlaying) frameView->hostWindow()->platformPageClient()->onPluginStopBackgroundPlay(this, m_private->m_pluginUniquePrefix.c_str()); @@ -884,7 +746,7 @@ void PluginView::setParent(ScrollView* parentWidget) if (parentWidget) { init(); - FrameView* frameView = static_cast<FrameView*>(parentWidget); + FrameView* frameView = toFrameView(parentWidget); if (frameView && m_private) { frameView->hostWindow()->platformPageClient()->registerPlugin(this, true /*shouldRegister*/); @@ -909,7 +771,7 @@ void PluginView::setNPWindowIfNeeded() if (!m_private || !m_isStarted || !parent() || !m_plugin->pluginFuncs()->setwindow) return; - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); if (!frameView->hostWindow()->platformPageClient()->isActive()) return; @@ -953,7 +815,7 @@ void PluginView::setNPWindowIfNeeded() ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->windowGroup = window->windowGroup(); PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); // FIXME: Passing zoomFactor to setwindow make windowed plugin scale incorrectly. @@ -1065,7 +927,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re return true; case NPNVRootWindowGroup: { - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); if (frameView) { BlackBerry::Platform::Graphics::Window *window = frameView->hostWindow()->platformPageClient()->platformWindow(); if (window) { @@ -1083,7 +945,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re } case NPNVBrowserWindowGroup: { - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); if (frameView) { BlackBerry::Platform::Graphics::Window* window = frameView->hostWindow()->platformPageClient()->platformWindow(); if (window) { @@ -1101,7 +963,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re } case NPNVBrowserDisplayContext: { - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); if (frameView) { BlackBerry::Platform::Graphics::PlatformDisplayContextHandle context = BlackBerry::Platform::Graphics::platformDisplayContext(); if (context) { @@ -1184,7 +1046,7 @@ void PluginView::invalidateRect(NPRect* rect) invalidateRect(IntRect(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top)); } -void PluginView::invalidateRegion(NPRegion region) +void PluginView::invalidateRegion(NPRegion) { invalidate(); } @@ -1203,7 +1065,7 @@ bool PluginView::platformStart() if (m_plugin->pluginFuncs()->getvalue) { PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginNeedsXEmbed, &m_needsXEmbed); setCallingPlugin(false); @@ -1211,7 +1073,7 @@ bool PluginView::platformStart() } #if USE(ACCELERATED_COMPOSITING) - if (m_parentFrame->page()->chrome()->client()->allowsAcceleratedCompositing() + if (m_parentFrame->page()->chrome().client()->allowsAcceleratedCompositing() && m_parentFrame->page()->settings() && m_parentFrame->page()->settings()->acceleratedCompositingEnabled()) { m_private->m_platformLayer = PluginLayerWebKitThread::create(this); @@ -1232,7 +1094,7 @@ bool PluginView::platformStart() show(); - if (FrameView* frameView = static_cast<FrameView*>(parent())) + if (FrameView* frameView = toFrameView(parent())) handleOrientationEvent(frameView->hostWindow()->platformPageClient()->orientation()); if (!(m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall))) { @@ -1255,7 +1117,7 @@ void PluginView::platformDestroy() m_private->clearVisibleRects(); // This will ensure that we unregistered the plugin. - if (FrameView* frameView = static_cast<FrameView*>(parent())) { + if (FrameView* frameView = toFrameView(parent())) { if (m_private->m_isBackgroundPlaying) frameView->hostWindow()->platformPageClient()->onPluginStopBackgroundPlay(this, m_private->m_pluginUniquePrefix.c_str()); @@ -1284,7 +1146,7 @@ void PluginView::getWindowInfo(Vector<PluginWindowInfo>& windowList) void* valPtr = 0; PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginScreenWindow, &valPtr); setCallingPlugin(false); @@ -1347,7 +1209,7 @@ void PluginView::setBackgroundPlay(bool value) if (!m_private || m_private->m_isBackgroundPlaying == value) return; - FrameView* frameView = static_cast<FrameView*>(m_private->m_view->parent()); + FrameView* frameView = toFrameView(m_private->m_view->parent()); m_private->m_isBackgroundPlaying = value; if (m_private->m_isBackgroundPlaying) frameView->hostWindow()->platformPageClient()->onPluginStartBackgroundPlay(this, m_private->m_pluginUniquePrefix.c_str()); diff --git a/Source/WebCore/plugins/blackberry/PluginViewPrivateBlackBerry.cpp b/Source/WebCore/plugins/blackberry/PluginViewPrivateBlackBerry.cpp index cf7f7e20a..e465beb6e 100644 --- a/Source/WebCore/plugins/blackberry/PluginViewPrivateBlackBerry.cpp +++ b/Source/WebCore/plugins/blackberry/PluginViewPrivateBlackBerry.cpp @@ -112,7 +112,7 @@ void PluginViewPrivate::setVisibleRects(const NPRect rects[], int32_t count) // Adjust the rect to the parent window and then adjust for scrolling. m_keepVisibleRect = m_view->convertToContainingWindow(m_keepVisibleRect); - FrameView* frameView = static_cast<FrameView*>(m_view->parent()); + FrameView* frameView = toFrameView(m_view->parent()); m_keepVisibleRect.move(frameView->scrollPosition().x(), frameView->scrollPosition().y()); frameView->hostWindow()->platformPageClient()->ensureContentVisible(); @@ -126,13 +126,13 @@ void PluginViewPrivate::clearVisibleRects() void PluginViewPrivate::showKeyboard(bool value) { - FrameView* frameView = static_cast<FrameView*>(m_view->parent()); + FrameView* frameView = toFrameView(m_view->parent()); frameView->hostWindow()->platformPageClient()->showVirtualKeyboard(value); } void PluginViewPrivate::requestFullScreen() { - if (FrameView* frameView = static_cast<FrameView*>(m_view->parent())) + if (FrameView* frameView = toFrameView(m_view->parent())) if (frameView->hostWindow()->platformPageClient()->shouldPluginEnterFullScreen(m_view, m_pluginUniquePrefix.c_str())) m_view->handleFullScreenAllowedEvent(); } @@ -144,7 +144,7 @@ void PluginViewPrivate::exitFullScreen() void PluginViewPrivate::requestCenterFitZoom() { - FrameView* frameView = static_cast<FrameView*>(m_view->parent()); + FrameView* frameView = toFrameView(m_view->parent()); if (!frameView) return; @@ -154,7 +154,7 @@ void PluginViewPrivate::requestCenterFitZoom() void PluginViewPrivate::lockOrientation(bool landscape) { - FrameView* frameView = static_cast<FrameView*>(m_view->parent()); + FrameView* frameView = toFrameView(m_view->parent()); if (!frameView) return; @@ -168,7 +168,7 @@ void PluginViewPrivate::unlockOrientation() if (!m_orientationLocked) return; - FrameView* frameView = static_cast<FrameView*>(m_view->parent()); + FrameView* frameView = toFrameView(m_view->parent()); if (!frameView) return; @@ -182,7 +182,7 @@ void PluginViewPrivate::preventIdle(bool preventIdle) if (preventIdle == m_idlePrevented) return; - FrameView* frameView = static_cast<FrameView*>(m_view->parent()); + FrameView* frameView = toFrameView(m_view->parent()); if (!frameView) return; @@ -364,18 +364,21 @@ bool PluginViewPrivate::resizeBuffers(NPSurfaceFormat format, int width, int hei bool PluginViewPrivate::destroyBuffers() { - PthreadMutexLocker backLock(&m_backBufferMutex); - PthreadWriteLocker frontLock(&m_frontBufferRwLock); - bool didDestroyBuffers = false; - for (int i = 0; i < PLUGIN_BUFFERS; i++) { - if (m_pluginBuffers[i]) { - didDestroyBuffers = true; - BlackBerry::Platform::Graphics::destroyBuffer(m_pluginBuffers[i]); - m_pluginBuffers[i] = 0; + + { + PthreadMutexLocker backLock(&m_backBufferMutex); + PthreadWriteLocker frontLock(&m_frontBufferRwLock); + + for (int i = 0; i < PLUGIN_BUFFERS; i++) { + if (m_pluginBuffers[i]) { + didDestroyBuffers = true; + BlackBerry::Platform::Graphics::destroyBuffer(m_pluginBuffers[i]); + m_pluginBuffers[i] = 0; + } } + m_pluginBufferSize = IntSize(); } - m_pluginBufferSize = IntSize(); if (didDestroyBuffers) { BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( diff --git a/Source/WebCore/plugins/chromium/PluginDataChromium.cpp b/Source/WebCore/plugins/chromium/PluginDataChromium.cpp deleted file mode 100644 index c7f879e22..000000000 --- a/Source/WebCore/plugins/chromium/PluginDataChromium.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2008, 2009, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "PluginDataChromium.h" - -#include "PlatformSupport.h" - -namespace WebCore { - -class PluginCache { -public: - PluginCache() : m_loaded(false), m_refresh(false) {} - ~PluginCache() { reset(false); } - - void reset(bool refresh) - { - m_plugins.clear(); - m_loaded = false; - m_refresh = refresh; - } - - const Vector<PluginInfo>& plugins() - { - if (!m_loaded) { - PlatformSupport::plugins(m_refresh, &m_plugins); - m_loaded = true; - m_refresh = false; - } - return m_plugins; - } - -private: - Vector<PluginInfo> m_plugins; - bool m_loaded; - bool m_refresh; -}; - -static PluginCache& pluginCache() -{ - DEFINE_STATIC_LOCAL(PluginCache, cache, ()); - return cache; -} - -void PluginData::initPlugins(const Page*) -{ - const Vector<PluginInfo>& plugins = pluginCache().plugins(); - for (size_t i = 0; i < plugins.size(); ++i) - m_plugins.append(plugins[i]); -} - -void PluginData::refresh() -{ - pluginCache().reset(true); - pluginCache().plugins(); // Force the plugins to be reloaded now. -} - -String getPluginMimeTypeFromExtension(const String& extension) -{ - const Vector<PluginInfo>& plugins = pluginCache().plugins(); - for (size_t i = 0; i < plugins.size(); ++i) { - for (size_t j = 0; j < plugins[i].mimes.size(); ++j) { - const MimeClassInfo& mime = plugins[i].mimes[j]; - const Vector<String>& extensions = mime.extensions; - for (size_t k = 0; k < extensions.size(); ++k) { - if (extension == extensions[k]) - return mime.type; - } - } - } - return String(); -} - -} // namespace WebCore diff --git a/Source/WebCore/plugins/chromium/PluginDataChromium.h b/Source/WebCore/plugins/chromium/PluginDataChromium.h deleted file mode 100644 index 78701b436..000000000 --- a/Source/WebCore/plugins/chromium/PluginDataChromium.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2009 Google, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef PluginDataChromium_h -#define PluginDataChromium_h - -#include "PluginData.h" - -namespace WebCore { - -// Checks if any of the plugins handle this extension, and if so returns the -// plugin's mime type for this extension. Otherwise returns an empty string. -String getPluginMimeTypeFromExtension(const String& extension); - -} // namespace WebCore - -#endif // PluginDataChromium_h diff --git a/Source/WebCore/plugins/efl/PluginViewEfl.cpp b/Source/WebCore/plugins/efl/PluginViewEfl.cpp index 4e1368f14..31acb1293 100644 --- a/Source/WebCore/plugins/efl/PluginViewEfl.cpp +++ b/Source/WebCore/plugins/efl/PluginViewEfl.cpp @@ -36,11 +36,14 @@ #include "HTMLNames.h" #include "HTMLPlugInElement.h" #include "HostWindow.h" +#include "JSDOMWindowBase.h" #include "MouseEvent.h" #include "NotImplemented.h" #include "PluginPackage.h" +#include "ScriptController.h" #include "npruntime_impl.h" #include "runtime/JSLock.h" +#include "runtime/Operations.h" #include <Ecore_Evas.h> #include <Ecore_X.h> #include <Evas.h> @@ -55,7 +58,7 @@ bool PluginView::dispatchNPEvent(NPEvent& event) return false; PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); bool accepted = m_plugin->pluginFuncs()->event(m_instance, &event); @@ -122,7 +125,7 @@ void PluginView::updatePluginWidget() void PluginView::setFocus(bool focused) { if (focused) - m_element->document()->setFocusedNode(m_element); + m_element->document()->setFocusedElement(m_element); Widget::setFocus(focused); } @@ -282,7 +285,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re } case NPNVnetscapeWindow: { - Evas* evas = m_parentFrame->view()->evas(); + Evas* evas = evas_object_evas_get(m_parentFrame->view()->evasObject()); if (!evas) return false; diff --git a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp index 2e67bc67e..ce145dcce 100644 --- a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp +++ b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp @@ -34,10 +34,10 @@ #include "DocumentLoader.h" #include "Element.h" #include "FocusController.h" -#include "FrameLoader.h" +#include "Frame.h" #include "FrameLoadRequest.h" +#include "FrameLoader.h" #include "FrameTree.h" -#include "Frame.h" #include "FrameView.h" #include "GRefPtrGtk.h" #include "GraphicsContext.h" @@ -46,6 +46,8 @@ #include "HTMLPlugInElement.h" #include "HostWindow.h" #include "Image.h" +#include "JSDOMBinding.h" +#include "JSDOMWindowBase.h" #include "KeyboardEvent.h" #include "MouseEvent.h" #include "NotImplemented.h" @@ -59,11 +61,10 @@ #include "RenderObject.h" #include "Settings.h" #include "SpatialNavigation.h" -#include "JSDOMBinding.h" #include "npruntime_impl.h" #include "runtime_root.h" +#include <runtime/JSCJSValue.h> #include <runtime/JSLock.h> -#include <runtime/JSValue.h> #ifdef GTK_API_VERSION_2 #include <gdkconfig.h> @@ -99,7 +100,7 @@ bool PluginView::dispatchNPEvent(NPEvent& event) return false; PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); bool accepted = !m_plugin->pluginFuncs()->event(m_instance, &event); @@ -122,7 +123,7 @@ void PluginView::updatePluginWidget() return; ASSERT(parent()->isFrameView()); - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); IntRect oldWindowRect = m_windowRect; IntRect oldClipRect = m_clipRect; @@ -263,7 +264,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) void PluginView::handleKeyboardEvent(KeyboardEvent* event) { - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully) return; @@ -389,7 +390,7 @@ static void setXCrossingEventSpecificFields(XEvent* xEvent, MouseEvent* event, c void PluginView::handleMouseEvent(MouseEvent* event) { - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); if (!m_isStarted || m_status != PluginStatusLoadedSuccessfully) return; @@ -514,7 +515,7 @@ void PluginView::setNPWindowIfNeeded() } PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); @@ -788,7 +789,7 @@ bool PluginView::platformStart() if (m_plugin->pluginFuncs()->getvalue) { PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginNeedsXEmbed, &m_needsXEmbed); setCallingPlugin(false); diff --git a/Source/WebCore/plugins/gtk/gtk2xtbin.c b/Source/WebCore/plugins/gtk/gtk2xtbin.c index 7bcfa7adc..6db746c90 100644 --- a/Source/WebCore/plugins/gtk/gtk2xtbin.c +++ b/Source/WebCore/plugins/gtk/gtk2xtbin.c @@ -42,6 +42,7 @@ * inside a GTK application. */ +#include "config.h" #include "GtkVersioning.h" #include "xembed.h" #include "gtk2xtbin.h" @@ -273,9 +274,7 @@ gtk_xtbin_realize (GtkWidget *widget) { GtkXtBin *xtbin; GtkAllocation allocation = { 0, 0, 200, 200 }; -#if GTK_CHECK_VERSION(2, 18, 0) GtkAllocation widget_allocation; -#endif #ifdef DEBUG_XTBIN printf("gtk_xtbin_realize()\n"); @@ -286,29 +285,17 @@ gtk_xtbin_realize (GtkWidget *widget) xtbin = GTK_XTBIN (widget); /* caculate the allocation before realize */ -#if GTK_CHECK_VERSION(2, 24, 0) allocation.width = gdk_window_get_width(xtbin->parent_window); allocation.height = gdk_window_get_height(xtbin->parent_window); -#else - gint x, y, w, h, d; /* geometry of window */ - gdk_window_get_geometry(xtbin->parent_window, &x, &y, &w, &h, &d); - allocation.width = w; - allocation.height = h; -#endif gtk_widget_size_allocate (widget, &allocation); #ifdef DEBUG_XTBIN printf("initial allocation %d %d %d %d\n", x, y, w, h); #endif -#if GTK_CHECK_VERSION(2, 18, 0) gtk_widget_get_allocation(widget, &widget_allocation); xtbin->width = widget_allocation.width; xtbin->height = widget_allocation.height; -#else - xtbin->width = widget->allocation.width; - xtbin->height = widget->allocation.height; -#endif /* use GtkSocket's realize */ (*GTK_WIDGET_CLASS(parent_class)->realize)(widget); diff --git a/Source/WebCore/plugins/mac/PluginPackageMac.cpp b/Source/WebCore/plugins/mac/PluginPackageMac.cpp index 23a5e231b..6b6c41775 100644 --- a/Source/WebCore/plugins/mac/PluginPackageMac.cpp +++ b/Source/WebCore/plugins/mac/PluginPackageMac.cpp @@ -119,7 +119,7 @@ static Vector<String> stringListFromResourceId(SInt16 id) for (SInt16 i = 0; i < count; ++i) { unsigned char length = *p; - WTF::RetainPtr<CFStringRef> str(AdoptCF, CFStringCreateWithPascalString(0, p, encoding)); + WTF::RetainPtr<CFStringRef> str = adoptCF(CFStringCreateWithPascalString(0, p, encoding)); list.append(str.get()); p += 1 + length; } @@ -138,8 +138,8 @@ bool PluginPackage::fetchInfo() if (mimeTypesFileName && CFGetTypeID(mimeTypesFileName.get()) == CFStringGetTypeID()) { WTF::RetainPtr<CFStringRef> fileName = (CFStringRef)mimeTypesFileName.get(); - WTF::RetainPtr<CFStringRef> homeDir = homeDirectoryPath().createCFString(); - WTF::RetainPtr<CFStringRef> path(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get())); + WTF::RetainPtr<CFStringRef> homeDir = adoptCF(homeDirectoryPath().createCFString()); + WTF::RetainPtr<CFStringRef> path = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get())); WTF::RetainPtr<CFDictionaryRef> plist = readPListFile(path.get(), /*createFile*/ false, m_module); if (plist) { @@ -255,8 +255,8 @@ bool PluginPackage::load() return true; } - WTF::RetainPtr<CFStringRef> path = m_path.createCFString(); - WTF::RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), + WTF::RetainPtr<CFStringRef> path = adoptCF(m_path.createCFString()); + WTF::RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), kCFURLPOSIXPathStyle, false)); m_module = CFBundleCreate(NULL, url.get()); if (!m_module || !CFBundleLoadExecutable(m_module)) { diff --git a/Source/WebCore/plugins/mac/PluginViewMac.mm b/Source/WebCore/plugins/mac/PluginViewMac.mm index c163b5f3b..0a7650f34 100644 --- a/Source/WebCore/plugins/mac/PluginViewMac.mm +++ b/Source/WebCore/plugins/mac/PluginViewMac.mm @@ -61,11 +61,8 @@ #include "WheelEvent.h" #include "npruntime_impl.h" #include "runtime_root.h" -#include <AppKit/NSEvent.h> -#include <AppKit/NSMenu.h> -#include <AppKit/NSWindow.h> #include <runtime/JSLock.h> -#include <runtime/JSValue.h> +#include <runtime/JSCJSValue.h> #include <wtf/RetainPtr.h> @@ -79,11 +76,6 @@ using JSC::JSValue; #include <QPainter> #endif -#if PLATFORM(WX) -#include <wx/defs.h> -#include <wx/wx.h> -#endif - using namespace WTF; namespace WebCore { @@ -303,7 +295,7 @@ void PluginView::setNPWindowIfNeeded() m_npWindow.clipRect.right - m_npWindow.clipRect.left, m_npWindow.clipRect.bottom - m_npWindow.clipRect.top); PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); @@ -316,7 +308,7 @@ void PluginView::updatePluginWidget() return; ASSERT(parent()->isFrameView()); - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); IntRect oldWindowRect = m_windowRect; m_windowRect = frameView->contentsToWindow(frameRect()); @@ -473,7 +465,7 @@ void PluginView::handleMouseEvent(MouseEvent* event) // The plugin needs focus to receive keyboard events if (Page* page = m_parentFrame->page()) page->focusController()->setFocusedFrame(m_parentFrame); - m_parentFrame->document()->setFocusedNode(m_element); + m_parentFrame->document()->setFocusedElement(m_element); break; case NSLeftMouseUp: @@ -609,7 +601,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event) int16_t PluginView::dispatchNPCocoaEvent(NPCocoaEvent& cocoaEvent) { PluginView::setCurrentPluginView(this); - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); int16_t response = m_plugin->pluginFuncs()->event(m_instance, &cocoaEvent); diff --git a/Source/WebCore/plugins/npapi-sandbox.h b/Source/WebCore/plugins/npapi-sandbox.h deleted file mode 100644 index 651fdad16..000000000 --- a/Source/WebCore/plugins/npapi-sandbox.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2012 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 met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*! - * @header WebKit Mac Sandbox - * - * This header provides an *EXPERIMENTAL* API for NPAPI plug-ins that wish - * to reduce their runtime privileges. When entering the sandbox, adopting - * plug-ins specify a whitelist of files they wish to have available for - * reading and writing. Plug-ins that need to have access to arbitrary files, - * such as to enable user-initiated file uploads or downloads, can invoke - * native Cocoa APIs, which will automatically grant permissions to the plug-in. - * - * - * Security characteristics - * - * Sandboxed plug-in's local file access is restricted to the union of: - * - * 1. The file whitelist specified by the plug-in when entering the sandbox. - * 2. Any files obtained at runtime through the secure Open and Save dialogs. - * 3. Any files that were open before entering the sandbox. - * - * Implementation may additionally choose to restrict the creation of IPC - * channels or the use of other security-sensitive system resources, such as - * the ability to spawn additional processes. However, any such resources - * acquired before entry into the sandbox are guaranteed to remain available - * within it. For example, plug-ins are free to spawn a trusted broker process - * before entering the sandbox and to establish an IPC channel with it. The - * channel will remain available within the sandbox even if the implementation - * is highly restrictive and allows neither process creation nor IPC channel - * establishment. - */ - - -#ifndef npapi_sandbox_h -#define npapi_sandbox_h - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * @constant WKNVSandboxFunctions - * Use this constant with NPN_GetValue to get a pointer to WKNSandboxFunctions - * structure, which contains pointers to sandboxing functions. - */ -#define WKNVSandboxFunctions 74659 - -/*! - * Version of WKNSandboxFunctions structure that is returned by NPN_GetValue. - */ -#define WKNVSandboxFunctionsVersionCurrent 1 - -/*! - * @function WKN_EnterSandbox - * Requests that the plug-in instance be placed in a sandbox. - * - * @param readOnlyPaths - * NULL-terminated C array of paths to files and directories that the plug-in - * wishes to have available in the sandbox for read-only access. Any - * directories in this array will automatically extend the sandbox to encompass - * all their files and subdirectories, meaning that they will be available - * through OS level file access functions for reading. - * - * @param readWritePaths - * NULL-terminated C array of paths to files and directories that the plug-in - * wishes to have available in the sandbox for both reading and writing. - * Typically, this array will include paths to the plug-in's local caches, a - * directory for temporary files, and any configuration files which are not - * security sensitive, in that they are not consulted when determining the - * lists of paths to pass to this function during plug-in instantiation. - * Any directories in this array will automatically extend the sandbox to - * encompass all their files and subdirectories, meaning that they will be - * available through OS level file access functions for reading and writing. - * - * @result - * Places the plug-in instance in a sandbox. The sandbox allows read-only access - * to paths specified by `readOnlyPaths` and read-write access to - * `readWritePaths`. If the same path appears in both `readOnlyPaths` and - * `readWritePaths`, access to that path will be read-only. No other filesystem - * access is available except as expressly permitted by the user through - * NSOpenPanel and NSSavePanel invocations. Returns NPERR_NO_ERROR when the - * navigator has successfully placed the plug-in in a sandbox and - * NPERR_GENERIC_ERROR if the the plug-in instance was already placed in a sandbox - * with a prior call to this function. If entering sandbox fails for any other reason, - * the process is terminated. - * Note that either or both `readOnlyPaths` and `readWritePaths` may be NULL. - * - * @discussion - * This function should be called as early as possible during plug-in - * instantiation and ALWAYS before any untrusted code has run. Generally, the - * only things that the plug-in should do before entering the sandbox are to - * determine the paths to pass in as `readOnlyPaths` and `readWritePaths`, and - * to establish any IPC channels to be used from the sandbox. In cases where - * the plug-in must parse its configuration files to determine any needed local - * resources (such as files to preload), it should do so and then immediately - * call this function. If configuration files do not influence the paths that - * the plug-in will pass as part of `readOnlyPaths` and `readWritePaths`, the - * plug-in should enter the sandbox first and only then process configuration - * files and deal with normal startup tasks. - * - * Very close attention must be paid to weeding out security-sensitive files - * from the `readWritePaths` list. If the plug-in instance reads a configuration - * file at startup to determine which additional files it will place in the - * `readWritePaths` list to this call, then that configuration file MUST NOT be - * in the `readWritePaths` itself. Otherwise, should the plug-in become - * compromised, it can trivially escape its sandbox the next time it is - * instantiated by writing arbitrary paths (or just "/") into this writable - * configuration file. - * - * Note that after a plug-in instance enters the sandbox, any native calls that - * it makes which refer to arbitrary paths on disk will only work if the paths are - * available within the sandbox, either statically through `readOnlyPaths` and - * `readWritePaths`, or dynamically through Cocoa APIs. - * However, NPAPI calls (such as e.g. NPN_PostURL with the file parameter set to TRUE) - * can access files that navigator policies allow, which is usually an entirely - * different set for remote and for local Web pages. - */ -typedef NPError (*WKN_EnterSandboxProcPtr)(const char *readOnlyPaths[], const char *readWritePaths[]); - -/*! - * @function WKN_FileStopAccessing - * Requests that the navigator revoke the plug-in's access to the given path. - * - * @param path - * Required. A path that was previously returned from NSOpenPanel or NSSavePanel. - * - * @result - * Returns NPERR_NO_ERROR, or NPERR_GENERIC_ERROR if the requesting plug-in - * instance is not in a sandbox. - * - * @discussion - * Whenever file access is provided to a plug-in instance through a - * Cocoa API, navigator should be notfied when it is no longer needed. - * This will cause subsequent open(2) calls on any of the revoked files to fail, - * but by design no attempt is made to invalidate existing file descriptors. - * plug-in writers are strongly encouraged to keep files open for as short a period - * of time as possible, and to always call this function when objects representing - * the returned files go out of scope or are otherwise destroyed. - */ -typedef NPError (*WKN_FileStopAccessingProcPtr)(const char* path); - -typedef struct _WKNSandboxFunctions { - uint16_t size; - uint16_t version; - - WKN_EnterSandboxProcPtr enterSandbox; - WKN_FileStopAccessingProcPtr fileStopAccessing; -} WKNSandboxFunctions; - -#ifdef __cplusplus -} -#endif - -#endif // npapi_sandbox_h diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp index 60d23f895..94ef7eb7d 100644 --- a/Source/WebCore/plugins/qt/PluginViewQt.cpp +++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp @@ -28,9 +28,7 @@ #include "config.h" #include "PluginView.h" -#if USE(JSC) #include "BridgeJSC.h" -#endif #include "Chrome.h" #include "ChromeClient.h" #include "Document.h" @@ -49,9 +47,8 @@ #include "HostWindow.h" #include "IFrameShimSupport.h" #include "Image.h" -#if USE(JSC) #include "JSDOMBinding.h" -#endif +#include "JSDOMWindowBase.h" #include "KeyboardEvent.h" #include "MouseEvent.h" #include "NotImplemented.h" @@ -65,9 +62,7 @@ #include "RenderObject.h" #include "Settings.h" #include "npruntime_impl.h" -#if USE(JSC) #include "runtime_root.h" -#endif #include <QKeyEvent> #include <QPainter> #include <X11/X.h> @@ -76,8 +71,8 @@ #define Status int #include <X11/extensions/Xrender.h> #endif +#include <runtime/JSCJSValue.h> #include <runtime/JSLock.h> -#include <runtime/JSValue.h> #include "QtX11ImageConversion.h" #include <QGuiApplication> @@ -85,9 +80,7 @@ #include <qpa/qplatformnativeinterface.h> using JSC::ExecState; -#if USE(JSC) using JSC::Interpreter; -#endif using JSC::JSLock; using JSC::JSObject; @@ -137,7 +130,7 @@ void PluginView::updatePluginWidget() return; ASSERT(parent()->isFrameView()); - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); IntRect oldWindowRect = m_windowRect; IntRect oldClipRect = m_clipRect; @@ -281,9 +274,7 @@ bool PluginView::dispatchNPEvent(NPEvent& event) } PluginView::setCurrentPluginView(this); -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); bool accepted = !m_plugin->pluginFuncs()->event(m_instance, &event); setCallingPlugin(false); @@ -566,9 +557,7 @@ void PluginView::setNPWindowIfNeeded() } PluginView::setCurrentPluginView(this); -#if USE(JSC) - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); -#endif + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); diff --git a/Source/WebCore/plugins/win/PluginDatabaseWin.cpp b/Source/WebCore/plugins/win/PluginDatabaseWin.cpp index 2460934b4..0ec7e0959 100644 --- a/Source/WebCore/plugins/win/PluginDatabaseWin.cpp +++ b/Source/WebCore/plugins/win/PluginDatabaseWin.cpp @@ -115,7 +115,7 @@ void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const for (Vector<String>::const_iterator it = m_pluginDirectories.begin(); it != end; ++it) { String pattern = *it + "\\*"; - hFind = FindFirstFileW(pattern.charactersWithNullTermination(), &findFileData); + hFind = FindFirstFileW(pattern.charactersWithNullTermination().data(), &findFileData); if (hFind == INVALID_HANDLE_VALUE) continue; @@ -215,7 +215,7 @@ static inline void addMozillaPluginDirectories(Vector<String>& directories) HKEY extensionsKey; // Try opening the key - result = RegOpenKeyEx(key, extensionsPath.charactersWithNullTermination(), 0, KEY_READ, &extensionsKey); + result = RegOpenKeyEx(key, extensionsPath.charactersWithNullTermination().data(), 0, KEY_READ, &extensionsKey); if (result == ERROR_SUCCESS) { // Now get the plugins directory @@ -305,7 +305,7 @@ static inline void addAdobeAcrobatPluginDirectory(Vector<String>& directories) DWORD acrobatInstallPathSize = sizeof(acrobatInstallPathStr); String acrobatPluginKeyPath = "Software\\Adobe\\Acrobat Reader\\" + latestAcrobatVersionString + "\\InstallPath"; - result = getRegistryValue(HKEY_LOCAL_MACHINE, acrobatPluginKeyPath.charactersWithNullTermination(), 0, &type, acrobatInstallPathStr, &acrobatInstallPathSize); + result = getRegistryValue(HKEY_LOCAL_MACHINE, acrobatPluginKeyPath.charactersWithNullTermination().data(), 0, &type, acrobatInstallPathStr, &acrobatInstallPathSize); if (result == ERROR_SUCCESS) { String acrobatPluginDirectory = String(acrobatInstallPathStr, acrobatInstallPathSize / sizeof(WCHAR) - 1) + "\\browser"; @@ -352,10 +352,10 @@ static inline void addJavaPluginDirectory(Vector<String>& directories) DWORD useNewPluginSize; String javaPluginKeyPath = "Software\\JavaSoft\\Java Plug-in\\" + latestJavaVersionString; - result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination(), L"UseNewJavaPlugin", &type, &useNewPluginValue, &useNewPluginSize); + result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination().data(), L"UseNewJavaPlugin", &type, &useNewPluginValue, &useNewPluginSize); if (result == ERROR_SUCCESS && useNewPluginValue == 1) { - result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination(), L"JavaHome", &type, javaInstallPathStr, &javaInstallPathSize); + result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination().data(), L"JavaHome", &type, javaInstallPathStr, &javaInstallPathSize); if (result == ERROR_SUCCESS) { String javaPluginDirectory = String(javaInstallPathStr, javaInstallPathSize / sizeof(WCHAR) - 1) + "\\bin\\new_plugin"; directories.append(javaPluginDirectory); @@ -413,7 +413,7 @@ static inline void addQtWebKitPluginPath(Vector<String>& directories) Vector<String> qtPaths; String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").constData()); qtPath.split(UChar(';'), false, qtPaths); - directories.append(qtPaths); + directories.appendVector(qtPaths); } #endif diff --git a/Source/WebCore/plugins/win/PluginPackageWin.cpp b/Source/WebCore/plugins/win/PluginPackageWin.cpp index 4088189a4..ab8459f75 100644 --- a/Source/WebCore/plugins/win/PluginPackageWin.cpp +++ b/Source/WebCore/plugins/win/PluginPackageWin.cpp @@ -47,7 +47,7 @@ static String getVersionInfo(const LPVOID versionInfoData, const String& info) UINT bufferLength; String subInfo = "\\StringfileInfo\\040904E4\\" + info; bool retval = VerQueryValueW(versionInfoData, - const_cast<UChar*>(subInfo.charactersWithNullTermination()), + const_cast<UChar*>(subInfo.charactersWithNullTermination().data()), &buffer, &bufferLength); if (!retval || bufferLength == 0) return String(); @@ -167,13 +167,13 @@ void PluginPackage::determineQuirks(const String& mimeType) bool PluginPackage::fetchInfo() { DWORD versionInfoSize, zeroHandle; - versionInfoSize = GetFileVersionInfoSizeW(const_cast<UChar*>(m_path.charactersWithNullTermination()), &zeroHandle); + versionInfoSize = GetFileVersionInfoSizeW(const_cast<UChar*>(m_path.charactersWithNullTermination().data()), &zeroHandle); if (versionInfoSize == 0) return false; OwnArrayPtr<char> versionInfoData = adoptArrayPtr(new char[versionInfoSize]); - if (!GetFileVersionInfoW(const_cast<UChar*>(m_path.charactersWithNullTermination()), + if (!GetFileVersionInfoW(const_cast<UChar*>(m_path.charactersWithNullTermination().data()), 0, versionInfoSize, versionInfoData.get())) return false; @@ -238,7 +238,7 @@ bool PluginPackage::load() return true; } else { #if OS(WINCE) - m_module = ::LoadLibraryW(m_path.charactersWithNullTermination()); + m_module = ::LoadLibraryW(m_path.charactersWithNullTermination().data()); #else WCHAR currentPath[MAX_PATH]; @@ -247,11 +247,11 @@ bool PluginPackage::load() String path = m_path.substring(0, m_path.reverseFind('\\')); - if (!::SetCurrentDirectoryW(path.charactersWithNullTermination())) + if (!::SetCurrentDirectoryW(path.charactersWithNullTermination().data())) return false; // Load the library - m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); + m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); if (!::SetCurrentDirectoryW(currentPath)) { if (m_module) diff --git a/Source/WebCore/plugins/win/PluginViewWin.cpp b/Source/WebCore/plugins/win/PluginViewWin.cpp index 7160d8a99..fae3c4415 100644 --- a/Source/WebCore/plugins/win/PluginViewWin.cpp +++ b/Source/WebCore/plugins/win/PluginViewWin.cpp @@ -29,6 +29,7 @@ #include "PluginView.h" #include "BitmapImage.h" +#include "BitmapInfo.h" #include "BridgeJSC.h" #include "Chrome.h" #include "ChromeClient.h" @@ -66,15 +67,11 @@ #include "c_instance.h" #include "npruntime_impl.h" #include "runtime_root.h" +#include <runtime/JSCJSValue.h> #include <runtime/JSLock.h> -#include <runtime/JSValue.h> #include <wtf/ASCIICType.h> #include <wtf/text/WTFString.h> -#if !PLATFORM(WX) -#include "BitmapInfo.h" -#endif - #if OS(WINCE) #undef LOG_NPERROR #define LOG_NPERROR(x) @@ -97,11 +94,6 @@ #include <QWindow> #endif -#if PLATFORM(WX) -#include <wx/defs.h> -#include <wx/window.h> -#endif - static inline HWND windowHandleForPageClient(PlatformPageClient client) { #if PLATFORM(GTK) @@ -116,10 +108,6 @@ static inline HWND windowHandleForPageClient(PlatformPageClient client) if (QWindow* window = client->ownerWindow()) return reinterpret_cast<HWND>(window->winId()); return 0; -#elif PLATFORM(WX) - if (!client) - return 0; - return (HWND)client->GetHandle(); #else return client; #endif @@ -455,7 +443,7 @@ void PluginView::updatePluginWidget() return; ASSERT(parent()->isFrameView()); - FrameView* frameView = static_cast<FrameView*>(parent()); + FrameView* frameView = toFrameView(parent()); IntRect oldWindowRect = m_windowRect; IntRect oldClipRect = m_clipRect; @@ -551,7 +539,7 @@ bool PluginView::dispatchNPEvent(NPEvent& npEvent) shouldPop = true; } - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); bool accepted = !m_plugin->pluginFuncs()->event(m_instance, &npEvent); setCallingPlugin(false); @@ -576,7 +564,7 @@ void PluginView::paintIntoTransformedContext(HDC hdc) WINDOWPOS windowpos = { 0, 0, 0, 0, 0, 0, 0 }; - IntRect r = contentsToNativeWindow(static_cast<FrameView*>(parent()), frameRect()); + IntRect r = contentsToNativeWindow(toFrameView(parent()), frameRect()); windowpos.x = r.x(); windowpos.y = r.y(); @@ -604,12 +592,12 @@ void PluginView::paintIntoTransformedContext(HDC hdc) void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const IntRect& rect) { -#if !OS(WINCE) +#if !USE(WINGDI) ASSERT(m_isWindowed); ASSERT(context->shouldIncludeChildWindows()); ASSERT(parent()->isFrameView()); - IntPoint locationInWindow = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location()); + IntPoint locationInWindow = toFrameView(parent())->convertToContainingWindow(frameRect().location()); LocalWindowsContext windowsContext(context, frameRect(), false); @@ -654,7 +642,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) setNPWindowRect(frameRect()); if (m_isWindowed) { -#if !OS(WINCE) +#if !USE(WINGDI) if (context->shouldIncludeChildWindows()) paintWindowedPluginIntoContext(context, rect); #endif @@ -669,7 +657,7 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) IntRect rectInWindow(rect); rectInWindow.intersect(frameRect()); #else - IntRect rectInWindow = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()); + IntRect rectInWindow = toFrameView(parent())->contentsToWindow(frameRect()); #endif LocalWindowsContext windowsContext(context, rectInWindow, m_isTransparent); @@ -710,7 +698,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event) } else return; - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); if (dispatchNPEvent(npEvent)) event->setDefaultHandled(); } @@ -725,7 +713,7 @@ void PluginView::handleMouseEvent(MouseEvent* event) NPEvent npEvent; - IntPoint p = contentsToNativeWindow(static_cast<FrameView*>(parent()), IntPoint(event->pageX(), event->pageY())); + IntPoint p = contentsToNativeWindow(toFrameView(parent()), IntPoint(event->pageX(), event->pageY())); npEvent.lParam = MAKELPARAM(p.x(), p.y()); npEvent.wParam = 0; @@ -780,17 +768,17 @@ void PluginView::handleMouseEvent(MouseEvent* event) } else return; - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); // FIXME: Consider back porting the http://webkit.org/b/58108 fix here. if (dispatchNPEvent(npEvent)) event->setDefaultHandled(); -#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(WX) && !OS(WINCE) +#if !PLATFORM(GTK) && !PLATFORM(QT) && !OS(WINCE) // Currently, Widget::setCursor is always called after this function in EventHandler.cpp // and since we don't want that we set ignoreNextSetCursor to true here to prevent that. ignoreNextSetCursor = true; if (Page* page = m_parentFrame->page()) - page->chrome()->client()->setLastSetCursorToCurrentCursor(); + page->chrome().client()->setLastSetCursorToCurrentCursor(); #endif } @@ -844,7 +832,7 @@ void PluginView::setNPWindowRect(const IntRect& rect) return; #if OS(WINCE) - IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(rect); + IntRect r = toFrameView(parent())->contentsToWindow(rect); m_npWindow.x = r.x(); m_npWindow.y = r.y(); @@ -859,7 +847,7 @@ void PluginView::setNPWindowRect(const IntRect& rect) # if PLATFORM(GTK) || PLATFORM(QT) IntPoint p = rect.location(); # else - IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(rect.location()); + IntPoint p = toFrameView(parent())->contentsToWindow(rect.location()); # endif m_npWindow.x = p.x(); m_npWindow.y = p.y(); @@ -874,7 +862,7 @@ void PluginView::setNPWindowRect(const IntRect& rect) m_npWindow.clipRect.top = 0; if (m_plugin->pluginFuncs()->setwindow) { - JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonJSGlobalData()); + JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); @@ -909,13 +897,13 @@ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32_t len, const // Get file info WIN32_FILE_ATTRIBUTE_DATA attrs; - if (GetFileAttributesExW(filename.charactersWithNullTermination(), GetFileExInfoStandard, &attrs) == 0) + if (GetFileAttributesExW(filename.charactersWithNullTermination().data(), GetFileExInfoStandard, &attrs) == 0) return NPERR_FILE_NOT_FOUND; if (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) return NPERR_FILE_NOT_FOUND; - HANDLE fileHandle = CreateFileW(filename.charactersWithNullTermination(), FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + HANDLE fileHandle = CreateFileW(filename.charactersWithNullTermination().data(), FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (fileHandle == INVALID_HANDLE_VALUE) return NPERR_FILE_NOT_FOUND; @@ -1036,7 +1024,7 @@ bool PluginView::platformStart() HWND window = ::CreateWindowEx(0, kWebPluginViewdowClassName, 0, flags, 0, 0, 0, 0, parentWindowHandle, 0, WebCore::instanceHandle(), 0); -#if OS(WINDOWS) && (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX)) +#if OS(WINDOWS) && (PLATFORM(GTK) || PLATFORM(QT)) m_window = window; #else setPlatformWidget(window); @@ -1079,7 +1067,7 @@ void PluginView::platformDestroy() PassRefPtr<Image> PluginView::snapshot() { -#if !PLATFORM(GTK) && !PLATFORM(WX) && !OS(WINCE) +#if !PLATFORM(GTK) && !USE(WINGDI) OwnPtr<HDC> hdc = adoptPtr(CreateCompatibleDC(0)); if (!m_isWindowed) { @@ -1092,7 +1080,7 @@ PassRefPtr<Image> PluginView::snapshot() // Windowless plug-ins assume that they're drawing onto the view's DC. // Translate the context so that the plug-in draws at (0, 0). ASSERT(parent()->isFrameView()); - IntPoint position = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()).location(); + IntPoint position = toFrameView(parent())->contentsToWindow(frameRect()).location(); transform.eDx = -position.x(); transform.eDy = -position.y(); SetWorldTransform(hdc.get(), &transform); diff --git a/Source/WebCore/plugins/wx/PluginDataWx.cpp b/Source/WebCore/plugins/wx/PluginDataWx.cpp deleted file mode 100644 index 27952c4ae..000000000 --- a/Source/WebCore/plugins/wx/PluginDataWx.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "config.h" -#include "PluginData.h" - -#include "NotImplemented.h" -#include "PluginDatabase.h" -#include "PluginPackage.h" - -namespace WebCore { - -void PluginData::initPlugins(const Page*) -{ - PluginDatabase* db = PluginDatabase::installedPlugins(); - const Vector<PluginPackage*> &plugins = db->plugins(); - - for (unsigned int i = 0; i < plugins.size(); ++i) { - PluginInfo info; - PluginPackage* package = plugins[i]; - - info.name = package->name(); - info.file = package->fileName(); - info.desc = package->description(); - - const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions(); - MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); - for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { - MimeClassInfo mime; - - mime.type = it->key; - mime.desc = it->value; - mime.extensions = package->mimeToExtensions().get(mime.type); - - info.mimes.append(mime); - } - - m_plugins.append(info); - } -} - -void PluginData::refresh() -{ - notImplemented(); -} - -}; |