2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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/. */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering objects for replaced elements implemented by a plugin */
|
|
|
|
|
2014-09-24 08:34:00 +04:00
|
|
|
#ifndef nsPluginFrame_h___
|
|
|
|
#define nsPluginFrame_h___
|
2000-04-15 02:48:30 +04:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-10-16 07:19:27 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2016-07-08 09:08:00 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2001-02-20 00:50:04 +03:00
|
|
|
#include "nsIObjectFrame.h"
|
2006-02-02 22:29:10 +03:00
|
|
|
#include "nsFrame.h"
|
2009-07-22 04:45:00 +04:00
|
|
|
#include "nsRegion.h"
|
|
|
|
#include "nsDisplayList.h"
|
2010-09-08 04:36:59 +04:00
|
|
|
#include "nsIReflowCallback.h"
|
2015-04-08 19:51:49 +03:00
|
|
|
#include "Units.h"
|
2017-08-16 10:08:55 +03:00
|
|
|
#include "mozilla/layers/StackingContextHelper.h"
|
|
|
|
#include "mozilla/webrender/WebRenderAPI.h"
|
2000-04-15 02:48:30 +04:00
|
|
|
|
2013-08-22 22:32:52 +04:00
|
|
|
#ifdef XP_WIN
|
|
|
|
# include <windows.h> // For HWND :(
|
2014-05-23 02:09:03 +04:00
|
|
|
// Undo the windows.h damage
|
|
|
|
# undef GetMessage
|
|
|
|
# undef CreateEvent
|
|
|
|
# undef GetClassName
|
|
|
|
# undef GetBinaryType
|
2014-06-22 06:17:44 +04:00
|
|
|
# undef RemoveDirectory
|
2015-10-06 22:23:24 +03:00
|
|
|
# undef LoadIcon
|
2016-10-28 15:59:17 +03:00
|
|
|
# undef LoadImage
|
2016-04-29 00:57:34 +03:00
|
|
|
# undef GetObject
|
2013-08-22 22:32:52 +04:00
|
|
|
#endif
|
|
|
|
|
2006-02-02 22:29:10 +03:00
|
|
|
class nsPresContext;
|
2012-08-17 08:25:19 +04:00
|
|
|
class nsRootPresContext;
|
2009-07-22 04:45:00 +04:00
|
|
|
class nsDisplayPlugin;
|
2011-02-17 01:43:30 +03:00
|
|
|
class PluginBackgroundSink;
|
2013-08-22 22:32:52 +04:00
|
|
|
class nsPluginInstanceOwner;
|
2000-04-15 02:48:30 +04:00
|
|
|
|
2012-07-31 04:42:26 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class ImageContainer;
|
|
|
|
class Layer;
|
|
|
|
class LayerManager;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2012-07-31 04:42:26 +04:00
|
|
|
|
2015-12-02 22:31:17 +03:00
|
|
|
class PluginFrameDidCompositeObserver;
|
|
|
|
|
2017-04-30 18:30:08 +03:00
|
|
|
class nsPluginFrame final : public nsFrame,
|
|
|
|
public nsIObjectFrame,
|
|
|
|
public nsIReflowCallback {
|
2000-04-15 02:48:30 +04:00
|
|
|
public:
|
2010-09-17 08:09:25 +04:00
|
|
|
typedef mozilla::LayerState LayerState;
|
2015-12-03 01:32:55 +03:00
|
|
|
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
|
|
|
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
|
|
|
typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
|
2010-09-17 08:09:25 +04:00
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
|
|
|
typedef mozilla::layers::ImageContainer ImageContainer;
|
2017-08-16 10:08:55 +03:00
|
|
|
typedef mozilla::layers::StackingContextHelper StackingContextHelper;
|
2019-01-08 00:33:10 +03:00
|
|
|
typedef mozilla::layers::RenderRootStateManager RenderRootStateManager;
|
2017-08-16 10:08:55 +03:00
|
|
|
typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand;
|
2013-09-27 10:01:16 +04:00
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
2010-09-17 08:09:25 +04:00
|
|
|
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsPluginFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell,
|
|
|
|
ComputedStyle* aStyle);
|
2006-03-27 01:30:36 +04:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2014-05-13 04:47:53 +04:00
|
|
|
virtual void DidReflow(nsPresContext* aPresContext,
|
2017-12-14 18:21:49 +03:00
|
|
|
const ReflowInput* aReflowInput) override;
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
2014-02-18 12:36:33 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsEventStatus* aEventStatus) override;
|
2000-04-15 02:48:30 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2016-04-18 09:01:57 +03:00
|
|
|
return nsFrame::IsFrameOfType(
|
2016-02-04 01:43:02 +03:00
|
|
|
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2000-04-15 02:48:30 +04:00
|
|
|
#endif
|
|
|
|
|
2017-11-07 03:20:33 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2000-04-15 02:48:30 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
2007-10-19 07:41:07 +04:00
|
|
|
|
2018-11-20 04:20:17 +03:00
|
|
|
nsNPAPIPluginInstance* GetPluginInstance() override;
|
2001-02-20 00:50:04 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetIsDocumentActive(bool aIsActive) override;
|
2011-08-30 10:09:56 +04:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
virtual nsresult GetCursor(const nsPoint& aPoint,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame::Cursor& aCursor) override;
|
2002-01-26 03:39:43 +03:00
|
|
|
|
2012-10-06 17:03:23 +04:00
|
|
|
// APIs used by nsRootPresContext to set up the widget position/size/clip
|
|
|
|
// region.
|
|
|
|
/**
|
|
|
|
* Set the next widget configuration for the plugin to the desired
|
|
|
|
* position of the plugin's widget, on the assumption that it is not visible
|
|
|
|
* (clipped out or covered by opaque content).
|
|
|
|
* This will only be called for plugins which have been registered
|
|
|
|
* with the root pres context for geometry updates.
|
|
|
|
* If there is no widget associated with the plugin, this will have no effect.
|
|
|
|
*/
|
|
|
|
void SetEmptyWidgetConfiguration() {
|
2015-12-03 01:32:55 +03:00
|
|
|
mNextConfigurationBounds = LayoutDeviceIntRect(0, 0, 0, 0);
|
2012-10-06 17:03:23 +04:00
|
|
|
mNextConfigurationClipRegion.Clear();
|
2009-07-22 04:45:00 +04:00
|
|
|
}
|
2012-10-06 17:03:23 +04:00
|
|
|
/**
|
|
|
|
* Append the desired widget configuration to aConfigurations.
|
|
|
|
*/
|
2015-01-29 22:41:55 +03:00
|
|
|
void GetWidgetConfiguration(
|
|
|
|
nsTArray<nsIWidget::Configuration>* aConfigurations);
|
2014-12-11 17:44:07 +03:00
|
|
|
|
2015-12-03 01:32:55 +03:00
|
|
|
LayoutDeviceIntRect GetWidgetlessClipRect() {
|
2014-12-11 17:44:07 +03:00
|
|
|
return RegionFromArray(mNextConfigurationClipRegion).GetBounds();
|
|
|
|
}
|
|
|
|
|
2012-10-06 17:03:23 +04:00
|
|
|
/**
|
|
|
|
* Called after all widget position/size/clip regions have been changed
|
|
|
|
* (even if there isn't a widget for this plugin).
|
|
|
|
*/
|
2009-07-22 04:45:02 +04:00
|
|
|
void DidSetWidgetGeometry();
|
|
|
|
|
2002-05-11 02:34:53 +04:00
|
|
|
// accessibility support
|
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2002-05-11 02:34:53 +04:00
|
|
|
# ifdef XP_WIN
|
|
|
|
NS_IMETHOD GetPluginPort(HWND* aPort);
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2000-04-15 02:48:30 +04:00
|
|
|
// local methods
|
2012-02-01 01:55:54 +04:00
|
|
|
nsresult PrepForDrawing(nsIWidget* aWidget);
|
2005-01-05 03:21:06 +03:00
|
|
|
|
2001-09-18 06:11:09 +04:00
|
|
|
// for a given aRoot, this walks the frame tree looking for the next outFrame
|
2004-08-01 03:15:21 +04:00
|
|
|
static nsIObjectFrame* GetNextObjectFrame(nsPresContext* aPresContext,
|
2004-02-09 20:33:45 +03:00
|
|
|
nsIFrame* aRoot);
|
2001-09-18 06:11:09 +04:00
|
|
|
|
2010-09-08 04:36:59 +04:00
|
|
|
// nsIReflowCallback
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ReflowFinished() override;
|
|
|
|
virtual void ReflowCallbackCanceled() override;
|
2010-09-08 04:36:59 +04:00
|
|
|
|
2011-02-17 01:43:30 +03:00
|
|
|
/**
|
|
|
|
* Builds either an ImageLayer or a ReadbackLayer, depending on the type
|
|
|
|
* of aItem (TYPE_PLUGIN or TYPE_PLUGIN_READBACK respectively).
|
|
|
|
*/
|
2010-09-17 08:09:25 +04:00
|
|
|
already_AddRefed<Layer> BuildLayer(
|
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2012-09-17 02:25:33 +04:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-27 10:01:16 +04:00
|
|
|
const ContainerLayerParameters& aContainerParameters);
|
2010-09-17 08:09:25 +04:00
|
|
|
|
2012-05-03 18:05:55 +04:00
|
|
|
LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
|
|
|
LayerManager* aManager);
|
2010-09-17 08:09:25 +04:00
|
|
|
|
2011-02-23 08:38:09 +03:00
|
|
|
/**
|
|
|
|
* Get the rectangle (relative to this frame) which it will paint. Normally
|
|
|
|
* the frame's content-box but may be smaller if the plugin is rendering
|
|
|
|
* asynchronously and has a different-sized image temporarily.
|
|
|
|
*/
|
2017-08-24 18:09:44 +03:00
|
|
|
nsRect GetPaintedRect(const nsDisplayPlugin* aItem) const;
|
2010-09-17 08:09:25 +04:00
|
|
|
|
2010-09-18 15:28:49 +04:00
|
|
|
/**
|
2014-09-24 08:34:00 +04:00
|
|
|
* If aSupports has a nsPluginFrame, then prepare it for a DocShell swap.
|
2010-09-18 15:28:49 +04:00
|
|
|
* @see nsSubDocumentFrame::BeginSwapDocShells.
|
|
|
|
* There will be a call to EndSwapDocShells after we were moved to the
|
|
|
|
* new view tree.
|
|
|
|
*/
|
2014-06-19 06:09:35 +04:00
|
|
|
static void BeginSwapDocShells(nsISupports* aSupports, void*);
|
2010-09-18 15:28:49 +04:00
|
|
|
/**
|
2014-09-24 08:34:00 +04:00
|
|
|
* If aSupports has a nsPluginFrame, then set it up after a DocShell swap.
|
2010-09-18 15:28:49 +04:00
|
|
|
* @see nsSubDocumentFrame::EndSwapDocShells.
|
|
|
|
*/
|
2014-06-19 06:09:35 +04:00
|
|
|
static void EndSwapDocShells(nsISupports* aSupports, void*);
|
2010-09-18 15:28:49 +04:00
|
|
|
|
2016-05-01 21:29:22 +03:00
|
|
|
nsIWidget* GetWidget() override {
|
|
|
|
if (!mInnerView) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mWidget;
|
|
|
|
}
|
2011-04-01 01:33:46 +04:00
|
|
|
|
2011-08-30 10:09:56 +04:00
|
|
|
/**
|
|
|
|
* Adjust the plugin's idea of its size, using aSize as its new size.
|
|
|
|
* (aSize must be in twips)
|
|
|
|
*/
|
|
|
|
void FixupWindow(const nsSize& aSize);
|
|
|
|
|
2012-02-01 01:55:54 +04:00
|
|
|
/*
|
2011-08-30 10:09:56 +04:00
|
|
|
* Sets up the plugin window and calls SetWindow on the plugin.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult CallSetWindow(bool aCheckIsHidden = true);
|
2011-08-30 10:09:56 +04:00
|
|
|
|
2012-02-01 01:55:54 +04:00
|
|
|
void SetInstanceOwner(nsPluginInstanceOwner* aOwner);
|
|
|
|
|
2015-10-16 07:19:27 +03:00
|
|
|
/**
|
|
|
|
* HandleWheelEventAsDefaultAction() handles eWheel event as default action.
|
|
|
|
* This should be called only when WantsToHandleWheelEventAsDefaultAction()
|
|
|
|
* returns true.
|
|
|
|
*/
|
|
|
|
void HandleWheelEventAsDefaultAction(mozilla::WidgetWheelEvent* aEvent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WantsToHandleWheelEventAsDefaultAction() returns true if the plugin
|
|
|
|
* may want to handle wheel events as default action.
|
|
|
|
*/
|
|
|
|
bool WantsToHandleWheelEventAsDefaultAction() const;
|
|
|
|
|
2019-01-08 00:33:10 +03:00
|
|
|
bool CreateWebRenderCommands(
|
|
|
|
nsDisplayItem* aItem, mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const StackingContextHelper& aSc,
|
|
|
|
mozilla::layers::RenderRootStateManager* aManager,
|
|
|
|
nsDisplayListBuilder* aDisplayListBuilder);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-02-01 01:55:54 +04:00
|
|
|
protected:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsPluginFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
|
2014-09-24 08:34:00 +04:00
|
|
|
virtual ~nsPluginFrame();
|
2012-02-01 01:55:54 +04:00
|
|
|
|
|
|
|
// NOTE: This frame class does not inherit from |nsLeafFrame|, so
|
|
|
|
// this is not a virtual method implementation.
|
|
|
|
void GetDesiredSize(nsPresContext* aPresContext,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize);
|
2012-02-01 01:55:54 +04:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
bool IsFocusable(int32_t* aTabIndex = nullptr,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aWithMouse = false) override;
|
2005-03-31 05:38:04 +04:00
|
|
|
|
2002-04-13 05:53:23 +04:00
|
|
|
// check attributes and optionally CSS to see if we should display anything
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsHidden(bool aCheckVisibilityStyle = true) const;
|
2000-07-20 03:46:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsOpaque() const;
|
|
|
|
bool IsTransparentMode() const;
|
2012-10-06 17:03:23 +04:00
|
|
|
bool IsPaintedByGecko() const;
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
nsIntPoint GetWindowOriginInPixels(bool aWindowless);
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2015-04-08 19:51:49 +03:00
|
|
|
/*
|
|
|
|
* If this frame is in a remote tab, return the tab offset to
|
|
|
|
* the origin of the chrome window. In non-e10s, this return 0,0.
|
|
|
|
* This api sends a sync ipc request so be careful about use.
|
|
|
|
*/
|
2015-12-03 01:32:55 +03:00
|
|
|
LayoutDeviceIntPoint GetRemoteTabChromeOffset();
|
2001-12-22 03:00:44 +03:00
|
|
|
|
2008-07-07 06:49:38 +04:00
|
|
|
static void PaintPrintPlugin(nsIFrame* aFrame, gfxContext* aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect, nsPoint aPt);
|
2017-06-09 22:14:53 +03:00
|
|
|
void PrintPlugin(gfxContext& aRenderingContext, const nsRect& aDirtyRect);
|
2010-10-25 18:38:09 +04:00
|
|
|
void PaintPlugin(nsDisplayListBuilder* aBuilder,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext& aRenderingContext, const nsRect& aDirtyRect,
|
2009-09-11 05:44:20 +04:00
|
|
|
const nsRect& aPluginRect);
|
2008-07-07 06:49:38 +04:00
|
|
|
|
2010-01-21 18:17:52 +03:00
|
|
|
void NotifyPluginReflowObservers();
|
2009-11-21 01:59:27 +03:00
|
|
|
|
2003-04-12 19:03:08 +04:00
|
|
|
friend class nsPluginInstanceOwner;
|
2009-07-22 04:45:00 +04:00
|
|
|
friend class nsDisplayPlugin;
|
2011-02-17 01:43:30 +03:00
|
|
|
friend class PluginBackgroundSink;
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2017-03-21 03:22:13 +03:00
|
|
|
nsView* GetViewInternal() const override { return mOuterView; }
|
|
|
|
void SetViewInternal(nsView* aView) override { mOuterView = aView; }
|
2017-08-16 10:08:55 +03:00
|
|
|
bool GetBounds(nsDisplayItem* aItem, mozilla::gfx::IntSize& aSize,
|
|
|
|
gfxRect& aRect);
|
2017-03-21 03:22:13 +03:00
|
|
|
|
2000-04-15 02:48:30 +04:00
|
|
|
private:
|
2012-08-17 08:25:19 +04:00
|
|
|
// Registers the plugin for a geometry update, and requests a geometry
|
|
|
|
// update. This caches the root pres context in
|
|
|
|
// mRootPresContextRegisteredWith, so that we can be sure we unregister
|
|
|
|
// from the right root prest context in UnregisterPluginForGeometryUpdates.
|
|
|
|
void RegisterPluginForGeometryUpdates();
|
|
|
|
|
|
|
|
// Unregisters the plugin for geometry updated with the root pres context
|
|
|
|
// stored in mRootPresContextRegisteredWith.
|
|
|
|
void UnregisterPluginForGeometryUpdates();
|
|
|
|
|
2015-12-03 01:32:55 +03:00
|
|
|
static const LayoutDeviceIntRegion RegionFromArray(
|
|
|
|
const nsTArray<LayoutDeviceIntRect>& aRects) {
|
|
|
|
LayoutDeviceIntRegion region;
|
2014-12-11 17:44:07 +03:00
|
|
|
for (uint32_t i = 0; i < aRects.Length(); ++i) {
|
|
|
|
region.Or(region, aRects[i]);
|
|
|
|
}
|
|
|
|
return region;
|
|
|
|
}
|
|
|
|
|
2016-04-26 03:23:21 +03:00
|
|
|
class PluginEventNotifier : public mozilla::Runnable {
|
2010-01-21 18:17:52 +03:00
|
|
|
public:
|
2017-06-12 22:34:10 +03:00
|
|
|
explicit PluginEventNotifier(const nsString& aEventType)
|
|
|
|
: mozilla::Runnable("nsPluginFrame::PluginEventNotifier"),
|
|
|
|
mEventType(aEventType) {}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Run() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2010-01-21 18:17:52 +03:00
|
|
|
private:
|
|
|
|
nsString mEventType;
|
|
|
|
};
|
2012-02-01 01:55:54 +04:00
|
|
|
|
|
|
|
nsPluginInstanceOwner* mInstanceOwner; // WEAK
|
2017-03-21 03:22:13 +03:00
|
|
|
nsView* mOuterView;
|
|
|
|
nsView* mInnerView;
|
2009-07-22 04:45:00 +04:00
|
|
|
nsCOMPtr<nsIWidget> mWidget;
|
2009-01-15 06:27:09 +03:00
|
|
|
nsIntRect mWindowlessRect;
|
2011-02-17 01:43:30 +03:00
|
|
|
/**
|
2014-09-24 08:34:00 +04:00
|
|
|
* This is owned by the ReadbackLayer for this nsPluginFrame. It is
|
2011-02-17 01:43:30 +03:00
|
|
|
* automatically cleared if the PluginBackgroundSink is destroyed.
|
|
|
|
*/
|
|
|
|
PluginBackgroundSink* mBackgroundSink;
|
2005-04-15 01:50:46 +04:00
|
|
|
|
2012-10-06 17:03:23 +04:00
|
|
|
/**
|
|
|
|
* Bounds that we should set the plugin's widget to in the next composite,
|
|
|
|
* for plugins with widgets. For plugins without widgets, bounds in device
|
|
|
|
* pixels relative to the nearest frame that's a display list reference frame.
|
|
|
|
*/
|
2015-12-03 01:32:55 +03:00
|
|
|
LayoutDeviceIntRect mNextConfigurationBounds;
|
2012-10-06 17:03:23 +04:00
|
|
|
/**
|
|
|
|
* Clip region that we should set the plugin's widget to
|
|
|
|
* in the next composite. Only meaningful for plugins with widgets.
|
|
|
|
*/
|
2015-12-03 01:32:55 +03:00
|
|
|
nsTArray<LayoutDeviceIntRect> mNextConfigurationClipRegion;
|
2012-10-06 17:03:23 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mReflowCallbackPosted;
|
2010-09-17 08:09:25 +04:00
|
|
|
|
2012-08-17 08:25:19 +04:00
|
|
|
// We keep this reference to ensure we can always unregister the
|
|
|
|
// plugins we register on the root PresContext.
|
|
|
|
// This is only non-null while we have a plugin registered for geometry
|
|
|
|
// updates.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsRootPresContext> mRootPresContextRegisteredWith;
|
2015-10-06 22:23:24 +03:00
|
|
|
|
2016-07-08 09:08:00 +03:00
|
|
|
mozilla::UniquePtr<PluginFrameDidCompositeObserver> mDidCompositeObserver;
|
2000-04-15 02:48:30 +04:00
|
|
|
};
|
|
|
|
|
2017-09-27 07:03:38 +03:00
|
|
|
class nsDisplayPluginGeometry : public nsDisplayItemGenericGeometry {
|
|
|
|
public:
|
|
|
|
nsDisplayPluginGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
|
|
|
|
: nsDisplayItemGenericGeometry(aItem, aBuilder) {}
|
|
|
|
|
|
|
|
// Plugins MozPaintWait event depends on sync decode, so we always want
|
|
|
|
// to rebuild the display list when sync decoding.
|
|
|
|
virtual bool InvalidateForSyncDecodeImages() const override { return true; }
|
|
|
|
};
|
|
|
|
|
2018-09-06 04:23:14 +03:00
|
|
|
class nsDisplayPlugin final : public nsDisplayItem {
|
2009-07-22 04:45:00 +04:00
|
|
|
public:
|
2010-08-13 14:01:13 +04:00
|
|
|
nsDisplayPlugin(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
|
|
|
: nsDisplayItem(aBuilder, aFrame) {
|
2009-07-22 04:45:00 +04:00
|
|
|
MOZ_COUNT_CTOR(nsDisplayPlugin);
|
2012-10-18 09:34:58 +04:00
|
|
|
aBuilder->SetContainsPluginItem();
|
2009-07-22 04:45:00 +04:00
|
|
|
}
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual ~nsDisplayPlugin() { MOZ_COUNT_DTOR(nsDisplayPlugin); }
|
|
|
|
#endif
|
|
|
|
|
2017-08-24 18:09:44 +03:00
|
|
|
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
|
|
|
bool* aSnap) const override;
|
2011-01-03 04:48:09 +03:00
|
|
|
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
2017-08-24 18:09:44 +03:00
|
|
|
bool* aSnap) const override;
|
2009-09-07 04:35:14 +04:00
|
|
|
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRegion* aVisibleRegion) override;
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2010-07-16 01:07:49 +04:00
|
|
|
NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN)
|
2009-07-22 04:45:00 +04:00
|
|
|
|
2010-09-17 08:09:25 +04:00
|
|
|
virtual already_AddRefed<Layer> BuildLayer(
|
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2015-03-21 19:28:04 +03:00
|
|
|
const ContainerLayerParameters& aContainerParameters) override {
|
2014-09-24 08:34:00 +04:00
|
|
|
return static_cast<nsPluginFrame*>(mFrame)->BuildLayer(
|
2012-09-17 02:25:33 +04:00
|
|
|
aBuilder, aManager, this, aContainerParameters);
|
2010-09-17 08:09:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual LayerState GetLayerState(
|
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2015-03-21 19:28:04 +03:00
|
|
|
const ContainerLayerParameters& aParameters) override {
|
2014-09-24 08:34:00 +04:00
|
|
|
return static_cast<nsPluginFrame*>(mFrame)->GetLayerState(aBuilder,
|
2011-02-17 01:43:30 +03:00
|
|
|
aManager);
|
2010-09-17 08:09:25 +04:00
|
|
|
}
|
2017-08-16 10:08:55 +03:00
|
|
|
|
2017-09-27 07:03:38 +03:00
|
|
|
virtual nsDisplayItemGeometry* AllocateGeometry(
|
|
|
|
nsDisplayListBuilder* aBuilder) override {
|
|
|
|
return new nsDisplayPluginGeometry(this, aBuilder);
|
|
|
|
}
|
|
|
|
|
2017-08-16 10:08:55 +03:00
|
|
|
virtual bool CreateWebRenderCommands(
|
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder,
|
2017-09-14 19:48:55 +03:00
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
2017-08-16 10:08:55 +03:00
|
|
|
const StackingContextHelper& aSc,
|
2019-01-08 00:33:10 +03:00
|
|
|
mozilla::layers::RenderRootStateManager* aManager,
|
2017-08-16 10:08:55 +03:00
|
|
|
nsDisplayListBuilder* aDisplayListBuilder) override;
|
2009-07-22 04:45:00 +04:00
|
|
|
};
|
2000-04-15 02:48:30 +04:00
|
|
|
|
2014-09-24 08:34:00 +04:00
|
|
|
#endif /* nsPluginFrame_h___ */
|