зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1687239 part 2 - Remove plugin support from layout/. r=emilio
Note that there's still a little plugin related code in widget/ and gfx/ etc after this. That can be removed once we remove plugin support from dom/ etc. The removal from layout/ should be pretty complete though. Differential Revision: https://phabricator.services.mozilla.com/D102140
This commit is contained in:
Родитель
334efb391e
Коммит
b41a2b9d21
|
@ -43,7 +43,6 @@ enum AccType {
|
|||
eHyperTextType,
|
||||
eImageType,
|
||||
eOuterDocType,
|
||||
ePluginType,
|
||||
eTextLeafType,
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsTreeBodyFrame.h"
|
||||
#include "nsTreeColumns.h"
|
||||
#include "nsTreeUtils.h"
|
||||
|
@ -87,10 +86,6 @@
|
|||
# include "XULTreeGridAccessibleWrap.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
|
||||
# include "nsNPAPIPluginInstance.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -398,111 +393,6 @@ Accessible* nsAccessibilityService::GetRootDocumentAccessible(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
static StaticAutoPtr<nsTArray<nsCOMPtr<nsIContent> > > sPendingPlugins;
|
||||
static StaticAutoPtr<nsTArray<nsCOMPtr<nsITimer> > > sPluginTimers;
|
||||
|
||||
class PluginTimerCallBack final : public nsITimerCallback, public nsINamed {
|
||||
~PluginTimerCallBack() {}
|
||||
|
||||
public:
|
||||
explicit PluginTimerCallBack(nsIContent* aContent) : mContent(aContent) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Notify(nsITimer* aTimer) final {
|
||||
if (!mContent->IsInUncomposedDoc()) return NS_OK;
|
||||
|
||||
PresShell* presShell = mContent->OwnerDoc()->GetPresShell();
|
||||
if (presShell) {
|
||||
DocAccessible* doc = presShell->GetDocAccessible();
|
||||
if (doc) {
|
||||
// Make sure that if we created an accessible for the plugin that wasn't
|
||||
// a plugin accessible we remove it before creating the right
|
||||
// accessible.
|
||||
doc->RecreateAccessible(mContent);
|
||||
sPluginTimers->RemoveElement(aTimer);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// We couldn't get a doc accessible so presumably the document went away.
|
||||
// In this case don't leak our ref to the content or timer.
|
||||
sPendingPlugins->RemoveElement(mContent);
|
||||
sPluginTimers->RemoveElement(aTimer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetName(nsACString& aName) final {
|
||||
aName.AssignLiteral("PluginTimerCallBack");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback, nsINamed)
|
||||
#endif
|
||||
|
||||
already_AddRefed<Accessible> nsAccessibilityService::CreatePluginAccessible(
|
||||
nsPluginFrame* aFrame, nsIContent* aContent, Accessible* aContext) {
|
||||
// nsPluginFrame means a plugin, so we need to use the accessibility support
|
||||
// of the plugin.
|
||||
if (aFrame->GetRect().IsEmpty()) return nullptr;
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
|
||||
RefPtr<nsNPAPIPluginInstance> pluginInstance = aFrame->GetPluginInstance();
|
||||
if (pluginInstance) {
|
||||
# ifdef XP_WIN
|
||||
if (!sPendingPlugins->Contains(aContent) &&
|
||||
(Preferences::GetBool("accessibility.delay_plugins") ||
|
||||
Compatibility::IsJAWS() || Compatibility::IsWE())) {
|
||||
RefPtr<PluginTimerCallBack> cb = new PluginTimerCallBack(aContent);
|
||||
nsCOMPtr<nsITimer> timer;
|
||||
NS_NewTimerWithCallback(
|
||||
getter_AddRefs(timer), cb,
|
||||
Preferences::GetUint("accessibility.delay_plugin_time"),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
sPluginTimers->AppendElement(timer);
|
||||
sPendingPlugins->AppendElement(aContent);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We need to remove aContent from the pending plugins here to avoid
|
||||
// reentrancy. When the timer fires it calls
|
||||
// DocAccessible::ContentInserted() which does the work async.
|
||||
sPendingPlugins->RemoveElement(aContent);
|
||||
|
||||
// Note: pluginPort will be null if windowless.
|
||||
HWND pluginPort = nullptr;
|
||||
aFrame->GetPluginPort(&pluginPort);
|
||||
|
||||
RefPtr<Accessible> accessible = new HTMLWin32ObjectOwnerAccessible(
|
||||
aContent, aContext->Document(), pluginPort);
|
||||
return accessible.forget();
|
||||
|
||||
# elif MOZ_ACCESSIBILITY_ATK
|
||||
if (!AtkSocketAccessible::gCanEmbed) return nullptr;
|
||||
|
||||
// Note this calls into the plugin, so unexpected things may happen and
|
||||
// aFrame may go away.
|
||||
nsCString plugId;
|
||||
nsresult rv = pluginInstance->GetValueFromPlugin(
|
||||
NPPVpluginNativeAccessibleAtkPlugId, &plugId);
|
||||
if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) {
|
||||
RefPtr<AtkSocketAccessible> socketAccessible =
|
||||
new AtkSocketAccessible(aContent, aContext->Document(), plugId);
|
||||
|
||||
return socketAccessible.forget();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void nsAccessibilityService::DeckPanelSwitched(PresShell* aPresShell,
|
||||
nsIContent* aDeckNode,
|
||||
nsIFrame* aPrevBoxFrame,
|
||||
|
@ -1306,11 +1196,6 @@ bool nsAccessibilityService::Init() {
|
|||
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::Accessibility,
|
||||
"Active"_ns);
|
||||
|
||||
#ifdef XP_WIN
|
||||
sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;
|
||||
sPluginTimers = new nsTArray<nsCOMPtr<nsITimer> >;
|
||||
#endif
|
||||
|
||||
// Now its safe to start platform accessibility.
|
||||
if (XRE_IsParentProcess()) PlatformInit();
|
||||
|
||||
|
@ -1344,16 +1229,6 @@ void nsAccessibilityService::Shutdown() {
|
|||
|
||||
SelectionManager::Shutdown();
|
||||
|
||||
#ifdef XP_WIN
|
||||
sPendingPlugins = nullptr;
|
||||
|
||||
uint32_t timerCount = sPluginTimers->Length();
|
||||
for (uint32_t i = 0; i < timerCount; i++)
|
||||
sPluginTimers->ElementAt(i)->Cancel();
|
||||
|
||||
sPluginTimers = nullptr;
|
||||
#endif
|
||||
|
||||
if (XRE_IsParentProcess()) PlatformShutdown();
|
||||
|
||||
gApplicationAccessible->Shutdown();
|
||||
|
@ -1510,11 +1385,6 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
|||
case eOuterDocType:
|
||||
newAcc = new OuterDocAccessible(aContent, document);
|
||||
break;
|
||||
case ePluginType: {
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
|
||||
newAcc = CreatePluginAccessible(pluginFrame, aContent, aContext);
|
||||
break;
|
||||
}
|
||||
case eTextLeafType:
|
||||
newAcc = new TextLeafAccessibleWrap(aContent, document);
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
class nsImageFrame;
|
||||
class nsIArray;
|
||||
class nsIPersistentProperties;
|
||||
class nsPluginFrame;
|
||||
class nsITreeView;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -116,9 +115,6 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
|
|||
|
||||
Accessible* GetRootDocumentAccessible(mozilla::PresShell* aPresShell,
|
||||
bool aCanCreate);
|
||||
already_AddRefed<Accessible> CreatePluginAccessible(nsPluginFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
Accessible* aContext);
|
||||
|
||||
/**
|
||||
* Adds/remove ATK root accessible for gtk+ native window to/from children
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "BrowserChild.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
|
@ -2210,36 +2209,6 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
|
|||
false);
|
||||
}
|
||||
|
||||
// if an object/plug-in/remote browser is being blurred, move the system
|
||||
// focus to the parent window, otherwise events will still get fired at the
|
||||
// plugin. But don't do this if we are blurring due to the window being
|
||||
// lowered, otherwise, the parent window can get raised again.
|
||||
if (GetActiveBrowsingContext()) {
|
||||
nsIFrame* contentFrame = element->GetPrimaryFrame();
|
||||
nsIObjectFrame* objectFrame = do_QueryFrame(contentFrame);
|
||||
if (aAdjustWidget && objectFrame && !sTestMode) {
|
||||
if (XRE_IsContentProcess()) {
|
||||
// set focus to the top level window via the chrome process.
|
||||
nsCOMPtr<nsIBrowserChild> browserChild = docShell->GetBrowserChild();
|
||||
if (browserChild) {
|
||||
static_cast<BrowserChild*>(browserChild.get())
|
||||
->SendDispatchFocusToTopLevelWindow();
|
||||
}
|
||||
} else {
|
||||
// note that the presshell's widget is being retrieved here, not the
|
||||
// one for the object frame.
|
||||
if (nsViewManager* vm = presShell->GetViewManager()) {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
vm->GetRootWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
// set focus to the top level window but don't raise it.
|
||||
widget->SetFocus(nsIWidget::Raise::No, CallerType::System);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool windowBeingLowered = !aBrowsingContextToClear &&
|
||||
!aAncestorBrowsingContextToFocus &&
|
||||
aIsLeavingDocument && aAdjustWidget;
|
||||
|
@ -2458,18 +2427,7 @@ void nsFocusManager::Focus(
|
|||
|
||||
SetFocusedWindowInternal(aWindow);
|
||||
|
||||
// Update the system focus by focusing the root widget. But avoid this
|
||||
// if 1) aAdjustWidget is false or 2) aElement is a plugin that has its
|
||||
// own widget and is either already focused or is about to be focused.
|
||||
nsCOMPtr<nsIWidget> objectFrameWidget;
|
||||
if (aElement) {
|
||||
nsIFrame* contentFrame = aElement->GetPrimaryFrame();
|
||||
nsIObjectFrame* objectFrame = do_QueryFrame(contentFrame);
|
||||
if (objectFrame) {
|
||||
objectFrameWidget = objectFrame->GetWidget();
|
||||
}
|
||||
}
|
||||
if (aAdjustWidget && !objectFrameWidget && !sTestMode) {
|
||||
if (aAdjustWidget && !sTestMode) {
|
||||
if (nsViewManager* vm = presShell->GetViewManager()) {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
vm->GetRootWidget(getter_AddRefs(widget));
|
||||
|
@ -2532,13 +2490,6 @@ void nsFocusManager::Focus(
|
|||
// that we might no longer be in the same document, due to the events we
|
||||
// fired above when aIsNewDocument.
|
||||
if (presShell->GetDocument() == aElement->GetComposedDoc()) {
|
||||
if (aAdjustWidget && objectFrameWidget && !sTestMode) {
|
||||
objectFrameWidget->SetFocus(nsIWidget::Raise::No,
|
||||
aFlags & FLAG_NONSYSTEMCALLER
|
||||
? CallerType::NonSystem
|
||||
: CallerType::System);
|
||||
}
|
||||
|
||||
// if the object being focused is a remote browser, activate remote
|
||||
// content
|
||||
ActivateRemoteFrameIfNeeded(*aElement, aActionId);
|
||||
|
@ -2572,23 +2523,6 @@ void nsFocusManager::Focus(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// If the window focus event (fired above when aIsNewDocument) caused
|
||||
// the plugin not to be focusable, update the system focus by focusing
|
||||
// the root widget.
|
||||
if (aAdjustWidget && objectFrameWidget &&
|
||||
GetFocusedBrowsingContext() == aWindow->GetBrowsingContext() &&
|
||||
mFocusedElement == nullptr && !sTestMode) {
|
||||
if (nsViewManager* vm = presShell->GetViewManager()) {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
vm->GetRootWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
widget->SetFocus(nsIWidget::Raise::No, aFlags & FLAG_NONSYSTEMCALLER
|
||||
? CallerType::NonSystem
|
||||
: CallerType::System);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mFocusedElement) {
|
||||
// When there is no focused element, IMEStateManager needs to adjust IME
|
||||
// enabled state with the document.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
interface nsIChannel;
|
||||
interface nsIRequest;
|
||||
interface nsIFrame;
|
||||
interface nsIObjectFrame;
|
||||
interface nsIPluginTag;
|
||||
interface nsIURI;
|
||||
|
||||
|
@ -102,23 +101,6 @@ interface nsIObjectLoadingContent : nsISupports
|
|||
*/
|
||||
[notxpcom,nostdcall] readonly attribute nsNPAPIPluginInstancePtr pluginInstance;
|
||||
|
||||
/**
|
||||
* Tells the content about an associated object frame.
|
||||
* This can be called multiple times for different frames.
|
||||
*
|
||||
* This is noscript because this is an internal method that will go away, and
|
||||
* because nsIObjectFrame is unscriptable.
|
||||
*/
|
||||
[noscript] void hasNewFrame(in nsIObjectFrame aFrame);
|
||||
|
||||
/**
|
||||
* If this object is in going to be printed, this method
|
||||
* returns the nsIObjectFrame object which should be used when
|
||||
* printing the plugin. The returned nsIFrame is in the original document,
|
||||
* not in the static clone.
|
||||
*/
|
||||
[noscript] nsIFrame getPrintFrame();
|
||||
|
||||
/*
|
||||
* Notifications from pluginhost that our instance crashed or was destroyed.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "mozilla/dom/Document.h"
|
||||
#include "nsIExternalProtocolHandler.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsPluginHost.h"
|
||||
|
@ -67,7 +66,6 @@
|
|||
#include "nsObjectLoadingContent.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "js/Object.h" // JS::GetClass
|
||||
|
@ -248,8 +246,7 @@ CheckPluginStopEvent::Run() {
|
|||
}
|
||||
}
|
||||
|
||||
// Still no frame, suspend plugin. HasNewFrame will restart us when we
|
||||
// become rendered again
|
||||
// Still no frame, suspend plugin.
|
||||
LOG(("OBJLC [%p]: Stopping plugin that lost frame", this));
|
||||
objLC->StopPluginInstance();
|
||||
|
||||
|
@ -725,7 +722,6 @@ nsresult nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading) {
|
|||
// (Bug 767635)
|
||||
if (newOwner) {
|
||||
RefPtr<nsNPAPIPluginInstance> inst = newOwner->GetInstance();
|
||||
newOwner->SetFrame(nullptr);
|
||||
if (inst) {
|
||||
pluginHost->StopPluginInstance(inst);
|
||||
}
|
||||
|
@ -743,18 +739,6 @@ nsresult nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading) {
|
|||
mHasRunID = NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
// Ensure the frame did not change during instantiation re-entry (common).
|
||||
// HasNewFrame would not have mInstanceOwner yet, so the new frame would be
|
||||
// dangling. (Bug 854082)
|
||||
nsIFrame* frame = thisContent->GetPrimaryFrame();
|
||||
if (frame && mInstanceOwner) {
|
||||
mInstanceOwner->SetFrame(static_cast<nsPluginFrame*>(frame));
|
||||
|
||||
// Bug 870216 - Adobe Reader renders with incorrect dimensions until it gets
|
||||
// a second SetWindow call. This is otherwise redundant.
|
||||
mInstanceOwner->CallSetWindow();
|
||||
}
|
||||
|
||||
// Set up scripting interfaces.
|
||||
NotifyContentObjectWrapper();
|
||||
|
||||
|
@ -1117,42 +1101,6 @@ nsObjectLoadingContent::GetDisplayedType(uint32_t* aType) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame) {
|
||||
if (mType != eType_Plugin) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!aFrame) {
|
||||
// Lost our frame. If we aren't going to be getting a new frame, e.g. we've
|
||||
// become display:none, we'll want to stop the plugin. Queue a
|
||||
// CheckPluginStopEvent
|
||||
if (mInstanceOwner || mInstantiating) {
|
||||
if (mInstanceOwner) {
|
||||
mInstanceOwner->SetFrame(nullptr);
|
||||
}
|
||||
QueueCheckPluginStopEvent();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Have a new frame
|
||||
|
||||
if (!mInstanceOwner) {
|
||||
// We are successfully setup as type plugin, but have not spawned an
|
||||
// instance due to a lack of a frame.
|
||||
AsyncStartPluginInstance();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise, we're just changing frames
|
||||
// Set up relationship between instance owner and frame.
|
||||
nsPluginFrame* objFrame = static_cast<nsPluginFrame*>(aFrame);
|
||||
mInstanceOwner->SetFrame(objFrame);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsNPAPIPluginInstance* nsObjectLoadingContent::GetPluginInstance() {
|
||||
if (!mInstanceOwner) {
|
||||
return nullptr;
|
||||
|
@ -2658,23 +2606,9 @@ nsObjectLoadingContent::ObjectType nsObjectLoadingContent::GetTypeOfContent(
|
|||
return type;
|
||||
}
|
||||
|
||||
nsPluginFrame* nsObjectLoadingContent::GetExistingFrame() {
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
nsIFrame* frame = thisContent->GetPrimaryFrame();
|
||||
nsIObjectFrame* objFrame = do_QueryFrame(frame);
|
||||
return static_cast<nsPluginFrame*>(objFrame);
|
||||
}
|
||||
|
||||
void nsObjectLoadingContent::CreateStaticClone(
|
||||
nsObjectLoadingContent* aDest) const {
|
||||
aDest->mType = mType;
|
||||
nsObjectLoadingContent* thisObj = const_cast<nsObjectLoadingContent*>(this);
|
||||
if (thisObj->mPrintFrame.IsAlive()) {
|
||||
aDest->mPrintFrame = thisObj->mPrintFrame;
|
||||
} else {
|
||||
aDest->mPrintFrame = thisObj->GetExistingFrame();
|
||||
}
|
||||
|
||||
if (mFrameLoader) {
|
||||
nsCOMPtr<nsIContent> content =
|
||||
|
@ -2686,12 +2620,6 @@ void nsObjectLoadingContent::CreateStaticClone(
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetPrintFrame(nsIFrame** aFrame) {
|
||||
*aFrame = mPrintFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::PluginDestroyed() {
|
||||
// Called when our plugin is destroyed from under us, usually when reloading
|
||||
|
@ -2979,10 +2907,6 @@ nsObjectLoadingContent::StopPluginInstance() {
|
|||
CloseChannel();
|
||||
}
|
||||
|
||||
// We detach the instance owner's frame before destruction, but don't destroy
|
||||
// the instance owner until the plugin is stopped.
|
||||
mInstanceOwner->SetFrame(nullptr);
|
||||
|
||||
RefPtr<nsPluginInstanceOwner> ownerGrip(mInstanceOwner);
|
||||
mInstanceOwner = nullptr;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ class nsStopPluginRunnable;
|
|||
class AutoSetInstantiatingToFalse;
|
||||
class nsIPrincipal;
|
||||
class nsFrameLoader;
|
||||
class nsPluginFrame;
|
||||
class nsPluginInstanceOwner;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -557,12 +556,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
|
|||
*/
|
||||
ObjectType GetTypeOfContent(const nsCString& aMIMEType, bool aNoFakePlugin);
|
||||
|
||||
/**
|
||||
* Gets the frame that's associated with this content node.
|
||||
* Does not flush.
|
||||
*/
|
||||
nsPluginFrame* GetExistingFrame();
|
||||
|
||||
/**
|
||||
* Used for identifying whether we can rewrite a youtube flash embed to
|
||||
* possibly use HTML5 instead.
|
||||
|
@ -704,8 +697,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
|
|||
bool mPreferFallback : 1;
|
||||
bool mPreferFallbackKnown : 1;
|
||||
|
||||
WeakFrame mPrintFrame;
|
||||
|
||||
RefPtr<nsPluginInstanceOwner> mInstanceOwner;
|
||||
nsTArray<mozilla::dom::MozPluginParameter> mCachedAttributes;
|
||||
nsTArray<mozilla::dom::MozPluginParameter> mCachedParameters;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "nsFontMetrics.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
|
|
@ -81,7 +81,6 @@
|
|||
#include "nsIContentViewer.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsIBrowserChild.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
|
@ -2626,13 +2625,6 @@ nsIFrame* EventStateManager::ComputeScrollTargetAndMayAdjustWheelEvent(
|
|||
// hasn't moved.
|
||||
nsIFrame* lastScrollFrame = WheelTransaction::GetTargetFrame();
|
||||
if (lastScrollFrame) {
|
||||
if (aOptions & INCLUDE_PLUGIN_AS_TARGET) {
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(lastScrollFrame);
|
||||
if (pluginFrame &&
|
||||
pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
||||
return lastScrollFrame;
|
||||
}
|
||||
}
|
||||
nsIScrollableFrame* scrollableFrame =
|
||||
lastScrollFrame->GetScrollTargetFrame();
|
||||
if (scrollableFrame) {
|
||||
|
@ -2684,18 +2676,6 @@ nsIFrame* EventStateManager::ComputeScrollTargetAndMayAdjustWheelEvent(
|
|||
// Check whether the frame wants to provide us with a scrollable view.
|
||||
nsIScrollableFrame* scrollableFrame = scrollFrame->GetScrollTargetFrame();
|
||||
if (!scrollableFrame) {
|
||||
// If the frame is a plugin frame, then, the plugin content may handle
|
||||
// wheel events. Only when the caller computes the scroll target for
|
||||
// default action handling, we should assume the plugin frame as
|
||||
// scrollable if the plugin wants to handle wheel events as default
|
||||
// action.
|
||||
if (aOptions & INCLUDE_PLUGIN_AS_TARGET) {
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(scrollFrame);
|
||||
if (pluginFrame &&
|
||||
pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
||||
return scrollFrame;
|
||||
}
|
||||
}
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(scrollFrame);
|
||||
if (menuPopupFrame) {
|
||||
return nullptr;
|
||||
|
@ -3500,19 +3480,9 @@ nsresult EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
// values is adjusted during its lifetime, the instance will restore the
|
||||
// adjusted delta when it's being destrcuted.
|
||||
ESMAutoDirWheelDeltaRestorer restorer(*wheelEvent);
|
||||
// Check if the frame to scroll before checking the default action
|
||||
// because if the scroll target is a plugin, the default action should be
|
||||
// chosen by the plugin rather than by our prefs.
|
||||
nsIFrame* frameToScroll = ComputeScrollTargetAndMayAdjustWheelEvent(
|
||||
mCurrentTarget, wheelEvent,
|
||||
COMPUTE_DEFAULT_ACTION_TARGET_WITH_AUTO_DIR);
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(frameToScroll);
|
||||
if (pluginFrame) {
|
||||
MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction());
|
||||
// Plugins should receive original values instead of adjusted values.
|
||||
horizontalizer.CancelHorizontalization();
|
||||
action = WheelPrefs::ACTION_SEND_TO_PLUGIN;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case WheelPrefs::ACTION_SCROLL:
|
||||
|
@ -3574,23 +3544,6 @@ nsresult EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
DoScrollZoom(mCurrentTarget, intDelta);
|
||||
break;
|
||||
}
|
||||
case WheelPrefs::ACTION_SEND_TO_PLUGIN:
|
||||
MOZ_ASSERT(pluginFrame);
|
||||
|
||||
if (wheelEvent->mMessage != eWheel ||
|
||||
(!wheelEvent->mDeltaX && !wheelEvent->mDeltaY)) {
|
||||
break;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(static_cast<void*>(frameToScroll) ==
|
||||
static_cast<void*>(pluginFrame));
|
||||
if (!WheelTransaction::WillHandleDefaultAction(wheelEvent,
|
||||
frameToScroll)) {
|
||||
break;
|
||||
}
|
||||
|
||||
pluginFrame->HandleWheelEventAsDefaultAction(wheelEvent);
|
||||
break;
|
||||
case WheelPrefs::ACTION_NONE:
|
||||
default:
|
||||
bool allDeltaOverflown = false;
|
||||
|
|
|
@ -115,10 +115,6 @@ void GlobalKeyListener::InstallKeyboardEventListenersTo(
|
|||
TrustedEventsAtCapture());
|
||||
aEventListenerManager->AddEventListenerByType(this, u"keypress"_ns,
|
||||
TrustedEventsAtCapture());
|
||||
aEventListenerManager->AddEventListenerByType(this, u"mozkeydownonplugin"_ns,
|
||||
TrustedEventsAtCapture());
|
||||
aEventListenerManager->AddEventListenerByType(this, u"mozkeyuponplugin"_ns,
|
||||
TrustedEventsAtCapture());
|
||||
|
||||
// For reducing the IPC cost, preventing to dispatch reserved keyboard
|
||||
// events into the content process.
|
||||
|
@ -128,10 +124,6 @@ void GlobalKeyListener::InstallKeyboardEventListenersTo(
|
|||
this, u"keyup"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
this, u"keypress"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
this, u"mozkeydownonplugin"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
this, u"mozkeyuponplugin"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
|
||||
// Handle keyboard events in bubbling phase of the system event group.
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
|
@ -145,10 +137,6 @@ void GlobalKeyListener::InstallKeyboardEventListenersTo(
|
|||
// remote content.
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
this, u"mozaccesskeynotfound"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
this, u"mozkeydownonplugin"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
aEventListenerManager->AddEventListenerByType(
|
||||
this, u"mozkeyuponplugin"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
}
|
||||
|
||||
void GlobalKeyListener::RemoveKeyboardEventListenersFrom(
|
||||
|
@ -159,10 +147,6 @@ void GlobalKeyListener::RemoveKeyboardEventListenersFrom(
|
|||
TrustedEventsAtCapture());
|
||||
aEventListenerManager->RemoveEventListenerByType(this, u"keypress"_ns,
|
||||
TrustedEventsAtCapture());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"mozkeydownonplugin"_ns, TrustedEventsAtCapture());
|
||||
aEventListenerManager->RemoveEventListenerByType(this, u"mozkeyuponplugin"_ns,
|
||||
TrustedEventsAtCapture());
|
||||
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"keydown"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
|
@ -170,10 +154,6 @@ void GlobalKeyListener::RemoveKeyboardEventListenersFrom(
|
|||
this, u"keyup"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"keypress"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"mozkeydownonplugin"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"mozkeyuponplugin"_ns, TrustedEventsAtSystemGroupCapture());
|
||||
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"keydown"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
|
@ -183,10 +163,6 @@ void GlobalKeyListener::RemoveKeyboardEventListenersFrom(
|
|||
this, u"keypress"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"mozaccesskeynotfound"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"mozkeydownonplugin"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
aEventListenerManager->RemoveEventListenerByType(
|
||||
this, u"mozkeyuponplugin"_ns, TrustedEventsAtSystemGroupBubble());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -205,28 +181,6 @@ GlobalKeyListener::HandleEvent(dom::Event* aEvent) {
|
|||
|
||||
WidgetKeyboardEvent* widgetKeyboardEvent =
|
||||
aEvent->WidgetEventPtr()->AsKeyboardEvent();
|
||||
if (widgetKeyboardEvent->IsKeyEventOnPlugin()) {
|
||||
// key events on plugin shouldn't execute shortcut key handlers which are
|
||||
// not reserved.
|
||||
if (!widgetKeyboardEvent->IsReservedByChrome()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the event is untrusted event or was already consumed, do nothing.
|
||||
if (!widgetKeyboardEvent->IsTrusted() ||
|
||||
widgetKeyboardEvent->DefaultPrevented()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX Don't check isReserved here because even if the handler in this
|
||||
// instance isn't reserved but another instance reserves the key
|
||||
// combination, it will be executed when the event is normal keyboard
|
||||
// events...
|
||||
bool isReserved = false;
|
||||
if (!HasHandlerForEvent(keyEvent, &isReserved)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// If this event was handled by APZ then don't do the default action, and
|
||||
// preventDefault to prevent any other listeners from handling the event.
|
||||
|
@ -346,17 +300,7 @@ bool GlobalKeyListener::WalkHandlersAndExecute(
|
|||
}
|
||||
|
||||
if (aExecute) {
|
||||
// If the event is eKeyDownOnPlugin, it should execute either keydown
|
||||
// handler or keypress handler because eKeyDownOnPlugin events are
|
||||
// never followed by keypress events.
|
||||
if (widgetKeyboardEvent->mMessage == eKeyDownOnPlugin) {
|
||||
if (!handler->EventTypeEquals(nsGkAtoms::keydown) &&
|
||||
!handler->EventTypeEquals(nsGkAtoms::keypress)) {
|
||||
continue;
|
||||
}
|
||||
// The other event types should exactly be matched with the handler's
|
||||
// event type.
|
||||
} else if (!handler->EventTypeEquals(eventType)) {
|
||||
if (!handler->EventTypeEquals(eventType)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
@ -418,13 +362,6 @@ bool GlobalKeyListener::WalkHandlersAndExecute(
|
|||
// This should only be assigned when aExecute is false.
|
||||
MOZ_ASSERT(!aOutReservedForChrome);
|
||||
|
||||
// If it's not reserved and the event is a key event on a plugin,
|
||||
// the handler shouldn't be executed.
|
||||
if (widgetKeyboardEvent->IsKeyEventOnPlugin() &&
|
||||
!IsReservedKey(widgetKeyboardEvent, handler)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<dom::EventTarget> target = GetHandlerTarget(handler);
|
||||
|
||||
// XXX Do we execute only one handler even if the handler neither stops
|
||||
|
|
|
@ -247,9 +247,7 @@ uint32_t KeyboardEvent::Which(CallerType aCallerType) {
|
|||
|
||||
switch (mEvent->mMessage) {
|
||||
case eKeyDown:
|
||||
case eKeyDownOnPlugin:
|
||||
case eKeyUp:
|
||||
case eKeyUpOnPlugin:
|
||||
return KeyCode(aCallerType);
|
||||
case eKeyPress:
|
||||
// Special case for 4xp bug 62878. Try to make value of which
|
||||
|
|
|
@ -51,10 +51,10 @@ KeyEventHandler* ShortcutKeys::GetHandlers(HandlerType aType) {
|
|||
/* static */
|
||||
nsAtom* ShortcutKeys::ConvertEventToDOMEventType(
|
||||
const WidgetKeyboardEvent* aWidgetKeyboardEvent) {
|
||||
if (aWidgetKeyboardEvent->IsKeyDownOrKeyDownOnPlugin()) {
|
||||
if (aWidgetKeyboardEvent->mMessage == eKeyDown) {
|
||||
return nsGkAtoms::keydown;
|
||||
}
|
||||
if (aWidgetKeyboardEvent->IsKeyUpOrKeyUpOnPlugin()) {
|
||||
if (aWidgetKeyboardEvent->mMessage == eKeyUp) {
|
||||
return nsGkAtoms::keyup;
|
||||
}
|
||||
// eAccessKeyNotFound event is always created from eKeyPress event and
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "DocumentInlines.h" // for Document and HTMLBodyElement
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "prtime.h"
|
||||
#include "Units.h"
|
||||
|
@ -55,11 +54,10 @@ bool WheelHandlingUtils::CanScrollInRange(nscoord aMin, nscoord aValue,
|
|||
bool WheelHandlingUtils::CanScrollOn(nsIFrame* aFrame, double aDirectionX,
|
||||
double aDirectionY) {
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aFrame);
|
||||
if (scrollableFrame) {
|
||||
return CanScrollOn(scrollableFrame, aDirectionX, aDirectionY);
|
||||
if (!scrollableFrame) {
|
||||
return false;
|
||||
}
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
|
||||
return pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction();
|
||||
return CanScrollOn(scrollableFrame, aDirectionX, aDirectionY);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "nsError.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "nsIPluginDocument.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -189,17 +188,6 @@ bool HTMLObjectElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
|||
const nsAttrValue* attrVal = mAttrs.GetAttr(nsGkAtoms::tabindex);
|
||||
bool isFocusable = attrVal && attrVal->Type() == nsAttrValue::eInteger;
|
||||
|
||||
// Has plugin content: let the plugin decide what to do in terms of
|
||||
// internal focus from mouse clicks
|
||||
if (Type() == eType_Plugin) {
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = isFocusable ? attrVal->GetIntegerValue() : -1;
|
||||
}
|
||||
|
||||
*aIsFocusable = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// This method doesn't call nsGenericHTMLFormElement intentionally.
|
||||
// TODO: It should probably be changed when bug 597242 will be fixed.
|
||||
if (IsEditableRoot() ||
|
||||
|
@ -228,32 +216,7 @@ HTMLObjectElement::Reset() { return NS_OK; }
|
|||
|
||||
NS_IMETHODIMP
|
||||
HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) {
|
||||
nsAutoString name;
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
||||
// No name, don't submit.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
|
||||
nsIObjectFrame* objFrame = do_QueryFrame(frame);
|
||||
if (!objFrame) {
|
||||
// No frame, nothing to submit.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<nsNPAPIPluginInstance> pi = objFrame->GetPluginInstance();
|
||||
if (!pi) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
nsresult rv = pi->GetFormValue(value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aFormSubmission->AddNameValuePair(name, value);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int32_t HTMLObjectElement::TabIndexDefault() { return 0; }
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "MediaDocument.h"
|
||||
#include "nsIPluginDocument.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "DocumentInlines.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
@ -239,21 +238,6 @@ NS_IMETHODIMP
|
|||
PluginDocument::Print() {
|
||||
NS_ENSURE_TRUE(mPluginContent, NS_ERROR_FAILURE);
|
||||
|
||||
nsIObjectFrame* objectFrame =
|
||||
do_QueryFrame(mPluginContent->GetPrimaryFrame());
|
||||
if (objectFrame) {
|
||||
RefPtr<nsNPAPIPluginInstance> pi = objectFrame->GetPluginInstance();
|
||||
if (pi) {
|
||||
NPPrint npprint;
|
||||
npprint.mode = NP_FULL;
|
||||
npprint.print.fullPrint.pluginPrinted = false;
|
||||
npprint.print.fullPrint.printOne = false;
|
||||
npprint.print.fullPrint.platformPrint = nullptr;
|
||||
|
||||
pi->Print(&npprint);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -2881,19 +2881,12 @@ void BrowserChild::MakeHidden() {
|
|||
}
|
||||
|
||||
if (nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation())) {
|
||||
// Hide all plugins in this tab. We don't use
|
||||
// We don't use
|
||||
// BrowserChildBase::GetPresShell() here because that would create a content
|
||||
// viewer if one doesn't exist yet. Creating a content viewer can cause JS
|
||||
// to run, which we want to avoid. nsIDocShell::GetPresShell returns null if
|
||||
// no content viewer exists yet.
|
||||
if (RefPtr<PresShell> presShell = docShell->GetPresShell()) {
|
||||
if (nsPresContext* presContext = presShell->GetPresContext()) {
|
||||
nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
|
||||
nsIFrame* rootFrame = presShell->GetRootFrame();
|
||||
rootPresContext->ComputePluginGeometryUpdates(rootFrame, nullptr,
|
||||
nullptr);
|
||||
rootPresContext->ApplyPluginGeometryUpdates();
|
||||
}
|
||||
presShell->SetIsActive(false);
|
||||
}
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -28,7 +28,6 @@
|
|||
|
||||
class nsIInputStream;
|
||||
class nsPluginDOMContextMenuListener;
|
||||
class nsPluginFrame;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
#if defined(MOZ_X11)
|
||||
|
@ -168,9 +167,6 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
|||
|
||||
void UpdateDocumentActiveState(bool aIsActive);
|
||||
|
||||
void SetFrame(nsPluginFrame* aFrame);
|
||||
nsPluginFrame* GetFrame();
|
||||
|
||||
uint32_t GetLastEventloopNestingLevel() const {
|
||||
return mLastEventloopNestingLevel;
|
||||
}
|
||||
|
@ -299,7 +295,6 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
|||
|
||||
nsPluginNativeWindow* mPluginWindow;
|
||||
RefPtr<nsNPAPIPluginInstance> mInstance;
|
||||
nsPluginFrame* mPluginFrame;
|
||||
nsWeakPtr mContent; // WEAK, content owns us
|
||||
nsCString mDocumentBase;
|
||||
bool mWidgetCreationComplete;
|
||||
|
@ -353,17 +348,6 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
|||
#endif
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -236,31 +236,6 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg,
|
|||
|
||||
break;
|
||||
|
||||
case WM_MOUSEACTIVATE: {
|
||||
// If a child window of this plug-in is already focused,
|
||||
// don't focus the parent to avoid focus dance. We'll
|
||||
// receive a follow up WM_SETFOCUS which will notify
|
||||
// the appropriate window anyway.
|
||||
HWND focusedWnd = ::GetFocus();
|
||||
if (!::IsChild((HWND)win->window, focusedWnd)) {
|
||||
// Notify the dom / focus manager the plugin has focus when one of
|
||||
// it's child windows receives it. OOPP specific - this code is
|
||||
// critical in notifying the dom of focus changes when the plugin
|
||||
// window in the child process receives focus via a mouse click.
|
||||
// WM_MOUSEACTIVATE is sent by nsWindow via a custom window event
|
||||
// sent from PluginInstanceParent in response to focus events sent
|
||||
// from the child. (bug 540052) Note, this gui event could also be
|
||||
// sent directly from widget.
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
win->GetPluginWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
WidgetGUIEvent event(true, ePluginActivate, widget);
|
||||
nsEventStatus status;
|
||||
widget->DispatchEvent(&event, status);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
case WM_KILLFOCUS: {
|
||||
// Make sure setfocus and killfocus get through to the widget procedure
|
||||
|
|
|
@ -22,8 +22,6 @@ class CompositorController {
|
|||
* Ask the compositor to schedule a new composite.
|
||||
*/
|
||||
virtual void ScheduleRenderOnCompositorThread() = 0;
|
||||
virtual void ScheduleHideAllPluginWindows() = 0;
|
||||
virtual void ScheduleShowAllPluginWindows() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~CompositorController() = default;
|
||||
|
|
|
@ -5402,24 +5402,10 @@ void AsyncPanZoomController::DispatchStateChangeNotification(
|
|||
if (!IsTransformingState(aOldState) && IsTransformingState(aNewState)) {
|
||||
controller->NotifyAPZStateChange(GetGuid(),
|
||||
APZStateChange::eTransformBegin);
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
// Let the compositor know about scroll state changes so it can manage
|
||||
// windowed plugins.
|
||||
if (StaticPrefs::gfx_e10s_hide_plugins_for_scroll_AtStartup() &&
|
||||
mCompositorController) {
|
||||
mCompositorController->ScheduleHideAllPluginWindows();
|
||||
}
|
||||
#endif
|
||||
} else if (IsTransformingState(aOldState) &&
|
||||
!IsTransformingState(aNewState)) {
|
||||
controller->NotifyAPZStateChange(GetGuid(),
|
||||
APZStateChange::eTransformEnd);
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (StaticPrefs::gfx_e10s_hide_plugins_for_scroll_AtStartup() &&
|
||||
mCompositorController) {
|
||||
mCompositorController->ScheduleShowAllPluginWindows();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,30 +80,17 @@ AsyncCompositionManager::AsyncCompositionManager(
|
|||
AsyncCompositionManager::~AsyncCompositionManager() = default;
|
||||
|
||||
void AsyncCompositionManager::ResolveRefLayers(
|
||||
CompositorBridgeParent* aCompositor, bool* aHasRemoteContent,
|
||||
bool* aResolvePlugins) {
|
||||
CompositorBridgeParent* aCompositor, bool* aHasRemoteContent) {
|
||||
if (aHasRemoteContent) {
|
||||
*aHasRemoteContent = false;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
// If valid *aResolvePlugins indicates if we need to update plugin geometry
|
||||
// when we walk the tree.
|
||||
bool resolvePlugins = (aCompositor && aResolvePlugins && *aResolvePlugins);
|
||||
#endif
|
||||
|
||||
if (!mLayerManager->GetRoot()) {
|
||||
// Updated the return value since this result controls completing
|
||||
// composition.
|
||||
if (aResolvePlugins) {
|
||||
*aResolvePlugins = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mReadyForCompose = true;
|
||||
bool hasRemoteContent = false;
|
||||
bool didResolvePlugins = false;
|
||||
|
||||
ForEachNode<ForwardIterator>(mLayerManager->GetRoot(), [&](Layer* layer) {
|
||||
RefLayer* refLayer = layer->AsRefLayer();
|
||||
|
@ -136,21 +123,11 @@ void AsyncCompositionManager::ResolveRefLayers(
|
|||
}
|
||||
|
||||
refLayer->ConnectReferentLayer(referent);
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (resolvePlugins) {
|
||||
didResolvePlugins |=
|
||||
aCompositor->UpdatePluginWindowState(refLayer->GetReferentId());
|
||||
}
|
||||
#endif
|
||||
});
|
||||
|
||||
if (aHasRemoteContent) {
|
||||
*aHasRemoteContent = hasRemoteContent;
|
||||
}
|
||||
if (aResolvePlugins) {
|
||||
*aResolvePlugins = didResolvePlugins;
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncCompositionManager::DetachRefLayers() {
|
||||
|
|
|
@ -173,13 +173,9 @@ class AsyncCompositionManager final {
|
|||
* to the layer tree, if found.
|
||||
* aHasRemoteContent - indicates if the layer tree contains a remote reflayer.
|
||||
* May be null.
|
||||
* aResolvePlugins - incoming value indicates if plugin windows should be
|
||||
* updated through a call on aCompositor's UpdatePluginWindowState. Applies
|
||||
* to linux and windows only, may be null. On return value indicates
|
||||
* if any updates occured.
|
||||
*/
|
||||
void ResolveRefLayers(CompositorBridgeParent* aCompositor,
|
||||
bool* aHasRemoteContent, bool* aResolvePlugins);
|
||||
bool* aHasRemoteContent);
|
||||
|
||||
/**
|
||||
* Detaches all referents resolved by ResolveRefLayers.
|
||||
|
@ -245,12 +241,10 @@ class MOZ_STACK_CLASS AutoResolveRefLayers {
|
|||
public:
|
||||
explicit AutoResolveRefLayers(AsyncCompositionManager* aManager,
|
||||
CompositorBridgeParent* aCompositor = nullptr,
|
||||
bool* aHasRemoteContent = nullptr,
|
||||
bool* aResolvePlugins = nullptr)
|
||||
bool* aHasRemoteContent = nullptr)
|
||||
: mManager(aManager) {
|
||||
if (mManager) {
|
||||
mManager->ResolveRefLayers(aCompositor, aHasRemoteContent,
|
||||
aResolvePlugins);
|
||||
mManager->ResolveRefLayers(aCompositor, aHasRemoteContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -349,176 +349,6 @@ mozilla::ipc::IPCResult CompositorBridgeChild::RecvInvalidateLayers(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
static void CalculatePluginClip(
|
||||
const LayoutDeviceIntRect& aBounds,
|
||||
const nsTArray<LayoutDeviceIntRect>& aPluginClipRects,
|
||||
const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aParentLayerVisibleRegion,
|
||||
nsTArray<LayoutDeviceIntRect>& aResult, LayoutDeviceIntRect& aVisibleBounds,
|
||||
bool& aPluginIsVisible) {
|
||||
aPluginIsVisible = true;
|
||||
LayoutDeviceIntRegion contentVisibleRegion;
|
||||
// aPluginClipRects (plugin widget origin) - contains *visible* rects
|
||||
for (uint32_t idx = 0; idx < aPluginClipRects.Length(); idx++) {
|
||||
LayoutDeviceIntRect rect = aPluginClipRects[idx];
|
||||
// shift to content origin
|
||||
rect.MoveBy(aBounds.X(), aBounds.Y());
|
||||
// accumulate visible rects
|
||||
contentVisibleRegion.OrWith(rect);
|
||||
}
|
||||
// apply layers clip (window origin)
|
||||
LayoutDeviceIntRegion region = aParentLayerVisibleRegion;
|
||||
region.MoveBy(-aContentOffset.x, -aContentOffset.y);
|
||||
contentVisibleRegion.AndWith(region);
|
||||
if (contentVisibleRegion.IsEmpty()) {
|
||||
aPluginIsVisible = false;
|
||||
return;
|
||||
}
|
||||
// shift to plugin widget origin
|
||||
contentVisibleRegion.MoveBy(-aBounds.X(), -aBounds.Y());
|
||||
for (auto iter = contentVisibleRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const LayoutDeviceIntRect& rect = iter.Get();
|
||||
aResult.AppendElement(rect);
|
||||
aVisibleBounds.UnionRect(aVisibleBounds, rect);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mozilla::ipc::IPCResult CompositorBridgeChild::RecvUpdatePluginConfigurations(
|
||||
const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aParentLayerVisibleRegion,
|
||||
nsTArray<PluginWindowData>&& aPlugins) {
|
||||
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"CompositorBridgeChild::RecvUpdatePluginConfigurations"
|
||||
" calls unexpected on this platform.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#else
|
||||
// Now that we are on the main thread, update plugin widget config.
|
||||
// This should happen a little before we paint to the screen assuming
|
||||
// the main thread is running freely.
|
||||
DebugOnly<nsresult> rv;
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Tracks visible plugins we update, so we can hide any plugins we don't.
|
||||
nsTArray<uintptr_t> visiblePluginIds;
|
||||
nsIWidget* parent = nullptr;
|
||||
for (uint32_t pluginsIdx = 0; pluginsIdx < aPlugins.Length(); pluginsIdx++) {
|
||||
nsIWidget* widget = nsIWidget::LookupRegisteredPluginWindow(
|
||||
aPlugins[pluginsIdx].windowId());
|
||||
if (!widget) {
|
||||
NS_WARNING("Unexpected, plugin id not found!");
|
||||
continue;
|
||||
}
|
||||
if (!parent) {
|
||||
parent = widget->GetParent();
|
||||
}
|
||||
bool isVisible = aPlugins[pluginsIdx].visible();
|
||||
if (widget && !widget->Destroyed()) {
|
||||
LayoutDeviceIntRect bounds;
|
||||
LayoutDeviceIntRect visibleBounds;
|
||||
// If the plugin is visible update it's geometry.
|
||||
if (isVisible) {
|
||||
// Set bounds (content origin)
|
||||
bounds = aPlugins[pluginsIdx].bounds();
|
||||
nsTArray<LayoutDeviceIntRect> rectsOut;
|
||||
// This call may change the value of isVisible
|
||||
CalculatePluginClip(bounds, aPlugins[pluginsIdx].clip(), aContentOffset,
|
||||
aParentLayerVisibleRegion, rectsOut, visibleBounds,
|
||||
isVisible);
|
||||
// content clipping region (widget origin)
|
||||
rv = widget->SetWindowClipRegion(rectsOut, false);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
|
||||
// This will trigger a browser window paint event for areas uncovered
|
||||
// by a child window move, and will call invalidate on the plugin
|
||||
// parent window which the browser owns. The latter gets picked up in
|
||||
// our OnPaint handler and forwarded over to the plugin process async.
|
||||
widget->Resize(aContentOffset.x + bounds.X(),
|
||||
aContentOffset.y + bounds.Y(), bounds.Width(),
|
||||
bounds.Height(), true);
|
||||
}
|
||||
|
||||
widget->Enable(isVisible);
|
||||
|
||||
// visible state - updated after clipping, prior to invalidating
|
||||
widget->Show(isVisible);
|
||||
|
||||
// Handle invalidation, this can be costly, avoid if it is not needed.
|
||||
if (isVisible) {
|
||||
// invalidate region (widget origin)
|
||||
# if defined(XP_WIN)
|
||||
// Work around for flash's crummy sandbox. See bug 762948. This call
|
||||
// digs down into the window hirearchy, invalidating regions on
|
||||
// windows owned by other processes.
|
||||
mozilla::widget::WinUtils::InvalidatePluginAsWorkaround(widget,
|
||||
visibleBounds);
|
||||
# else
|
||||
widget->Invalidate(visibleBounds);
|
||||
# endif
|
||||
visiblePluginIds.AppendElement(aPlugins[pluginsIdx].windowId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Any plugins we didn't update need to be hidden, as they are
|
||||
// not associated with visible content.
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility((uintptr_t)parent,
|
||||
visiblePluginIds);
|
||||
if (!mCanSend) {
|
||||
return IPC_OK();
|
||||
}
|
||||
SendRemotePluginsReady();
|
||||
return IPC_OK();
|
||||
#endif // !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
static void ScheduleSendAllPluginsCaptured(CompositorBridgeChild* aThis,
|
||||
nsISerialEventTarget* aThread) {
|
||||
aThread->Dispatch(NewNonOwningRunnableMethod(
|
||||
"CompositorBridgeChild::SendAllPluginsCaptured", aThis,
|
||||
&CompositorBridgeChild::SendAllPluginsCaptured));
|
||||
}
|
||||
#endif
|
||||
|
||||
mozilla::ipc::IPCResult CompositorBridgeChild::RecvCaptureAllPlugins(
|
||||
const uintptr_t& aParentWidget) {
|
||||
#if defined(XP_WIN)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsIWidget::CaptureRegisteredPlugins(aParentWidget);
|
||||
|
||||
// Bounce the call to SendAllPluginsCaptured off the ImageBridgeChild thread,
|
||||
// to make sure that the image updates on that thread have been processed.
|
||||
ImageBridgeChild::GetSingleton()->GetThread()->Dispatch(NewRunnableFunction(
|
||||
"ScheduleSendAllPluginsCapturedRunnable", &ScheduleSendAllPluginsCaptured,
|
||||
this, NS_GetCurrentThread()));
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"CompositorBridgeChild::RecvCaptureAllPlugins calls unexpected.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CompositorBridgeChild::RecvHideAllPlugins(
|
||||
const uintptr_t& aParentWidget) {
|
||||
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"CompositorBridgeChild::RecvHideAllPlugins calls "
|
||||
"unexpected on this platform.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#else
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsTArray<uintptr_t> list;
|
||||
nsIWidget::UpdateRegisteredPluginWindowVisibility(aParentWidget, list);
|
||||
if (!mCanSend) {
|
||||
return IPC_OK();
|
||||
}
|
||||
SendRemotePluginsReady();
|
||||
return IPC_OK();
|
||||
#endif // !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CompositorBridgeChild::RecvDidComposite(
|
||||
const LayersId& aId, const TransactionId& aTransactionId,
|
||||
const TimeStamp& aCompositeStart, const TimeStamp& aCompositeEnd) {
|
||||
|
@ -789,13 +619,6 @@ bool CompositorBridgeChild::SendRequestNotifyAfterRemotePaint() {
|
|||
return PCompositorBridgeChild::SendRequestNotifyAfterRemotePaint();
|
||||
}
|
||||
|
||||
bool CompositorBridgeChild::SendAllPluginsCaptured() {
|
||||
if (!mCanSend) {
|
||||
return false;
|
||||
}
|
||||
return PCompositorBridgeChild::SendAllPluginsCaptured();
|
||||
}
|
||||
|
||||
PTextureChild* CompositorBridgeChild::AllocPTextureChild(
|
||||
const SurfaceDescriptor&, const ReadLockDescriptor&, const LayersBackend&,
|
||||
const TextureFlags&, const LayersId&, const uint64_t& aSerial,
|
||||
|
|
|
@ -102,15 +102,6 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
|
|||
|
||||
mozilla::ipc::IPCResult RecvInvalidateLayers(const LayersId& aLayersId);
|
||||
|
||||
mozilla::ipc::IPCResult RecvUpdatePluginConfigurations(
|
||||
const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aVisibleRegion,
|
||||
nsTArray<PluginWindowData>&& aPlugins);
|
||||
|
||||
mozilla::ipc::IPCResult RecvCaptureAllPlugins(const uintptr_t& aParentWidget);
|
||||
|
||||
mozilla::ipc::IPCResult RecvHideAllPlugins(const uintptr_t& aParentWidget);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNotifyJankedAnimations(
|
||||
const LayersId& aLayersId, nsTArray<uint64_t>&& aJankedAnimations);
|
||||
|
||||
|
@ -169,7 +160,6 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
|
|||
nsTArray<float>* intervals);
|
||||
bool SendNotifyRegionInvalidated(const nsIntRegion& region);
|
||||
bool SendRequestNotifyAfterRemotePaint();
|
||||
bool SendAllPluginsCaptured();
|
||||
bool IsSameProcess() const override;
|
||||
|
||||
bool IPCOpen() const override { return mCanSend; }
|
||||
|
|
|
@ -228,8 +228,7 @@ CompositorBridgeParent::LayerTreeState::LayerTreeState()
|
|||
mParent(nullptr),
|
||||
mLayerManager(nullptr),
|
||||
mContentCompositorBridgeParent(nullptr),
|
||||
mLayerTree(nullptr),
|
||||
mUpdatedPluginDataAvailable(false) {}
|
||||
mLayerTree(nullptr) {}
|
||||
|
||||
CompositorBridgeParent::LayerTreeState::~LayerTreeState() {
|
||||
if (mController) {
|
||||
|
@ -349,12 +348,6 @@ CompositorBridgeParent::CompositorBridgeParent(
|
|||
mCompositorScheduler(nullptr),
|
||||
mAnimationStorage(nullptr),
|
||||
mPaintTime(TimeDuration::Forever())
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
,
|
||||
mLastPluginUpdateLayerTreeId{0},
|
||||
mDeferPluginWindows(false),
|
||||
mPluginWindowsHidden(false)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -815,19 +808,7 @@ void CompositorBridgeParent::NotifyShadowTreeTransaction(
|
|||
bool aScheduleComposite, uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction, bool aHitTestUpdate) {
|
||||
if (!aIsRepeatTransaction && mLayerManager && mLayerManager->GetRoot()) {
|
||||
// Process plugin data here to give time for them to update before the next
|
||||
// composition.
|
||||
bool pluginsUpdatedFlag = true;
|
||||
AutoResolveRefLayers resolve(mCompositionManager, this, nullptr,
|
||||
&pluginsUpdatedFlag);
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
// If plugins haven't been updated, stop waiting.
|
||||
if (!pluginsUpdatedFlag) {
|
||||
mWaitForPluginsUntil = TimeStamp();
|
||||
mHaveBlockedForPlugins = false;
|
||||
}
|
||||
#endif
|
||||
AutoResolveRefLayers resolve(mCompositionManager, this, nullptr);
|
||||
|
||||
if (mApzUpdater) {
|
||||
mApzUpdater->UpdateFocusState(mRootLayerTreeID, aId, aFocusTarget);
|
||||
|
@ -904,41 +885,7 @@ void CompositorBridgeParent::CompositeToTarget(VsyncId aId, DrawTarget* aTarget,
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (!mWaitForPluginsUntil.IsNull() && mWaitForPluginsUntil > start) {
|
||||
mHaveBlockedForPlugins = true;
|
||||
ScheduleComposition();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AutoResolveRefLayers handles two tasks related to Windows and Linux
|
||||
* plugin window management:
|
||||
* 1) calculating if we have remote content in the view. If we do not have
|
||||
* remote content, all plugin windows for this CompositorBridgeParent (window)
|
||||
* can be hidden since we do not support plugins in chrome when running
|
||||
* under e10s.
|
||||
* 2) Updating plugin position, size, and clip. We do this here while the
|
||||
* remote layer tree is hooked up to to chrome layer tree. This is needed
|
||||
* since plugin clipping can depend on chrome (for example, due to tab modal
|
||||
* prompts). Updates in step 2 are applied via an async ipc message sent
|
||||
* to the main thread.
|
||||
*/
|
||||
bool hasRemoteContent = false;
|
||||
bool updatePluginsFlag = true;
|
||||
AutoResolveRefLayers resolve(mCompositionManager, this, &hasRemoteContent,
|
||||
&updatePluginsFlag);
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
// We do not support plugins in local content. When switching tabs
|
||||
// to local pages, hide every plugin associated with the window.
|
||||
if (!hasRemoteContent && gfxVars::BrowserTabsRemoteAutostart() &&
|
||||
mCachedPluginData.Length()) {
|
||||
Unused << SendHideAllPlugins(GetWidget()->GetWidgetKey());
|
||||
mCachedPluginData.Clear();
|
||||
}
|
||||
#endif
|
||||
AutoResolveRefLayers resolve(mCompositionManager, this);
|
||||
|
||||
nsCString none;
|
||||
if (aTarget) {
|
||||
|
@ -967,14 +914,6 @@ void CompositorBridgeParent::CompositeToTarget(VsyncId aId, DrawTarget* aTarget,
|
|||
|
||||
if (requestNextFrame) {
|
||||
ScheduleComposition();
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
// If we have visible windowed plugins then we need to wait for content (and
|
||||
// then the plugins) to have been updated by the active animation.
|
||||
if (!mPluginWindowsHidden && mCachedPluginData.Length()) {
|
||||
mWaitForPluginsUntil =
|
||||
mCompositorScheduler->GetLastComposeTime().Time() + (mVsyncRate * 2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RenderTraceLayers(mLayerManager->GetRoot(), "0000");
|
||||
|
@ -1031,24 +970,6 @@ void CompositorBridgeParent::CompositeToTarget(VsyncId aId, DrawTarget* aTarget,
|
|||
start);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult CompositorBridgeParent::RecvRemotePluginsReady() {
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
mWaitForPluginsUntil = TimeStamp();
|
||||
if (mHaveBlockedForPlugins) {
|
||||
mHaveBlockedForPlugins = false;
|
||||
ForceComposeToTarget(nullptr);
|
||||
} else {
|
||||
ScheduleComposition();
|
||||
}
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"CompositorBridgeParent::RecvRemotePluginsReady calls "
|
||||
"unexpected on this platform.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::ForceComposeToTarget(DrawTarget* aTarget,
|
||||
const gfx::IntRect* aRect) {
|
||||
AUTO_PROFILER_LABEL("CompositorBridgeParent::ForceComposeToTarget", GRAPHICS);
|
||||
|
@ -2568,189 +2489,6 @@ void CompositorBridgeParent::NotifyWebRenderDisableNativeCompositor() {
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
//#define PLUGINS_LOG(...) printf_stderr("CP [%s]: ", __FUNCTION__);
|
||||
// printf_stderr(__VA_ARGS__);
|
||||
// printf_stderr("\n");
|
||||
# define PLUGINS_LOG(...)
|
||||
|
||||
bool CompositorBridgeParent::UpdatePluginWindowState(LayersId aId) {
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
CompositorBridgeParent::LayerTreeState& lts = sIndirectLayerTrees[aId];
|
||||
if (!lts.mParent) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] layer tree compositor parent pointer is null",
|
||||
aId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if this layer tree has received any shadow layer updates
|
||||
if (!lts.mUpdatedPluginDataAvailable) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] no plugin data", aId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// pluginMetricsChanged tracks whether we need to send plugin update
|
||||
// data to the main thread. If we do we'll have to block composition,
|
||||
// which we want to avoid if at all possible.
|
||||
bool pluginMetricsChanged = false;
|
||||
|
||||
// Same layer tree checks
|
||||
if (mLastPluginUpdateLayerTreeId == aId) {
|
||||
// no plugin data and nothing has changed, bail.
|
||||
if (!mCachedPluginData.Length() && !lts.mPluginData.Length()) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] no data, no changes", aId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mCachedPluginData.Length() == lts.mPluginData.Length()) {
|
||||
// check for plugin data changes
|
||||
for (uint32_t idx = 0; idx < lts.mPluginData.Length(); idx++) {
|
||||
if (!(mCachedPluginData[idx] == lts.mPluginData[idx])) {
|
||||
pluginMetricsChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// array lengths don't match, need to update
|
||||
pluginMetricsChanged = true;
|
||||
}
|
||||
} else {
|
||||
// exchanging layer trees, we need to update
|
||||
pluginMetricsChanged = true;
|
||||
}
|
||||
|
||||
// Check if plugin windows are currently hidden due to scrolling
|
||||
if (mDeferPluginWindows) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] suppressing", aId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the plugin windows were hidden but now are not, we need to force
|
||||
// update the metrics to make sure they are visible again.
|
||||
if (mPluginWindowsHidden) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] re-showing", aId);
|
||||
mPluginWindowsHidden = false;
|
||||
pluginMetricsChanged = true;
|
||||
}
|
||||
|
||||
if (!lts.mPluginData.Length()) {
|
||||
// Don't hide plugins if the previous remote layer tree didn't contain any.
|
||||
if (!mCachedPluginData.Length()) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] nothing to hide", aId);
|
||||
return false;
|
||||
}
|
||||
|
||||
uintptr_t parentWidget = GetWidget()->GetWidgetKey();
|
||||
|
||||
// We will pass through here in cases where the previous shadow layer
|
||||
// tree contained visible plugins and the new tree does not. All we need
|
||||
// to do here is hide the plugins for the old tree, so don't waste time
|
||||
// calculating clipping.
|
||||
mPluginsLayerOffset = nsIntPoint(0, 0);
|
||||
mPluginsLayerVisibleRegion.SetEmpty();
|
||||
Unused << lts.mParent->SendHideAllPlugins(parentWidget);
|
||||
lts.mUpdatedPluginDataAvailable = false;
|
||||
PLUGINS_LOG("[%" PRIu64 "] hide all", aId);
|
||||
} else {
|
||||
// Retrieve the offset and visible region of the layer that hosts
|
||||
// the plugins, CompositorBridgeChild needs these in calculating proper
|
||||
// plugin clipping.
|
||||
LayerTransactionParent* layerTree = lts.mLayerTree;
|
||||
Layer* contentRoot = layerTree->GetRoot();
|
||||
if (contentRoot) {
|
||||
nsIntPoint offset;
|
||||
nsIntRegion visibleRegion;
|
||||
if (contentRoot->GetVisibleRegionRelativeToRootLayer(visibleRegion,
|
||||
&offset)) {
|
||||
// Check to see if these values have changed, if so we need to
|
||||
// update plugin window position within the window.
|
||||
if (!pluginMetricsChanged &&
|
||||
mPluginsLayerVisibleRegion == visibleRegion &&
|
||||
mPluginsLayerOffset == offset) {
|
||||
PLUGINS_LOG("[%" PRIu64 "] no change", aId);
|
||||
return false;
|
||||
}
|
||||
mPluginsLayerOffset = offset;
|
||||
mPluginsLayerVisibleRegion = visibleRegion;
|
||||
Unused << lts.mParent->SendUpdatePluginConfigurations(
|
||||
LayoutDeviceIntPoint::FromUnknownPoint(offset),
|
||||
LayoutDeviceIntRegion::FromUnknownRegion(visibleRegion),
|
||||
lts.mPluginData);
|
||||
lts.mUpdatedPluginDataAvailable = false;
|
||||
PLUGINS_LOG("[%" PRIu64 "] updated", aId);
|
||||
} else {
|
||||
PLUGINS_LOG("[%" PRIu64 "] no visibility data", aId);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
PLUGINS_LOG("[%" PRIu64 "] no content root", aId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
mLastPluginUpdateLayerTreeId = aId;
|
||||
mCachedPluginData = lts.mPluginData.Clone();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::ScheduleShowAllPluginWindows() {
|
||||
MOZ_ASSERT(CompositorThread());
|
||||
CompositorThread()->Dispatch(
|
||||
NewRunnableMethod("layers::CompositorBridgeParent::ShowAllPluginWindows",
|
||||
this, &CompositorBridgeParent::ShowAllPluginWindows));
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::ShowAllPluginWindows() {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
mDeferPluginWindows = false;
|
||||
ScheduleComposition();
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::ScheduleHideAllPluginWindows() {
|
||||
MOZ_ASSERT(CompositorThread());
|
||||
CompositorThread()->Dispatch(
|
||||
NewRunnableMethod("layers::CompositorBridgeParent::HideAllPluginWindows",
|
||||
this, &CompositorBridgeParent::HideAllPluginWindows));
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::HideAllPluginWindows() {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
// No plugins in the cache implies no plugins to manage
|
||||
// in this content.
|
||||
if (!mCachedPluginData.Length() || mDeferPluginWindows) {
|
||||
return;
|
||||
}
|
||||
|
||||
uintptr_t parentWidget = GetWidget()->GetWidgetKey();
|
||||
|
||||
mDeferPluginWindows = true;
|
||||
mPluginWindowsHidden = true;
|
||||
|
||||
# if defined(XP_WIN)
|
||||
// We will get an async reply that this has happened and then send hide.
|
||||
mWaitForPluginsUntil = TimeStamp::Now() + mVsyncRate;
|
||||
Unused << SendCaptureAllPlugins(parentWidget);
|
||||
# else
|
||||
Unused << SendHideAllPlugins(parentWidget);
|
||||
ScheduleComposition();
|
||||
# endif
|
||||
}
|
||||
#endif // #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
|
||||
mozilla::ipc::IPCResult CompositorBridgeParent::RecvAllPluginsCaptured() {
|
||||
#if defined(XP_WIN)
|
||||
mWaitForPluginsUntil = TimeStamp();
|
||||
mHaveBlockedForPlugins = false;
|
||||
ForceComposeToTarget(nullptr);
|
||||
Unused << SendHideAllPlugins(GetWidget()->GetWidgetKey());
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"CompositorBridgeParent::RecvAllPluginsCaptured calls unexpected.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t RecordContentFrameTime(
|
||||
const VsyncId& aTxnId, const TimeStamp& aVsyncStart,
|
||||
const TimeStamp& aTxnStart, const VsyncId& aCompositeId,
|
||||
|
|
|
@ -255,14 +255,12 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
|
|||
virtual bool DeallocPCompositorWidgetParent(
|
||||
PCompositorWidgetParent* aActor) = 0;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvRemotePluginsReady() = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvAdoptChild(const LayersId& id) = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvFlushRenderingAsync() = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvForcePresent() = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvNotifyRegionInvalidated(
|
||||
const nsIntRegion& region) = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvRequestNotifyAfterRemotePaint() = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvAllPluginsCaptured() = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvBeginRecording(
|
||||
const TimeStamp& aRecordingStart, BeginRecordingResolver&& aResolve) = 0;
|
||||
virtual mozilla::ipc::IPCResult RecvEndRecordingToDisk(
|
||||
|
@ -386,7 +384,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
return IPC_OK();
|
||||
};
|
||||
|
||||
mozilla::ipc::IPCResult RecvAllPluginsCaptured() override;
|
||||
mozilla::ipc::IPCResult RecvBeginRecording(
|
||||
const TimeStamp& aRecordingStart,
|
||||
BeginRecordingResolver&& aResolve) override;
|
||||
|
@ -564,8 +561,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
ContentCompositorBridgeParent* mContentCompositorBridgeParent;
|
||||
TargetConfig mTargetConfig;
|
||||
LayerTransactionParent* mLayerTree;
|
||||
nsTArray<PluginWindowData> mPluginData;
|
||||
bool mUpdatedPluginDataAvailable;
|
||||
|
||||
CompositorController* GetCompositorController() const;
|
||||
MetricsSharingController* CrossProcessSharingController() const;
|
||||
|
@ -605,32 +600,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
static GeckoContentController* GetGeckoContentControllerForRoot(
|
||||
LayersId aContentLayersId);
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
/**
|
||||
* Calculates and requests the main thread update plugin positioning, clip,
|
||||
* and visibility via ipc.
|
||||
*/
|
||||
bool UpdatePluginWindowState(LayersId aId);
|
||||
|
||||
/**
|
||||
* Plugin visibility helpers for the apz (main thread) and compositor
|
||||
* thread.
|
||||
*/
|
||||
void ScheduleShowAllPluginWindows() override;
|
||||
void ScheduleHideAllPluginWindows() override;
|
||||
void ShowAllPluginWindows();
|
||||
void HideAllPluginWindows();
|
||||
#else
|
||||
void ScheduleShowAllPluginWindows() override {}
|
||||
void ScheduleHideAllPluginWindows() override {}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Main thread response for a plugin visibility request made by the
|
||||
* compositor thread.
|
||||
*/
|
||||
mozilla::ipc::IPCResult RecvRemotePluginsReady() override;
|
||||
|
||||
/**
|
||||
* Used by the profiler to denote when a vsync occured
|
||||
*/
|
||||
|
@ -870,24 +839,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
|
||||
TimeDuration mPaintTime;
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
// cached plugin data used to reduce the number of updates we request.
|
||||
LayersId mLastPluginUpdateLayerTreeId;
|
||||
nsIntPoint mPluginsLayerOffset;
|
||||
nsIntRegion mPluginsLayerVisibleRegion;
|
||||
nsTArray<PluginWindowData> mCachedPluginData;
|
||||
// Time until which we will block composition to wait for plugin updates.
|
||||
TimeStamp mWaitForPluginsUntil;
|
||||
// Indicates that we have actually blocked a composition waiting for plugins.
|
||||
bool mHaveBlockedForPlugins = false;
|
||||
// indicates if plugin window visibility and metric updates are currently
|
||||
// being defered due to a scroll operation.
|
||||
bool mDeferPluginWindows;
|
||||
// indicates if the plugin windows were hidden, and need to be made
|
||||
// visible again even if their geometry has not changed.
|
||||
bool mPluginWindowsHidden;
|
||||
#endif
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(CompositorBridgeParent);
|
||||
};
|
||||
|
||||
|
|
|
@ -349,10 +349,6 @@ void ContentCompositorBridgeParent::ShadowLayersUpdated(
|
|||
}
|
||||
UpdateIndirectTree(id, shadowRoot, aInfo.targetConfig());
|
||||
|
||||
// Cache the plugin data for this remote layer tree
|
||||
state->mPluginData = aInfo.plugins().Clone();
|
||||
state->mUpdatedPluginDataAvailable = true;
|
||||
|
||||
state->mParent->NotifyShadowTreeTransaction(
|
||||
id, aInfo.isFirstPaint(), aInfo.focusTarget(), aInfo.scheduleComposite(),
|
||||
aInfo.paintSequenceNumber(), aInfo.isRepeatTransaction(), aHitTestUpdate);
|
||||
|
|
|
@ -91,7 +91,6 @@ class ContentCompositorBridgeParent final : public CompositorBridgeParentBase {
|
|||
mozilla::ipc::IPCResult RecvCheckContentOnlyTDR(
|
||||
const uint32_t& sequenceNum, bool* isContentOnlyTDR) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvAllPluginsCaptured() override { return IPC_OK(); }
|
||||
|
||||
mozilla::ipc::IPCResult RecvBeginRecording(
|
||||
const TimeStamp& aRecordingStart,
|
||||
|
@ -151,9 +150,6 @@ class ContentCompositorBridgeParent final : public CompositorBridgeParentBase {
|
|||
|
||||
AsyncCompositionManager* GetCompositionManager(
|
||||
LayerTransactionParent* aParent) override;
|
||||
mozilla::ipc::IPCResult RecvRemotePluginsReady() override {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
||||
already_AddRefed<dom::PWebGLParent> AllocPWebGLParent() override;
|
||||
|
||||
|
|
|
@ -133,28 +133,6 @@ child:
|
|||
*/
|
||||
async RemotePaintIsReady();
|
||||
|
||||
/**
|
||||
* Bounce plugin widget configurations over to the main thread for
|
||||
* application on the widgets. Used on Windows and Linux in managing
|
||||
* plugin widgets.
|
||||
*/
|
||||
async UpdatePluginConfigurations(LayoutDeviceIntPoint aContentOffset,
|
||||
LayoutDeviceIntRegion aVisibleRegion,
|
||||
PluginWindowData[] aPlugins);
|
||||
|
||||
/**
|
||||
* Captures an image for all visible child plugins of a given widget for use
|
||||
* during scrolling.
|
||||
* @param aParentWidget parent of widgets to be captured
|
||||
*/
|
||||
async CaptureAllPlugins(uintptr_t aParentWidget);
|
||||
|
||||
/**
|
||||
* Hides all registered plugin widgets associated with a particular chrome
|
||||
* widget.
|
||||
*/
|
||||
async HideAllPlugins(uintptr_t aParentWidget);
|
||||
|
||||
async ParentAsyncMessages(AsyncParentMessageData[] aMessages);
|
||||
|
||||
async ObserveLayersUpdate(LayersId aLayersId, LayersObserverEpoch aEpoch, bool aActive);
|
||||
|
@ -180,11 +158,6 @@ parent:
|
|||
// Must be called before Initialize().
|
||||
async PWebGPU();
|
||||
|
||||
/**
|
||||
* Confirmation callback for UpdatePluginConfigurations and HideAllPlugins.
|
||||
*/
|
||||
async RemotePluginsReady();
|
||||
|
||||
// The child is about to be destroyed, so perform any necessary cleanup.
|
||||
sync WillClose();
|
||||
|
||||
|
@ -261,11 +234,6 @@ parent:
|
|||
*/
|
||||
async RequestNotifyAfterRemotePaint();
|
||||
|
||||
/**
|
||||
* Sent when the child has finished CaptureAllPlugins.
|
||||
*/
|
||||
async AllPluginsCaptured();
|
||||
|
||||
async PTexture(SurfaceDescriptor aSharedData, ReadLockDescriptor aReadLock, LayersBackend aBackend, TextureFlags aTextureFlags, LayersId id, uint64_t aSerial, MaybeExternalImageId aExternalImageId);
|
||||
|
||||
async InitPCanvasParent(Endpoint<PCanvasParent> aEndpoint);
|
||||
|
|
|
@ -120,8 +120,6 @@
|
|||
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsStyleSheetService.h"
|
||||
|
@ -1450,6 +1448,7 @@ void PresShell::Destroy() {
|
|||
// Revoke any pending events. We need to do this and cancel pending reflows
|
||||
// before we destroy the frame manager, since apparently frame destruction
|
||||
// sometimes spins the event queue when plug-ins are involved(!).
|
||||
// XXXmats is this still needed now that plugins are gone?
|
||||
StopObservingRefreshDriver();
|
||||
|
||||
if (rd->GetPresContext() == GetPresContext()) {
|
||||
|
@ -9240,19 +9239,6 @@ void PresShell::WillPaint() {
|
|||
ChangesToFlush(FlushType::InterruptibleLayout, false));
|
||||
}
|
||||
|
||||
void PresShell::WillPaintWindow() {
|
||||
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
|
||||
if (rootPresContext != mPresContext) {
|
||||
// This could be a popup's presshell. We don't allow plugins in popups
|
||||
// so there's nothing to do here.
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
rootPresContext->ApplyPluginGeometryUpdates();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PresShell::DidPaintWindow() {
|
||||
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
|
||||
if (rootPresContext != mPresContext) {
|
||||
|
@ -9328,12 +9314,6 @@ bool PresShell::IsDisplayportSuppressed() {
|
|||
return sDisplayPortSuppressionRespected && mActiveSuppressDisplayport > 0;
|
||||
}
|
||||
|
||||
static void FreezeElement(nsISupports* aSupports) {
|
||||
if (nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(aSupports)) {
|
||||
olc->StopPluginInstance();
|
||||
}
|
||||
}
|
||||
|
||||
static CallState FreezeSubDocument(Document& aDocument) {
|
||||
if (PresShell* presShell = aDocument.GetPresShell()) {
|
||||
presShell->Freeze();
|
||||
|
@ -9346,8 +9326,6 @@ void PresShell::Freeze() {
|
|||
|
||||
MaybeReleaseCapturingContent();
|
||||
|
||||
mDocument->EnumerateActivityObservers(FreezeElement);
|
||||
|
||||
if (mCaret) {
|
||||
SetCaretEnabled(false);
|
||||
}
|
||||
|
@ -9404,12 +9382,6 @@ void PresShell::Thaw() {
|
|||
presContext->RefreshDriver()->Thaw();
|
||||
}
|
||||
|
||||
mDocument->EnumerateActivityObservers([](nsISupports* aSupports) {
|
||||
if (nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(aSupports)) {
|
||||
olc->AsyncStartPluginInstance();
|
||||
}
|
||||
});
|
||||
|
||||
if (mDocument) {
|
||||
mDocument->EnumerateSubDocuments([](Document& aSubDoc) {
|
||||
if (PresShell* presShell = aSubDoc.GetPresShell()) {
|
||||
|
@ -10904,17 +10876,6 @@ void PresShell::QueryIsActive() {
|
|||
}
|
||||
}
|
||||
|
||||
static void SetPluginIsActive(nsISupports* aSupports, bool aIsActive) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aSupports));
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsIObjectFrame* objectFrame = do_QueryFrame(content->GetPrimaryFrame())) {
|
||||
objectFrame->SetIsDocumentActive(aIsActive);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult PresShell::SetIsActive(bool aIsActive) {
|
||||
MOZ_ASSERT(mDocument, "should only be called with a document");
|
||||
|
||||
|
@ -10940,12 +10901,6 @@ nsresult PresShell::SetIsActive(bool aIsActive) {
|
|||
};
|
||||
mDocument->EnumerateExternalResources(recurse);
|
||||
}
|
||||
{
|
||||
auto visitPlugin = [aIsActive](nsISupports* aSupports) {
|
||||
SetPluginIsActive(aSupports, aIsActive);
|
||||
};
|
||||
mDocument->EnumerateActivityObservers(visitPlugin);
|
||||
}
|
||||
nsresult rv = UpdateImageLockingState();
|
||||
#ifdef ACCESSIBILITY
|
||||
if (aIsActive) {
|
||||
|
|
|
@ -738,7 +738,7 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Stop all active elements (plugins and the caret) in this presentation and
|
||||
* Stop all refresh drivers and carets in this presentation and
|
||||
* in the presentations of subdocuments. Resets painting to a suppressed
|
||||
* state.
|
||||
* XXX this should include image animations
|
||||
|
@ -747,7 +747,7 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
bool IsFrozen() { return mFrozen; }
|
||||
|
||||
/**
|
||||
* Restarts active elements (plugins) in this presentation and in the
|
||||
* Restarts refresh drivers in this presentation and in the
|
||||
* presentations of subdocuments, then do a full invalidate of the content
|
||||
* area.
|
||||
*/
|
||||
|
@ -997,12 +997,6 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
nsresult HandleEvent(nsIFrame* aFrame, WidgetGUIEvent* aEvent,
|
||||
bool aDontRetargetEvents, nsEventStatus* aEventStatus);
|
||||
bool ShouldIgnoreInvalidation();
|
||||
/**
|
||||
* Notify that we're going to call Paint with PaintFlags::PaintComposite.
|
||||
* Fires on the presshell for the painted widget.
|
||||
* This is issued at a time when it's safe to modify widget geometry.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT void WillPaintWindow();
|
||||
/**
|
||||
* Notify that we called Paint with PaintFlags::PaintComposite.
|
||||
* Fires on the presshell for the painted widget.
|
||||
|
|
|
@ -3518,12 +3518,11 @@ nsCSSFrameConstructor::FindObjectData(const Element& aElement,
|
|||
static const FrameConstructionDataByInt sObjectData[] = {
|
||||
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_LOADING,
|
||||
NS_NewEmptyFrame),
|
||||
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_PLUGIN,
|
||||
NS_NewObjectFrame),
|
||||
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_IMAGE, NS_NewImageFrame),
|
||||
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_DOCUMENT,
|
||||
NS_NewSubDocumentFrame),
|
||||
// Fake plugin handlers load as documents
|
||||
// XXXmats is TYPE_FAKE_PLUGIN something we need?
|
||||
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_FAKE_PLUGIN,
|
||||
NS_NewSubDocumentFrame)
|
||||
// Nothing for TYPE_NULL so we'll construct frames by display there
|
||||
|
|
|
@ -2537,7 +2537,7 @@ nsRect nsLayoutUtils::TransformFrameRectToAncestor(
|
|||
static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget,
|
||||
nsIWidget*& aRootWidget) {
|
||||
LayoutDeviceIntPoint offset(0, 0);
|
||||
while ((aWidget->WindowType() == eWindowType_child || aWidget->IsPlugin())) {
|
||||
while (aWidget->WindowType() == eWindowType_child) {
|
||||
nsIWidget* parent = aWidget->GetParent();
|
||||
if (!parent) {
|
||||
break;
|
||||
|
@ -3082,10 +3082,6 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
|
|||
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
PresShell* presShell = presContext->PresShell();
|
||||
nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
|
||||
if (!rootPresContext) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TimeStamp startBuildDisplayList = TimeStamp::Now();
|
||||
|
||||
|
@ -3198,18 +3194,6 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
|
|||
visibleRegion = aDirtyRegion;
|
||||
}
|
||||
|
||||
// If the root has embedded plugins, flag the builder so we know we'll need
|
||||
// to update plugin geometry after painting.
|
||||
if ((aFlags & PaintFrameFlags::WidgetLayers) &&
|
||||
!(aFlags & PaintFrameFlags::DocumentRelative) &&
|
||||
rootPresContext->NeedToComputePluginGeometryUpdates()) {
|
||||
builder->SetWillComputePluginGeometry(true);
|
||||
|
||||
// Disable partial updates for this paint as the list we're about to
|
||||
// build has plugin-specific differences that won't trigger invalidations.
|
||||
builder->SetDisablePartialUpdates(true);
|
||||
}
|
||||
|
||||
nsRect canvasArea(nsPoint(0, 0), aFrame->GetSize());
|
||||
bool ignoreViewportScrolling =
|
||||
!aFrame->GetParent() && presShell->IgnoringViewportScrolling();
|
||||
|
@ -3457,8 +3441,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
|
|||
}
|
||||
|
||||
// Update the widget's opaque region information. This sets
|
||||
// glass boundaries on Windows. Also set up the window dragging region
|
||||
// and plugin clip regions and bounds.
|
||||
// glass boundaries on Windows. Also set up the window dragging region.
|
||||
if ((aFlags & PaintFrameFlags::WidgetLayers) &&
|
||||
!(aFlags & PaintFrameFlags::DocumentRelative)) {
|
||||
nsIWidget* widget = aFrame->GetNearestWidget();
|
||||
|
@ -3473,35 +3456,6 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (builder->WillComputePluginGeometry()) {
|
||||
// For single process compute and apply plugin geometry updates to plugin
|
||||
// windows, then request composition. For content processes skip eveything
|
||||
// except requesting composition. Geometry updates were calculated and
|
||||
// shipped to the chrome process in nsDisplayList when the layer
|
||||
// transaction completed.
|
||||
if (XRE_IsParentProcess()) {
|
||||
rootPresContext->ComputePluginGeometryUpdates(aFrame, builder, list);
|
||||
// We're not going to get a WillPaintWindow event here if we didn't do
|
||||
// widget invalidation, so just apply the plugin geometry update here
|
||||
// instead. We could instead have the compositor send back an equivalent
|
||||
// to WillPaintWindow, but it should be close enough to now not to matter.
|
||||
if (layerManager && !layerManager->NeedsWidgetInvalidation()) {
|
||||
rootPresContext->ApplyPluginGeometryUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
// We told the compositor thread not to composite when it received the
|
||||
// transaction because we wanted to update plugins first. Schedule the
|
||||
// composite now.
|
||||
if (layerManager) {
|
||||
layerManager->ScheduleComposite();
|
||||
}
|
||||
|
||||
// Disable partial updates for the following paint as well, as we now have
|
||||
// a plugin-specific display list.
|
||||
builder->SetDisablePartialUpdates(true);
|
||||
}
|
||||
|
||||
// Apply effects updates if we were actually painting
|
||||
if (isForPainting) {
|
||||
ApplyEffectsUpdates(builder->GetEffectUpdates());
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "prenv.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsTransitionManager.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "CounterStyleManager.h"
|
||||
|
@ -819,14 +818,6 @@ void nsPresContext::DetachPresShell() {
|
|||
mRefreshDriver->Disconnect();
|
||||
// Can't null out the refresh driver here.
|
||||
}
|
||||
|
||||
if (IsRoot()) {
|
||||
nsRootPresContext* thisRoot = static_cast<nsRootPresContext*>(this);
|
||||
|
||||
// Have to cancel our plugin geometry timer, because the
|
||||
// callback for that depends on a non-null presshell.
|
||||
thisRoot->CancelApplyPluginGeometryTimer();
|
||||
}
|
||||
}
|
||||
|
||||
void nsPresContext::DocumentCharSetChanged(NotNull<const Encoding*> aCharSet) {
|
||||
|
@ -2689,244 +2680,6 @@ nsRootPresContext::nsRootPresContext(dom::Document* aDocument,
|
|||
nsPresContextType aType)
|
||||
: nsPresContext(aDocument, aType) {}
|
||||
|
||||
nsRootPresContext::~nsRootPresContext() {
|
||||
NS_ASSERTION(mRegisteredPlugins.Count() == 0,
|
||||
"All plugins should have been unregistered");
|
||||
CancelApplyPluginGeometryTimer();
|
||||
}
|
||||
|
||||
void nsRootPresContext::RegisterPluginForGeometryUpdates(nsIContent* aPlugin) {
|
||||
mRegisteredPlugins.PutEntry(aPlugin);
|
||||
}
|
||||
|
||||
void nsRootPresContext::UnregisterPluginForGeometryUpdates(
|
||||
nsIContent* aPlugin) {
|
||||
mRegisteredPlugins.RemoveEntry(aPlugin);
|
||||
}
|
||||
|
||||
void nsRootPresContext::ComputePluginGeometryUpdates(
|
||||
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsDisplayList* aList) {
|
||||
if (mRegisteredPlugins.Count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Initially make the next state for each plugin descendant of aFrame be
|
||||
// "hidden". Plugins that are visible will have their next state set to
|
||||
// unhidden by nsDisplayPlugin::ComputeVisibility.
|
||||
for (auto iter = mRegisteredPlugins.Iter(); !iter.Done(); iter.Next()) {
|
||||
auto f =
|
||||
static_cast<nsPluginFrame*>(iter.Get()->GetKey()->GetPrimaryFrame());
|
||||
if (!f) {
|
||||
NS_WARNING("Null frame in ComputePluginGeometryUpdates");
|
||||
continue;
|
||||
}
|
||||
if (!nsLayoutUtils::IsAncestorFrameCrossDoc(aFrame, f)) {
|
||||
// f is not managed by this frame so we should ignore it.
|
||||
continue;
|
||||
}
|
||||
f->SetEmptyWidgetConfiguration();
|
||||
}
|
||||
|
||||
if (aBuilder) {
|
||||
MOZ_ASSERT(aList);
|
||||
nsIFrame* rootFrame = mPresShell->GetRootFrame();
|
||||
|
||||
if (rootFrame && aBuilder->ContainsPluginItem()) {
|
||||
aBuilder->SetForPluginGeometry(true);
|
||||
// Merging and flattening has already been done and we should not do it
|
||||
// again. nsDisplayScroll(Info)Layer doesn't support trying to flatten
|
||||
// again.
|
||||
aBuilder->SetAllowMergingAndFlattening(false);
|
||||
nsRegion region = rootFrame->InkOverflowRectRelativeToSelf();
|
||||
// nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden
|
||||
// widget configuration for the plugin, if it's visible.
|
||||
aList->ComputeVisibilityForRoot(aBuilder, ®ion);
|
||||
aBuilder->SetForPluginGeometry(false);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// We control painting of Mac plugins, so just apply geometry updates now.
|
||||
// This is not happening during a paint event.
|
||||
ApplyPluginGeometryUpdates();
|
||||
#else
|
||||
if (XRE_IsParentProcess()) {
|
||||
InitApplyPluginGeometryTimer();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ApplyPluginGeometryUpdatesCallback(nsITimer* aTimer,
|
||||
void* aClosure) {
|
||||
static_cast<nsRootPresContext*>(aClosure)->ApplyPluginGeometryUpdates();
|
||||
}
|
||||
|
||||
void nsRootPresContext::InitApplyPluginGeometryTimer() {
|
||||
if (mApplyPluginGeometryTimer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We'll apply the plugin geometry updates during the next compositing paint
|
||||
// in this presContext (either from PresShell::WillPaintWindow() or from
|
||||
// PresShell::DidPaintWindow(), depending on the platform). But paints might
|
||||
// get optimized away if the old plugin geometry covers the invalid region,
|
||||
// so set a backup timer to do this too. We want to make sure this
|
||||
// won't fire before our normal paint notifications, if those would
|
||||
// update the geometry, so set it for double the refresh driver interval.
|
||||
mApplyPluginGeometryTimer = CreateTimer(
|
||||
ApplyPluginGeometryUpdatesCallback, "ApplyPluginGeometryUpdatesCallback",
|
||||
nsRefreshDriver::DefaultInterval() * 2);
|
||||
}
|
||||
|
||||
void nsRootPresContext::CancelApplyPluginGeometryTimer() {
|
||||
if (mApplyPluginGeometryTimer) {
|
||||
mApplyPluginGeometryTimer->Cancel();
|
||||
mApplyPluginGeometryTimer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
|
||||
static bool HasOverlap(const LayoutDeviceIntPoint& aOffset1,
|
||||
const nsTArray<LayoutDeviceIntRect>& aClipRects1,
|
||||
const LayoutDeviceIntPoint& aOffset2,
|
||||
const nsTArray<LayoutDeviceIntRect>& aClipRects2) {
|
||||
LayoutDeviceIntPoint offsetDelta = aOffset1 - aOffset2;
|
||||
for (uint32_t i = 0; i < aClipRects1.Length(); ++i) {
|
||||
for (uint32_t j = 0; j < aClipRects2.Length(); ++j) {
|
||||
if ((aClipRects1[i] + offsetDelta).Intersects(aClipRects2[j])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of plugin windows to move to new locations, sort the list
|
||||
* so that for each window move, the window moves to a location that
|
||||
* does not intersect other windows. This minimizes flicker and repainting.
|
||||
* It's not always possible to do this perfectly, since in general
|
||||
* we might have cycles. But we do our best.
|
||||
* We need to take into account that windows are clipped to particular
|
||||
* regions and the clip regions change as the windows are moved.
|
||||
*/
|
||||
static void SortConfigurations(
|
||||
nsTArray<nsIWidget::Configuration>* aConfigurations) {
|
||||
if (aConfigurations->Length() > 10) {
|
||||
// Give up, we don't want to get bogged down here
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsIWidget::Configuration> pluginsToMove =
|
||||
std::move(*aConfigurations);
|
||||
|
||||
// Our algorithm is quite naive. At each step we try to identify
|
||||
// a window that can be moved to its new location that won't overlap
|
||||
// any other windows at the new location. If there is no such
|
||||
// window, we just move the last window in the list anyway.
|
||||
while (!pluginsToMove.IsEmpty()) {
|
||||
// Find a window whose destination does not overlap any other window
|
||||
uint32_t i;
|
||||
for (i = 0; i + 1 < pluginsToMove.Length(); ++i) {
|
||||
nsIWidget::Configuration* config = &pluginsToMove[i];
|
||||
bool foundOverlap = false;
|
||||
for (uint32_t j = 0; j < pluginsToMove.Length(); ++j) {
|
||||
if (i == j) continue;
|
||||
LayoutDeviceIntRect bounds = pluginsToMove[j].mChild->GetBounds();
|
||||
AutoTArray<LayoutDeviceIntRect, 1> clipRects;
|
||||
pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects);
|
||||
if (HasOverlap(bounds.TopLeft(), clipRects, config->mBounds.TopLeft(),
|
||||
config->mClipRegion)) {
|
||||
foundOverlap = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundOverlap) break;
|
||||
}
|
||||
// Note that we always move the last plugin in pluginsToMove, if we
|
||||
// can't find any other plugin to move
|
||||
aConfigurations->AppendElement(pluginsToMove[i]);
|
||||
pluginsToMove.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
static void PluginGetGeometryUpdate(
|
||||
nsTHashtable<nsRefPtrHashKey<nsIContent>>& aPlugins,
|
||||
nsTArray<nsIWidget::Configuration>* aConfigurations) {
|
||||
for (auto iter = aPlugins.Iter(); !iter.Done(); iter.Next()) {
|
||||
auto f =
|
||||
static_cast<nsPluginFrame*>(iter.Get()->GetKey()->GetPrimaryFrame());
|
||||
if (!f) {
|
||||
NS_WARNING("Null frame in PluginGeometryUpdate");
|
||||
continue;
|
||||
}
|
||||
f->GetWidgetConfiguration(aConfigurations);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // #ifndef XP_MACOSX
|
||||
|
||||
static void PluginDidSetGeometry(
|
||||
nsTHashtable<nsRefPtrHashKey<nsIContent>>& aPlugins) {
|
||||
for (auto iter = aPlugins.Iter(); !iter.Done(); iter.Next()) {
|
||||
auto f =
|
||||
static_cast<nsPluginFrame*>(iter.Get()->GetKey()->GetPrimaryFrame());
|
||||
if (!f) {
|
||||
NS_WARNING("Null frame in PluginDidSetGeometry");
|
||||
continue;
|
||||
}
|
||||
f->DidSetWidgetGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
void nsRootPresContext::ApplyPluginGeometryUpdates() {
|
||||
#ifndef XP_MACOSX
|
||||
CancelApplyPluginGeometryTimer();
|
||||
|
||||
nsTArray<nsIWidget::Configuration> configurations;
|
||||
PluginGetGeometryUpdate(mRegisteredPlugins, &configurations);
|
||||
// Walk mRegisteredPlugins and ask each plugin for its configuration
|
||||
if (!configurations.IsEmpty()) {
|
||||
nsIWidget* widget = configurations[0].mChild->GetParent();
|
||||
NS_ASSERTION(widget, "Plugins must have a parent window");
|
||||
SortConfigurations(&configurations);
|
||||
widget->ConfigureChildren(configurations);
|
||||
}
|
||||
#endif // #ifndef XP_MACOSX
|
||||
|
||||
PluginDidSetGeometry(mRegisteredPlugins);
|
||||
}
|
||||
|
||||
void nsRootPresContext::CollectPluginGeometryUpdates(
|
||||
LayerManager* aLayerManager) {
|
||||
#ifndef XP_MACOSX
|
||||
// Collect and pass plugin widget configurations down to the compositor
|
||||
// for transmission to the chrome process.
|
||||
NS_ASSERTION(aLayerManager, "layer manager is invalid!");
|
||||
mozilla::layers::ClientLayerManager* clm =
|
||||
aLayerManager->AsClientLayerManager();
|
||||
|
||||
nsTArray<nsIWidget::Configuration> configurations;
|
||||
// If there aren't any plugins to configure, clear the plugin data cache
|
||||
// in the layer system.
|
||||
if (!mRegisteredPlugins.Count() && clm) {
|
||||
clm->StorePluginWidgetConfigurations(configurations);
|
||||
return;
|
||||
}
|
||||
PluginGetGeometryUpdate(mRegisteredPlugins, &configurations);
|
||||
if (configurations.IsEmpty()) {
|
||||
PluginDidSetGeometry(mRegisteredPlugins);
|
||||
return;
|
||||
}
|
||||
SortConfigurations(&configurations);
|
||||
if (clm) {
|
||||
clm->StorePluginWidgetConfigurations(configurations);
|
||||
}
|
||||
PluginDidSetGeometry(mRegisteredPlugins);
|
||||
#endif // #ifndef XP_MACOSX
|
||||
}
|
||||
|
||||
void nsRootPresContext::AddWillPaintObserver(nsIRunnable* aRunnable) {
|
||||
if (!mWillPaintFallbackEvent.IsPending()) {
|
||||
mWillPaintFallbackEvent = new RunWillPaintObservers(this);
|
||||
|
@ -2953,7 +2706,6 @@ size_t nsRootPresContext::SizeOfExcludingThis(
|
|||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mRegisteredPlugins
|
||||
// - mWillPaintObservers
|
||||
// - mWillPaintFallbackEvent
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ class nsCSSFontFeatureValuesRule;
|
|||
class nsCSSFrameConstructor;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsPluginFrame;
|
||||
class nsTransitionManager;
|
||||
class nsAnimationManager;
|
||||
class nsRefreshDriver;
|
||||
|
@ -1368,54 +1367,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
|||
class nsRootPresContext final : public nsPresContext {
|
||||
public:
|
||||
nsRootPresContext(mozilla::dom::Document* aDocument, nsPresContextType aType);
|
||||
virtual ~nsRootPresContext();
|
||||
|
||||
/**
|
||||
* Registers a plugin to receive geometry updates (position and clip
|
||||
* region) so it can update its widget.
|
||||
* Callers must call UnregisterPluginForGeometryUpdates before
|
||||
* the aPlugin frame is destroyed.
|
||||
*/
|
||||
void RegisterPluginForGeometryUpdates(nsIContent* aPlugin);
|
||||
/**
|
||||
* Stops a plugin receiving geometry updates (position and clip
|
||||
* region). If the plugin was not already registered, this does
|
||||
* nothing.
|
||||
*/
|
||||
void UnregisterPluginForGeometryUpdates(nsIContent* aPlugin);
|
||||
|
||||
bool NeedToComputePluginGeometryUpdates() {
|
||||
return mRegisteredPlugins.Count() > 0;
|
||||
}
|
||||
/**
|
||||
* Compute geometry updates for each plugin given that aList is the display
|
||||
* list for aFrame. The updates are not yet applied;
|
||||
* ApplyPluginGeometryUpdates is responsible for that. In the meantime they
|
||||
* are stored on each nsPluginFrame.
|
||||
* This needs to be called even when aFrame is a popup, since although
|
||||
* windowed plugins aren't allowed in popups, windowless plugins are
|
||||
* and ComputePluginGeometryUpdates needs to be called for them.
|
||||
* aBuilder and aList can be null. This indicates that all plugins are
|
||||
* hidden because we're in a background tab.
|
||||
*/
|
||||
void ComputePluginGeometryUpdates(nsIFrame* aFrame,
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayList* aList);
|
||||
|
||||
/**
|
||||
* Apply the stored plugin geometry updates. This should normally be called
|
||||
* in DidPaint so the plugins are moved/clipped immediately after we've
|
||||
* updated our window, so they look in sync with our window.
|
||||
*/
|
||||
void ApplyPluginGeometryUpdates();
|
||||
|
||||
/**
|
||||
* Transfer stored plugin geometry updates to the compositor. Called during
|
||||
* reflow, data is shipped over with layer updates. e10s specific.
|
||||
*/
|
||||
void CollectPluginGeometryUpdates(
|
||||
mozilla::layers::LayerManager* aLayerManager);
|
||||
|
||||
virtual bool IsRoot() override { return true; }
|
||||
|
||||
/**
|
||||
|
@ -1434,15 +1385,6 @@ class nsRootPresContext final : public nsPresContext {
|
|||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Start a timer to ensure we eventually run ApplyPluginGeometryUpdates.
|
||||
*/
|
||||
void InitApplyPluginGeometryTimer();
|
||||
/**
|
||||
* Cancel the timer that ensures we eventually run ApplyPluginGeometryUpdates.
|
||||
*/
|
||||
void CancelApplyPluginGeometryTimer();
|
||||
|
||||
class RunWillPaintObservers : public mozilla::Runnable {
|
||||
public:
|
||||
explicit RunWillPaintObservers(nsRootPresContext* aPresContext)
|
||||
|
@ -1461,8 +1403,6 @@ class nsRootPresContext final : public nsPresContext {
|
|||
|
||||
friend class nsPresContext;
|
||||
|
||||
nsCOMPtr<nsITimer> mApplyPluginGeometryTimer;
|
||||
nsTHashtable<nsRefPtrHashKey<nsIContent>> mRegisteredPlugins;
|
||||
nsTArray<nsCOMPtr<nsIRunnable>> mWillPaintObservers;
|
||||
nsRevocableEventPtr<RunWillPaintObservers> mWillPaintFallbackEvent;
|
||||
};
|
||||
|
|
|
@ -70,14 +70,6 @@ class nsIDocumentLoaderFactory;
|
|||
|
||||
#define PRODUCT_NAME "Gecko"
|
||||
|
||||
/* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
|
||||
#define NS_PLUGINDOCLOADERFACTORY_CID \
|
||||
{ \
|
||||
0x0ddf4df8, 0x4dbb, 0x4133, { \
|
||||
0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 \
|
||||
} \
|
||||
}
|
||||
|
||||
#include "inDeepTreeWalker.h"
|
||||
|
||||
static void Shutdown();
|
||||
|
|
|
@ -73,7 +73,6 @@ FRAME_CLASSES = [
|
|||
Frame("nsMenuPopupFrame", "MenuPopup", DYNAMIC_LEAF),
|
||||
Frame("nsMeterFrame", "Meter", LEAF),
|
||||
Frame("nsNumberControlFrame", "TextInput", LEAF),
|
||||
Frame("nsPluginFrame", "Object", LEAF),
|
||||
Frame("nsPageBreakFrame", "PageBreak", LEAF),
|
||||
Frame("nsPageContentFrame", "PageContent", NOT_LEAF),
|
||||
Frame("nsPageFrame", "Page", NOT_LEAF),
|
||||
|
@ -163,7 +162,6 @@ FRAME_CLASSES = [
|
|||
AbstractFrame("nsIListControlFrame"),
|
||||
AbstractFrame("nsIMathMLFrame"),
|
||||
AbstractFrame("nsIMenuFrame"),
|
||||
AbstractFrame("nsIObjectFrame"),
|
||||
AbstractFrame("nsIPercentBSizeObserver"),
|
||||
AbstractFrame("nsIPopupContainer"),
|
||||
AbstractFrame("nsIScrollableFrame"),
|
||||
|
|
|
@ -88,9 +88,6 @@ with Files("*Scroll*"):
|
|||
with Files("nsFont*"):
|
||||
BUG_COMPONENT = ("Core", "Layout: Text and Fonts")
|
||||
|
||||
with Files("nsPluginFrame.*"):
|
||||
BUG_COMPONENT = ("Core", "Plug-ins")
|
||||
|
||||
with Files("nsVideoFrame.*"):
|
||||
BUG_COMPONENT = ("Core", "Audio/Video")
|
||||
|
||||
|
@ -109,14 +106,12 @@ EXPORTS += [
|
|||
"nsIFrame.h",
|
||||
"nsIFrameInlines.h",
|
||||
"nsILineIterator.h",
|
||||
"nsIObjectFrame.h",
|
||||
"nsIScrollableFrame.h",
|
||||
"nsIScrollPositionListener.h",
|
||||
"nsIStatefulFrame.h",
|
||||
"nsLineBox.h",
|
||||
"nsPageSequenceFrame.h",
|
||||
"nsPlaceholderFrame.h",
|
||||
"nsPluginFrame.h",
|
||||
"nsQueryFrame.h",
|
||||
"nsRubyBaseContainerFrame.h",
|
||||
"nsRubyBaseFrame.h",
|
||||
|
@ -234,11 +229,6 @@ UNIFIED_SOURCES += [
|
|||
"WBRFrame.cpp",
|
||||
]
|
||||
|
||||
# nsPluginFrame.cpp needs to be built separately because of name clashes in the OS X headers.
|
||||
SOURCES += [
|
||||
"nsPluginFrame.cpp",
|
||||
]
|
||||
|
||||
GeneratedFile(
|
||||
"FrameIdList.h",
|
||||
script="GenerateFrameLists.py",
|
||||
|
@ -257,7 +247,6 @@ include("/ipc/chromium/chromium-config.mozbuild")
|
|||
FINAL_LIBRARY = "xul"
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
"../../dom/plugins/base",
|
||||
"../base",
|
||||
"../forms",
|
||||
"../painting",
|
||||
|
|
|
@ -77,7 +77,6 @@
|
|||
#include "ScrollAnimationMSDPhysics.h"
|
||||
#include "ScrollSnap.h"
|
||||
#include "UnitTransforms.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsSliderFrame.h"
|
||||
#include "ViewportFrame.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
|
@ -772,10 +771,10 @@ void nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput* aState,
|
|||
LogicalPoint(wm), dummyContainerSize,
|
||||
ReflowChildFlags::NoMoveFrame | ReflowChildFlags::NoSizeView);
|
||||
|
||||
// XXX Some frames (e.g., nsPluginFrame, nsFrameFrame, nsTextFrame) don't
|
||||
// XXX Some frames (e.g. nsFrameFrame, nsTextFrame) don't
|
||||
// bother setting their mOverflowArea. This is wrong because every frame
|
||||
// should always set mOverflowArea. In fact nsPluginFrame and nsFrameFrame
|
||||
// don't support the 'outline' property because of this. Rather than fix the
|
||||
// should always set mOverflowArea. In fact nsFrameFrame doesn't
|
||||
// support the 'outline' property because of this. Rather than fix the
|
||||
// world right now, just fix up the overflow area if necessary. Note that we
|
||||
// don't check HasOverflowRect() because it could be set even though the
|
||||
// overflow area doesn't include the frame bounds.
|
||||
|
@ -2335,20 +2334,6 @@ void ScrollFrameHelper::CompleteAsyncScroll(const nsRect& aRange,
|
|||
PostScrollEndEvent();
|
||||
}
|
||||
|
||||
bool ScrollFrameHelper::HasPluginFrames() {
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (XRE_IsContentProcess()) {
|
||||
nsPresContext* presContext = mOuter->PresContext();
|
||||
nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
|
||||
if (!rootPresContext ||
|
||||
rootPresContext->NeedToComputePluginGeometryUpdates()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScrollFrameHelper::HasBgAttachmentLocal() const {
|
||||
const nsStyleBackground* bg = mOuter->StyleBackground();
|
||||
return bg->HasLocalBackground();
|
||||
|
@ -3041,12 +3026,12 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
|
|||
displayPort.MoveBy(-mScrolledFrame->GetPosition());
|
||||
|
||||
PAINT_SKIP_LOG(
|
||||
"New scrollpos %s usingDP %d dpEqual %d scrollableByApz %d plugins"
|
||||
"New scrollpos %s usingDP %d dpEqual %d scrollableByApz "
|
||||
"%d perspective %d bglocal %d filter %d\n",
|
||||
ToString(CSSPoint::FromAppUnits(GetScrollPosition())).c_str(),
|
||||
usingDisplayPort, displayPort.IsEqualEdges(oldDisplayPort),
|
||||
mScrollableByAPZ, HasPluginFrames(), HasPerspective(),
|
||||
HasBgAttachmentLocal(), mHasOutOfFlowContentInsideFilter);
|
||||
mScrollableByAPZ, HasPerspective(), HasBgAttachmentLocal(),
|
||||
mHasOutOfFlowContentInsideFilter);
|
||||
if (usingDisplayPort && displayPort.IsEqualEdges(oldDisplayPort) &&
|
||||
!HasPerspective() && !HasBgAttachmentLocal() &&
|
||||
!mHasOutOfFlowContentInsideFilter) {
|
||||
|
@ -3054,7 +3039,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
|
|||
content->GetComposedDoc()->HasScrollLinkedEffect();
|
||||
bool apzDisabled = haveScrollLinkedEffects &&
|
||||
StaticPrefs::apz_disable_for_scroll_linked_effects();
|
||||
if (!apzDisabled && !HasPluginFrames()) {
|
||||
if (!apzDisabled) {
|
||||
if (LastScrollOrigin() == ScrollOrigin::Apz) {
|
||||
schedulePaint = false;
|
||||
PAINT_SKIP_LOG("Skipping due to APZ scroll\n");
|
||||
|
|
|
@ -769,7 +769,6 @@ class ScrollFrameHelper : public nsIReflowCallback {
|
|||
void CompleteAsyncScroll(const nsRect& aRange,
|
||||
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified);
|
||||
|
||||
bool HasPluginFrames();
|
||||
bool HasPerspective() const { return mOuter->ChildrenHavePerspective(); }
|
||||
bool HasBgAttachmentLocal() const;
|
||||
mozilla::StyleDirection GetScrolledFrameDir() const;
|
||||
|
|
|
@ -85,8 +85,6 @@ nsIFrame* NS_NewImageFrame(mozilla::PresShell* aPresShell,
|
|||
class nsInlineFrame;
|
||||
nsInlineFrame* NS_NewInlineFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
nsIFrame* NS_NewObjectFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
nsIFrame* NS_NewTextFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
nsIFrame* NS_NewContinuingTextFrame(mozilla::PresShell* aPresShell,
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsFlexContainerFrame.h"
|
||||
#include "nsFrameList.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentInlines.h"
|
||||
|
@ -3113,19 +3112,17 @@ void nsIFrame::BuildDisplayListForStackingContext(
|
|||
EffectSet* effectSetForOpacity = EffectSet::GetEffectSetForFrame(
|
||||
this, nsCSSPropertyIDSet::OpacityProperties());
|
||||
// We can stop right away if this is a zero-opacity stacking context and
|
||||
// we're painting, and we're not animating opacity. Don't do this
|
||||
// if we're going to compute plugin geometry, since opacity-0 plugins
|
||||
// need to have display items built for them.
|
||||
// we're painting, and we're not animating opacity.
|
||||
bool needHitTestInfo =
|
||||
aBuilder->BuildCompositorHitTestInfo() &&
|
||||
StyleUI()->GetEffectivePointerEvents(this) != StylePointerEvents::None;
|
||||
bool opacityItemForEventsAndPluginsOnly = false;
|
||||
bool opacityItemForEventsOnly = false;
|
||||
if (effects->mOpacity == 0.0 && aBuilder->IsForPainting() &&
|
||||
!(disp->mWillChange.bits & StyleWillChangeBits::OPACITY) &&
|
||||
!nsLayoutUtils::HasAnimationOfPropertySet(
|
||||
this, nsCSSPropertyIDSet::OpacityProperties(), effectSetForOpacity)) {
|
||||
if (needHitTestInfo || aBuilder->WillComputePluginGeometry()) {
|
||||
opacityItemForEventsAndPluginsOnly = true;
|
||||
if (needHitTestInfo) {
|
||||
opacityItemForEventsOnly = true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
@ -3404,8 +3401,8 @@ void nsIFrame::BuildDisplayListForStackingContext(
|
|||
inTransform);
|
||||
nsDisplayListBuilder::AutoEnterFilter filterASRSetter(aBuilder,
|
||||
usingFilter);
|
||||
nsDisplayListBuilder::AutoInEventsAndPluginsOnly inEventsAndPluginsSetter(
|
||||
aBuilder, opacityItemForEventsAndPluginsOnly);
|
||||
nsDisplayListBuilder::AutoInEventsOnly inEventsSetter(
|
||||
aBuilder, opacityItemForEventsOnly);
|
||||
|
||||
CheckForApzAwareEventHandlers(aBuilder, this);
|
||||
|
||||
|
@ -3632,8 +3629,8 @@ void nsIFrame::BuildDisplayListForStackingContext(
|
|||
nsDisplayOpacity::NeedsActiveLayer(aBuilder, this);
|
||||
|
||||
resultList.AppendNewToTop<nsDisplayOpacity>(
|
||||
aBuilder, this, &resultList, containerItemASR,
|
||||
opacityItemForEventsAndPluginsOnly, needsActiveOpacityLayer);
|
||||
aBuilder, this, &resultList, containerItemASR, opacityItemForEventsOnly,
|
||||
needsActiveOpacityLayer);
|
||||
ct.TrackContainer(resultList.GetTop());
|
||||
}
|
||||
|
||||
|
@ -6743,7 +6740,6 @@ void nsIFrame::SetView(nsView* aView) {
|
|||
LayoutFrameType frameType = Type();
|
||||
NS_ASSERTION(frameType == LayoutFrameType::SubDocument ||
|
||||
frameType == LayoutFrameType::ListControl ||
|
||||
frameType == LayoutFrameType::Object ||
|
||||
frameType == LayoutFrameType::Viewport ||
|
||||
frameType == LayoutFrameType::MenuPopup,
|
||||
"Only specific frame types can have an nsView");
|
||||
|
@ -7415,17 +7411,12 @@ Layer* nsIFrame::InvalidateLayer(DisplayItemType aDisplayItemKey,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// Plugins can transition from not rendering anything to rendering,
|
||||
// and still only call this. So always invalidate, with specifying
|
||||
// the display item type just in case.
|
||||
//
|
||||
// In the bug 930056, dialer app startup but not shown on the
|
||||
// screen because sometimes we don't have any retainned data
|
||||
// for remote type displayitem and thus Repaint event is not
|
||||
// triggered. So, always invalidate here as well.
|
||||
// triggered. So, always invalidate in this case.
|
||||
DisplayItemType displayItemKey = aDisplayItemKey;
|
||||
if (aDisplayItemKey == DisplayItemType::TYPE_PLUGIN ||
|
||||
aDisplayItemKey == DisplayItemType::TYPE_REMOTE) {
|
||||
if (aDisplayItemKey == DisplayItemType::TYPE_REMOTE) {
|
||||
displayItemKey = DisplayItemType::TYPE_ZERO;
|
||||
}
|
||||
|
||||
|
@ -11271,13 +11262,6 @@ CompositorHitTestInfo nsIFrame::GetCompositorHitTestInfo(
|
|||
result += CompositorHitTestFlags::eInactiveScrollframe;
|
||||
} else if (aBuilder->GetAncestorHasApzAwareEventHandler()) {
|
||||
result += CompositorHitTestFlags::eApzAwareListeners;
|
||||
} else if (IsObjectFrame()) {
|
||||
// If the frame is a plugin frame and wants to handle wheel events as
|
||||
// default action, we should add the frame to dispatch-to-content region.
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(this);
|
||||
if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
||||
result += CompositorHitTestFlags::eApzAwareListeners;
|
||||
}
|
||||
} else if (IsRangeFrame()) {
|
||||
// Range frames handle touch events directly without having a touch listener
|
||||
// so we need to let APZ know that this area cares about events.
|
||||
|
@ -12031,7 +12015,6 @@ void DR_State::InitFrameTypeTable() {
|
|||
AddFrameTypeInfo(LayoutFrameType::Letter, "letter", "letter");
|
||||
AddFrameTypeInfo(LayoutFrameType::Line, "line", "line");
|
||||
AddFrameTypeInfo(LayoutFrameType::ListControl, "select", "select");
|
||||
AddFrameTypeInfo(LayoutFrameType::Object, "obj", "object");
|
||||
AddFrameTypeInfo(LayoutFrameType::Page, "page", "page");
|
||||
AddFrameTypeInfo(LayoutFrameType::Placeholder, "place", "placeholder");
|
||||
AddFrameTypeInfo(LayoutFrameType::Canvas, "canvas", "canvas");
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
/*
|
||||
* interface for rendering objects for replaced elements implemented by
|
||||
* a plugin
|
||||
*/
|
||||
|
||||
#ifndef nsIObjectFrame_h___
|
||||
#define nsIObjectFrame_h___
|
||||
|
||||
#include "nsQueryFrame.h"
|
||||
|
||||
class nsNPAPIPluginInstance;
|
||||
class nsIWidget;
|
||||
|
||||
class nsIObjectFrame : public nsQueryFrame {
|
||||
public:
|
||||
NS_DECL_QUERYFRAME_TARGET(nsIObjectFrame)
|
||||
|
||||
virtual nsNPAPIPluginInstance* GetPluginInstance() = 0;
|
||||
|
||||
/**
|
||||
* Get the native widget for the plugin, if any.
|
||||
*/
|
||||
virtual nsIWidget* GetWidget() = 0;
|
||||
|
||||
/**
|
||||
* Update plugin active state. Frame should update if it is on an active tab
|
||||
* or not and forward that information to the plugin to make it possible to
|
||||
* throttle down plugin instance in non active case.
|
||||
*/
|
||||
virtual void SetIsDocumentActive(bool aIsActive) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIObjectFrame_h___ */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,399 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
/* rendering objects for replaced elements implemented by a plugin */
|
||||
|
||||
#ifndef nsPluginFrame_h___
|
||||
#define nsPluginFrame_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsIReflowCallback.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/layers/StackingContextHelper.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
# include <windows.h> // For HWND :(
|
||||
// Undo the windows.h damage
|
||||
# undef GetMessage
|
||||
# undef CreateEvent
|
||||
# undef GetClassName
|
||||
# undef GetBinaryType
|
||||
# undef RemoveDirectory
|
||||
# undef LoadIcon
|
||||
# undef LoadImage
|
||||
# undef GetObject
|
||||
#endif
|
||||
|
||||
class nsPresContext;
|
||||
class nsRootPresContext;
|
||||
class nsDisplayPlugin;
|
||||
class PluginBackgroundSink;
|
||||
class nsPluginInstanceOwner;
|
||||
|
||||
namespace mozilla {
|
||||
class PresShell;
|
||||
namespace layers {
|
||||
class ImageContainer;
|
||||
class Layer;
|
||||
class LayerManager;
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
class PluginFrameDidCompositeObserver;
|
||||
|
||||
class nsPluginFrame final : public nsIFrame,
|
||||
public nsIObjectFrame,
|
||||
public nsIReflowCallback {
|
||||
public:
|
||||
typedef mozilla::LayerState LayerState;
|
||||
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||
typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
|
||||
typedef mozilla::layers::Layer Layer;
|
||||
typedef mozilla::layers::LayerManager LayerManager;
|
||||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
typedef mozilla::layers::StackingContextHelper StackingContextHelper;
|
||||
typedef mozilla::layers::RenderRootStateManager RenderRootStateManager;
|
||||
typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand;
|
||||
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
||||
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsPluginFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
friend nsIFrame* NS_NewObjectFrame(mozilla::PresShell* aPresShell,
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) override;
|
||||
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
||||
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
||||
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
virtual void DidReflow(nsPresContext* aPresContext,
|
||||
const ReflowInput* aReflowInput) override;
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual nsresult HandleEvent(
|
||||
nsPresContext* aPresContext, mozilla::WidgetGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus) override;
|
||||
|
||||
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
||||
return nsIFrame::IsFrameOfType(
|
||||
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
||||
PostDestroyData& aPostDestroyData) override;
|
||||
|
||||
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
||||
|
||||
nsNPAPIPluginInstance* GetPluginInstance() override;
|
||||
|
||||
virtual void SetIsDocumentActive(bool aIsActive) override;
|
||||
|
||||
mozilla::Maybe<Cursor> GetCursor(const nsPoint&) override;
|
||||
|
||||
// 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() {
|
||||
mNextConfigurationBounds = LayoutDeviceIntRect(0, 0, 0, 0);
|
||||
mNextConfigurationClipRegion.Clear();
|
||||
}
|
||||
/**
|
||||
* Append the desired widget configuration to aConfigurations.
|
||||
*/
|
||||
void GetWidgetConfiguration(
|
||||
nsTArray<nsIWidget::Configuration>* aConfigurations);
|
||||
|
||||
LayoutDeviceIntRect GetWidgetlessClipRect() {
|
||||
return RegionFromArray(mNextConfigurationClipRegion).GetBounds();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after all widget position/size/clip regions have been changed
|
||||
* (even if there isn't a widget for this plugin).
|
||||
*/
|
||||
void DidSetWidgetGeometry();
|
||||
|
||||
// accessibility support
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual mozilla::a11y::AccType AccessibleType() override;
|
||||
# ifdef XP_WIN
|
||||
NS_IMETHOD GetPluginPort(HWND* aPort);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// local methods
|
||||
nsresult PrepForDrawing(nsIWidget* aWidget);
|
||||
|
||||
// for a given aRoot, this walks the frame tree looking for the next outFrame
|
||||
static nsIObjectFrame* GetNextObjectFrame(nsPresContext* aPresContext,
|
||||
nsIFrame* aRoot);
|
||||
|
||||
// nsIReflowCallback
|
||||
virtual bool ReflowFinished() override;
|
||||
virtual void ReflowCallbackCanceled() override;
|
||||
|
||||
/**
|
||||
* Builds either an ImageLayer or a ReadbackLayer, depending on the type
|
||||
* of aItem (TYPE_PLUGIN or TYPE_PLUGIN_READBACK respectively).
|
||||
*/
|
||||
already_AddRefed<Layer> BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
nsDisplayItem* aItem,
|
||||
const ContainerLayerParameters& aContainerParameters);
|
||||
|
||||
LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
nsRect GetPaintedRect(const nsDisplayPlugin* aItem) const;
|
||||
|
||||
/**
|
||||
* If aSupports has a nsPluginFrame, then prepare it for a DocShell swap.
|
||||
* @see nsSubDocumentFrame::BeginSwapDocShells.
|
||||
* There will be a call to EndSwapDocShells after we were moved to the
|
||||
* new view tree.
|
||||
*/
|
||||
static void BeginSwapDocShells(nsISupports* aSupports);
|
||||
/**
|
||||
* If aSupports has a nsPluginFrame, then set it up after a DocShell swap.
|
||||
* @see nsSubDocumentFrame::EndSwapDocShells.
|
||||
*/
|
||||
static void EndSwapDocShells(nsISupports* aSupports);
|
||||
|
||||
nsIWidget* GetWidget() override {
|
||||
if (!mInnerView) {
|
||||
return nullptr;
|
||||
}
|
||||
return mWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the plugin's idea of its size, using aSize as its new size.
|
||||
* (aSize must be in twips)
|
||||
*/
|
||||
void FixupWindow(const nsSize& aSize);
|
||||
|
||||
/*
|
||||
* Sets up the plugin window and calls SetWindow on the plugin.
|
||||
*/
|
||||
nsresult CallSetWindow(bool aCheckIsHidden = true);
|
||||
|
||||
void SetInstanceOwner(nsPluginInstanceOwner* aOwner);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
bool CreateWebRenderCommands(
|
||||
nsDisplayItem* aItem, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder);
|
||||
|
||||
protected:
|
||||
explicit nsPluginFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
|
||||
virtual ~nsPluginFrame();
|
||||
|
||||
// NOTE: This frame class does not inherit from |nsLeafFrame|, so
|
||||
// this is not a virtual method implementation.
|
||||
void GetDesiredSize(nsPresContext* aPresContext,
|
||||
const ReflowInput& aReflowInput,
|
||||
ReflowOutput& aDesiredSize);
|
||||
|
||||
// check attributes and optionally CSS to see if we should display anything
|
||||
bool IsHidden(bool aCheckVisibilityStyle = true) const;
|
||||
|
||||
bool IsOpaque() const;
|
||||
bool IsTransparentMode() const;
|
||||
bool IsPaintedByGecko() const;
|
||||
|
||||
nsIntPoint GetWindowOriginInPixels(bool aWindowless);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
LayoutDeviceIntPoint GetRemoteTabChromeOffset();
|
||||
|
||||
static void PaintPrintPlugin(nsIFrame* aFrame, gfxContext* aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsPoint aPt);
|
||||
void PrintPlugin(gfxContext& aRenderingContext, const nsRect& aDirtyRect);
|
||||
void PaintPlugin(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext& aRenderingContext, const nsRect& aDirtyRect,
|
||||
const nsRect& aPluginRect);
|
||||
|
||||
void NotifyPluginReflowObservers();
|
||||
|
||||
friend class nsPluginInstanceOwner;
|
||||
friend class nsDisplayPlugin;
|
||||
friend class PluginBackgroundSink;
|
||||
|
||||
nsView* GetViewInternal() const override { return mOuterView; }
|
||||
void SetViewInternal(nsView* aView) override { mOuterView = aView; }
|
||||
bool GetBounds(nsDisplayItem* aItem, mozilla::gfx::IntSize& aSize,
|
||||
gfxRect& aRect);
|
||||
|
||||
private:
|
||||
// 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();
|
||||
|
||||
static const LayoutDeviceIntRegion RegionFromArray(
|
||||
const nsTArray<LayoutDeviceIntRect>& aRects) {
|
||||
LayoutDeviceIntRegion region;
|
||||
for (uint32_t i = 0; i < aRects.Length(); ++i) {
|
||||
region.Or(region, aRects[i]);
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
class PluginEventNotifier : public mozilla::Runnable {
|
||||
public:
|
||||
explicit PluginEventNotifier(const nsString& aEventType)
|
||||
: mozilla::Runnable("nsPluginFrame::PluginEventNotifier"),
|
||||
mEventType(aEventType) {}
|
||||
|
||||
NS_IMETHOD Run() override;
|
||||
|
||||
private:
|
||||
nsString mEventType;
|
||||
};
|
||||
|
||||
nsPluginInstanceOwner* mInstanceOwner; // WEAK
|
||||
nsView* mOuterView;
|
||||
nsView* mInnerView;
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
nsIntRect mWindowlessRect;
|
||||
/**
|
||||
* This is owned by the ReadbackLayer for this nsPluginFrame. It is
|
||||
* automatically cleared if the PluginBackgroundSink is destroyed.
|
||||
*/
|
||||
PluginBackgroundSink* mBackgroundSink;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
LayoutDeviceIntRect mNextConfigurationBounds;
|
||||
/**
|
||||
* Clip region that we should set the plugin's widget to
|
||||
* in the next composite. Only meaningful for plugins with widgets.
|
||||
*/
|
||||
nsTArray<LayoutDeviceIntRect> mNextConfigurationClipRegion;
|
||||
|
||||
bool mReflowCallbackPosted;
|
||||
|
||||
// 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.
|
||||
RefPtr<nsRootPresContext> mRootPresContextRegisteredWith;
|
||||
|
||||
mozilla::UniquePtr<PluginFrameDidCompositeObserver> mDidCompositeObserver;
|
||||
};
|
||||
|
||||
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; }
|
||||
};
|
||||
|
||||
class nsDisplayPlugin final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayPlugin(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
: nsPaintedDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayPlugin);
|
||||
aBuilder->SetContainsPluginItem();
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayPlugin)
|
||||
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override;
|
||||
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override;
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRegion* aVisibleRegion) override;
|
||||
|
||||
NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN)
|
||||
|
||||
virtual already_AddRefed<Layer> BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters) override {
|
||||
return static_cast<nsPluginFrame*>(mFrame)->BuildLayer(
|
||||
aBuilder, aManager, this, aContainerParameters);
|
||||
}
|
||||
|
||||
virtual LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return static_cast<nsPluginFrame*>(mFrame)->GetLayerState(aBuilder,
|
||||
aManager);
|
||||
}
|
||||
|
||||
virtual nsDisplayItemGeometry* AllocateGeometry(
|
||||
nsDisplayListBuilder* aBuilder) override {
|
||||
return new nsDisplayPluginGeometry(this, aBuilder);
|
||||
}
|
||||
|
||||
virtual bool CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override;
|
||||
};
|
||||
|
||||
#endif /* nsPluginFrame_h___ */
|
|
@ -40,7 +40,6 @@
|
|||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
@ -972,7 +971,6 @@ static CallState BeginSwapDocShellsForDocument(Document& aDocument) {
|
|||
::DestroyDisplayItemDataForFrames(rootFrame);
|
||||
}
|
||||
}
|
||||
aDocument.EnumerateActivityObservers(nsPluginFrame::BeginSwapDocShells);
|
||||
aDocument.EnumerateSubDocuments(BeginSwapDocShellsForDocument);
|
||||
return CallState::Continue;
|
||||
}
|
||||
|
@ -1056,7 +1054,6 @@ static CallState EndSwapDocShellsForDocument(Document& aDocument) {
|
|||
}
|
||||
}
|
||||
|
||||
aDocument.EnumerateActivityObservers(nsPluginFrame::EndSwapDocShells);
|
||||
aDocument.EnumerateSubDocuments(EndSwapDocShellsForDocument);
|
||||
return CallState::Continue;
|
||||
}
|
||||
|
|
|
@ -60,9 +60,6 @@ DECLARE_DISPLAY_ITEM_TYPE(OUTLINE, TYPE_RENDERS_NO_IMAGES)
|
|||
DECLARE_DISPLAY_ITEM_TYPE(OWN_LAYER, TYPE_RENDERS_NO_IMAGES | TYPE_IS_CONTAINER)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(PERSPECTIVE,
|
||||
TYPE_RENDERS_NO_IMAGES | TYPE_IS_CONTAINER)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(PLUGIN, 0)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(PLUGIN_READBACK, 0)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(PRINT_PLUGIN, 0)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(RANGE_FOCUS_RING, 0)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(REMOTE, TYPE_RENDERS_NO_IMAGES)
|
||||
DECLARE_DISPLAY_ITEM_TYPE(SCROLL_INFO_LAYER,
|
||||
|
|
|
@ -155,9 +155,8 @@ void AssertUniqueItem(nsDisplayItem* aItem) {
|
|||
}
|
||||
#endif
|
||||
|
||||
bool ShouldBuildItemForEventsOrPlugins(const DisplayItemType aType) {
|
||||
bool ShouldBuildItemForEvents(const DisplayItemType aType) {
|
||||
return aType == DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO ||
|
||||
aType == DisplayItemType::TYPE_PLUGIN ||
|
||||
(GetDisplayItemFlagsForType(aType) & TYPE_IS_CONTAINER);
|
||||
}
|
||||
|
||||
|
@ -589,9 +588,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
|||
mDescendIntoSubdocuments(true),
|
||||
mSelectedFramesOnly(false),
|
||||
mAllowMergingAndFlattening(true),
|
||||
mWillComputePluginGeometry(false),
|
||||
mInTransform(false),
|
||||
mInEventsAndPluginsOnly(false),
|
||||
mInEventsOnly(false),
|
||||
mInFilter(false),
|
||||
mInPageSequence(false),
|
||||
mIsInChromePresContext(false),
|
||||
|
@ -600,7 +598,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
|||
mUseHighQualityScaling(false),
|
||||
mIsPaintingForWebRender(false),
|
||||
mIsCompositingCheap(false),
|
||||
mContainsPluginItem(false),
|
||||
mAncestorHasApzAwareEventHandler(false),
|
||||
mHaveScrollableDisplayPort(false),
|
||||
mWindowDraggingAllowed(false),
|
||||
|
@ -1016,8 +1013,7 @@ void nsDisplayListBuilder::SubtractFromVisibleRegion(nsRegion* aVisibleRegion,
|
|||
// to its bounds either, which can be very bad (see bug 516740).
|
||||
// Do let aVisibleRegion get more complex if by doing so we reduce its
|
||||
// area by at least half.
|
||||
if (GetAccurateVisibleRegions() || tmp.GetNumRects() <= 15 ||
|
||||
tmp.Area() <= aVisibleRegion->Area() / 2) {
|
||||
if (tmp.GetNumRects() <= 15 || tmp.Area() <= aVisibleRegion->Area() / 2) {
|
||||
*aVisibleRegion = tmp;
|
||||
}
|
||||
}
|
||||
|
@ -2192,23 +2188,6 @@ static nsRegion TreatAsOpaque(nsDisplayItem* aItem,
|
|||
MOZ_ASSERT(
|
||||
(aBuilder->IsForEventDelivery() && aBuilder->HitTestIsForVisibility()) ||
|
||||
!opaque.IsComplex());
|
||||
if (aBuilder->IsForPluginGeometry() &&
|
||||
aItem->GetType() != DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO) {
|
||||
// Treat all leaf chrome items as opaque, unless their frames are opacity:0.
|
||||
// Since opacity:0 frames generate an nsDisplayOpacity, that item will
|
||||
// not be treated as opaque here, so opacity:0 chrome content will be
|
||||
// effectively ignored, as it should be.
|
||||
// We treat leaf chrome items as opaque to ensure that they cover
|
||||
// content plugins, for security reasons.
|
||||
// Non-leaf chrome items don't render contents of their own so shouldn't
|
||||
// be treated as opaque (and their bounds is just the union of their
|
||||
// children, which might be a large area their contents don't really cover).
|
||||
nsIFrame* f = aItem->Frame();
|
||||
if (f->PresContext()->IsChrome() && !aItem->GetChildren() &&
|
||||
f->StyleEffects()->mOpacity != 0.0) {
|
||||
opaque = aItem->GetBounds(aBuilder, &snap);
|
||||
}
|
||||
}
|
||||
if (opaque.IsEmpty()) {
|
||||
return opaque;
|
||||
}
|
||||
|
@ -2482,19 +2461,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
}
|
||||
|
||||
if (!sent) {
|
||||
// Windowed plugins are not supported with WebRender enabled.
|
||||
// But PluginGeometry needs to be updated to show plugin.
|
||||
// Windowed plugins are going to be removed by Bug 1296400.
|
||||
nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
|
||||
if (rootPresContext && XRE_IsContentProcess()) {
|
||||
if (aBuilder->WillComputePluginGeometry()) {
|
||||
rootPresContext->ComputePluginGeometryUpdates(
|
||||
aBuilder->RootReferenceFrame(), aBuilder, this);
|
||||
}
|
||||
// This must be called even if PluginGeometryUpdates were not computed.
|
||||
rootPresContext->CollectPluginGeometryUpdates(layerManager);
|
||||
}
|
||||
|
||||
auto* wrManager = static_cast<WebRenderLayerManager*>(layerManager.get());
|
||||
|
||||
nsIDocShell* docShell = presContext->GetDocShell();
|
||||
|
@ -2566,16 +2532,9 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
bool temp =
|
||||
aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
|
||||
LayerManager::EndTransactionFlags flags = LayerManager::END_DEFAULT;
|
||||
if (layerManager->NeedsWidgetInvalidation()) {
|
||||
if (aFlags & PAINT_NO_COMPOSITE) {
|
||||
flags = LayerManager::END_NO_COMPOSITE;
|
||||
}
|
||||
} else {
|
||||
// Client layer managers never composite directly, so
|
||||
// we don't need to worry about END_NO_COMPOSITE.
|
||||
if (aBuilder->WillComputePluginGeometry()) {
|
||||
flags = LayerManager::END_NO_REMOTE_COMPOSITE;
|
||||
}
|
||||
if (layerManager->NeedsWidgetInvalidation() &&
|
||||
(aFlags & PAINT_NO_COMPOSITE)) {
|
||||
flags = LayerManager::END_NO_COMPOSITE;
|
||||
}
|
||||
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
|
@ -2594,20 +2553,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// If this is the content process, we ship plugin geometry updates over with
|
||||
// layer updates, so calculate that now before we call EndTransaction.
|
||||
nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
|
||||
if (rootPresContext && XRE_IsContentProcess()) {
|
||||
if (aBuilder->WillComputePluginGeometry()) {
|
||||
rootPresContext->ComputePluginGeometryUpdates(
|
||||
aBuilder->RootReferenceFrame(), aBuilder, this);
|
||||
}
|
||||
// The layer system caches plugin configuration information for forwarding
|
||||
// with layer updates which needs to get set during reflow. This must be
|
||||
// called even if there are no windowed plugins in the page.
|
||||
rootPresContext->CollectPluginGeometryUpdates(layerManager);
|
||||
}
|
||||
|
||||
layerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, aBuilder,
|
||||
flags);
|
||||
layerBuilder->DidEndTransaction();
|
||||
|
@ -3026,9 +2971,6 @@ bool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
|
|||
SetPaintRect(itemVisible.GetBounds());
|
||||
}
|
||||
|
||||
// When we recompute visibility within layers we don't need to
|
||||
// expand the visible region for content behind plugins (the plugin
|
||||
// is not in the layer).
|
||||
if (!ComputeVisibility(aBuilder, aVisibleRegion)) {
|
||||
SetPaintRect(nsRect());
|
||||
return false;
|
||||
|
@ -5804,11 +5746,11 @@ nsresult nsDisplayWrapper::WrapListsInPlace(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
nsDisplayOpacity::nsDisplayOpacity(
|
||||
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
bool aForEventsAndPluginsOnly, bool aNeedsActiveLayer)
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot, bool aForEventsOnly,
|
||||
bool aNeedsActiveLayer)
|
||||
: nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, true),
|
||||
mOpacity(aFrame->StyleEffects()->mOpacity),
|
||||
mForEventsAndPluginsOnly(aForEventsAndPluginsOnly),
|
||||
mForEventsOnly(aForEventsOnly),
|
||||
mNeedsActiveLayer(aNeedsActiveLayer),
|
||||
mChildOpacityState(ChildOpacityState::Unknown) {
|
||||
MOZ_COUNT_CTOR(nsDisplayOpacity);
|
||||
|
@ -6073,7 +6015,7 @@ nsDisplayItem::LayerState nsDisplayOpacity::GetLayerState(
|
|||
// If we only created this item so that we'd get correct nsDisplayEventRegions
|
||||
// for child frames, then force us to inactive to avoid unnecessary
|
||||
// layerization changes for content that won't ever be painted.
|
||||
if (mForEventsAndPluginsOnly) {
|
||||
if (mForEventsOnly) {
|
||||
MOZ_ASSERT(mOpacity == 0);
|
||||
return LayerState::LAYER_INACTIVE;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,6 @@ struct ActiveScrolledRoot {
|
|||
enum class nsDisplayListBuilderMode : uint8_t {
|
||||
Painting,
|
||||
EventDelivery,
|
||||
PluginGeometry,
|
||||
FrameVisibility,
|
||||
TransformComputation,
|
||||
GenerateGlyph,
|
||||
|
@ -450,24 +449,6 @@ class nsDisplayListBuilder {
|
|||
mTemporaryItems.AppendElement(aItem);
|
||||
}
|
||||
|
||||
void SetWillComputePluginGeometry(bool aWillComputePluginGeometry) {
|
||||
mWillComputePluginGeometry = aWillComputePluginGeometry;
|
||||
}
|
||||
|
||||
void SetForPluginGeometry(bool aForPlugin) {
|
||||
if (aForPlugin) {
|
||||
NS_ASSERTION(mMode == nsDisplayListBuilderMode::Painting,
|
||||
"Can only switch from Painting to PluginGeometry");
|
||||
NS_ASSERTION(mWillComputePluginGeometry,
|
||||
"Should have signalled this in advance");
|
||||
mMode = nsDisplayListBuilderMode::PluginGeometry;
|
||||
} else {
|
||||
NS_ASSERTION(mMode == nsDisplayListBuilderMode::PluginGeometry,
|
||||
"Can only switch from Painting to PluginGeometry");
|
||||
mMode = nsDisplayListBuilderMode::Painting;
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::layers::LayerManager* GetWidgetLayerManager(
|
||||
nsView** aView = nullptr);
|
||||
|
||||
|
@ -479,17 +460,6 @@ class nsDisplayListBuilder {
|
|||
return mMode == nsDisplayListBuilderMode::EventDelivery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Be careful with this. The display list will be built in Painting mode
|
||||
* first and then switched to PluginGeometry before a second call to
|
||||
* ComputeVisibility.
|
||||
* @return true if the display list is being built to compute geometry
|
||||
* for plugins.
|
||||
*/
|
||||
bool IsForPluginGeometry() const {
|
||||
return mMode == nsDisplayListBuilderMode::PluginGeometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the display list is being built for painting.
|
||||
*/
|
||||
|
@ -517,8 +487,6 @@ class nsDisplayListBuilder {
|
|||
return mBuildCompositorHitTestInfo;
|
||||
}
|
||||
|
||||
bool WillComputePluginGeometry() const { return mWillComputePluginGeometry; }
|
||||
|
||||
/**
|
||||
* @return true if "painting is suppressed" during page load and we
|
||||
* should paint only the background of the document.
|
||||
|
@ -611,13 +579,6 @@ class nsDisplayListBuilder {
|
|||
*/
|
||||
void SetSelectedFramesOnly() { mSelectedFramesOnly = true; }
|
||||
bool GetSelectedFramesOnly() { return mSelectedFramesOnly; }
|
||||
/**
|
||||
* Calling this setter makes us compute accurate visible regions at the cost
|
||||
* of performance if regions get very complex.
|
||||
*/
|
||||
bool GetAccurateVisibleRegions() {
|
||||
return mMode == nsDisplayListBuilderMode::PluginGeometry;
|
||||
}
|
||||
/**
|
||||
* @return Returns true if we should include the caret in any display lists
|
||||
* that we make.
|
||||
|
@ -833,7 +794,7 @@ class nsDisplayListBuilder {
|
|||
*/
|
||||
bool IsInTransform() const { return mInTransform; }
|
||||
|
||||
bool InEventsAndPluginsOnly() const { return mInEventsAndPluginsOnly; }
|
||||
bool InEventsOnly() const { return mInEventsOnly; }
|
||||
/**
|
||||
* Indicate whether or not we're directly or indirectly under and
|
||||
* nsDisplayTransform or SVG foreignObject.
|
||||
|
@ -1220,17 +1181,14 @@ class nsDisplayListBuilder {
|
|||
bool mOldValue;
|
||||
};
|
||||
|
||||
class AutoInEventsAndPluginsOnly {
|
||||
class AutoInEventsOnly {
|
||||
public:
|
||||
AutoInEventsAndPluginsOnly(nsDisplayListBuilder* aBuilder,
|
||||
bool aInEventsAndPluginsOnly)
|
||||
: mBuilder(aBuilder), mOldValue(aBuilder->mInEventsAndPluginsOnly) {
|
||||
aBuilder->mInEventsAndPluginsOnly |= aInEventsAndPluginsOnly;
|
||||
AutoInEventsOnly(nsDisplayListBuilder* aBuilder, bool aInEventsOnly)
|
||||
: mBuilder(aBuilder), mOldValue(aBuilder->mInEventsOnly) {
|
||||
aBuilder->mInEventsOnly |= aInEventsOnly;
|
||||
}
|
||||
|
||||
~AutoInEventsAndPluginsOnly() {
|
||||
mBuilder->mInEventsAndPluginsOnly = mOldValue;
|
||||
}
|
||||
~AutoInEventsOnly() { mBuilder->mInEventsOnly = mOldValue; }
|
||||
|
||||
private:
|
||||
nsDisplayListBuilder* mBuilder;
|
||||
|
@ -1647,9 +1605,6 @@ class nsDisplayListBuilder {
|
|||
|
||||
bool NeedToForceTransparentSurfaceForItem(nsDisplayItem* aItem);
|
||||
|
||||
void SetContainsPluginItem() { mContainsPluginItem = true; }
|
||||
bool ContainsPluginItem() { return mContainsPluginItem; }
|
||||
|
||||
/**
|
||||
* mContainsBlendMode is true if we processed a display item that
|
||||
* has a blend mode attached. We do this so we can insert a
|
||||
|
@ -2040,11 +1995,10 @@ class nsDisplayListBuilder {
|
|||
bool mDescendIntoSubdocuments;
|
||||
bool mSelectedFramesOnly;
|
||||
bool mAllowMergingAndFlattening;
|
||||
bool mWillComputePluginGeometry;
|
||||
// True when we're building a display list that's directly or indirectly
|
||||
// under an nsDisplayTransform
|
||||
bool mInTransform;
|
||||
bool mInEventsAndPluginsOnly;
|
||||
bool mInEventsOnly;
|
||||
bool mInFilter;
|
||||
bool mInPageSequence;
|
||||
bool mIsInChromePresContext;
|
||||
|
@ -2053,7 +2007,6 @@ class nsDisplayListBuilder {
|
|||
bool mUseHighQualityScaling;
|
||||
bool mIsPaintingForWebRender;
|
||||
bool mIsCompositingCheap;
|
||||
bool mContainsPluginItem;
|
||||
bool mAncestorHasApzAwareEventHandler;
|
||||
// True when the first async-scrollable scroll frame for which we build a
|
||||
// display list has a display port. An async-scrollable scroll frame is one
|
||||
|
@ -2128,7 +2081,7 @@ void AssertUniqueItem(nsDisplayItem* aItem);
|
|||
* Returns true, if a display item of given |aType| needs to be built within
|
||||
* opacity:0 container.
|
||||
*/
|
||||
bool ShouldBuildItemForEventsOrPlugins(const DisplayItemType aType);
|
||||
bool ShouldBuildItemForEvents(const DisplayItemType aType);
|
||||
|
||||
void UpdateDisplayItemData(nsPaintedDisplayItem* aItem);
|
||||
|
||||
|
@ -2142,9 +2095,8 @@ MOZ_ALWAYS_INLINE T* MakeDisplayItemWithIndex(nsDisplayListBuilder* aBuilder,
|
|||
"Frame type should be derived from nsIFrame");
|
||||
|
||||
const DisplayItemType type = T::ItemType();
|
||||
if (aBuilder->InEventsAndPluginsOnly() &&
|
||||
!ShouldBuildItemForEventsOrPlugins(type)) {
|
||||
// This item is not needed for events or plugins.
|
||||
if (aBuilder->InEventsOnly() && !ShouldBuildItemForEvents(type)) {
|
||||
// This item is not needed for events.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2931,9 +2883,6 @@ class nsDisplayItem : public nsDisplayItemBase {
|
|||
* this item to the intersection of *aVisibleRegion and this item's bounds.
|
||||
* We rely on that, so this should only be called by
|
||||
* nsDisplayList::ComputeVisibility or nsDisplayItem::RecomputeVisibility.
|
||||
* aAllowVisibleRegionExpansion is a rect where we are allowed to
|
||||
* expand the visible region and is only used for making sure the
|
||||
* background behind a plugin is visible.
|
||||
* This method needs to be idempotent.
|
||||
*
|
||||
* @return true if the item is visible, false if no part of the item
|
||||
|
@ -5650,13 +5599,13 @@ class nsDisplayOpacity : public nsDisplayWrapList {
|
|||
nsDisplayOpacity(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
bool aForEventsAndPluginsOnly, bool aNeedsActiveLayer);
|
||||
bool aForEventsOnly, bool aNeedsActiveLayer);
|
||||
|
||||
nsDisplayOpacity(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayOpacity& aOther)
|
||||
: nsDisplayWrapList(aBuilder, aOther),
|
||||
mOpacity(aOther.mOpacity),
|
||||
mForEventsAndPluginsOnly(aOther.mForEventsAndPluginsOnly),
|
||||
mForEventsOnly(aOther.mForEventsOnly),
|
||||
mNeedsActiveLayer(aOther.mNeedsActiveLayer),
|
||||
mChildOpacityState(ChildOpacityState::Unknown) {
|
||||
MOZ_COUNT_CTOR(nsDisplayOpacity);
|
||||
|
@ -5714,7 +5663,7 @@ class nsDisplayOpacity : public nsDisplayWrapList {
|
|||
nsRegion* aInvalidRegion) const override;
|
||||
|
||||
bool IsInvalid(nsRect& aRect) const override {
|
||||
if (mForEventsAndPluginsOnly) {
|
||||
if (mForEventsOnly) {
|
||||
return false;
|
||||
}
|
||||
return nsDisplayWrapList::IsInvalid(aRect);
|
||||
|
@ -5760,7 +5709,7 @@ class nsDisplayOpacity : public nsDisplayWrapList {
|
|||
bool ApplyToFilterOrMask(const bool aUsingLayers);
|
||||
|
||||
float mOpacity;
|
||||
bool mForEventsAndPluginsOnly : 1;
|
||||
bool mForEventsOnly : 1;
|
||||
enum class ChildOpacityState : uint8_t {
|
||||
// Our child list has changed since the last time ApplyToChildren was
|
||||
// called.
|
||||
|
|
|
@ -37,14 +37,14 @@ class PresShell;
|
|||
* has a widget it must also have a view, but not all frames with views will
|
||||
* have widgets.
|
||||
*
|
||||
* Only five types of frames can have a view: root frames (ViewportFrame),
|
||||
* subdocument frames (nsSubDocumentFrame), plugin frames (nsPluginFrame),
|
||||
* Only four types of frames can have a view: root frames (ViewportFrame),
|
||||
* subdocument frames (nsSubDocumentFrame),
|
||||
* menu popup frames (nsMenuPopupFrame), and list control frames
|
||||
* (nsListControlFrame). Root frames and subdocument frames have views to link
|
||||
* the two documents together (the frame trees do not link up otherwise).
|
||||
* Plugin frames, menu popup frames, and list control frames have views because
|
||||
* they (sometimes) need to create widgets (although plugins with widgets might
|
||||
* be going away/gone?). Menu popup frames handles xul popups, which is anything
|
||||
* Menu popup frames, and list control frames have views because
|
||||
* they (sometimes) need to create widgets.
|
||||
* Menu popup frames handles xul popups, which is anything
|
||||
* where we need content to go over top the main window at an os level. List
|
||||
* control frames handle select popups/dropdowns in non-e10s mode.
|
||||
*
|
||||
|
@ -57,10 +57,8 @@ class PresShell;
|
|||
* root frame is created, so the root view will not have a frame very early in
|
||||
* document creation.
|
||||
*
|
||||
* Subdocument frames and plugin frames have an anonymous (no frame associated
|
||||
* with it) inner view that is a child of their "outer" view. On a plugin frame
|
||||
* with a widget the inner view would be associated with the widget (as opposed
|
||||
* to the outer view).
|
||||
* Subdocument frames have an anonymous (no frame associated
|
||||
* with it) inner view that is a child of their "outer" view.
|
||||
*
|
||||
* On a subdocument frame the inner view serves as the parent of the
|
||||
* root view of the subdocument. The outer and inner view of the subdocument
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIPluginWidget.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
@ -261,7 +260,7 @@ nsView* nsViewManager::GetDisplayRootFor(nsView* aView) {
|
|||
// If we have a combobox dropdown popup within a panel popup, both the view
|
||||
// for the dropdown popup and its parent will be floating, so we need to
|
||||
// distinguish this situation. We do this by looking for a widget. Any view
|
||||
// with a widget is a display root, except for plugins.
|
||||
// with a widget is a display root.
|
||||
nsIWidget* widget = displayRoot->GetWidget();
|
||||
if (widget && widget->WindowType() == eWindowType_popup) {
|
||||
NS_ASSERTION(displayRoot->GetFloating() && displayParent->GetFloating(),
|
||||
|
@ -540,46 +539,8 @@ void nsViewManager::InvalidateWidgetArea(nsView* aWidgetView,
|
|||
return;
|
||||
}
|
||||
|
||||
// Update all child widgets with the damage. In the process,
|
||||
// accumulate the union of all the child widget areas, or at least
|
||||
// some subset of that.
|
||||
nsRegion children;
|
||||
if (widget->GetTransparencyMode() != eTransparencyTransparent) {
|
||||
for (nsIWidget* childWidget = widget->GetFirstChild(); childWidget;
|
||||
childWidget = childWidget->GetNextSibling()) {
|
||||
nsView* view = nsView::GetViewFor(childWidget);
|
||||
NS_ASSERTION(view != aWidgetView, "will recur infinitely");
|
||||
nsWindowType type = childWidget->WindowType();
|
||||
if (view && childWidget->IsVisible() && type != eWindowType_popup) {
|
||||
NS_ASSERTION(childWidget->IsPlugin(),
|
||||
"Only plugin or popup widgets can be children!");
|
||||
|
||||
// We do not need to invalidate in plugin widgets, but we should
|
||||
// exclude them from the invalidation region IF we're not on
|
||||
// Mac. On Mac we need to draw under plugin widgets, because
|
||||
// plugin widgets are basically invisible
|
||||
#ifndef XP_MACOSX
|
||||
// GetBounds should compensate for chrome on a toplevel widget
|
||||
LayoutDeviceIntRect bounds = childWidget->GetBounds();
|
||||
|
||||
nsTArray<LayoutDeviceIntRect> clipRects;
|
||||
childWidget->GetWindowClipRegion(&clipRects);
|
||||
for (uint32_t i = 0; i < clipRects.Length(); ++i) {
|
||||
nsRect rr = LayoutDeviceIntRect::ToAppUnits(
|
||||
clipRects[i] + bounds.TopLeft(), AppUnitsPerDevPixel());
|
||||
children.Or(children, rr - aWidgetView->ViewToWidgetOffset());
|
||||
children.SimplifyInward(20);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsRegion leftOver;
|
||||
leftOver.Sub(aDamagedRegion, children);
|
||||
|
||||
if (!leftOver.IsEmpty()) {
|
||||
for (auto iter = leftOver.RectIter(); !iter.Done(); iter.Next()) {
|
||||
if (!aDamagedRegion.IsEmpty()) {
|
||||
for (auto iter = aDamagedRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
LayoutDeviceIntRect bounds = ViewToWidget(aWidgetView, iter.Get());
|
||||
widget->Invalidate(bounds);
|
||||
}
|
||||
|
@ -670,10 +631,6 @@ void nsViewManager::WillPaintWindow(nsIWidget* aWidget) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RefPtr<PresShell> presShell = mPresShell) {
|
||||
presShell->WillPaintWindow();
|
||||
}
|
||||
}
|
||||
|
||||
bool nsViewManager::PaintWindow(nsIWidget* aWidget,
|
||||
|
@ -729,8 +686,7 @@ void nsViewManager::DispatchEvent(WidgetGUIEvent* aEvent, nsView* aView,
|
|||
// If the view has no frame, look for a view that does.
|
||||
nsIFrame* frame = view->GetFrame();
|
||||
if (!frame && (dispatchUsingCoordinates || aEvent->HasKeyEventMessage() ||
|
||||
aEvent->IsIMERelatedEvent() ||
|
||||
aEvent->HasPluginActivationEventMessage())) {
|
||||
aEvent->IsIMERelatedEvent())) {
|
||||
while (view && !view->GetFrame()) {
|
||||
view = view->GetParent();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ def rustPreventForward(s):
|
|||
reason."""
|
||||
return s in (
|
||||
"nsIFrame",
|
||||
"nsIObjectFrame",
|
||||
"nsSubDocumentFrame",
|
||||
)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче