зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1312163 - Rename ScrollSnapType to ScrollSnapStrictness. r=emilio
The scroll snap strictness is defined in the new spec [1], and the structure is the exactly same as the old scroll snap type structure. [1] https://drafts.csswg.org/css-scroll-snap-1/#snap-strictness Differential Revision: https://phabricator.services.mozilla.com/D21621 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
444bfa1fba
Коммит
19102cb3b9
|
@ -723,15 +723,15 @@ struct ScrollSnapInfo {
|
|||
}
|
||||
|
||||
bool HasScrollSnapping() const {
|
||||
return mScrollSnapTypeY != mozilla::StyleScrollSnapType::None ||
|
||||
mScrollSnapTypeX != mozilla::StyleScrollSnapType::None;
|
||||
return mScrollSnapTypeY != mozilla::StyleScrollSnapStrictness::None ||
|
||||
mScrollSnapTypeX != mozilla::StyleScrollSnapStrictness::None;
|
||||
}
|
||||
|
||||
// The scroll frame's scroll-snap-type.
|
||||
mozilla::StyleScrollSnapType mScrollSnapTypeX =
|
||||
mozilla::StyleScrollSnapType::None;
|
||||
mozilla::StyleScrollSnapType mScrollSnapTypeY =
|
||||
mozilla::StyleScrollSnapType::None;
|
||||
mozilla::StyleScrollSnapStrictness mScrollSnapTypeX =
|
||||
mozilla::StyleScrollSnapStrictness::None;
|
||||
mozilla::StyleScrollSnapStrictness mScrollSnapTypeY =
|
||||
mozilla::StyleScrollSnapStrictness::None;
|
||||
|
||||
// The intervals derived from the scroll frame's scroll-snap-points.
|
||||
Maybe<nscoord> mScrollSnapIntervalX;
|
||||
|
|
|
@ -26,7 +26,7 @@ TEST_F(APZCSnappingTester, Bug1265510) {
|
|||
SetScrollHandoff(layers[1], root);
|
||||
|
||||
ScrollSnapInfo snap;
|
||||
snap.mScrollSnapTypeY = StyleScrollSnapType::Mandatory;
|
||||
snap.mScrollSnapTypeY = StyleScrollSnapStrictness::Mandatory;
|
||||
snap.mScrollSnapIntervalY = Some(100 * AppUnitsPerCSSPixel());
|
||||
|
||||
ScrollMetadata metadata = root->GetScrollMetadata(0);
|
||||
|
@ -96,7 +96,7 @@ TEST_F(APZCSnappingTester, Snap_After_Pinch) {
|
|||
|
||||
// Set up some basic scroll snapping
|
||||
ScrollSnapInfo snap;
|
||||
snap.mScrollSnapTypeY = StyleScrollSnapType::Mandatory;
|
||||
snap.mScrollSnapTypeY = StyleScrollSnapStrictness::Mandatory;
|
||||
snap.mScrollSnapIntervalY = Some(100 * AppUnitsPerCSSPixel());
|
||||
|
||||
// Save the scroll snap info on the root APZC.
|
||||
|
|
|
@ -87,10 +87,11 @@ struct ParamTraits<mozilla::layers::ScaleMode>
|
|||
mozilla::layers::kHighestScaleMode> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::StyleScrollSnapType>
|
||||
struct ParamTraits<mozilla::StyleScrollSnapStrictness>
|
||||
: public ContiguousEnumSerializerInclusive<
|
||||
mozilla::StyleScrollSnapType, mozilla::StyleScrollSnapType::None,
|
||||
mozilla::StyleScrollSnapType::Proximity> {};
|
||||
mozilla::StyleScrollSnapStrictness,
|
||||
mozilla::StyleScrollSnapStrictness::None,
|
||||
mozilla::StyleScrollSnapStrictness::Proximity> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::TextureFlags>
|
||||
|
|
|
@ -26,8 +26,8 @@ struct ScrollStyles {
|
|||
uint8_t mScrollBehavior;
|
||||
StyleOverscrollBehavior mOverscrollBehaviorX;
|
||||
StyleOverscrollBehavior mOverscrollBehaviorY;
|
||||
StyleScrollSnapType mScrollSnapTypeX;
|
||||
StyleScrollSnapType mScrollSnapTypeY;
|
||||
StyleScrollSnapStrictness mScrollSnapTypeX;
|
||||
StyleScrollSnapStrictness mScrollSnapTypeY;
|
||||
nsStyleCoord mScrollSnapPointsX;
|
||||
nsStyleCoord mScrollSnapPointsY;
|
||||
LengthPercentage mScrollSnapDestinationX;
|
||||
|
@ -39,8 +39,8 @@ struct ScrollStyles {
|
|||
mScrollBehavior(NS_STYLE_SCROLL_BEHAVIOR_AUTO),
|
||||
mOverscrollBehaviorX(StyleOverscrollBehavior::Auto),
|
||||
mOverscrollBehaviorY(StyleOverscrollBehavior::Auto),
|
||||
mScrollSnapTypeX(StyleScrollSnapType::None),
|
||||
mScrollSnapTypeY(StyleScrollSnapType::None),
|
||||
mScrollSnapTypeX(StyleScrollSnapStrictness::None),
|
||||
mScrollSnapTypeY(StyleScrollSnapStrictness::None),
|
||||
mScrollSnapPointsX(nsStyleCoord(eStyleUnit_None)),
|
||||
mScrollSnapPointsY(nsStyleCoord(eStyleUnit_None)),
|
||||
mScrollSnapDestinationX(LengthPercentage::Zero()),
|
||||
|
|
|
@ -1021,8 +1021,8 @@ static bool CheckOverflow(const nsStyleDisplay* aDisplay,
|
|||
aDisplay->mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_AUTO &&
|
||||
aDisplay->mOverscrollBehaviorX == StyleOverscrollBehavior::Auto &&
|
||||
aDisplay->mOverscrollBehaviorY == StyleOverscrollBehavior::Auto &&
|
||||
aDisplay->mScrollSnapTypeX == StyleScrollSnapType::None &&
|
||||
aDisplay->mScrollSnapTypeY == StyleScrollSnapType::None &&
|
||||
aDisplay->mScrollSnapTypeX == StyleScrollSnapStrictness::None &&
|
||||
aDisplay->mScrollSnapTypeY == StyleScrollSnapStrictness::None &&
|
||||
aDisplay->mScrollSnapPointsX == nsStyleCoord(eStyleUnit_None) &&
|
||||
aDisplay->mScrollSnapPointsY == nsStyleCoord(eStyleUnit_None) &&
|
||||
aDisplay->mScrollSnapDestination.horizontal == LengthPercentage::Zero() &&
|
||||
|
|
|
@ -236,8 +236,8 @@ Maybe<nsPoint> ScrollSnapUtils::GetSnapPointForDestination(
|
|||
const ScrollSnapInfo& aSnapInfo, nsIScrollableFrame::ScrollUnit aUnit,
|
||||
const nsRect& aScrollRange, const nsPoint& aStartPos,
|
||||
const nsPoint& aDestination) {
|
||||
if (aSnapInfo.mScrollSnapTypeY == StyleScrollSnapType::None &&
|
||||
aSnapInfo.mScrollSnapTypeX == StyleScrollSnapType::None) {
|
||||
if (aSnapInfo.mScrollSnapTypeY == StyleScrollSnapStrictness::None &&
|
||||
aSnapInfo.mScrollSnapTypeX == StyleScrollSnapStrictness::None) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
@ -260,13 +260,13 @@ Maybe<nsPoint> ScrollSnapUtils::GetSnapPointForDestination(
|
|||
nsPoint finalPos = calcSnapPoints.GetBestEdge();
|
||||
nscoord proximityThreshold = gfxPrefs::ScrollSnapProximityThreshold();
|
||||
proximityThreshold = nsPresContext::CSSPixelsToAppUnits(proximityThreshold);
|
||||
if (aSnapInfo.mScrollSnapTypeY == StyleScrollSnapType::Proximity &&
|
||||
if (aSnapInfo.mScrollSnapTypeY == StyleScrollSnapStrictness::Proximity &&
|
||||
std::abs(aDestination.y - finalPos.y) > proximityThreshold) {
|
||||
finalPos.y = aDestination.y;
|
||||
} else {
|
||||
snapped = true;
|
||||
}
|
||||
if (aSnapInfo.mScrollSnapTypeX == StyleScrollSnapType::Proximity &&
|
||||
if (aSnapInfo.mScrollSnapTypeX == StyleScrollSnapStrictness::Proximity &&
|
||||
std::abs(aDestination.x - finalPos.x) > proximityThreshold) {
|
||||
finalPos.x = aDestination.x;
|
||||
} else {
|
||||
|
|
|
@ -4211,8 +4211,9 @@ void ScrollFrameHelper::ScrollBy(nsIntPoint aDelta,
|
|||
|
||||
if (aSnap == nsIScrollableFrame::ENABLE_SNAP) {
|
||||
ScrollStyles styles = GetScrollStylesFromFrame();
|
||||
if (styles.mScrollSnapTypeY != StyleScrollSnapType::None ||
|
||||
styles.mScrollSnapTypeX != StyleScrollSnapType::None) {
|
||||
|
||||
if (styles.mScrollSnapTypeY != StyleScrollSnapStrictness::None ||
|
||||
styles.mScrollSnapTypeX != StyleScrollSnapStrictness::None) {
|
||||
nscoord appUnitsPerDevPixel =
|
||||
mOuter->PresContext()->AppUnitsPerDevPixel();
|
||||
deltaMultiplier = nsSize(appUnitsPerDevPixel, appUnitsPerDevPixel);
|
||||
|
@ -6535,8 +6536,8 @@ static layers::ScrollSnapInfo ComputeScrollSnapInfo(
|
|||
|
||||
ScrollStyles styles = aScrollFrame.GetScrollStylesFromFrame();
|
||||
|
||||
if (styles.mScrollSnapTypeY == StyleScrollSnapType::None &&
|
||||
styles.mScrollSnapTypeX == StyleScrollSnapType::None) {
|
||||
if (styles.mScrollSnapTypeY == StyleScrollSnapStrictness::None &&
|
||||
styles.mScrollSnapTypeX == StyleScrollSnapStrictness::None) {
|
||||
// We won't be snapping, short-circuit the computation.
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ cbindgen-types = [
|
|||
{ gecko = "StyleBorderStyle", servo = "values::computed::BorderStyle" },
|
||||
{ gecko = "StyleOutlineStyle", servo = "values::computed::OutlineStyle" },
|
||||
{ gecko = "StyleScrollSnapAlign", servo = "values::computed::ScrollSnapAlign" },
|
||||
{ gecko = "StyleScrollSnapType", servo = "values::computed::ScrollSnapType" },
|
||||
{ gecko = "StyleScrollSnapStrictness", servo = "values::computed::ScrollSnapStrictness" },
|
||||
{ gecko = "StyleResize", servo = "values::computed::Resize" },
|
||||
{ gecko = "StyleOverflowClipBox", servo = "values::computed::OverflowClipBox" },
|
||||
{ gecko = "StyleFloat", servo = "values::computed::Float" },
|
||||
|
|
|
@ -2939,8 +2939,8 @@ nsStyleDisplay::nsStyleDisplay(const Document& aDocument)
|
|||
mOverscrollBehaviorX(StyleOverscrollBehavior::Auto),
|
||||
mOverscrollBehaviorY(StyleOverscrollBehavior::Auto),
|
||||
mOverflowAnchor(StyleOverflowAnchor::Auto),
|
||||
mScrollSnapTypeX(StyleScrollSnapType::None),
|
||||
mScrollSnapTypeY(StyleScrollSnapType::None),
|
||||
mScrollSnapTypeX(StyleScrollSnapStrictness::None),
|
||||
mScrollSnapTypeY(StyleScrollSnapStrictness::None),
|
||||
mScrollSnapPointsX(eStyleUnit_None),
|
||||
mScrollSnapPointsY(eStyleUnit_None),
|
||||
mScrollSnapDestination(
|
||||
|
|
|
@ -1895,8 +1895,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
|
|||
mozilla::StyleOverscrollBehavior mOverscrollBehaviorY;
|
||||
mozilla::StyleOverflowAnchor mOverflowAnchor;
|
||||
mozilla::StyleScrollSnapAlign mScrollSnapAlign;
|
||||
mozilla::StyleScrollSnapType mScrollSnapTypeX;
|
||||
mozilla::StyleScrollSnapType mScrollSnapTypeY;
|
||||
mozilla::StyleScrollSnapStrictness mScrollSnapTypeX;
|
||||
mozilla::StyleScrollSnapStrictness mScrollSnapTypeY;
|
||||
nsStyleCoord mScrollSnapPointsX;
|
||||
nsStyleCoord mScrollSnapPointsY;
|
||||
mozilla::Position mScrollSnapDestination;
|
||||
|
|
|
@ -341,7 +341,7 @@ class Longhand(object):
|
|||
"SVGOpacity",
|
||||
"SVGPaintOrder",
|
||||
"ScrollSnapAlign",
|
||||
"ScrollSnapType",
|
||||
"ScrollSnapStrictness",
|
||||
"TextAlign",
|
||||
"TextDecorationLine",
|
||||
"TextEmphasisPosition",
|
||||
|
|
|
@ -430,8 +430,8 @@ ${helpers.predefined_type(
|
|||
% for axis in ["x", "y"]:
|
||||
${helpers.predefined_type(
|
||||
"scroll-snap-type-" + axis,
|
||||
"ScrollSnapType",
|
||||
"computed::ScrollSnapType::None",
|
||||
"ScrollSnapStrictness",
|
||||
"computed::ScrollSnapStrictness::None",
|
||||
products="gecko",
|
||||
needs_context=False,
|
||||
gecko_pref="layout.css.scroll-snap.enabled",
|
||||
|
|
|
@ -15,7 +15,7 @@ pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween
|
|||
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
|
||||
pub use crate::values::specified::box_::{Contain, Display, Overflow};
|
||||
pub use crate::values::specified::box_::{OverflowAnchor, OverflowClipBox};
|
||||
pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapAlign, ScrollSnapType};
|
||||
pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapAlign, ScrollSnapStrictness};
|
||||
pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};
|
||||
|
||||
/// A computed value for the `vertical-align` property.
|
||||
|
|
|
@ -42,7 +42,7 @@ pub use self::box_::{AnimationIterationCount, AnimationName, Contain};
|
|||
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
|
||||
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapType, TouchAction, VerticalAlign, WillChange};
|
||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapStrictness, TouchAction, VerticalAlign, WillChange};
|
||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue};
|
||||
pub use self::column::ColumnCount;
|
||||
pub use self::counters::{Content, ContentItem, CounterIncrement, CounterSetOrReset};
|
||||
|
|
|
@ -379,6 +379,7 @@ impl Parse for AnimationName {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-scroll-snap-1/#snap-strictness
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(
|
||||
|
@ -396,7 +397,7 @@ impl Parse for AnimationName {
|
|||
ToShmem,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum ScrollSnapType {
|
||||
pub enum ScrollSnapStrictness {
|
||||
None,
|
||||
Mandatory,
|
||||
Proximity,
|
||||
|
|
|
@ -40,7 +40,7 @@ pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display};
|
|||
pub use self::box_::{Appearance, BreakBetween, BreakWithin};
|
||||
pub use self::box_::{Clear, Float, Overflow, OverflowAnchor};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapType};
|
||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapStrictness};
|
||||
pub use self::box_::{TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue};
|
||||
pub use self::column::ColumnCount;
|
||||
|
|
|
@ -71,7 +71,7 @@ include = [
|
|||
"Float",
|
||||
"OverscrollBehavior",
|
||||
"ScrollSnapAlign",
|
||||
"ScrollSnapType",
|
||||
"ScrollSnapStrictness",
|
||||
"OverflowAnchor",
|
||||
"OverflowClipBox",
|
||||
"Resize",
|
||||
|
|
Загрузка…
Ссылка в новой задаче