Bug 1305957 part 2 - Add 'overflow-anchor' CSS property. r=emilio

https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api

Differential Revision: https://phabricator.services.mozilla.com/D13265

--HG--
extra : rebase_source : eaef41c6fecb8e90850c617b5b1d3602f91990b2
extra : histedit_source : 3beb002b612e4caf22538928acffd702f70adf92
This commit is contained in:
Ryan Hunt 2018-11-21 22:33:15 -06:00
parent 9761005f99
commit 53ae64fd5e
14 changed files with 55 additions and 3 deletions

View File

@ -107,6 +107,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"-moz-orient",
"-moz-osx-font-smoothing",
"outline-style",
"overflow-anchor",
"overflow-clip-box-block",
"overflow-clip-box-inline",
"overflow-wrap",

View File

@ -132,6 +132,7 @@ rusty-enums = [
"mozilla::StyleRuleInclusion",
"mozilla::StyleGridTrackBreadth",
"mozilla::StyleOverscrollBehavior",
"mozilla::StyleOverflowAnchor",
"mozilla::StyleScrollbarWidth",
"mozilla::StyleWhiteSpace",
"mozilla::StyleTextRendering",
@ -410,6 +411,7 @@ cbindgen-types = [
{ gecko = "StyleOverscrollBehavior", servo = "values::computed::OverscrollBehavior" },
{ gecko = "StyleTextAlign", servo = "values::computed::TextAlign" },
{ gecko = "StyleOverflow", servo = "values::computed::Overflow" },
{ gecko = "StyleOverflowAnchor", servo = "values::computed::OverflowAnchor" },
]
mapped-generic-types = [

View File

@ -131,6 +131,7 @@ SERIALIZED_PREDEFINED_TYPES = [
"url::ImageUrlOrNone",
"Appearance",
"OverscrollBehavior",
"OverflowAnchor",
"OverflowClipBox",
"ScrollSnapType",
"Float",

View File

@ -2990,6 +2990,7 @@ nsStyleDisplay::nsStyleDisplay(const nsPresContext* aContext)
mScrollBehavior(NS_STYLE_SCROLL_BEHAVIOR_AUTO),
mOverscrollBehaviorX(StyleOverscrollBehavior::Auto),
mOverscrollBehaviorY(StyleOverscrollBehavior::Auto),
mOverflowAnchor(StyleOverflowAnchor::Auto),
mScrollSnapTypeX(StyleScrollSnapType::None),
mScrollSnapTypeY(StyleScrollSnapType::None),
mScrollSnapPointsX(eStyleUnit_None),

View File

@ -1922,6 +1922,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
uint8_t mScrollBehavior; // NS_STYLE_SCROLL_BEHAVIOR_*
mozilla::StyleOverscrollBehavior mOverscrollBehaviorX;
mozilla::StyleOverscrollBehavior mOverscrollBehaviorY;
mozilla::StyleOverflowAnchor mOverflowAnchor;
mozilla::StyleScrollSnapType mScrollSnapTypeX;
mozilla::StyleScrollSnapType mScrollSnapTypeY;
nsStyleCoord mScrollSnapPointsX;

View File

@ -7268,6 +7268,17 @@ if (IsCSSPropertyPrefEnabled("layout.css.osx-font-smoothing.enabled")) {
};
}
if (IsCSSPropertyPrefEnabled("layout.css.scroll-anchoring.enabled")) {
gCSSProperties["overflow-anchor"] = {
domProp: "overflowAnchor",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "auto" ],
other_values: [ "none" ],
invalid_values: []
};
}
if (IsCSSPropertyPrefEnabled("layout.css.overflow-clip-box.enabled")) {
gCSSProperties["overflow-clip-box-block"] = {
domProp: "overflowClipBoxBlock",

View File

@ -63,6 +63,7 @@ include = [
"Float",
"OverscrollBehavior",
"ScrollSnapType",
"OverflowAnchor",
"OverflowClipBox",
"Resize",
"Overflow",

View File

@ -326,6 +326,7 @@ class Longhand(object):
"Opacity",
"OutlineStyle",
"Overflow",
"OverflowAnchor",
"OverflowClipBox",
"OverflowWrap",
"OverscrollBehavior",

View File

@ -1419,6 +1419,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
"Number": impl_simple,
"Opacity": impl_simple,
"OverflowWrap": impl_simple,
"OverflowAnchor": impl_simple,
"Perspective": impl_style_coord,
"Position": impl_position,
"RGBAColor": impl_rgba_color,

View File

@ -125,6 +125,18 @@ ${helpers.predefined_type(
servo_restyle_damage = "reflow",
)}
${helpers.predefined_type(
"overflow-anchor",
"OverflowAnchor",
"computed::OverflowAnchor::Auto",
initial_specified_value="specified::OverflowAnchor::Auto",
products="gecko",
needs_context=False,
gecko_pref="layout.css.scroll-anchoring.enabled",
spec="https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api",
animation_value_type="discrete",
)}
<% transition_extra_prefixes = "moz:layout.css.prefixes.transitions webkit" %>
${helpers.predefined_type(

View File

@ -13,7 +13,7 @@ use crate::values::specified::box_ as specified;
pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin};
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowClipBox};
pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowAnchor, OverflowClipBox};
pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType};
pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};

View File

@ -43,7 +43,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
pub use self::border::{BorderImageSlice, BorderImageWidth};
pub use self::box_::{AnimationIterationCount, AnimationName, Contain};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
pub use self::box_::{Display, Overflow, TransitionProperty};
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange};
pub use self::color::{Color, ColorPropertyValue, RGBAColor};

View File

@ -413,6 +413,26 @@ pub enum OverscrollBehavior {
None,
}
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
)]
#[repr(u8)]
pub enum OverflowAnchor {
Auto,
None,
}
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(

View File

@ -36,7 +36,7 @@ pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle};
pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow, OverflowAnchor};
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange};
pub use self::color::{Color, ColorPropertyValue, RGBAColor};