Fix asynchronously scrolling containerful subframes. (bug 1148582 part 6.1, r=tn)

This commit is contained in:
David Anderson 2015-06-02 16:34:46 -07:00
parent e04fb998df
commit 689e3a4a98
8 changed files with 45 additions and 8 deletions

View File

@ -734,6 +734,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.AllowVerticalScrollWithWheel());
WriteParam(aMsg, aParam.mClipRect);
WriteParam(aMsg, aParam.mIsLayersIdRoot);
WriteParam(aMsg, aParam.mUsesContainerScrolling);
WriteParam(aMsg, aParam.GetContentDescription());
}
@ -778,6 +779,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mAllowVerticalScrollWithWheel) &&
ReadParam(aMsg, aIter, &aResult->mClipRect) &&
ReadParam(aMsg, aIter, &aResult->mIsLayersIdRoot) &&
ReadParam(aMsg, aIter, &aResult->mUsesContainerScrolling) &&
ReadContentDescription(aMsg, aIter, aResult));
}
};

View File

@ -14,6 +14,7 @@
#include "mozilla/gfx/ScaleFactor.h" // for ScaleFactor
#include "mozilla/gfx/Logging.h" // for Log
#include "gfxColor.h"
#include "gfxPrefs.h" // for LayoutUseContainersForRootFrames
#include "nsString.h"
namespace IPC {
@ -68,6 +69,7 @@ public:
, mPageScrollAmount(0, 0)
, mAllowVerticalScrollWithWheel(false)
, mIsLayersIdRoot(false)
, mUsesContainerScrolling(false)
{
}
@ -102,7 +104,8 @@ public:
mPageScrollAmount == aOther.mPageScrollAmount &&
mAllowVerticalScrollWithWheel == aOther.mAllowVerticalScrollWithWheel &&
mClipRect == aOther.mClipRect &&
mIsLayersIdRoot == aOther.mIsLayersIdRoot;
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
mUsesContainerScrolling == aOther.mUsesContainerScrolling;
}
bool operator!=(const FrameMetrics& aOther) const
{
@ -534,6 +537,14 @@ public:
return mIsLayersIdRoot;
}
void SetUsesContainerScrolling(bool aValue) {
MOZ_ASSERT_IF(aValue, gfxPrefs::LayoutUseContainersForRootFrames());
mUsesContainerScrolling = aValue;
}
bool UsesContainerScrolling() const {
return mUsesContainerScrolling;
}
private:
// The pres-shell resolution that has been induced on the document containing
@ -712,6 +723,10 @@ private:
// we don't have a root scroll frame) for its layers id.
bool mIsLayersIdRoot;
// True if scrolling using containers, false otherwise. This can be removed
// when containerful scrolling is eliminated.
bool mUsesContainerScrolling;
// WARNING!!!!
//
// When adding new fields to FrameMetrics, the following places should be

View File

@ -2903,6 +2903,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
mFrameMetrics.SetPageScrollAmount(aLayerMetrics.GetPageScrollAmount());
mFrameMetrics.SetClipRect(aLayerMetrics.GetClipRect());
mFrameMetrics.SetIsLayersIdRoot(aLayerMetrics.IsLayersIdRoot());
mFrameMetrics.SetUsesContainerScrolling(aLayerMetrics.UsesContainerScrolling());
if (scrollOffsetUpdated) {
APZC_LOG("%p updating scroll offset from %s to %s\n", this,

View File

@ -633,13 +633,9 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
mLayerManager->GetCompositor()->SetScreenRenderOffset(offset);
// Transform the current local clip by this APZC's async transform. If we're
// using containerful scrolling, the layer's clip is pre-transform instead
// of post-transform, so we skip this to avoid transforming it twice.
if (asyncClip &&
!(gfxPrefs::LayoutUseContainersForRootFrames() &&
aLayer->AsContainerLayer() &&
i == 0))
{
// using containerful scrolling, then the clip is not part of the scrolled
// frame and should not be transformed.
if (asyncClip && !metrics.UsesContainerScrolling()) {
asyncClip = Some(TransformTo<ParentLayerPixel>(asyncTransform, *asyncClip));
}

View File

@ -8219,6 +8219,8 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
{
metrics.SetAllowVerticalScrollWithWheel();
}
metrics.SetUsesContainerScrolling(scrollableFrame->UsesContainerScrolling());
}
// If we have the scrollparent being the same as the scroll id, the

View File

@ -5586,3 +5586,12 @@ ScrollFrameHelper::GetSnapPointForDestination(nsIScrollableFrame::ScrollUnit aUn
}
return snapped;
}
bool
ScrollFrameHelper::UsesContainerScrolling() const
{
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
return mIsRoot;
}
return false;
}

View File

@ -359,6 +359,7 @@ public:
bool IsTransformingByAPZ() const {
return mTransformingByAPZ;
}
bool UsesContainerScrolling() const;
void ScheduleSyntheticMouseMove();
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
@ -845,6 +846,9 @@ public:
virtual void MarkScrollbarsDirtyForReflow() const override {
mHelper.MarkScrollbarsDirtyForReflow();
}
virtual bool UsesContainerScrolling() const override {
return mHelper.UsesContainerScrolling();
}
// nsIStatefulFrame
NS_IMETHOD SaveState(nsPresState** aState) override {
@ -1306,6 +1310,9 @@ public:
virtual void SetTransformingByAPZ(bool aTransforming) override {
mHelper.SetTransformingByAPZ(aTransforming);
}
virtual bool UsesContainerScrolling() const override {
return mHelper.UsesContainerScrolling();
}
bool IsTransformingByAPZ() const override {
return mHelper.IsTransformingByAPZ();
}

View File

@ -432,6 +432,11 @@ public:
virtual void SetTransformingByAPZ(bool aTransforming) = 0;
virtual bool IsTransformingByAPZ() const = 0;
/**
* Whether or not this frame uses containerful scrolling.
*/
virtual bool UsesContainerScrolling() const = 0;
};
#endif