Back out 530555a2d6d4 (bug 1162064) for debug b2g emulator assertions and failure to thrive

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2015-05-17 22:42:05 -07:00
parent b17f382917
commit 881f3ba8cc
34 changed files with 69 additions and 199 deletions

View File

@ -13858,14 +13858,7 @@ nsDocShell::GetAppManifestURL(nsAString& aAppManifestURL)
NS_IMETHODIMP
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
{
if (nsIPresShell* presShell = GetPresShell()) {
if (layers::LayerManager* lm = presShell->GetLayerManager()) {
*aOut = lm->AsyncPanZoomEnabled();
return NS_OK;
}
}
*aOut = false;
*aOut = Preferences::GetBool("layers.async-pan-zoom.enabled", false);
return NS_OK;
}

View File

@ -375,12 +375,9 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
new DisplayPortPropertyData(displayport, aPriority),
nsINode::DeleteProperty<DisplayPortPropertyData>);
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
if (nsLayoutUtils::UsesAsyncScrolling() && gfxPrefs::LayoutUseContainersForRootFrames()) {
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
if (rootScrollFrame &&
content == rootScrollFrame->GetContent() &&
nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame))
{
if (rootScrollFrame && content == rootScrollFrame->GetContent()) {
// We are setting a root displayport for a document.
// The pres shell needs a special flag set.
presShell->SetIgnoreViewportScrolling(true);
@ -861,7 +858,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
widget->DispatchAPZAwareEvent(&wheelEvent);
if (widget->AsyncPanZoomEnabled()) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
// Computing overflow deltas is not compatible with APZ, so if APZ is
// enabled, we skip testing it.
return NS_OK;

View File

@ -515,8 +515,7 @@ parent:
sync GetRenderFrameInfo(PRenderFrame aRenderFrame)
returns (TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId,
bool asyncPanZoomEnabled);
uint64_t layersId);
/**
* Sent by the child to the parent to inform it that an update to the
@ -546,8 +545,7 @@ child:
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId,
nullable PRenderFrame renderFrame,
bool parentIsActive,
bool asyncPanZoomEnabled);
bool parentIsActive);
LoadURL(nsCString uri, BrowserConfiguration config);

View File

@ -268,8 +268,7 @@ CSSToParentLayerScale ConvertScaleForRoot(CSSToScreenScale aScale) {
bool
TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
{
nsIWidget* widget = WebWidget();
if (!widget || !widget->AsyncPanZoomEnabled()) {
if (!gfxPrefs::AsyncPanZoomEnabled()) {
return false;
}
@ -876,7 +875,6 @@ TabChild::TabChild(nsIContentChild* aManager,
, mDefaultScale(0)
, mIPCOpen(true)
, mParentIsActive(false)
, mAsyncPanZoomEnabled(false)
{
// preloaded TabChild should not be added to child map
if (mUniqueId) {
@ -923,7 +921,7 @@ TabChild::Observe(nsISupports *aSubject,
}
}
} else if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
if (AsyncPanZoomEnabled()) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
nsCOMPtr<nsIDocument> doc(GetDocument());
@ -981,7 +979,7 @@ TabChild::OnLocationChange(nsIWebProgress* aWebProgress,
nsIURI *aLocation,
uint32_t aFlags)
{
if (!AsyncPanZoomEnabled()) {
if (!gfxPrefs::AsyncPanZoomEnabled()) {
return NS_OK;
}
@ -1539,11 +1537,9 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
TextureFactoryIdentifier textureFactoryIdentifier;
uint64_t layersId = 0;
PRenderFrameChild* renderFrame = newChild->SendPRenderFrameConstructor();
bool asyncPanZoomEnabled = false;
newChild->SendGetRenderFrameInfo(renderFrame,
&textureFactoryIdentifier,
&layersId,
&asyncPanZoomEnabled);
&layersId);
if (layersId == 0) { // if renderFrame is invalid.
PRenderFrameChild::Send__delete__(renderFrame);
renderFrame = nullptr;
@ -1551,8 +1547,7 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
// Unfortunately we don't get a window unless we've shown the frame. That's
// pretty bogus; see bug 763602.
newChild->DoFakeShow(textureFactoryIdentifier, layersId, renderFrame,
asyncPanZoomEnabled);
newChild->DoFakeShow(textureFactoryIdentifier, layersId, renderFrame);
for (size_t i = 0; i < frameScripts.Length(); i++) {
FrameScriptInfo& info = frameScripts[i];
@ -1880,12 +1875,11 @@ TabChild::CancelCachedFileDescriptorCallback(
void
TabChild::DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
bool aAsyncPanZoomEnabled)
PRenderFrameChild* aRenderFrame)
{
ShowInfo info(EmptyString(), false, false, 0, 0);
RecvShow(ScreenIntSize(0, 0), info, aTextureFactoryIdentifier,
aLayersId, aRenderFrame, mParentIsActive, aAsyncPanZoomEnabled);
aLayersId, aRenderFrame, mParentIsActive);
mDidFakeShow = true;
}
@ -1987,8 +1981,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
const bool& aParentIsActive,
const bool& aAsyncPanZoomEnabled)
const bool& aParentIsActive)
{
MOZ_ASSERT((!mDidFakeShow && aRenderFrame) || (mDidFakeShow && !aRenderFrame));
@ -2021,8 +2014,6 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
bool res = InitTabChildGlobal();
ApplyShowInfo(aInfo);
RecvParentActivated(aParentIsActive);
mAsyncPanZoomEnabled = aAsyncPanZoomEnabled;
return res;
}
@ -2208,7 +2199,7 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId)
{
if (AsyncPanZoomEnabled()) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
nsCOMPtr<nsIDocument> document(GetDocument());
APZCCallbackHelper::SendSetTargetAPZCNotification(WebWidget(), document, aEvent, aGuid,
aInputBlockId);
@ -2218,7 +2209,7 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
event.widget = mWidget;
APZCCallbackHelper::DispatchWidgetEvent(event);
if (AsyncPanZoomEnabled()) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
mAPZEventState->ProcessWheelEvent(event, aGuid, aInputBlockId);
}
return true;
@ -2400,7 +2391,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
mWidget->GetDefaultScale(), GetPresShellResolution());
if (localEvent.message == NS_TOUCH_START && AsyncPanZoomEnabled()) {
if (localEvent.message == NS_TOUCH_START && gfxPrefs::AsyncPanZoomEnabled()) {
if (gfxPrefs::TouchActionEnabled()) {
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(WebWidget(),
localEvent, aInputBlockId, mSetAllowedTouchBehaviorCallback);
@ -2413,7 +2404,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
// Dispatch event to content (potentially a long-running operation)
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
if (!AsyncPanZoomEnabled()) {
if (!gfxPrefs::AsyncPanZoomEnabled()) {
UpdateTapState(localEvent, status);
return true;
}

View File

@ -319,8 +319,7 @@ public:
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
const bool& aParentIsActive,
const bool& aAsyncPanZoomEnabled) override;
const bool& aParentIsActive) override;
virtual bool RecvUpdateDimensions(const nsIntRect& rect,
const ScreenIntSize& size,
const ScreenOrientation& orientation,
@ -505,7 +504,6 @@ public:
{
return mParentIsActive;
}
bool AsyncPanZoomEnabled() { return mAsyncPanZoomEnabled; }
protected:
virtual ~TabChild();
@ -562,8 +560,7 @@ private:
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
void DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
bool aAsyncPanZoomEnabled);
PRenderFrameChild* aRenderFrame);
void ApplyShowInfo(const ShowInfo& aInfo);
@ -643,7 +640,6 @@ private:
double mDefaultScale;
bool mIPCOpen;
bool mParentIsActive;
bool mAsyncPanZoomEnabled;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

View File

@ -888,8 +888,7 @@ TabParent::Show(const ScreenIntSize& size, bool aParentIsActive)
}
unused << SendShow(size, info, textureFactoryIdentifier,
layersId, renderFrame, aParentIsActive,
AsyncPanZoomEnabled());
layersId, renderFrame, aParentIsActive);
}
bool
@ -2649,15 +2648,12 @@ TabParent::DeallocPRenderFrameParent(PRenderFrameParent* aFrame)
bool
TabParent::RecvGetRenderFrameInfo(PRenderFrameParent* aRenderFrame,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
bool* aAsyncPanZoomEnabled)
uint64_t* aLayersId)
{
RenderFrameParent* renderFrame = static_cast<RenderFrameParent*>(aRenderFrame);
renderFrame->GetTextureFactoryIdentifier(aTextureFactoryIdentifier);
*aLayersId = renderFrame->GetLayersId();
*aAsyncPanZoomEnabled = AsyncPanZoomEnabled();
if (mNeedLayerTreeReadyNotification) {
RequestNotifyLayerTreeReady();
mNeedLayerTreeReadyNotification = false;
@ -2735,7 +2731,7 @@ TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId,
nsEventStatus* aOutApzResponse)
{
if (AsyncPanZoomEnabled()) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
if (aOutTargetGuid) {
*aOutTargetGuid = InputAPZContext::GetTargetLayerGuid();
@ -2915,7 +2911,7 @@ TabParent::InjectTouchEvent(const nsAString& aType,
NS_IMETHODIMP
TabParent::GetUseAsyncPanZoom(bool* useAsyncPanZoom)
{
*useAsyncPanZoom = AsyncPanZoomEnabled();
*useAsyncPanZoom = gfxPrefs::AsyncPanZoomEnabled();
return NS_OK;
}
@ -3322,13 +3318,6 @@ 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)
{

View File

@ -448,8 +448,7 @@ protected:
virtual bool RecvGetRenderFrameInfo(PRenderFrameParent* aRenderFrame,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId,
bool* aAsyncPanZoomEnabled) override;
uint64_t* aLayersId) override;
virtual bool RecvSetDimensions(const uint32_t& aFlags,
const int32_t& aX, const int32_t& aY,
@ -501,8 +500,6 @@ 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.

View File

@ -669,10 +669,6 @@ public:
return mAnimationReadyTime;
}
virtual bool AsyncPanZoomEnabled() const {
return false;
}
protected:
nsRefPtr<Layer> mRoot;
gfx::UserData mUserData;

View File

@ -213,7 +213,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
// platforms.
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
if (mWidget && mWidget->GetOwningTabChild()) {
mCompositorMightResample = AsyncPanZoomEnabled();
mCompositorMightResample = gfxPrefs::AsyncPanZoomEnabled();
}
#endif
@ -782,12 +782,6 @@ ClientLayerManager::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
#endif
}
bool
ClientLayerManager::AsyncPanZoomEnabled() const
{
return mWidget && mWidget->AsyncPanZoomEnabled();
}
ClientLayer::~ClientLayer()
{
if (HasShadow()) {

View File

@ -250,9 +250,6 @@ 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

View File

@ -257,7 +257,7 @@ ClientTiledPaintedLayer::UseProgressiveDraw() {
return false;
}
if (ClientManager()->AsyncPanZoomEnabled()) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
LayerMetricsWrapper scrollAncestor;
GetAncestorLayers(&scrollAncestor, nullptr, nullptr);
MOZ_ASSERT(scrollAncestor); // because mPaintData.mCriticalDisplayPort is non-empty

View File

@ -1329,12 +1329,6 @@ LayerComposite::SetLayerManager(LayerManagerComposite* aManager)
mCompositor = aManager->GetCompositor();
}
bool
LayerManagerComposite::AsyncPanZoomEnabled() const
{
return mCompositor->GetWidget()->AsyncPanZoomEnabled();
}
nsIntRegion
LayerComposite::GetFullyRenderedRegion() {
if (TiledLayerComposer* tiled = GetTiledLayerComposer()) {

View File

@ -249,8 +249,6 @@ public:
bool LastFrameMissedHWC() { return mLastFrameMissedHWC; }
bool AsyncPanZoomEnabled() const override;
private:
/** Region we're clipping our current drawing to. */
nsIntRegion mClippingRegion;

View File

@ -662,9 +662,7 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
}
// The Compositor uses the APZ pref directly since it needs to know whether
// to attempt to create the APZ machinery at all.
if (gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly() &&
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

View File

@ -2444,9 +2444,7 @@ DetectBadApzWheelInputPrefs()
void
gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj)
{
// This is only a diagnostic so we use the low-level pref to see whether
// C++ APZ is enabled at all.
if (!gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly()) {
if (!gfxPrefs::AsyncPanZoomEnabled()) {
return;
}

View File

@ -269,7 +269,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", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabled, bool, false);
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);

View File

@ -47,16 +47,11 @@ 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;

View File

@ -8,7 +8,6 @@
#include "AccessibleCaretLogger.h"
#include "AccessibleCaretManager.h"
#include "Layers.h"
#include "gfxPrefs.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/TextEvents.h"
@ -412,9 +411,7 @@ AccessibleCaretEventHub::Init(nsIPresShell* aPresShell)
}
#if defined(MOZ_WIDGET_GONK)
if (layers::LayerManager* lm = mPresShell->GetLayerManager()) {
mUseAsyncPanZoom = lm->AsyncPanZoomEnabled();
}
mUseAsyncPanZoom = gfxPrefs::AsyncPanZoomEnabled();
#endif
docShell->AddWeakReflowObserver(this);

