Bug 1252877 Part 4: Remove notification of plugins about scrolling from child. r=jimm
MozReview-Commit-ID: 2tHtOxx7jKa
This commit is contained in:
@@ -327,11 +327,6 @@ PluginPRLibrary::GetScrollCaptureContainer(NPP aInstance, ImageContainer** aCont
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult
|
||||
PluginPRLibrary::UpdateScrollState(NPP aInstance, bool aIsScrolling)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
|
||||
@@ -127,7 +127,6 @@ public:
|
||||
virtual void SetHasLocalInstance() override { }
|
||||
#if defined(XP_WIN)
|
||||
virtual nsresult GetScrollCaptureContainer(NPP aInstance, mozilla::layers::ImageContainer** aContainer) override;
|
||||
virtual nsresult UpdateScrollState(NPP aInstance, bool aIsScrolling) override;
|
||||
#endif
|
||||
virtual nsresult HandledWindowedPluginKeyEvent(
|
||||
NPP aInstance,
|
||||
|
||||
@@ -1161,15 +1161,6 @@ nsNPAPIPluginInstance::GetScrollCaptureContainer(ImageContainer**aContainer)
|
||||
AutoPluginLibraryCall library(this);
|
||||
return !library ? NS_ERROR_FAILURE : library->GetScrollCaptureContainer(&mNPP, aContainer);
|
||||
}
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::UpdateScrollState(bool aIsScrolling)
|
||||
{
|
||||
if (RUNNING != mRunning)
|
||||
return NS_OK;
|
||||
|
||||
AutoPluginLibraryCall library(this);
|
||||
return !library ? NS_ERROR_FAILURE : library->UpdateScrollState(&mNPP, aIsScrolling);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
|
||||
@@ -122,7 +122,6 @@ public:
|
||||
nsresult GetMIMEType(const char* *result);
|
||||
#if defined(XP_WIN)
|
||||
nsresult GetScrollCaptureContainer(mozilla::layers::ImageContainer **aContainer);
|
||||
nsresult UpdateScrollState(bool aIsScrolling);
|
||||
#endif
|
||||
nsresult HandledWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData,
|
||||
|
||||
@@ -322,21 +322,6 @@ nsPluginInstanceOwner::GetCurrentImageSize()
|
||||
return size;
|
||||
}
|
||||
|
||||
bool
|
||||
nsPluginInstanceOwner::UpdateScrollState(bool aIsScrolling)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
if (!mInstance) {
|
||||
return false;
|
||||
}
|
||||
mScrollState = aIsScrolling;
|
||||
nsresult rv = mInstance->UpdateScrollState(aIsScrolling);
|
||||
return NS_SUCCEEDED(rv);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsPluginInstanceOwner::nsPluginInstanceOwner()
|
||||
: mPluginWindow(nullptr)
|
||||
{
|
||||
@@ -384,7 +369,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
|
||||
mGotCompositionData = false;
|
||||
mSentStartComposition = false;
|
||||
mPluginDidNotHandleIMEComposition = false;
|
||||
mScrollState = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -229,8 +229,6 @@ public:
|
||||
// Returns true if this is windowed plugin that can return static captures
|
||||
// for scroll operations.
|
||||
bool NeedsScrollImageLayer();
|
||||
// Notification we receive from nsPluginFrame about scroll state.
|
||||
bool UpdateScrollState(bool aIsScrolling);
|
||||
|
||||
void DidComposite();
|
||||
|
||||
@@ -411,9 +409,6 @@ private:
|
||||
#endif
|
||||
|
||||
bool mWaitingForPaint;
|
||||
#if defined(XP_WIN)
|
||||
bool mScrollState;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // nsPluginInstanceOwner_h_
|
||||
|
||||
@@ -1209,12 +1209,6 @@ PluginInstanceParent::GetScrollCaptureContainer(ImageContainer** aContainer)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PluginInstanceParent::UpdateScrollState(bool aIsScrolling)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // XP_WIN
|
||||
|
||||
PluginAsyncSurrogate*
|
||||
|
||||
@@ -333,7 +333,6 @@ public:
|
||||
#if defined(XP_WIN)
|
||||
nsresult SetScrollCaptureId(uint64_t aScrollCaptureId);
|
||||
nsresult GetScrollCaptureContainer(mozilla::layers::ImageContainer** aContainer);
|
||||
nsresult UpdateScrollState(bool aIsScrolling);
|
||||
#endif
|
||||
void DidComposite();
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ public:
|
||||
#endif
|
||||
#if defined(XP_WIN)
|
||||
virtual nsresult GetScrollCaptureContainer(NPP aInstance, mozilla::layers::ImageContainer** aContainer) = 0;
|
||||
virtual nsresult UpdateScrollState(NPP aInstance, bool aIsScrolling) = 0;
|
||||
#endif
|
||||
virtual nsresult HandledWindowedPluginKeyEvent(
|
||||
NPP aInstance,
|
||||
|
||||
@@ -2033,12 +2033,6 @@ PluginModuleParent::GetScrollCaptureContainer(NPP aInstance,
|
||||
PluginInstanceParent* inst = PluginInstanceParent::Cast(aInstance);
|
||||
return !inst ? NS_ERROR_FAILURE : inst->GetScrollCaptureContainer(aContainer);
|
||||
}
|
||||
nsresult
|
||||
PluginModuleParent::UpdateScrollState(NPP aInstance, bool aIsScrolling)
|
||||
{
|
||||
PluginInstanceParent* inst = PluginInstanceParent::Cast(aInstance);
|
||||
return !inst ? NS_ERROR_FAILURE : inst->UpdateScrollState(aIsScrolling);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
|
||||
@@ -263,7 +263,6 @@ protected:
|
||||
|
||||
#if defined(XP_WIN)
|
||||
virtual nsresult GetScrollCaptureContainer(NPP aInstance, mozilla::layers::ImageContainer** aContainer) override;
|
||||
virtual nsresult UpdateScrollState(NPP aInstance, bool aIsScrolling);
|
||||
#endif
|
||||
|
||||
virtual nsresult HandledWindowedPluginKeyEvent(
|
||||
|
||||
@@ -1893,7 +1893,6 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
|
||||
, mZoomableByAPZ(false)
|
||||
, mScrollsClipOnUnscrolledOutOfFlow(false)
|
||||
, mVelocityQueue(aOuter->PresContext())
|
||||
, mAsyncScrollEvent(END_DOM)
|
||||
{
|
||||
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||
mScrollbarActivity = new ScrollbarActivity(do_QueryFrame(aOuter));
|
||||
@@ -2006,8 +2005,6 @@ ScrollFrameHelper::AsyncScrollCallback(ScrollFrameHelper* aInstance,
|
||||
void
|
||||
ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin)
|
||||
{
|
||||
NotifyPluginFrames(END_DOM);
|
||||
|
||||
// Apply desired destination range since this is the last step of scrolling.
|
||||
mAsyncSmoothMSDScroll = nullptr;
|
||||
mAsyncScroll = nullptr;
|
||||
@@ -2023,11 +2020,6 @@ ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin)
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
struct PluginSearchCtx {
|
||||
enum PluginAction {
|
||||
UPDATE, // Update the scroll visibility of any plugin frames using |value|
|
||||
QUERY // Set |value| to true if plugin frames were found
|
||||
};
|
||||
PluginAction action;
|
||||
nsIFrame* outer;
|
||||
bool value;
|
||||
};
|
||||
@@ -2044,15 +2036,11 @@ NotifyPluginFramesCallback(nsISupports* aSupports, void* aCtx)
|
||||
// Check to be sure this plugin is contained within a subframe of
|
||||
// the nsGfxScrollFrame that initiated this callback.
|
||||
if (nsLayoutUtils::IsAncestorFrameCrossDoc(pCtx->outer, plugin, nullptr)) {
|
||||
if (pCtx->action == PluginSearchCtx::UPDATE) {
|
||||
plugin->SetScrollVisibility(pCtx->value);
|
||||
} else if (pCtx->action == PluginSearchCtx::QUERY) {
|
||||
pCtx->value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -2064,39 +2052,13 @@ NotifyPluginSubframesCallback(nsIDocument* aDocument, void* aCtx)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ScrollFrameHelper::NotifyPluginFrames(AsyncScrollEventType aEvent)
|
||||
{
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (!gfxPrefs::HidePluginsForScroll()) {
|
||||
return;
|
||||
}
|
||||
if (XRE_IsContentProcess()) {
|
||||
// Ignore 'inner' dom events triggered by apz transformations
|
||||
if (mAsyncScrollEvent == BEGIN_APZ && aEvent != END_APZ) {
|
||||
return;
|
||||
}
|
||||
if (aEvent != mAsyncScrollEvent) {
|
||||
nsPresContext* presContext = mOuter->PresContext();
|
||||
PluginSearchCtx ctx = { PluginSearchCtx::UPDATE, mOuter, (aEvent == BEGIN_APZ || aEvent == BEGIN_DOM) };
|
||||
presContext->Document()->EnumerateActivityObservers(NotifyPluginFramesCallback,
|
||||
(void*)&ctx);
|
||||
presContext->Document()->EnumerateSubDocuments(NotifyPluginSubframesCallback,
|
||||
(void*)&ctx);
|
||||
|
||||
mAsyncScrollEvent = aEvent;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ScrollFrameHelper::HasPluginFrames()
|
||||
{
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (XRE_IsContentProcess()) {
|
||||
nsPresContext* presContext = mOuter->PresContext();
|
||||
PluginSearchCtx ctx = { PluginSearchCtx::QUERY, mOuter, false };
|
||||
PluginSearchCtx ctx = { mOuter, false };
|
||||
presContext->Document()->EnumerateActivityObservers(NotifyPluginFramesCallback,
|
||||
(void*)&ctx);
|
||||
if (ctx.value) {
|
||||
@@ -2322,7 +2284,6 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
mAsyncScroll->mIsSmoothScroll = isSmoothScroll;
|
||||
|
||||
if (isSmoothScroll) {
|
||||
NotifyPluginFrames(BEGIN_DOM);
|
||||
mAsyncScroll->InitSmoothScroll(now, mDestination, aOrigin, range, currentVelocity);
|
||||
} else {
|
||||
mAsyncScroll->Init(range);
|
||||
|
||||
@@ -379,7 +379,6 @@ public:
|
||||
// because we have special behaviour for it when APZ scrolling is active.
|
||||
mOuter->SchedulePaint();
|
||||
}
|
||||
NotifyPluginFrames(aTransforming ? BEGIN_APZ : END_APZ);
|
||||
}
|
||||
bool IsTransformingByAPZ() const {
|
||||
return mTransformingByAPZ;
|
||||
@@ -620,13 +619,6 @@ protected:
|
||||
|
||||
void CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin = nullptr);
|
||||
|
||||
/*
|
||||
* Helper that notifies plugins about async smooth scroll operations managed
|
||||
* by nsGfxScrollFrame.
|
||||
*/
|
||||
enum AsyncScrollEventType { BEGIN_DOM, BEGIN_APZ, END_DOM, END_APZ };
|
||||
void NotifyPluginFrames(AsyncScrollEventType aEvent);
|
||||
AsyncScrollEventType mAsyncScrollEvent;
|
||||
bool HasPluginFrames();
|
||||
bool HasPerspective() const;
|
||||
bool HasBgAttachmentLocal() const;
|
||||
|
||||
@@ -153,7 +153,6 @@ nsPluginFrame::nsPluginFrame(nsStyleContext* aContext)
|
||||
: nsFrame(aContext)
|
||||
, mInstanceOwner(nullptr)
|
||||
, mReflowCallbackPosted(false)
|
||||
, mIsHiddenDueToScroll(false)
|
||||
{
|
||||
MOZ_LOG(sPluginFrameLog, LogLevel::Debug,
|
||||
("Created new nsPluginFrame %p\n", this));
|
||||
@@ -418,7 +417,7 @@ nsPluginFrame::GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfi
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (XRE_IsContentProcess()) {
|
||||
configuration->mWindowID = (uintptr_t)mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
configuration->mVisible = !mIsHiddenDueToScroll && mWidget->IsVisible();
|
||||
configuration->mVisible = mWidget->IsVisible();
|
||||
|
||||
}
|
||||
#endif // defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
@@ -772,24 +771,6 @@ nsPluginFrame::IsHidden(bool aCheckVisibilityStyle) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clips windowed plugin frames during remote content scroll operations managed
|
||||
// by nsGfxScrollFrame.
|
||||
void
|
||||
nsPluginFrame::SetScrollVisibility(bool aState)
|
||||
{
|
||||
// Limit this setting to windowed plugins by checking if we have a widget
|
||||
if (mWidget) {
|
||||
bool changed = mIsHiddenDueToScroll != aState;
|
||||
mIsHiddenDueToScroll = aState;
|
||||
// Force a paint so plugin window visibility gets flushed via
|
||||
// the compositor.
|
||||
if (changed && mInstanceOwner) {
|
||||
mInstanceOwner->UpdateScrollState(mIsHiddenDueToScroll);
|
||||
SchedulePaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::LayoutDeviceIntPoint
|
||||
nsPluginFrame::GetRemoteTabChromeOffset()
|
||||
{
|
||||
@@ -1138,13 +1119,6 @@ nsPluginFrame::DidSetWidgetGeometry()
|
||||
bool
|
||||
nsPluginFrame::IsOpaque() const
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
// Insure underlying content gets painted when we clip windowed plugins
|
||||
// during remote content scroll operations managed by nsGfxScrollFrame.
|
||||
if (mIsHiddenDueToScroll) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#if defined(XP_MACOSX)
|
||||
return false;
|
||||
#elif defined(MOZ_WIDGET_ANDROID)
|
||||
@@ -1194,14 +1168,6 @@ nsPluginFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists)
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
// Clip windowed plugin frames from the list during remote content scroll
|
||||
// operations managed by nsGfxScrollFrame.
|
||||
if (mIsHiddenDueToScroll) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX why are we painting collapsed object frames?
|
||||
if (!IsVisibleOrCollapsedForPainting(aBuilder))
|
||||
return;
|
||||
|
||||
@@ -213,11 +213,6 @@ public:
|
||||
|
||||
void SetInstanceOwner(nsPluginInstanceOwner* aOwner);
|
||||
|
||||
/**
|
||||
* Helper for hiding windowed plugins during async scroll operations.
|
||||
*/
|
||||
void SetScrollVisibility(bool aState);
|
||||
|
||||
/**
|
||||
* HandleWheelEventAsDefaultAction() handles eWheel event as default action.
|
||||
* This should be called only when WantsToHandleWheelEventAsDefaultAction()
|
||||
@@ -337,10 +332,6 @@ private:
|
||||
RefPtr<nsRootPresContext> mRootPresContextRegisteredWith;
|
||||
|
||||
mozilla::UniquePtr<PluginFrameDidCompositeObserver> mDidCompositeObserver;
|
||||
|
||||
// Tracks windowed plugin visibility during scroll operations. See
|
||||
// SetScrollVisibility.
|
||||
bool mIsHiddenDueToScroll;
|
||||
};
|
||||
|
||||
class nsDisplayPlugin : public nsDisplayItem {
|
||||
|
||||
Reference in New Issue
Block a user