servo: Merge #19497 - style: Add internal overflow-clip-box-block/-inline properties and make overflow-clip-box a shorthand (from emilio:overflow-clip-box); r=emilio,nox

These are the changes from bug 1422839. First commit is reviewed by me, the second is a fixup to that.

Source-Repo: https://github.com/servo/servo
Source-Revision: 479847d8b906654b34aeddb09c7e89a3b3beb99c

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 9bc7f6e2789a2947956ad3ff452ee2d9510eb11e
This commit is contained in:
Emilio Cobos Álvarez 2017-12-05 12:43:45 -06:00
Родитель 80e7a5e3f5
Коммит 22eeea2e48
9 изменённых файлов: 410 добавлений и 937 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -3098,6 +3098,7 @@ fn static_assert() {
scroll-snap-type-x scroll-snap-type-y scroll-snap-coordinate
perspective-origin -moz-binding will-change
overscroll-behavior-x overscroll-behavior-y
overflow-clip-box-inline overflow-clip-box-block
perspective-origin -moz-binding will-change
shape-outside contain touch-action""" %>
<%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_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) {
self.gecko.mPerspectiveOrigin[0].set(v.horizontal);
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, \
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",
products="gecko", animation_value_type="discrete", enabled_in="ua",
gecko_pref="layout.css.overflow-clip-box.enabled",
flags="APPLIES_TO_PLACEHOLDER",
spec="Internal, not web-exposed, \
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
% for direction in ["inline", "block"]:
${helpers.predefined_type(
"overflow-clip-box-" + direction,
"OverflowClipBox",
"computed::OverflowClipBox::padding_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" }

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

@ -58,6 +58,44 @@
}
</%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 {
($input: expr, $var: ident, $prop_module: ident) => {
if $var.is_none() {

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

@ -9,7 +9,7 @@ use values::computed::length::LengthOrPercentage;
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
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.
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::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
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::effects::{BoxShadow, Filter, SimpleShadow};
pub use self::flex::FlexBasis;

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

@ -124,3 +124,10 @@ define_css_keyword_enum! { OverscrollBehavior:
"none" => None,
}
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::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
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::effects::{BoxShadow, Filter, SimpleShadow};
pub use self::flex::FlexBasis;