mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Use widgets for APZ checks, rather than gfxPrefs. (bug 1162064, r=kats,mstange)
This commit is contained in:
parent
a41eaf2ebd
commit
53244f3c1b
@ -13862,7 +13862,12 @@ nsDocShell::GetAppManifestURL(nsAString& aAppManifestURL)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||
{
|
||||
*aOut = Preferences::GetBool("layers.async-pan-zoom.enabled", false);
|
||||
if (nsIPresShell* presShell = GetPresShell()) {
|
||||
*aOut = presShell->AsyncPanZoomEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aOut = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -378,9 +378,12 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
||||
new DisplayPortPropertyData(displayport, aPriority),
|
||||
nsINode::DeleteProperty<DisplayPortPropertyData>);
|
||||
|
||||
if (nsLayoutUtils::UsesAsyncScrolling() && gfxPrefs::LayoutUseContainersForRootFrames()) {
|
||||
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
|
||||
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
|
||||
if (rootScrollFrame && content == rootScrollFrame->GetContent()) {
|
||||
if (rootScrollFrame &&
|
||||
content == rootScrollFrame->GetContent() &&
|
||||
nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame))
|
||||
{
|
||||
// We are setting a root displayport for a document.
|
||||
// The pres shell needs a special flag set.
|
||||
presShell->SetIgnoreViewportScrolling(true);
|
||||
@ -861,7 +864,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
|
||||
|
||||
widget->DispatchAPZAwareEvent(&wheelEvent);
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (widget->AsyncPanZoomEnabled()) {
|
||||
// Computing overflow deltas is not compatible with APZ, so if APZ is
|
||||
// enabled, we skip testing it.
|
||||
return NS_OK;
|
||||
|
@ -293,7 +293,8 @@ TabChildBase::GetPageSize(nsCOMPtr<nsIDocument> aDocument, const CSSSize& aViewp
|
||||
bool
|
||||
TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
|
||||
{
|
||||
if (!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
nsIWidget* widget = WebWidget();
|
||||
if (!widget || !widget->AsyncPanZoomEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -899,6 +900,13 @@ TabChild::TabChild(nsIContentChild* aManager,
|
||||
, mIPCOpen(true)
|
||||
, mParentIsActive(false)
|
||||
{
|
||||
// In the general case having the TabParent tell us if APZ is enabled or not
|
||||
// doesn't really work because the TabParent itself may not have a reference
|
||||
// to the owning widget during initialization. Instead we assume that this
|
||||
// TabChild corresponds to a widget type that would have APZ enabled, and just
|
||||
// check the other conditions necessary for enabling APZ.
|
||||
mAsyncPanZoomEnabled = gfxPlatform::AsyncPanZoomEnabled();
|
||||
|
||||
// preloaded TabChild should not be added to child map
|
||||
if (mUniqueId) {
|
||||
MOZ_ASSERT(NestedTabChildMap().find(mUniqueId) == NestedTabChildMap().end());
|
||||
@ -944,7 +952,7 @@ TabChild::Observe(nsISupports *aSubject,
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (AsyncPanZoomEnabled()) {
|
||||
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsIDocument> doc(GetDocument());
|
||||
|
||||
@ -1002,7 +1010,7 @@ TabChild::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||
nsIURI *aLocation,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
if (!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (!AsyncPanZoomEnabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2037,6 +2045,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
|
||||
bool res = InitTabChildGlobal();
|
||||
ApplyShowInfo(aInfo);
|
||||
RecvParentActivated(aParentIsActive);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -2222,7 +2231,7 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId)
|
||||
{
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (AsyncPanZoomEnabled()) {
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
APZCCallbackHelper::SendSetTargetAPZCNotification(WebWidget(), document, aEvent, aGuid,
|
||||
aInputBlockId);
|
||||
@ -2232,7 +2241,7 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
||||
event.widget = mWidget;
|
||||
APZCCallbackHelper::DispatchWidgetEvent(event);
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (AsyncPanZoomEnabled()) {
|
||||
mAPZEventState->ProcessWheelEvent(event, aGuid, aInputBlockId);
|
||||
}
|
||||
return true;
|
||||
@ -2414,7 +2423,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
||||
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
|
||||
mWidget->GetDefaultScale(), GetPresShellResolution());
|
||||
|
||||
if (localEvent.message == NS_TOUCH_START && gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (localEvent.message == NS_TOUCH_START && AsyncPanZoomEnabled()) {
|
||||
if (gfxPrefs::TouchActionEnabled()) {
|
||||
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(WebWidget(),
|
||||
localEvent, aInputBlockId, mSetAllowedTouchBehaviorCallback);
|
||||
@ -2427,7 +2436,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
||||
// Dispatch event to content (potentially a long-running operation)
|
||||
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
||||
|
||||
if (!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (!AsyncPanZoomEnabled()) {
|
||||
UpdateTapState(localEvent, status);
|
||||
return true;
|
||||
}
|
||||
|
@ -508,6 +508,7 @@ public:
|
||||
{
|
||||
return mParentIsActive;
|
||||
}
|
||||
bool AsyncPanZoomEnabled() { return mAsyncPanZoomEnabled; }
|
||||
|
||||
protected:
|
||||
virtual ~TabChild();
|
||||
@ -644,6 +645,7 @@ private:
|
||||
double mDefaultScale;
|
||||
bool mIPCOpen;
|
||||
bool mParentIsActive;
|
||||
bool mAsyncPanZoomEnabled;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
||||
};
|
||||
|
@ -2813,7 +2813,7 @@ TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId,
|
||||
nsEventStatus* aOutApzResponse)
|
||||
{
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (AsyncPanZoomEnabled()) {
|
||||
if (aOutTargetGuid) {
|
||||
*aOutTargetGuid = InputAPZContext::GetTargetLayerGuid();
|
||||
|
||||
@ -2993,7 +2993,7 @@ TabParent::InjectTouchEvent(const nsAString& aType,
|
||||
NS_IMETHODIMP
|
||||
TabParent::GetUseAsyncPanZoom(bool* useAsyncPanZoom)
|
||||
{
|
||||
*useAsyncPanZoom = gfxPrefs::AsyncPanZoomEnabled();
|
||||
*useAsyncPanZoom = AsyncPanZoomEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3400,6 +3400,13 @@ TabParent::TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
|
||||
aDragAreaY = mDragAreaY;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::AsyncPanZoomEnabled() const
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
return widget && widget->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
|
||||
{
|
||||
|
@ -514,6 +514,8 @@ private:
|
||||
|
||||
CSSPoint AdjustTapToChildWidget(const CSSPoint& aPoint);
|
||||
|
||||
bool AsyncPanZoomEnabled() const;
|
||||
|
||||
// Update state prior to routing an APZ-aware event to the child process.
|
||||
// |aOutTargetGuid| will contain the identifier
|
||||
// of the APZC instance that handled the event. aOutTargetGuid may be null.
|
||||
|
@ -668,6 +668,10 @@ public:
|
||||
return mAnimationReadyTime;
|
||||
}
|
||||
|
||||
virtual bool AsyncPanZoomEnabled() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRefPtr<Layer> mRoot;
|
||||
gfx::UserData mUserData;
|
||||
|
@ -213,7 +213,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
// platforms.
|
||||
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
||||
if (mWidget && mWidget->GetOwningTabChild()) {
|
||||
mCompositorMightResample = gfxPrefs::AsyncPanZoomEnabled();
|
||||
mCompositorMightResample = AsyncPanZoomEnabled();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -782,6 +782,12 @@ ClientLayerManager::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ClientLayerManager::AsyncPanZoomEnabled() const
|
||||
{
|
||||
return mWidget && mWidget->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
ClientLayer::~ClientLayer()
|
||||
{
|
||||
if (HasShadow()) {
|
||||
|
@ -250,6 +250,9 @@ public:
|
||||
void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) { mTransactionIdAllocator = aAllocator; }
|
||||
|
||||
float RequestProperty(const nsAString& aProperty) override;
|
||||
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
|
@ -257,7 +257,7 @@ ClientTiledPaintedLayer::UseProgressiveDraw() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (ClientManager()->AsyncPanZoomEnabled()) {
|
||||
LayerMetricsWrapper scrollAncestor;
|
||||
GetAncestorLayers(&scrollAncestor, nullptr, nullptr);
|
||||
MOZ_ASSERT(scrollAncestor); // because mPaintData.mCriticalDisplayPort is non-empty
|
||||
|
@ -1329,6 +1329,12 @@ LayerComposite::SetLayerManager(LayerManagerComposite* aManager)
|
||||
mCompositor = aManager->GetCompositor();
|
||||
}
|
||||
|
||||
bool
|
||||
LayerManagerComposite::AsyncPanZoomEnabled() const
|
||||
{
|
||||
return mCompositor->GetWidget()->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
nsIntRegion
|
||||
LayerComposite::GetFullyRenderedRegion() {
|
||||
if (TiledLayerComposer* tiled = GetTiledLayerComposer()) {
|
||||
|
@ -249,6 +249,8 @@ public:
|
||||
|
||||
bool LastFrameMissedHWC() { return mLastFrameMissedHWC; }
|
||||
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
private:
|
||||
/** Region we're clipping our current drawing to. */
|
||||
nsIntRegion mClippingRegion;
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "nsDebug.h" // for NS_ASSERTION, etc
|
||||
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
||||
#include "nsIWidget.h" // for nsIWidget
|
||||
#include "nsIXULRuntime.h" // for mozilla::BrowserTabsRemoteAutostart
|
||||
#include "nsTArray.h" // for nsTArray
|
||||
#include "nsThreadUtils.h" // for NS_IsMainThread
|
||||
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
|
||||
@ -663,14 +662,9 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
|
||||
sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
|
||||
}
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled() &&
|
||||
#if !defined(MOZ_B2G) && !defined(MOZ_WIDGET_ANDROID)
|
||||
// For XUL applications (everything but B2G on mobile and desktop, and
|
||||
// Firefox on Android) we only want to use APZ when E10S is enabled. If
|
||||
// we ever get input events off the main thread we can consider relaxing
|
||||
// this requirement.
|
||||
mozilla::BrowserTabsRemoteAutostart() &&
|
||||
#endif
|
||||
// The Compositor uses the APZ pref directly since it needs to know whether
|
||||
// to attempt to create the APZ machinery at all.
|
||||
if (gfxPlatform::AsyncPanZoomEnabled() &&
|
||||
(aWidget->WindowType() == eWindowType_toplevel || aWidget->WindowType() == eWindowType_child)) {
|
||||
mApzcTreeManager = new APZCTreeManager();
|
||||
}
|
||||
|
@ -2454,7 +2454,7 @@ DetectBadApzWheelInputPrefs()
|
||||
void
|
||||
gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj)
|
||||
{
|
||||
if (!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (!gfxPlatform::AsyncPanZoomEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2472,3 +2472,17 @@ gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj)
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
gfxPlatform::AsyncPanZoomEnabled()
|
||||
{
|
||||
#if !defined(MOZ_B2G) && !defined(MOZ_WIDGET_ANDROID)
|
||||
// For XUL applications (everything but B2G on mobile and desktop, and
|
||||
// Firefox on Android) we only want to use APZ when E10S is enabled. If
|
||||
// we ever get input events off the main thread we can consider relaxing
|
||||
// this requirement.
|
||||
if (!BrowserTabsRemoteAutostart()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
|
||||
}
|
||||
|
@ -289,6 +289,8 @@ public:
|
||||
/// as different platforms may override the behaviour.
|
||||
virtual bool UseProgressivePaint() { return gfxPrefs::ProgressivePaintDoNotUseDirectly(); }
|
||||
|
||||
static bool AsyncPanZoomEnabled();
|
||||
|
||||
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
|
||||
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));
|
||||
aObj.DefineProperty("AzureSkiaAccelerated", UseAcceleratedSkiaCanvas());
|
||||
|
@ -276,7 +276,7 @@ private:
|
||||
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
|
||||
DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.async-video.enabled", AsyncVideoEnabled, bool, true);
|
||||
DECL_GFX_PREF(Once, "layers.async-video-oop.enabled", AsyncVideoOOPEnabled, bool, true);
|
||||
|
@ -47,11 +47,16 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
|
||||
|
||||
// We default to the static globals.
|
||||
bool isDiscardable = gfxPrefs::ImageMemDiscardable();
|
||||
bool doDecodeOnlyOnDraw = gfxPrefs::ImageDecodeOnlyOnDrawEnabled() &&
|
||||
gfxPrefs::AsyncPanZoomEnabled();
|
||||
bool doDecodeImmediately = gfxPrefs::ImageDecodeImmediatelyEnabled();
|
||||
bool doDownscaleDuringDecode = gfxPrefs::ImageDownscaleDuringDecodeEnabled();
|
||||
|
||||
// We use the compositor APZ pref here since we don't have a widget to test.
|
||||
// It's safe since this is an optimization, and the only platform
|
||||
// ImageDecodeOnlyOnDraw is disabled on is B2G (where APZ is enabled in all
|
||||
// widgets anyway).
|
||||
bool doDecodeOnlyOnDraw = gfxPrefs::ImageDecodeOnlyOnDrawEnabled() &&
|
||||
gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
|
||||
|
||||
// We want UI to be as snappy as possible and not to flicker. Disable
|
||||
// discarding and decode-only-on-draw for chrome URLS.
|
||||
bool isChrome = false;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "AccessibleCaretLogger.h"
|
||||
#include "AccessibleCaretManager.h"
|
||||
#include "Layers.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
@ -411,7 +412,7 @@ AccessibleCaretEventHub::Init(nsIPresShell* aPresShell)
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
mUseAsyncPanZoom = gfxPrefs::AsyncPanZoomEnabled();
|
||||
mUseAsyncPanZoom = mPresShell->AsyncPanZoomEnabled();
|
||||
#endif
|
||||
|
||||
docShell->AddWeakReflowObserver(this);
|
||||
|
@ -4885,7 +4885,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
|
||||
if ((aContainerFrame->GetStateBits() & NS_FRAME_NO_COMPONENT_ALPHA) &&
|
||||
mRetainingManager &&
|
||||
mRetainingManager->ShouldAvoidComponentAlphaLayers() &&
|
||||
!gfxPrefs::AsyncPanZoomEnabled())
|
||||
!nsLayoutUtils::AsyncPanZoomEnabled(aContainerFrame))
|
||||
{
|
||||
flattenToSingleLayer = true;
|
||||
}
|
||||
@ -4917,7 +4917,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
|
||||
mRetainingManager->ShouldAvoidComponentAlphaLayers() &&
|
||||
containerLayer->HasMultipleChildren() &&
|
||||
!flattenToSingleLayer &&
|
||||
!gfxPrefs::AsyncPanZoomEnabled())
|
||||
!nsLayoutUtils::AsyncPanZoomEnabled(aContainerFrame))
|
||||
{
|
||||
// Since we don't want any component alpha layers on BasicLayers, we repeat
|
||||
// the layer building process with this explicitely forced off.
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "mozilla/dom/TreeWalker.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "Layers.h"
|
||||
#include "TouchCaret.h"
|
||||
#include "nsFrameSelection.h"
|
||||
|
||||
@ -116,7 +117,7 @@ SelectionCarets::Init()
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
mUseAsyncPanZoom = gfxPrefs::AsyncPanZoomEnabled();
|
||||
mUseAsyncPanZoom = mPresShell->AsyncPanZoomEnabled();
|
||||
#endif
|
||||
|
||||
docShell->AddWeakReflowObserver(this);
|
||||
|
@ -635,7 +635,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
||||
mHaveScrollableDisplayPort(false),
|
||||
mWindowDraggingAllowed(false),
|
||||
mIsBuildingForPopup(nsLayoutUtils::IsPopup(aReferenceFrame)),
|
||||
mForceLayerForScrollParent(false)
|
||||
mForceLayerForScrollParent(false),
|
||||
mAsyncPanZoomEnabled(nsLayoutUtils::AsyncPanZoomEnabled(aReferenceFrame))
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayListBuilder);
|
||||
PL_InitArenaPool(&mPool, "displayListArena", 1024,
|
||||
@ -1553,7 +1554,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
|
||||
// Add metrics if there are none in the layer tree with the id (create an id
|
||||
// if there isn't one already) of the root scroll frame/root content.
|
||||
bool ensureMetricsForRootId =
|
||||
gfxPrefs::AsyncPanZoomEnabled() &&
|
||||
nsLayoutUtils::AsyncPanZoomEnabled(frame) &&
|
||||
!gfxPrefs::LayoutUseContainersForRootFrames() &&
|
||||
aBuilder->IsPaintingToWindow() &&
|
||||
!presContext->GetParentPresContext();
|
||||
@ -2333,7 +2334,7 @@ nsDisplayBackgroundImage::ShouldFixToViewport(LayerManager* aManager)
|
||||
{
|
||||
// APZ doesn't (yet) know how to scroll the visible region for these type of
|
||||
// items, so don't layerize them if it's enabled.
|
||||
if (nsLayoutUtils::UsesAsyncScrolling() ||
|
||||
if (nsLayoutUtils::UsesAsyncScrolling(mFrame) ||
|
||||
(aManager && aManager->ShouldAvoidComponentAlphaLayers())) {
|
||||
return false;
|
||||
}
|
||||
@ -4275,7 +4276,7 @@ nsDisplaySubDocument::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
// If APZ is enabled then don't allow this computation to influence
|
||||
// aVisibleRegion, on the assumption that the layer can be asynchronously
|
||||
// scrolled so we'll definitely need all the content under it.
|
||||
if (!nsLayoutUtils::UsesAsyncScrolling()) {
|
||||
if (!nsLayoutUtils::UsesAsyncScrolling(mFrame)) {
|
||||
bool snap;
|
||||
nsRect bounds = GetBounds(aBuilder, &snap);
|
||||
nsRegion removed;
|
||||
|
@ -350,8 +350,8 @@ public:
|
||||
if (mMode == PAINTING) {
|
||||
// Note: this is the only place that gets to query LayoutEventRegionsEnabled
|
||||
// 'directly' - other code should call this function.
|
||||
return (gfxPrefs::LayoutEventRegionsEnabledDoNotUseDirectly() ||
|
||||
gfxPrefs::AsyncPanZoomEnabled());
|
||||
return gfxPrefs::LayoutEventRegionsEnabledDoNotUseDirectly() ||
|
||||
mAsyncPanZoomEnabled;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -996,6 +996,7 @@ private:
|
||||
bool mWindowDraggingAllowed;
|
||||
bool mIsBuildingForPopup;
|
||||
bool mForceLayerForScrollParent;
|
||||
bool mAsyncPanZoomEnabled;
|
||||
};
|
||||
|
||||
class nsDisplayItem;
|
||||
|
@ -1368,6 +1368,12 @@ public:
|
||||
*/
|
||||
virtual LayerManager* GetLayerManager() = 0;
|
||||
|
||||
/**
|
||||
* Return true iff there is a widget rendering this presShell and that
|
||||
* widget is APZ-enabled.
|
||||
*/
|
||||
virtual bool AsyncPanZoomEnabled() = 0;
|
||||
|
||||
/**
|
||||
* Track whether we're ignoring viewport scrolling for the purposes
|
||||
* of painting. If we are ignoring, then layers aren't clipped to
|
||||
|
@ -815,6 +815,34 @@ ApplyRectMultiplier(nsRect aRect, float aMultiplier)
|
||||
return nsRect(ceil(newX), ceil(newY), floor(newWidth), floor(newHeight));
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::UsesAsyncScrolling(nsIFrame* aFrame)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// We always have async scrolling for android
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return AsyncPanZoomEnabled(aFrame);
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::AsyncPanZoomEnabled(nsIFrame* aFrame)
|
||||
{
|
||||
// We use this as a shortcut, since if the compositor will never use APZ,
|
||||
// no widget will either.
|
||||
if (!gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIFrame *frame = nsLayoutUtils::GetDisplayRootFrame(aFrame);
|
||||
nsIWidget* widget = frame->GetNearestWidget();
|
||||
if (!widget) {
|
||||
return false;
|
||||
}
|
||||
return widget->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
// Return the maximum displayport size, based on the LayerManager's maximum
|
||||
// supported texture size. The result is in app units.
|
||||
static nscoord
|
||||
@ -1093,9 +1121,12 @@ nsLayoutUtils::SetDisplayPortMargins(nsIContent* aContent,
|
||||
aMargins, aPriority),
|
||||
nsINode::DeleteProperty<DisplayPortMarginsPropertyData>);
|
||||
|
||||
if (nsLayoutUtils::UsesAsyncScrolling() && gfxPrefs::LayoutUseContainersForRootFrames()) {
|
||||
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
|
||||
nsIFrame* rootScrollFrame = aPresShell->GetRootScrollFrame();
|
||||
if (rootScrollFrame && aContent == rootScrollFrame->GetContent()) {
|
||||
if (rootScrollFrame &&
|
||||
aContent == rootScrollFrame->GetContent() &&
|
||||
nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame))
|
||||
{
|
||||
// We are setting a root displayport for a document.
|
||||
// If we have APZ, then set a special flag on the pres shell so
|
||||
// that we don't get scrollbars drawn.
|
||||
@ -2987,7 +3018,7 @@ nsLayoutUtils::GetOrMaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
|
||||
// Note: we only do this in processes where we do subframe scrolling to
|
||||
// begin with (i.e., not in the parent process on B2G).
|
||||
if (aBuilder.IsPaintingToWindow() &&
|
||||
gfxPrefs::AsyncPanZoomEnabled() &&
|
||||
nsLayoutUtils::AsyncPanZoomEnabled(aScrollFrame) &&
|
||||
!aBuilder.HaveScrollableDisplayPort() &&
|
||||
scrollableFrame->WantAsyncScroll()) {
|
||||
|
||||
@ -7838,17 +7869,6 @@ nsLayoutUtils::CalculateExpandedScrollableRect(nsIFrame* aFrame)
|
||||
return scrollableRect;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsLayoutUtils::UsesAsyncScrolling()
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// We always have async scrolling for android
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return gfxPrefs::AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutUtils::DoLogTestDataForPaint(LayerManager* aManager,
|
||||
ViewID aScrollId,
|
||||
|
@ -2529,10 +2529,16 @@ public:
|
||||
CalculateExpandedScrollableRect(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Returns true if we're using asynchronous scrolling (either through
|
||||
* APZ or the android frontend).
|
||||
* Returns true if the widget owning the given frame uses asynchronous
|
||||
* scrolling.
|
||||
*/
|
||||
static bool UsesAsyncScrolling();
|
||||
static bool UsesAsyncScrolling(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Returns true if the widget owning the given frame has builtin APZ support
|
||||
* enabled.
|
||||
*/
|
||||
static bool AsyncPanZoomEnabled(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Log a key/value pair for APZ testing during a paint.
|
||||
|
@ -5558,6 +5558,18 @@ LayerManager* PresShell::GetLayerManager()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PresShell::AsyncPanZoomEnabled()
|
||||
{
|
||||
NS_ASSERTION(mViewManager, "Should have view manager");
|
||||
nsView* rootView = mViewManager->GetRootView();
|
||||
if (rootView) {
|
||||
if (nsIWidget* widget = rootView->GetWidget()) {
|
||||
return widget->AsyncPanZoomEnabled();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PresShell::SetIgnoreViewportScrolling(bool aIgnore)
|
||||
{
|
||||
if (IgnoringViewportScrolling() == aIgnore) {
|
||||
@ -11053,10 +11065,10 @@ nsIPresShell::RecomputeFontSizeInflationEnabled()
|
||||
|
||||
// Force-enabling font inflation always trumps the heuristics here.
|
||||
if (!FontSizeInflationForceEnabled()) {
|
||||
if (TabChild::GetFrom(this)) {
|
||||
if (TabChild* tab = TabChild::GetFrom(this)) {
|
||||
// We're in a child process. Cancel inflation if we're not
|
||||
// async-pan zoomed.
|
||||
if (!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (!tab->AsyncPanZoomEnabled()) {
|
||||
mFontSizeInflationEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
@ -198,6 +198,8 @@ public:
|
||||
|
||||
virtual LayerManager* GetLayerManager() override;
|
||||
|
||||
virtual bool AsyncPanZoomEnabled() override;
|
||||
|
||||
virtual void SetIgnoreViewportScrolling(bool aIgnore) override;
|
||||
|
||||
virtual nsresult SetResolution(float aResolution) override {
|
||||
|
@ -1826,7 +1826,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
|
||||
|
||||
if (IsAlwaysActive() &&
|
||||
gfxPrefs::LayersTilesEnabled() &&
|
||||
!nsLayoutUtils::UsesAsyncScrolling() &&
|
||||
!nsLayoutUtils::UsesAsyncScrolling(mOuter) &&
|
||||
mOuter->GetContent()) {
|
||||
// If we have tiling but no APZ, then set a 0-margin display port on
|
||||
// active scroll containers so that we paint by whole tile increments
|
||||
@ -2030,7 +2030,7 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
mAsyncScroll = nullptr;
|
||||
}
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
|
||||
// The animation will be handled in the compositor, pass the
|
||||
// information needed to start the animation and skip the main-thread
|
||||
// animation for this scroll.
|
||||
@ -2914,7 +2914,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
shouldBuildLayer = true;
|
||||
} else {
|
||||
shouldBuildLayer =
|
||||
gfxPrefs::AsyncPanZoomEnabled() &&
|
||||
nsLayoutUtils::AsyncPanZoomEnabled(mOuter) &&
|
||||
WantAsyncScroll() &&
|
||||
// If we are using containers for root frames, and we are the root
|
||||
// scroll frame for the display root, then we don't need a scroll
|
||||
@ -3085,7 +3085,7 @@ ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer,
|
||||
parentLayerClip = Some(clip);
|
||||
}
|
||||
|
||||
bool thisScrollFrameUsesAsyncScrolling = nsLayoutUtils::UsesAsyncScrolling();
|
||||
bool thisScrollFrameUsesAsyncScrolling = nsLayoutUtils::UsesAsyncScrolling(mOuter);
|
||||
#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ)
|
||||
// Android without apzc (aka the java pan zoom code) only uses async scrolling
|
||||
// for the root scroll frame of the root content document.
|
||||
@ -3403,7 +3403,8 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta,
|
||||
}
|
||||
|
||||
if (aUnit == nsIScrollableFrame::DEVICE_PIXELS &&
|
||||
!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
!nsLayoutUtils::AsyncPanZoomEnabled(mOuter))
|
||||
{
|
||||
// When APZ is disabled, we must track the velocity
|
||||
// on the main thread; otherwise, the APZC will manage this.
|
||||
mVelocityQueue.Sample(GetScrollPosition());
|
||||
|
@ -299,6 +299,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
|
||||
, mFrameLoader(aFrameLoader)
|
||||
, mFrameLoaderDestroyed(false)
|
||||
, mBackgroundColor(gfxRGBA(1, 1, 1))
|
||||
, mAsyncPanZoomEnabled(false)
|
||||
{
|
||||
*aSuccess = false;
|
||||
if (!mFrameLoader) {
|
||||
@ -308,6 +309,9 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
|
||||
*aId = 0;
|
||||
|
||||
nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
|
||||
|
||||
mAsyncPanZoomEnabled = lm && lm->AsyncPanZoomEnabled();
|
||||
|
||||
// Perhaps the document containing this frame currently has no presentation?
|
||||
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
||||
*aTextureFactoryIdentifier =
|
||||
@ -325,7 +329,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
|
||||
static_cast<ClientLayerManager*>(lm.get());
|
||||
clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
|
||||
}
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (mAsyncPanZoomEnabled) {
|
||||
mContentController = new RemoteContentController(this);
|
||||
CompositorParent::SetControllerForLayerTree(mLayersId, mContentController);
|
||||
}
|
||||
@ -346,7 +350,7 @@ RenderFrameParent::GetApzcTreeManager()
|
||||
// created and the static getter knows which CompositorParent is
|
||||
// instantiated with this layers ID. That's why try to fetch it when
|
||||
// we first need it and cache the result.
|
||||
if (!mApzcTreeManager && gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (!mApzcTreeManager && mAsyncPanZoomEnabled) {
|
||||
mApzcTreeManager = CompositorParent::GetAPZCTreeManager(mLayersId);
|
||||
}
|
||||
return mApzcTreeManager.get();
|
||||
|
@ -151,6 +151,8 @@ private:
|
||||
gfxRGBA mBackgroundColor;
|
||||
|
||||
nsRegion mTouchRegion;
|
||||
|
||||
bool mAsyncPanZoomEnabled;
|
||||
};
|
||||
|
||||
} // namespace layout
|
||||
|
@ -745,7 +745,7 @@ function BuildConditionSandbox(aURL) {
|
||||
sandbox.Mulet = gB2GisMulet;
|
||||
|
||||
try {
|
||||
sandbox.asyncPanZoom = prefs.getBoolPref("layers.async-pan-zoom.enabled");
|
||||
sandbox.asyncPanZoom = gContainingWindow.document.docShell.asyncPanZoomEnabled;
|
||||
} catch (e) {
|
||||
sandbox.asyncPanZoom = false;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ PuppetWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
|
||||
nsEventStatus
|
||||
PuppetWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
|
||||
{
|
||||
if (!gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
if (!AsyncPanZoomEnabled()) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
DispatchEvent(aEvent, status);
|
||||
return status;
|
||||
@ -483,6 +483,12 @@ PuppetWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PuppetWidget::AsyncPanZoomEnabled() const
|
||||
{
|
||||
return mTabChild && mTabChild->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
|
||||
const mozilla::WidgetKeyboardEvent& aEvent,
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
nsEventStatus DispatchInputEvent(WidgetInputEvent* aEvent) override;
|
||||
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
|
||||
bool aDoCapture) override
|
||||
|
@ -1010,6 +1010,12 @@ nsBaseWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||
mAPZC.get(), setTargetApzcFunc, aInputBlockId, mozilla::Move(aTargets)));
|
||||
}
|
||||
|
||||
bool
|
||||
nsBaseWidget::AsyncPanZoomEnabled() const
|
||||
{
|
||||
return !!mAPZC;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
@ -243,6 +243,8 @@ public:
|
||||
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
||||
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
void NotifyWindowDestroyed();
|
||||
void NotifySizeMoveDone();
|
||||
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
||||
|
@ -1820,6 +1820,11 @@ class nsIWidget : public nsISupports {
|
||||
virtual void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||
const nsTArray<mozilla::layers::ScrollableLayerGuid>& aTargets) const = 0;
|
||||
|
||||
/**
|
||||
* Returns true if APZ is in use, false otherwise.
|
||||
*/
|
||||
virtual bool AsyncPanZoomEnabled() const = 0;
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user