diff options
Diffstat (limited to 'Source/WebCore/html/HTMLPlugInElement.h')
-rw-r--r-- | Source/WebCore/html/HTMLPlugInElement.h | 66 |
1 files changed, 27 insertions, 39 deletions
diff --git a/Source/WebCore/html/HTMLPlugInElement.h b/Source/WebCore/html/HTMLPlugInElement.h index 5866a4bf0..89271c48b 100644 --- a/Source/WebCore/html/HTMLPlugInElement.h +++ b/Source/WebCore/html/HTMLPlugInElement.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2004-2017 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,16 +20,11 @@ * */ -#ifndef HTMLPlugInElement_h -#define HTMLPlugInElement_h +#pragma once #include "HTMLFrameOwnerElement.h" #include "Image.h" -#if ENABLE(NETSCAPE_PLUGIN_API) -struct NPObject; -#endif - namespace JSC { namespace Bindings { class Instance; @@ -49,9 +44,10 @@ public: void resetInstance(); - PassRefPtr<JSC::Bindings::Instance> getInstance(); + JSC::Bindings::Instance* bindingsInstance(); - Widget* pluginWidget() const; + enum class PluginLoadingPolicy { DoNotLoad, Load }; + WEBCORE_EXPORT Widget* pluginWidget(PluginLoadingPolicy = PluginLoadingPolicy::Load) const; enum DisplayState { WaitingForSnapshot, @@ -64,44 +60,42 @@ public: }; DisplayState displayState() const { return m_displayState; } virtual void setDisplayState(DisplayState); - virtual void updateSnapshot(PassRefPtr<Image>) { } + virtual void updateSnapshot(Image*) { } virtual void dispatchPendingMouseClick() { } virtual bool isRestartedPlugin() const { return false; } JSC::JSObject* scriptObjectForPluginReplacement(); -#if ENABLE(NETSCAPE_PLUGIN_API) - NPObject* getNPObject(); -#endif - bool isCapturingMouseEvents() const { return m_isCapturingMouseEvents; } void setIsCapturingMouseEvents(bool capturing) { m_isCapturingMouseEvents = capturing; } - virtual bool canContainRangeEndPoint() const override { return false; } + bool canContainRangeEndPoint() const override { return false; } bool canProcessDrag() const; #if PLATFORM(IOS) - virtual bool willRespondToMouseMoveEvents() override { return false; } + bool willRespondToMouseMoveEvents() override { return false; } #endif - virtual bool willRespondToMouseClickEvents() override; + bool willRespondToMouseClickEvents() override; virtual bool isPlugInImageElement() const { return false; } + bool isUserObservable() const; + protected: HTMLPlugInElement(const QualifiedName& tagName, Document&); - virtual void willDetachRenderers() override; - virtual bool isPresentationAttribute(const QualifiedName&) const override; - virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; + void willDetachRenderers() override; + bool isPresentationAttribute(const QualifiedName&) const override; + void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; virtual bool useFallbackContent() const { return false; } - virtual void defaultEventHandler(Event*) override; + void defaultEventHandler(Event&) override; virtual bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues); - virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override; - virtual void didAddUserAgentShadowRoot(ShadowRoot*) override; + RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; + void didAddUserAgentShadowRoot(ShadowRoot*) override; // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly. bool guardedDispatchBeforeLoadEvent(const String& sourceURL); @@ -109,35 +103,29 @@ protected: bool m_inBeforeLoadEventHandler; private: - void swapRendererTimerFired(Timer<HTMLPlugInElement>&); + void swapRendererTimerFired(); bool shouldOverridePlugin(const String& url, const String& mimeType); bool dispatchBeforeLoadEvent(const String& sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake. - virtual bool areAuthorShadowsAllowed() const override { return false; } + // This will load the plugin if necessary. + virtual RenderWidget* renderWidgetLoadingPlugin() const = 0; - virtual RenderWidget* renderWidgetForJSBindings() const = 0; + bool supportsFocus() const override; - virtual bool supportsFocus() const override; - - virtual bool isKeyboardFocusable(KeyboardEvent*) const override; - virtual bool isPluginElement() const override final; + bool isKeyboardFocusable(KeyboardEvent&) const override; + bool isPluginElement() const final; RefPtr<JSC::Bindings::Instance> m_instance; - Timer<HTMLPlugInElement> m_swapRendererTimer; + Timer m_swapRendererTimer; RefPtr<PluginReplacement> m_pluginReplacement; -#if ENABLE(NETSCAPE_PLUGIN_API) - NPObject* m_NPObject; -#endif bool m_isCapturingMouseEvents; DisplayState m_displayState; }; -void isHTMLPlugInElement(const HTMLPlugInElement&); // Catch unnecessary runtime check of type known at compile time. -inline bool isHTMLPlugInElement(const Node& node) { return node.isPluginElement(); } -NODE_TYPE_CASTS(HTMLPlugInElement) - } // namespace WebCore -#endif // HTMLPlugInElement_h +SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLPlugInElement) + static bool isType(const WebCore::Node& node) { return node.isPluginElement(); } +SPECIALIZE_TYPE_TRAITS_END() |