View File

@ -4751,7 +4751,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
if ((aContainerFrame->GetStateBits() & NS_FRAME_NO_COMPONENT_ALPHA) &&
mRetainingManager &&
mRetainingManager->ShouldAvoidComponentAlphaLayers() &&
!nsLayoutUtils::AsyncPanZoomEnabled(aContainerFrame))
!gfxPrefs::AsyncPanZoomEnabled())
{
flattenToSingleLayer = true;
}
@ -4783,7 +4783,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
mRetainingManager->ShouldAvoidComponentAlphaLayers() &&
containerLayer->HasMultipleChildren() &&
!flattenToSingleLayer &&
!nsLayoutUtils::AsyncPanZoomEnabled(aContainerFrame))
!gfxPrefs::AsyncPanZoomEnabled())
{
// Since we don't want any component alpha layers on BasicLayers, we repeat
// the layer building process with this explicitely forced off.

View File

@ -33,7 +33,6 @@
#include "mozilla/dom/TreeWalker.h"
#include "mozilla/Preferences.h"
#include "mozilla/TouchEvents.h"
#include "Layers.h"
#include "TouchCaret.h"
#include "nsFrameSelection.h"
@ -117,9 +116,7 @@ SelectionCarets::Init()
}
#if defined(MOZ_WIDGET_GONK)
if (layers::LayerManager* lm = mPresShell->GetLayerManager()) {
mUseAsyncPanZoom = lm->AsyncPanZoomEnabled();
}
mUseAsyncPanZoom = gfxPrefs::AsyncPanZoomEnabled();
#endif
docShell->AddWeakReflowObserver(this);

