mirror of
https://github.com/servo/servo.git
synced 2025-07-05 22:43:40 +01:00
Auto merge of #19497 - emilio:overflow-clip-box, r=emilio,nox
style: Add internal overflow-clip-box-block/-inline properties and make overflow-clip-box a shorthand. These are the changes from bug 1422839. First commit is reviewed by me, the second is a fixup to that. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19497) <!-- Reviewable:end -->
This commit is contained in:
commit
479847d8b9
9 changed files with 410 additions and 937 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -3098,6 +3098,7 @@ fn static_assert() {
|
||||||
scroll-snap-type-x scroll-snap-type-y scroll-snap-coordinate
|
scroll-snap-type-x scroll-snap-type-y scroll-snap-coordinate
|
||||||
perspective-origin -moz-binding will-change
|
perspective-origin -moz-binding will-change
|
||||||
overscroll-behavior-x overscroll-behavior-y
|
overscroll-behavior-x overscroll-behavior-y
|
||||||
|
overflow-clip-box-inline overflow-clip-box-block
|
||||||
perspective-origin -moz-binding will-change
|
perspective-origin -moz-binding will-change
|
||||||
shape-outside contain touch-action""" %>
|
shape-outside contain touch-action""" %>
|
||||||
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
||||||
|
@ -3491,6 +3492,10 @@ fn static_assert() {
|
||||||
${impl_keyword('overscroll_behavior_x', 'mOverscrollBehaviorX', overscroll_behavior_keyword)}
|
${impl_keyword('overscroll_behavior_x', 'mOverscrollBehaviorX', overscroll_behavior_keyword)}
|
||||||
${impl_keyword('overscroll_behavior_y', 'mOverscrollBehaviorY', overscroll_behavior_keyword)}
|
${impl_keyword('overscroll_behavior_y', 'mOverscrollBehaviorY', overscroll_behavior_keyword)}
|
||||||
|
|
||||||
|
<% overflow_clip_box_keyword = Keyword("overflow-clip-box", "padding-box content-box") %>
|
||||||
|
${impl_keyword('overflow_clip_box_inline', 'mOverflowClipBoxInline', overflow_clip_box_keyword)}
|
||||||
|
${impl_keyword('overflow_clip_box_block', 'mOverflowClipBoxBlock', overflow_clip_box_keyword)}
|
||||||
|
|
||||||
pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) {
|
pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) {
|
||||||
self.gecko.mPerspectiveOrigin[0].set(v.horizontal);
|
self.gecko.mPerspectiveOrigin[0].set(v.horizontal);
|
||||||
self.gecko.mPerspectiveOrigin[1].set(v.vertical);
|
self.gecko.mPerspectiveOrigin[1].set(v.vertical);
|
||||||
|
|
|
@ -373,12 +373,21 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
|
||||||
spec="Internal, not web-exposed, \
|
spec="Internal, not web-exposed, \
|
||||||
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
|
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
|
||||||
|
|
||||||
${helpers.single_keyword("overflow-clip-box", "padding-box content-box",
|
% for direction in ["inline", "block"]:
|
||||||
products="gecko", animation_value_type="discrete", enabled_in="ua",
|
${helpers.predefined_type(
|
||||||
gecko_pref="layout.css.overflow-clip-box.enabled",
|
"overflow-clip-box-" + direction,
|
||||||
flags="APPLIES_TO_PLACEHOLDER",
|
"OverflowClipBox",
|
||||||
spec="Internal, not web-exposed, \
|
"computed::OverflowClipBox::padding_box",
|
||||||
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
|
products="gecko",
|
||||||
|
enabled_in="ua",
|
||||||
|
needs_context=False,
|
||||||
|
flags="APPLIES_TO_PLACEHOLDER",
|
||||||
|
gecko_pref="layout.css.overscroll-behavior.enabled",
|
||||||
|
animation_value_type="discrete",
|
||||||
|
spec="Internal, may be standardized in the future: \
|
||||||
|
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box",
|
||||||
|
)}
|
||||||
|
% endfor
|
||||||
|
|
||||||
<%
|
<%
|
||||||
overflow_custom_consts = { "-moz-hidden-unscrollable": "CLIP" }
|
overflow_custom_consts = { "-moz-hidden-unscrollable": "CLIP" }
|
||||||
|
|
|
@ -58,6 +58,44 @@
|
||||||
}
|
}
|
||||||
</%helpers:shorthand>
|
</%helpers:shorthand>
|
||||||
|
|
||||||
|
<%helpers:shorthand
|
||||||
|
name="overflow-clip-box"
|
||||||
|
sub_properties="overflow-clip-box-block overflow-clip-box-inline"
|
||||||
|
enabled_in="ua"
|
||||||
|
gecko_pref="layout.css.overflow-clip-box.enabled"
|
||||||
|
spec="Internal, may be standardized in the future "
|
||||||
|
"(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)"
|
||||||
|
products="gecko"
|
||||||
|
>
|
||||||
|
use values::specified::OverflowClipBox;
|
||||||
|
pub fn parse_value<'i, 't>(
|
||||||
|
_: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Result<Longhands, ParseError<'i>> {
|
||||||
|
let block_value = OverflowClipBox::parse(input)?;
|
||||||
|
let inline_value =
|
||||||
|
input.try(|input| OverflowClipBox::parse(input)).unwrap_or(block_value);
|
||||||
|
|
||||||
|
Ok(expanded! {
|
||||||
|
overflow_clip_box_block: block_value,
|
||||||
|
overflow_clip_box_inline: inline_value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||||
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
self.overflow_clip_box_block.to_css(dest)?;
|
||||||
|
|
||||||
|
if self.overflow_clip_box_block != self.overflow_clip_box_inline {
|
||||||
|
dest.write_str(" ")?;
|
||||||
|
self.overflow_clip_box_inline.to_css(dest)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</%helpers:shorthand>
|
||||||
|
|
||||||
macro_rules! try_parse_one {
|
macro_rules! try_parse_one {
|
||||||
($input: expr, $var: ident, $prop_module: ident) => {
|
($input: expr, $var: ident, $prop_module: ident) => {
|
||||||
if $var.is_none() {
|
if $var.is_none() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use values::computed::length::LengthOrPercentage;
|
||||||
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||||
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||||
|
|
||||||
pub use values::specified::box_::{AnimationName, OverscrollBehavior, ScrollSnapType};
|
pub use values::specified::box_::{AnimationName, OverflowClipBox, OverscrollBehavior, ScrollSnapType};
|
||||||
|
|
||||||
/// A computed value for the `vertical-align` property.
|
/// A computed value for the `vertical-align` property.
|
||||||
pub type VerticalAlign = GenericVerticalAlign<LengthOrPercentage>;
|
pub type VerticalAlign = GenericVerticalAlign<LengthOrPercentage>;
|
||||||
|
|
|
@ -40,7 +40,8 @@ pub use self::font::{FontSize, FontSizeAdjust, FontSynthesis, FontWeight, FontVa
|
||||||
pub use self::font::{FontFamily, FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
pub use self::font::{FontFamily, FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
||||||
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
||||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XTextZoom, XLang};
|
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XTextZoom, XLang};
|
||||||
pub use self::box_::{AnimationIterationCount, AnimationName, OverscrollBehavior, ScrollSnapType, VerticalAlign};
|
pub use self::box_::{AnimationIterationCount, AnimationName, OverscrollBehavior};
|
||||||
|
pub use self::box_::{OverflowClipBox, ScrollSnapType, VerticalAlign};
|
||||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||||
pub use self::flex::FlexBasis;
|
pub use self::flex::FlexBasis;
|
||||||
|
|
|
@ -124,3 +124,10 @@ define_css_keyword_enum! { OverscrollBehavior:
|
||||||
"none" => None,
|
"none" => None,
|
||||||
}
|
}
|
||||||
add_impls_for_keyword_enum!(OverscrollBehavior);
|
add_impls_for_keyword_enum!(OverscrollBehavior);
|
||||||
|
|
||||||
|
// FIXME(emilio): Make all keywords CamelCase.
|
||||||
|
define_css_keyword_enum! { OverflowClipBox:
|
||||||
|
"padding-box" => padding_box,
|
||||||
|
"content-box" => content_box,
|
||||||
|
}
|
||||||
|
add_impls_for_keyword_enum!(OverflowClipBox);
|
||||||
|
|
|
@ -34,7 +34,8 @@ pub use self::font::{FontSize, FontSizeAdjust, FontSynthesis, FontWeight, FontVa
|
||||||
pub use self::font::{FontFamily, FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
pub use self::font::{FontFamily, FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
||||||
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
||||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XTextZoom, XLang};
|
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XTextZoom, XLang};
|
||||||
pub use self::box_::{AnimationIterationCount, AnimationName, OverscrollBehavior, ScrollSnapType, VerticalAlign};
|
pub use self::box_::{AnimationIterationCount, AnimationName, OverscrollBehavior};
|
||||||
|
pub use self::box_::{OverflowClipBox, ScrollSnapType, VerticalAlign};
|
||||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||||
pub use self::flex::FlexBasis;
|
pub use self::flex::FlexBasis;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue