Bug 951793 - Store the overscroll behavior in ScrollMetadata and propagate it to APZ. r=mstange

MozReview-Commit-ID: J7Vkd941QxK
This commit is contained in:
Botond Ballo
2017-10-18 20:13:19 -04:00
parent d27f700e8a
commit 6d31fe7d6b
6 changed files with 108 additions and 2 deletions

View File

@@ -6,6 +6,7 @@
#include "FrameMetrics.h"
#include "gfxPrefs.h"
#include "nsStyleConsts.h"
namespace mozilla {
namespace layers {
@@ -18,6 +19,31 @@ ScrollMetadata::SetUsesContainerScrolling(bool aValue) {
mUsesContainerScrolling = aValue;
}
static OverscrollBehavior
ToOverscrollBehavior(StyleOverscrollBehavior aBehavior)
{
switch (aBehavior) {
case StyleOverscrollBehavior::Auto:
return OverscrollBehavior::Auto;
case StyleOverscrollBehavior::Contain:
return OverscrollBehavior::Contain;
case StyleOverscrollBehavior::None:
return OverscrollBehavior::None;
}
MOZ_ASSERT_UNREACHABLE("Invalid overscroll behavior");
return OverscrollBehavior::Auto;
}
OverscrollBehaviorInfo
OverscrollBehaviorInfo::FromStyleConstants(StyleOverscrollBehavior aBehaviorX,
StyleOverscrollBehavior aBehaviorY)
{
OverscrollBehaviorInfo result;
result.mBehaviorX = ToOverscrollBehavior(aBehaviorX);
result.mBehaviorY = ToOverscrollBehavior(aBehaviorY);
return result;
}
StaticAutoPtr<const ScrollMetadata> ScrollMetadata::sNullMetadata;
}