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 : 14d4a6282274b125a6153a05daff5d93e34a29b7
extra : source : c66c00f7329619d53bc14ec615a0d92f06b6a892
This commit is contained in:
Ryan Hunt 2018-11-21 22:33:15 -06:00
Родитель b6d009810b
Коммит 9f09201ef2
15 изменённых файлов: 74 добавлений и 3 удалений

Просмотреть файл

@ -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",

Просмотреть файл

@ -2917,6 +2917,7 @@ exports.CSS_PROPERTIES = {
"overflow-clip-box-block",
"overflow-x",
"overflow-y",
"overflow-anchor",
"transition-duration",
"transition-timing-function",
"transition-property",
@ -7643,6 +7644,20 @@ exports.CSS_PROPERTIES = {
"visible"
]
},
"overflow-anchor": {
"isInherited": false,
"subproperties": [
"overflow-anchor"
],
"supports": [],
"values": [
"auto",
"inherit",
"initial",
"none",
"unset"
]
},
"overflow-wrap": {
"isInherited": true,
"subproperties": [
@ -9376,6 +9391,10 @@ exports.PREFERENCES = [
"-moz-osx-font-smoothing",
"layout.css.osx-font-smoothing.enabled"
],
[
"overflow-anchor",
"layout.css.scroll-anchoring.enabled"
],
[
"scrollbar-width",
"layout.css.scrollbar-width.enabled"

Просмотреть файл

@ -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 = [

Просмотреть файл

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

Просмотреть файл

@ -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),

Просмотреть файл

@ -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;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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,

Просмотреть файл

@ -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(

Просмотреть файл

@ -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};

Просмотреть файл

@ -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};

Просмотреть файл

@ -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(

Просмотреть файл

@ -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};