2011-06-01 08:37:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
// vim:set ts=2 sts=2 sw=2 et cin:
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
#ifndef nsPluginInstanceOwner_h_
|
|
|
|
#define nsPluginInstanceOwner_h_
|
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-06-01 08:37:54 +04:00
|
|
|
#include "npapi.h"
|
|
|
|
#include "nsCOMPtr.h"
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
#include "nsIKeyEventInPluginCallback.h"
|
2011-06-01 08:37:54 +04:00
|
|
|
#include "nsIPluginInstanceOwner.h"
|
2012-04-24 08:49:25 +04:00
|
|
|
#include "nsIPrivacyTransitionObserver.h"
|
2011-08-08 22:26:22 +04:00
|
|
|
#include "nsIDOMEventListener.h"
|
2011-06-01 08:37:54 +04:00
|
|
|
#include "nsPluginHost.h"
|
|
|
|
#include "nsPluginNativeWindow.h"
|
2012-04-24 08:49:25 +04:00
|
|
|
#include "nsWeakReference.h"
|
2011-06-01 08:37:54 +04:00
|
|
|
#include "gfxRect.h"
|
|
|
|
|
|
|
|
#ifdef XP_MACOSX
|
2012-07-31 19:11:57 +04:00
|
|
|
#include "mozilla/gfx/QuartzSupport.h"
|
2011-06-01 08:37:54 +04:00
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class nsIInputStream;
|
|
|
|
class nsPluginDOMContextMenuListener;
|
2014-09-24 08:34:00 +04:00
|
|
|
class nsPluginFrame;
|
2011-06-01 08:37:54 +04:00
|
|
|
class nsDisplayListBuilder;
|
|
|
|
|
2015-12-18 06:39:10 +03:00
|
|
|
#if defined(MOZ_X11) || defined(ANDROID)
|
|
|
|
class gfxContext;
|
|
|
|
#endif
|
|
|
|
|
2014-08-16 01:17:35 +04:00
|
|
|
namespace mozilla {
|
2015-12-29 16:57:38 +03:00
|
|
|
class TextComposition;
|
2014-08-16 01:17:35 +04:00
|
|
|
namespace dom {
|
|
|
|
struct MozPluginParameter;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2014-12-11 17:44:07 +03:00
|
|
|
namespace widget {
|
|
|
|
class PuppetWidget;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
2014-12-11 17:44:07 +03:00
|
|
|
|
|
|
|
using mozilla::widget::PuppetWidget;
|
2014-08-16 01:17:35 +04:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
#ifdef MOZ_X11
|
2012-04-21 01:15:59 +04:00
|
|
|
#include "gfxXlibNativeRenderer.h"
|
2011-06-01 08:37:54 +04:00
|
|
|
#endif
|
|
|
|
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
class nsPluginInstanceOwner final : public nsIPluginInstanceOwner
|
|
|
|
, public nsIDOMEventListener
|
|
|
|
, public nsIPrivacyTransitionObserver
|
|
|
|
, public nsIKeyEventInPluginCallback
|
|
|
|
, public nsSupportsWeakReference
|
2011-06-01 08:37:54 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-12-18 06:39:10 +03:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
nsPluginInstanceOwner();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPLUGININSTANCEOWNER
|
2012-04-24 08:49:25 +04:00
|
|
|
NS_DECL_NSIPRIVACYTRANSITIONOBSERVER
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
NS_IMETHOD GetURL(const char *aURL, const char *aTarget,
|
|
|
|
nsIInputStream *aPostStream,
|
2015-08-05 06:06:03 +03:00
|
|
|
void *aHeadersData, uint32_t aHeadersDataLen,
|
|
|
|
bool aDoCheckLoadURIChecks) override;
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
2015-03-21 19:28:04 +03:00
|
|
|
double *destX, double *destY, NPCoordinateSpace destSpace) override;
|
2015-12-02 22:31:16 +03:00
|
|
|
|
|
|
|
NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
|
|
|
|
void *initData, NPAsyncSurface *surface) override;
|
|
|
|
NPError FinalizeAsyncSurface(NPAsyncSurface *surface) override;
|
|
|
|
void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) override;
|
|
|
|
|
2013-12-03 12:36:13 +04:00
|
|
|
/**
|
|
|
|
* Get the type of the HTML tag that was used ot instantiate this
|
|
|
|
* plugin. Currently supported tags are EMBED, OBJECT and APPLET.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetTagType(nsPluginTagType *aResult);
|
|
|
|
|
2014-08-16 01:17:35 +04:00
|
|
|
void GetParameters(nsTArray<mozilla::dom::MozPluginParameter>& parameters);
|
|
|
|
void GetAttributes(nsTArray<mozilla::dom::MozPluginParameter>& attributes);
|
2013-12-03 12:36:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the DOM element corresponding to the tag which references
|
|
|
|
* this plugin in the document.
|
|
|
|
*
|
|
|
|
* @param aDOMElement - resulting DOM element
|
|
|
|
* @result - NS_OK if this operation was successful
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetDOMElement(nsIDOMElement* * aResult);
|
2011-06-01 08:37:54 +04:00
|
|
|
|
2011-08-08 22:26:22 +04:00
|
|
|
// nsIDOMEventListener interfaces
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
2011-06-01 08:37:54 +04:00
|
|
|
|
2012-10-03 06:43:18 +04:00
|
|
|
nsresult ProcessMouseDown(nsIDOMEvent* aKeyEvent);
|
|
|
|
nsresult ProcessKeyPress(nsIDOMEvent* aKeyEvent);
|
2011-06-01 08:37:54 +04:00
|
|
|
nsresult Destroy();
|
2012-02-01 01:55:54 +04:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
#ifdef XP_WIN
|
|
|
|
void Paint(const RECT& aDirty, HDC aDC);
|
|
|
|
#elif defined(XP_MACOSX)
|
|
|
|
void Paint(const gfxRect& aDirtyRect, CGContextRef cgContext);
|
|
|
|
void RenderCoreAnimation(CGContextRef aCGContext, int aWidth, int aHeight);
|
|
|
|
void DoCocoaEventDrawRect(const gfxRect& aDrawRect, CGContextRef cgContext);
|
2011-09-17 01:34:31 +04:00
|
|
|
#elif defined(MOZ_X11) || defined(ANDROID)
|
2011-06-01 08:37:54 +04:00
|
|
|
void Paint(gfxContext* aContext,
|
|
|
|
const gfxRect& aFrameRect,
|
|
|
|
const gfxRect& aDirtyRect);
|
|
|
|
#endif
|
2012-10-15 16:38:34 +04:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
//locals
|
|
|
|
|
2012-02-01 01:55:54 +04:00
|
|
|
nsresult Init(nsIContent* aContent);
|
2011-06-01 08:37:54 +04:00
|
|
|
|
2014-12-11 17:44:07 +03:00
|
|
|
void* GetPluginPort();
|
2011-06-01 08:37:54 +04:00
|
|
|
void ReleasePluginPort(void* pluginPort);
|
2012-02-01 01:55:54 +04:00
|
|
|
|
2013-10-02 07:46:03 +04:00
|
|
|
nsEventStatus ProcessEvent(const mozilla::WidgetGUIEvent& anEvent);
|
2015-08-12 18:00:26 +03:00
|
|
|
|
2015-12-29 16:57:37 +03:00
|
|
|
static void GeneratePluginEvent(
|
|
|
|
const mozilla::WidgetCompositionEvent* aSrcCompositionEvent,
|
|
|
|
mozilla::WidgetCompositionEvent* aDistCompositionEvent);
|
|
|
|
|
2015-08-12 18:00:26 +03:00
|
|
|
#if defined(XP_WIN)
|
|
|
|
void SetWidgetWindowAsParent(HWND aWindowToAdopt);
|
|
|
|
nsresult SetNetscapeWindowAsParent(HWND aWindowToAdopt);
|
|
|
|
#endif
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
enum { ePluginPaintEnable, ePluginPaintDisable };
|
2014-12-11 17:44:07 +03:00
|
|
|
|
|
|
|
void WindowFocusMayHaveChanged();
|
|
|
|
|
|
|
|
bool WindowIsActive();
|
|
|
|
void SendWindowFocusChanged(bool aIsActive);
|
2011-06-01 08:37:54 +04:00
|
|
|
NPDrawingModel GetDrawingModel();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsRemoteDrawingCoreAnimation();
|
2015-09-17 23:31:34 +03:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
NPEventModel GetEventModel();
|
|
|
|
static void CARefresh(nsITimer *aTimer, void *aClosure);
|
2012-02-17 06:27:37 +04:00
|
|
|
void AddToCARefreshTimer();
|
|
|
|
void RemoveFromCARefreshTimer();
|
2011-10-28 00:00:49 +04:00
|
|
|
// This calls into the plugin (NPP_SetWindow) and can run script.
|
2014-12-11 17:44:07 +03:00
|
|
|
void FixUpPluginWindow(int32_t inPaintState);
|
2011-06-01 08:37:54 +04:00
|
|
|
void HidePluginWindow();
|
|
|
|
// Set plugin port info in the plugin (in the 'window' member of the
|
2014-12-11 17:44:07 +03:00
|
|
|
// NPWindow structure passed to the plugin by SetWindow()).
|
|
|
|
void SetPluginPort();
|
2011-06-01 08:37:54 +04:00
|
|
|
#else // XP_MACOSX
|
2011-09-29 10:19:26 +04:00
|
|
|
void UpdateWindowPositionAndClipRect(bool aSetWindow);
|
|
|
|
void UpdateWindowVisibility(bool aVisible);
|
2011-06-01 08:37:54 +04:00
|
|
|
#endif // XP_MACOSX
|
2012-02-01 01:55:54 +04:00
|
|
|
|
2016-03-17 22:00:59 +03:00
|
|
|
void ResolutionMayHaveChanged();
|
2015-09-17 23:31:34 +03:00
|
|
|
#if defined(XP_MACOSX) || defined(XP_WIN)
|
|
|
|
nsresult ContentsScaleFactorChanged(double aContentsScaleFactor);
|
|
|
|
#endif
|
|
|
|
|
2014-11-12 23:59:20 +03:00
|
|
|
void UpdateDocumentActiveState(bool aIsActive);
|
|
|
|
|
2014-09-24 08:34:00 +04:00
|
|
|
void SetFrame(nsPluginFrame *aFrame);
|
|
|
|
nsPluginFrame* GetFrame();
|
2012-02-01 01:55:54 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetLastEventloopNestingLevel() const {
|
2011-06-01 08:37:54 +04:00
|
|
|
return mLastEventloopNestingLevel;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t GetEventloopNestingLevel();
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
void ConsiderNewEventloopNestingLevel() {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t currentLevel = GetEventloopNestingLevel();
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
if (currentLevel < mLastEventloopNestingLevel) {
|
|
|
|
mLastEventloopNestingLevel = currentLevel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* GetPluginName()
|
|
|
|
{
|
|
|
|
if (mInstance && mPluginHost) {
|
2013-10-24 00:34:30 +04:00
|
|
|
const char* name = nullptr;
|
2011-06-01 08:37:54 +04:00
|
|
|
if (NS_SUCCEEDED(mPluginHost->GetPluginName(mInstance, &name)) && name)
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MOZ_X11
|
|
|
|
void GetPluginDescription(nsACString& aDescription)
|
|
|
|
{
|
|
|
|
aDescription.Truncate();
|
|
|
|
if (mInstance && mPluginHost) {
|
|
|
|
nsCOMPtr<nsIPluginTag> pluginTag;
|
|
|
|
|
|
|
|
mPluginHost->GetPluginTagForInstance(mInstance,
|
|
|
|
getter_AddRefs(pluginTag));
|
|
|
|
if (pluginTag) {
|
|
|
|
pluginTag->GetDescription(aDescription);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool SendNativeEvents()
|
2011-06-01 08:37:54 +04:00
|
|
|
{
|
|
|
|
#ifdef XP_WIN
|
|
|
|
// XXX we should remove the plugin name check
|
|
|
|
return mPluginWindow->type == NPWindowTypeDrawable &&
|
|
|
|
(MatchPluginName("Shockwave Flash") ||
|
|
|
|
MatchPluginName("Test Plug-in"));
|
|
|
|
#elif defined(MOZ_X11) || defined(XP_MACOSX)
|
2011-09-30 10:02:59 +04:00
|
|
|
return true;
|
2011-06-01 08:37:54 +04:00
|
|
|
#else
|
2011-09-30 10:02:59 +04:00
|
|
|
return false;
|
2011-06-01 08:37:54 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool MatchPluginName(const char *aPluginName)
|
2011-06-01 08:37:54 +04:00
|
|
|
{
|
|
|
|
return strncmp(GetPluginName(), aPluginName, strlen(aPluginName)) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPaintWaiter(nsDisplayListBuilder* aBuilder);
|
2012-02-08 19:34:27 +04:00
|
|
|
|
|
|
|
// Returns the image container that has our currently displayed image.
|
2012-11-10 19:45:52 +04:00
|
|
|
already_AddRefed<mozilla::layers::ImageContainer> GetImageContainer();
|
2016-03-01 21:48:26 +03:00
|
|
|
// Returns true if this is windowed plugin that can return static captures
|
|
|
|
// for scroll operations.
|
|
|
|
bool NeedsScrollImageLayer();
|
2016-03-01 21:48:26 +03:00
|
|
|
|
2015-12-02 22:31:17 +03:00
|
|
|
void DidComposite();
|
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
/**
|
|
|
|
* Returns the bounds of the current async-rendered surface. This can only
|
|
|
|
* change in response to messages received by the event loop (i.e. not during
|
|
|
|
* painting).
|
|
|
|
*/
|
|
|
|
nsIntSize GetCurrentImageSize();
|
|
|
|
|
|
|
|
// Methods to update the background image we send to async plugins.
|
|
|
|
// The eventual target of these operations is PluginInstanceParent,
|
|
|
|
// but it takes several hops to get there.
|
|
|
|
void SetBackgroundUnknown();
|
2015-12-18 06:39:10 +03:00
|
|
|
already_AddRefed<DrawTarget> BeginUpdateBackground(const nsIntRect& aRect);
|
2015-12-18 06:39:09 +03:00
|
|
|
void EndUpdateBackground(const nsIntRect& aRect);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool UseAsyncRendering();
|
2012-01-31 18:40:58 +04:00
|
|
|
|
2012-11-27 18:14:38 +04:00
|
|
|
already_AddRefed<nsIURI> GetBaseURI() const;
|
|
|
|
|
2012-02-01 21:28:57 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2012-07-20 23:20:51 +04:00
|
|
|
// Returns the image container for the specified VideoInfo
|
|
|
|
void GetVideos(nsTArray<nsNPAPIPluginInstance::VideoInfo*>& aVideos);
|
2012-11-10 19:45:52 +04:00
|
|
|
already_AddRefed<mozilla::layers::ImageContainer> GetImageContainerForVideo(nsNPAPIPluginInstance::VideoInfo* aVideoInfo);
|
2012-01-31 18:40:58 +04:00
|
|
|
|
|
|
|
void Invalidate();
|
2016-08-20 00:17:24 +03:00
|
|
|
void Recomposite();
|
2012-05-30 20:10:49 +04:00
|
|
|
|
|
|
|
void RequestFullScreen();
|
|
|
|
void ExitFullScreen();
|
|
|
|
|
2016-08-19 01:04:11 +03:00
|
|
|
// Called from nsAppShell when we removed the fullscreen view.
|
2012-05-30 20:10:49 +04:00
|
|
|
static void ExitFullScreen(jobject view);
|
2012-01-31 18:40:58 +04:00
|
|
|
#endif
|
2014-12-30 02:12:40 +03:00
|
|
|
|
|
|
|
void NotifyHostAsyncInitFailed();
|
|
|
|
void NotifyHostCreateWidget();
|
2015-02-27 22:59:07 +03:00
|
|
|
void NotifyDestroyPending();
|
2014-12-30 02:12:40 +03:00
|
|
|
|
2015-12-29 16:57:38 +03:00
|
|
|
bool GetCompositionString(uint32_t aIndex, nsTArray<uint8_t>* aString,
|
|
|
|
int32_t* aLength);
|
2016-02-02 11:05:56 +03:00
|
|
|
bool SetCandidateWindow(
|
|
|
|
const mozilla::widget::CandidateWindowPosition& aPosition);
|
2015-12-29 16:57:38 +03:00
|
|
|
bool RequestCommitOrCancel(bool aCommitted);
|
|
|
|
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
// See nsIKeyEventInPluginCallback
|
|
|
|
virtual void HandledWindowedPluginKeyEvent(
|
|
|
|
const mozilla::NativeEventData& aKeyEventData,
|
|
|
|
bool aIsConsumed) override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OnWindowedPluginKeyEvent() is called when the plugin process receives
|
|
|
|
* native key event directly.
|
|
|
|
*
|
|
|
|
* @param aNativeKeyData The key event which was received by the
|
|
|
|
* plugin process directly.
|
|
|
|
*/
|
|
|
|
void OnWindowedPluginKeyEvent(
|
|
|
|
const mozilla::NativeEventData& aNativeKeyData);
|
|
|
|
|
2016-03-17 22:00:59 +03:00
|
|
|
void GetCSSZoomFactor(float *result);
|
2011-06-01 08:37:54 +04:00
|
|
|
private:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsPluginInstanceOwner();
|
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
// return FALSE if LayerSurface dirty (newly created and don't have valid plugin content yet)
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsUpToDate()
|
2011-06-01 08:37:54 +04:00
|
|
|
{
|
|
|
|
nsIntSize size;
|
|
|
|
return NS_SUCCEEDED(mInstance->GetImageSize(&size)) &&
|
|
|
|
size == nsIntSize(mPluginWindow->width, mPluginWindow->height);
|
|
|
|
}
|
2014-08-16 01:17:35 +04:00
|
|
|
|
2012-02-01 21:28:57 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2013-08-13 19:49:21 +04:00
|
|
|
mozilla::LayoutDeviceRect GetPluginRect();
|
|
|
|
bool AddPluginView(const mozilla::LayoutDeviceRect& aRect = mozilla::LayoutDeviceRect(0, 0, 0, 0));
|
2011-09-17 01:34:31 +04:00
|
|
|
void RemovePluginView();
|
2012-01-31 18:40:58 +04:00
|
|
|
|
2012-05-30 20:10:49 +04:00
|
|
|
bool mFullScreen;
|
|
|
|
void* mJavaView;
|
2011-09-17 01:34:31 +04:00
|
|
|
#endif
|
2015-08-12 18:00:26 +03:00
|
|
|
|
|
|
|
#if defined(XP_WIN)
|
|
|
|
nsIWidget* GetContainingWidgetIfOffset();
|
2015-12-29 16:57:38 +03:00
|
|
|
already_AddRefed<mozilla::TextComposition> GetTextComposition();
|
2016-01-12 11:47:38 +03:00
|
|
|
void HandleNoConsumedCompositionMessage(
|
|
|
|
mozilla::WidgetCompositionEvent* aCompositionEvent,
|
|
|
|
const NPEvent* aPluginEvent);
|
2015-12-29 16:57:38 +03:00
|
|
|
bool mGotCompositionData;
|
|
|
|
bool mSentStartComposition;
|
2016-01-12 11:47:38 +03:00
|
|
|
bool mPluginDidNotHandleIMEComposition;
|
2015-08-12 18:00:26 +03:00
|
|
|
#endif
|
2011-09-17 01:34:31 +04:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
nsPluginNativeWindow *mPluginWindow;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsNPAPIPluginInstance> mInstance;
|
2014-09-24 08:35:00 +04:00
|
|
|
nsPluginFrame *mPluginFrame;
|
2015-04-04 21:39:36 +03:00
|
|
|
nsWeakPtr mContent; // WEAK, content owns us
|
2011-06-01 08:37:54 +04:00
|
|
|
nsCString mDocumentBase;
|
2012-02-01 01:55:54 +04:00
|
|
|
bool mWidgetCreationComplete;
|
2011-06-01 08:37:54 +04:00
|
|
|
nsCOMPtr<nsIWidget> mWidget;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPluginHost> mPluginHost;
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
static nsCOMPtr<nsITimer> *sCATimer;
|
|
|
|
static nsTArray<nsPluginInstanceOwner*> *sCARefreshListeners;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSentInitialTopLevelWindowEvent;
|
2014-12-11 17:44:07 +03:00
|
|
|
bool mLastWindowIsActive;
|
|
|
|
bool mLastContentFocused;
|
|
|
|
// True if, the next time the window is activated, we should blur ourselves.
|
|
|
|
bool mShouldBlurOnActivate;
|
2011-06-01 08:37:54 +04:00
|
|
|
#endif
|
2015-09-17 23:31:34 +03:00
|
|
|
double mLastScaleFactor;
|
2016-03-17 22:00:59 +03:00
|
|
|
double mLastCSSZoomFactor;
|
2011-06-01 08:37:54 +04:00
|
|
|
// Initially, the event loop nesting level we were created on, it's updated
|
|
|
|
// if we detect the appshell is on a lower level as long as we're not stopped.
|
|
|
|
// We delay DoStopPlugin() until the appshell reaches this level or lower.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLastEventloopNestingLevel;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mContentFocused;
|
|
|
|
bool mWidgetVisible; // used on Mac to store our widget's visible state
|
2011-06-01 08:37:54 +04:00
|
|
|
#ifdef MOZ_X11
|
|
|
|
// Used with windowless plugins only, initialized in CreateWidget().
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mFlash10Quirks;
|
2011-06-01 08:37:54 +04:00
|
|
|
#endif
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPluginWindowVisible;
|
|
|
|
bool mPluginDocumentActiveState;
|
2012-02-01 01:55:54 +04:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
NPEventModel mEventModel;
|
2012-02-01 01:55:54 +04:00
|
|
|
// This is a hack! UseAsyncRendering() can incorrectly return false
|
|
|
|
// when we don't have an object frame (possible as of bug 90268).
|
|
|
|
// We hack around this by always returning true if we've ever
|
|
|
|
// returned true.
|
|
|
|
bool mUseAsyncRendering;
|
2011-06-01 08:37:54 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// pointer to wrapper for nsIDOMContextMenuListener
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPluginDOMContextMenuListener> mCXMenuListener;
|
2011-06-01 08:37:54 +04:00
|
|
|
|
|
|
|
nsresult DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent);
|
2013-10-25 01:04:36 +04:00
|
|
|
nsresult DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent,
|
|
|
|
bool aAllowPropagate = false);
|
2011-06-01 08:37:54 +04:00
|
|
|
nsresult DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent);
|
2015-12-29 16:57:37 +03:00
|
|
|
nsresult DispatchCompositionToPlugin(nsIDOMEvent* aEvent);
|
2015-12-29 16:57:38 +03:00
|
|
|
|
2015-12-29 16:57:38 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
void CallDefaultProc(const mozilla::WidgetGUIEvent* aEvent);
|
|
|
|
#endif
|
|
|
|
|
2014-12-11 17:44:07 +03:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
static NPBool ConvertPointPuppet(PuppetWidget *widget, nsPluginFrame* pluginFrame,
|
|
|
|
double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
|
|
|
double *destX, double *destY, NPCoordinateSpace destSpace);
|
|
|
|
static NPBool ConvertPointNoPuppet(nsIWidget *widget, nsPluginFrame* pluginFrame,
|
|
|
|
double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
|
|
|
double *destX, double *destY, NPCoordinateSpace destSpace);
|
|
|
|
void PerformDelayedBlurs();
|
|
|
|
#endif // XP_MACOSX
|
|
|
|
|
2013-09-18 03:36:03 +04:00
|
|
|
int mLastMouseDownButtonType;
|
2014-08-16 01:17:35 +04:00
|
|
|
|
2011-06-01 08:37:54 +04:00
|
|
|
#ifdef MOZ_X11
|
2016-07-13 03:28:31 +03:00
|
|
|
class Renderer : public gfxXlibNativeRenderer
|
2011-06-01 08:37:54 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Renderer(NPWindow* aWindow, nsPluginInstanceOwner* aInstanceOwner,
|
|
|
|
const nsIntSize& aPluginSize, const nsIntRect& aDirtyRect)
|
|
|
|
: mWindow(aWindow), mInstanceOwner(aInstanceOwner),
|
|
|
|
mPluginSize(aPluginSize), mDirtyRect(aDirtyRect)
|
|
|
|
{}
|
2013-10-26 01:25:40 +04:00
|
|
|
virtual nsresult DrawWithXlib(cairo_surface_t* surface,
|
|
|
|
nsIntPoint offset,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIntRect* clipRects, uint32_t numClipRects) override;
|
2011-06-01 08:37:54 +04:00
|
|
|
private:
|
|
|
|
NPWindow* mWindow;
|
|
|
|
nsPluginInstanceOwner* mInstanceOwner;
|
|
|
|
const nsIntSize& mPluginSize;
|
|
|
|
const nsIntRect& mDirtyRect;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mWaitingForPaint;
|
2011-06-01 08:37:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsPluginInstanceOwner_h_
|
|
|
|
|