View File

@ -634,8 +634,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mHaveScrollableDisplayPort(false),
mWindowDraggingAllowed(false),
mIsBuildingForPopup(nsLayoutUtils::IsPopup(aReferenceFrame)),
mForceLayerForScrollParent(false),
mAsyncPanZoomEnabled(nsLayoutUtils::AsyncPanZoomEnabled(aReferenceFrame))
mForceLayerForScrollParent(false)
{
MOZ_COUNT_CTOR(nsDisplayListBuilder);
PL_InitArenaPool(&mPool, "displayListArena", 1024,
@ -2285,7 +2284,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(mFrame) ||
if (nsLayoutUtils::UsesAsyncScrolling() ||
(aManager && aManager->ShouldAvoidComponentAlphaLayers())) {
return false;
}
@ -4210,7 +4209,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(mFrame)) {
if (!nsLayoutUtils::UsesAsyncScrolling()) {
bool snap;
nsRect bounds = GetBounds(aBuilder, &snap);
nsRegion removed;

View File

@ -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() ||
mAsyncPanZoomEnabled;
return (gfxPrefs::LayoutEventRegionsEnabledDoNotUseDirectly() ||
gfxPrefs::AsyncPanZoomEnabled());
}
return false;
}
@ -976,7 +976,6 @@ private:
bool mWindowDraggingAllowed;
bool mIsBuildingForPopup;
bool mForceLayerForScrollParent;
bool mAsyncPanZoomEnabled;
};
class nsDisplayItem;

View File

@ -814,34 +814,6 @@ 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
@ -1113,12 +1085,9 @@ nsLayoutUtils::SetDisplayPortMargins(nsIContent* aContent,
aMargins, aPriority),
nsINode::DeleteProperty<DisplayPortMarginsPropertyData>);
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
if (nsLayoutUtils::UsesAsyncScrolling() && gfxPrefs::LayoutUseContainersForRootFrames()) {
nsIFrame* rootScrollFrame = aPresShell->GetRootScrollFrame();
if (rootScrollFrame &&
aContent == rootScrollFrame->GetContent() &&
nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame))
{
if (rootScrollFrame && aContent == rootScrollFrame->GetContent()) {
// 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.
@ -3006,7 +2975,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() &&
nsLayoutUtils::AsyncPanZoomEnabled(aScrollFrame) &&
gfxPrefs::AsyncPanZoomEnabled() &&
!aBuilder.HaveScrollableDisplayPort() &&
scrollableFrame->WantAsyncScroll()) {
@ -7853,6 +7822,17 @@ 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,

View File

@ -2514,16 +2514,10 @@ public:
CalculateExpandedScrollableRect(nsIFrame* aFrame);
/**
* Returns true if the widget owning the given frame uses asynchronous
* scrolling.
* Returns true if we're using asynchronous scrolling (either through
* APZ or the android frontend).
*/
static bool UsesAsyncScrolling(nsIFrame* aFrame);
/**
* Returns true if the widget owning the given frame has builtin APZ support
* enabled.
*/
static bool AsyncPanZoomEnabled(nsIFrame* aFrame);
static bool UsesAsyncScrolling();
/**
* Log a key/value pair for APZ testing during a paint.

View File

@ -11041,10 +11041,10 @@ nsIPresShell::RecomputeFontSizeInflationEnabled()
// Force-enabling font inflation always trumps the heuristics here.
if (!FontSizeInflationForceEnabled()) {
if (TabChild* tab = TabChild::GetFrom(this)) {
if (TabChild::GetFrom(this)) {
// We're in a child process. Cancel inflation if we're not
// async-pan zoomed.
if (!tab->AsyncPanZoomEnabled()) {
if (!gfxPrefs::AsyncPanZoomEnabled()) {
mFontSizeInflationEnabled = false;
return;
}

View File

@ -1824,7 +1824,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter,
if (IsAlwaysActive() &&
gfxPrefs::LayersTilesEnabled() &&
!nsLayoutUtils::UsesAsyncScrolling(mOuter) &&
!nsLayoutUtils::UsesAsyncScrolling() &&
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
@ -2028,7 +2028,7 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
mAsyncScroll = nullptr;
}
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
// 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.
@ -2909,7 +2909,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
shouldBuildLayer = true;
} else {
shouldBuildLayer =
nsLayoutUtils::AsyncPanZoomEnabled(mOuter) &&
gfxPrefs::AsyncPanZoomEnabled() &&
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
@ -3051,7 +3051,7 @@ ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer,
// above the first one on a given layer. They will be applied by the
// compositor instead, with async transforms for the scrollframes interspersed
// between them.
bool omitClip = nsLayoutUtils::AsyncPanZoomEnabled(mOuter) && aOutput->Length() > 0;
bool omitClip = gfxPrefs::AsyncPanZoomEnabled() && aOutput->Length() > 0;
if (!omitClip && (!gfxPrefs::LayoutUseContainersForRootFrames() || mAddClipRectToLayer)) {
nsRect clip = nsRect(mScrollPort.TopLeft() + toReferenceFrame,
nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter));
@ -3355,8 +3355,7 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta,
}
if (aUnit == nsIScrollableFrame::DEVICE_PIXELS &&
!nsLayoutUtils::AsyncPanZoomEnabled(mOuter))
{
!gfxPrefs::AsyncPanZoomEnabled()) {
// When APZ is disabled, we must track the velocity
// on the main thread; otherwise, the APZC will manage this.
mVelocityQueue.Sample(GetScrollPosition());

View File

@ -299,7 +299,6 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
, mFrameLoader(aFrameLoader)
, mFrameLoaderDestroyed(false)
, mBackgroundColor(gfxRGBA(1, 1, 1))
, mAsyncPanZoomEnabled(false)
{
*aSuccess = false;
if (!mFrameLoader) {
@ -309,9 +308,6 @@ 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 =
@ -329,7 +325,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
static_cast<ClientLayerManager*>(lm.get());
clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
}
if (mAsyncPanZoomEnabled) {
if (gfxPrefs::AsyncPanZoomEnabled()) {
mContentController = new RemoteContentController(this);
CompositorParent::SetControllerForLayerTree(mLayersId, mContentController);
}
@ -350,7 +346,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 && mAsyncPanZoomEnabled) {
if (!mApzcTreeManager && gfxPrefs::AsyncPanZoomEnabled()) {
mApzcTreeManager = CompositorParent::GetAPZCTreeManager(mLayersId);
}
return mApzcTreeManager.get();

View File

@ -151,8 +151,6 @@ private:
gfxRGBA mBackgroundColor;
nsRegion mTouchRegion;
bool mAsyncPanZoomEnabled;
};
} // namespace layout

View File

@ -744,7 +744,7 @@ function BuildConditionSandbox(aURL) {
sandbox.Mulet = gB2GisMulet;
try {
sandbox.asyncPanZoom = gContainingWindow.document.docShell.asyncPanZoomEnabled;
sandbox.asyncPanZoom = prefs.getBoolPref("layers.async-pan-zoom.enabled");
} catch (e) {
sandbox.asyncPanZoom = false;
}

View File

@ -354,7 +354,7 @@ PuppetWidget::DispatchInputEvent(WidgetInputEvent* aEvent)
nsEventStatus
PuppetWidget::DispatchAPZAwareEvent(WidgetInputEvent* aEvent)
{
if (!AsyncPanZoomEnabled()) {
if (!gfxPrefs::AsyncPanZoomEnabled()) {
nsEventStatus status = nsEventStatus_eIgnore;
DispatchEvent(aEvent, status);
return status;
@ -493,12 +493,6 @@ PuppetWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
}
}
bool
PuppetWidget::AsyncPanZoomEnabled() const
{
return mTabChild && mTabChild->AsyncPanZoomEnabled();
}
NS_IMETHODIMP_(bool)
PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
const mozilla::WidgetKeyboardEvent& aEvent,

View File

@ -135,7 +135,6 @@ 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

View File

@ -1007,12 +1007,6 @@ 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,

View File

@ -242,8 +242,6 @@ 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);

View File

@ -1807,11 +1807,6 @@ 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)
*