servo: Merge #20001 - Autogenerate compute_damage (from Manishearth:compute-damage); r=mbrubeck

fixes #10622

Source-Repo: https://github.com/servo/servo
Source-Revision: e19bab84cf43c43930d7493840444a8ee2af1e8b

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : d2c9df586b89b582e0edbff92c8ba125f80081f4
This commit is contained in:
Manish Goregaokar 2018-02-09 12:02:04 -05:00
Родитель fc5f933414
Коммит 7f2c119b46
19 изменённых файлов: 200 добавлений и 180 удалений

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

@ -116,13 +116,12 @@ pub mod selector_map;
pub mod selector_parser;
pub mod shared_lock;
pub mod sharing;
pub mod style_resolver;
pub mod stylist;
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod servo;
pub mod str;
pub mod style_adjuster;
pub mod style_resolver;
pub mod stylesheet_set;
pub mod stylesheets;
pub mod stylist;
pub mod thread_state;
pub mod timer;
pub mod traversal;
@ -154,6 +153,9 @@ pub mod properties {
include!(concat!(env!("OUT_DIR"), "/properties.rs"));
}
// uses a macro from properties
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod servo;
#[cfg(feature = "gecko")]
#[allow(unsafe_code, missing_docs)]
pub mod gecko_properties {

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

@ -152,7 +152,7 @@ class Longhand(object):
allowed_in_keyframe_block=True, cast_type='u8',
logical=False, alias=None, extra_prefixes=None, boxed=False,
flags=None, allowed_in_page_rule=False, allow_quirks=False, ignored_when_colors_disabled=False,
vector=False, need_animatable=False):
vector=False, need_animatable=False, servo_restyle_damage="repaint"):
self.name = name
if not spec:
raise TypeError("Spec should be specified for %s" % name)
@ -211,6 +211,9 @@ class Longhand(object):
self.transitionable = False
self.animation_type = None
# See compute_damage for the various values this can take
self.servo_restyle_damage = servo_restyle_damage
def experimental(self, product):
if product == "gecko":
return bool(self.gecko_pref)

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

@ -52,7 +52,8 @@
animation_value_type="NonNegativeLength",
logical=is_logical,
flags="APPLIES_TO_FIRST_LETTER",
allow_quirks=not is_logical)}
allow_quirks=not is_logical,
servo_restyle_damage = "reflow rebuild_and_reflow_inline")}
% endfor
${helpers.gecko_keyword_conversion(Keyword('border-style',

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

@ -22,6 +22,7 @@ ${helpers.predefined_type(
needs_context=False,
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-display/#propdef-display",
servo_restyle_damage="rebuild_and_reflow"
)}
// FIXME(emilio): Listing all the display values here is very unfortunate, we should teach C++ to use the
@ -52,7 +53,8 @@ ${helpers.single_keyword("-moz-top-layer", "none top",
${helpers.single_keyword("position", "static absolute relative fixed sticky",
animation_value_type="discrete",
flags="CREATES_STACKING_CONTEXT ABSPOS_CB",
spec="https://drafts.csswg.org/css-position/#position-property")}
spec="https://drafts.csswg.org/css-position/#position-property",
servo_restyle_damage="rebuild_and_reflow")}
<%helpers:single_keyword
name="float"
@ -66,6 +68,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
gecko_ffi_name="mFloat"
flags="APPLIES_TO_FIRST_LETTER"
spec="https://drafts.csswg.org/css-box/#propdef-float"
servo_restyle_damage="rebuild_and_reflow"
>
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
@ -120,6 +123,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
gecko_enum_prefix="StyleClear"
gecko_ffi_name="mBreakType"
spec="https://drafts.csswg.org/css-box/#propdef-clear"
servo_restyle_damage="rebuild_and_reflow"
>
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
@ -170,6 +174,7 @@ ${helpers.predefined_type(
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align",
servo_restyle_damage = "reflow"
)}
// CSS 2.1, Section 11 - Visual effects
@ -206,12 +211,14 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
custom_consts=overflow_custom_consts,
gecko_constant_prefix="NS_STYLE_OVERFLOW",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-x")}
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-x",
servo_restyle_damage = "reflow")}
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
<%helpers:longhand name="overflow-y" animation_value_type="discrete"
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y">
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y"
servo_restyle_damage = "reflow">
pub use super::overflow_x::{SpecifiedValue, parse, get_initial_value, computed_value};
</%helpers:longhand>
@ -392,7 +399,8 @@ ${helpers.predefined_type("transform", "Transform",
animation_value_type="ComputedValue",
gecko_ffi_name="mSpecifiedTransform",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
spec="https://drafts.csswg.org/css-transforms/#propdef-transform")}
spec="https://drafts.csswg.org/css-transforms/#propdef-transform",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type("rotate", "Rotate",
"generics::transform::Rotate::None",
@ -400,7 +408,8 @@ ${helpers.predefined_type("rotate", "Rotate",
boxed=True,
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
gecko_pref="layout.css.individual-transform.enabled",
spec="https://drafts.csswg.org/css-transforms-2/#individual-transforms")}
spec="https://drafts.csswg.org/css-transforms-2/#individual-transforms",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type("scale", "Scale",
"generics::transform::Scale::None",
@ -408,7 +417,8 @@ ${helpers.predefined_type("scale", "Scale",
boxed=True,
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
gecko_pref="layout.css.individual-transform.enabled",
spec="https://drafts.csswg.org/css-transforms-2/#individual-transforms")}
spec="https://drafts.csswg.org/css-transforms-2/#individual-transforms",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type("translate", "Translate",
"generics::transform::Translate::None",
@ -416,7 +426,8 @@ ${helpers.predefined_type("translate", "Translate",
boxed=True,
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
gecko_pref="layout.css.individual-transform.enabled",
spec="https://drafts.csswg.org/css-transforms-2/#individual-transforms")}
spec="https://drafts.csswg.org/css-transforms-2/#individual-transforms",
servo_restyle_damage = "reflow_out_of_flow")}
// CSSOM View Module
// https://www.w3.org/TR/cssom-view-1/
@ -505,7 +516,8 @@ ${helpers.predefined_type("perspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes="moz webkit",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
animation_value_type="ComputedValue")}
animation_value_type="ComputedValue",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type("perspective-origin",
"position::Position",
@ -513,7 +525,8 @@ ${helpers.predefined_type("perspective-origin",
boxed=True,
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-transforms-2/#perspective-origin-property",
animation_value_type="ComputedValue")}
animation_value_type="ComputedValue",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.single_keyword("backface-visibility",
"visible hidden",
@ -539,6 +552,7 @@ ${helpers.predefined_type(
extra_prefixes="moz webkit",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
animation_value_type="discrete",
servo_restyle_damage = "reflow_out_of_flow",
)}
${helpers.predefined_type("transform-origin",
@ -548,7 +562,8 @@ ${helpers.predefined_type("transform-origin",
extra_prefixes="moz webkit",
gecko_ffi_name="mTransformOrigin",
boxed=True,
spec="https://drafts.csswg.org/css-transforms/#transform-origin-property")}
spec="https://drafts.csswg.org/css-transforms/#transform-origin-property",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type("contain",
"Contain",

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

@ -13,7 +13,8 @@ ${helpers.predefined_type("column-width",
extra_prefixes="moz",
animation_value_type="NonNegativeLengthOrAuto",
servo_pref="layout.column-width.enabled",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")}
spec="https://drafts.csswg.org/css-multicol/#propdef-column-width",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("column-count",
@ -23,7 +24,8 @@ ${helpers.predefined_type("column-count",
servo_pref="layout.column-count.enabled",
animation_value_type="PositiveIntegerOrAuto",
extra_prefixes="moz",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count")}
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("column-gap",
"length::NonNegativeLengthOrNormal",
@ -31,7 +33,8 @@ ${helpers.predefined_type("column-gap",
extra_prefixes="moz",
servo_pref="layout.column-gap.enabled",
animation_value_type="NonNegativeLengthOrNormal",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap",
servo_restyle_damage = "reflow")}
${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",
products="gecko", animation_value_type="discrete",

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

@ -11,7 +11,8 @@ ${helpers.predefined_type("content",
"computed::Content::normal()",
initial_specified_value="specified::Content::normal()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-content/#propdef-content")}
spec="https://drafts.csswg.org/css-content/#propdef-content",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type(
"counter-increment",
@ -19,6 +20,7 @@ ${helpers.predefined_type(
initial_value="Default::default()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-counter-increment",
servo_restyle_damage="rebuild_and_reflow"
)}
${helpers.predefined_type(
@ -27,4 +29,5 @@ ${helpers.predefined_type(
initial_value="Default::default()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists-3/#propdef-counter-reset",
servo_restyle_damage="rebuild_and_reflow"
)}

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

@ -12,7 +12,8 @@ ${helpers.predefined_type("opacity",
"1.0",
animation_value_type="ComputedValue",
flags="CREATES_STACKING_CONTEXT APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-color/#opacity")}
spec="https://drafts.csswg.org/css-color/#opacity",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type(
"box-shadow",

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

@ -12,7 +12,8 @@ ${helpers.predefined_type("font-family",
initial_value="computed::FontFamily::serif()",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family")}
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword_system("font-style",
"normal italic oblique",
@ -20,7 +21,8 @@ ${helpers.single_keyword_system("font-style",
gecko_ffi_name="mFont.style",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-style",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage="rebuild_and_reflow")}
<% font_variant_caps_custom_consts= { "small-caps": "SMALLCAPS",
@ -37,7 +39,8 @@ ${helpers.single_keyword_system("font-variant-caps",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-caps",
custom_consts=font_variant_caps_custom_consts,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("font-weight",
"FontWeight",
@ -45,7 +48,8 @@ ${helpers.predefined_type("font-weight",
initial_specified_value="specified::FontWeight::Normal",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight")}
spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("font-size",
"FontSize",
@ -54,7 +58,8 @@ ${helpers.predefined_type("font-size",
animation_value_type="NonNegativeLength",
allow_quirks=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size")}
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("font-size-adjust",
"FontSizeAdjust",
@ -82,7 +87,8 @@ ${helpers.single_keyword_system("font-stretch",
cast_type='i16',
spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="ComputedValue")}
animation_value_type="ComputedValue",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword_system("font-kerning",
"auto none normal",

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

@ -24,11 +24,13 @@ ${helpers.single_keyword("writing-mode",
tb=vertical-rl tb-rl=vertical-rl",
servo_pref="layout.writing-mode.enabled",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode")}
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword("direction", "ltr rtl", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction",
needs_conversion=True)}
needs_conversion=True,
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword("text-orientation",
"mixed upright sideways",

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

@ -9,20 +9,24 @@
${helpers.single_keyword("border-collapse", "separate collapse",
gecko_constant_prefix="NS_STYLE_BORDER",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse")}
spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse",
servo_restyle_damage = "reflow")}
${helpers.single_keyword("empty-cells", "show hide",
gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells")}
spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword("caption-side", "top bottom",
extra_gecko_values="right left top-outside bottom-outside",
needs_conversion="True",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-caption-side")}
spec="https://drafts.csswg.org/css-tables/#propdef-caption-side",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("border-spacing",
"BorderSpacing",
"computed::BorderSpacing::zero()",
animation_value_type="BorderSpacing",
boxed=True,
spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing")}
spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing",
servo_restyle_damage = "reflow")}

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

@ -11,7 +11,8 @@ ${helpers.predefined_type("line-height",
"computed::LineHeight::normal()",
animation_value_type="LineHeight",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height")}
spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height",
servo_restyle_damage = "reflow")}
// CSS Text Module Level 3
@ -21,7 +22,8 @@ ${helpers.single_keyword("text-transform",
extra_gecko_values="full-width",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-text-transform")}
spec="https://drafts.csswg.org/css-text/#propdef-text-transform",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword("hyphens", "manual none auto",
gecko_enum_prefix="StyleHyphens",
@ -41,7 +43,7 @@ ${helpers.predefined_type("text-indent",
"computed::LengthOrPercentage::Length(computed::Length::new(0.))",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
allow_quirks=True)}
allow_quirks=True, servo_restyle_damage = "reflow")}
// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred
// name per CSS-TEXT 6.2.
@ -50,14 +52,16 @@ ${helpers.single_keyword("overflow-wrap",
gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
alias="word-wrap")}
alias="word-wrap",
servo_restyle_damage="rebuild_and_reflow")}
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
${helpers.single_keyword("word-break",
"normal break-all keep-all",
gecko_constant_prefix="NS_STYLE_WORDBREAK",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-word-break")}
spec="https://drafts.csswg.org/css-text/#propdef-word-break",
servo_restyle_damage="rebuild_and_reflow")}
// TODO(pcwalton): Support `text-justify: distribute`.
<%helpers:single_keyword
@ -70,6 +74,7 @@ ${helpers.single_keyword("word-break",
gecko_pref="layout.css.text-justify.enabled"
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-text-justify"
servo_restyle_damage="rebuild_and_reflow"
>
% if product == 'gecko':
impl ToComputedValue for SpecifiedValue {
@ -113,21 +118,24 @@ ${helpers.predefined_type("text-align",
"computed::TextAlign::start()",
animation_value_type="discrete",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-text-align")}
spec="https://drafts.csswg.org/css-text/#propdef-text-align",
servo_restyle_damage = "reflow")}
${helpers.predefined_type("letter-spacing",
"LetterSpacing",
"computed::LetterSpacing::normal()",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing")}
spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("word-spacing",
"WordSpacing",
"computed::WordSpacing::normal()",
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-word-spacing")}
spec="https://drafts.csswg.org/css-text/#propdef-word-spacing",
servo_restyle_damage="rebuild_and_reflow")}
<%helpers:single_keyword
name="white-space"
@ -139,6 +147,7 @@ ${helpers.predefined_type("word-spacing",
// Only allowed for UA sheets, which set it !important.
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-text/#propdef-white-space"
servo_restyle_damage="rebuild_and_reflow"
>
% if product != "gecko":
impl SpecifiedValue {
@ -544,7 +553,8 @@ ${helpers.single_keyword("text-combine-upright", "none all",
${helpers.single_keyword("text-rendering",
"auto optimizespeed optimizelegibility geometricprecision",
animation_value_type="discrete",
spec="https://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty")}
spec="https://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty",
servo_restyle_damage="rebuild_and_reflow")}
// FIXME Firefox expects the initial value of this property to change depending
// on the value of the layout.css.control-characters.visible pref.

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

@ -7,7 +7,8 @@
<% data.new_style_struct("List", inherited=True) %>
${helpers.single_keyword("list-style-position", "outside inside", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-position")}
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-position",
servo_restyle_damage="rebuild_and_reflow")}
// TODO(pcwalton): Implement the full set of counter styles per CSS-COUNTER-STYLES [1] 6.1:
//
@ -28,7 +29,8 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
malayalam mongolian myanmar oriya persian telugu thai tibetan cjk-earthly-branch
cjk-heavenly-stem lower-greek hiragana hiragana-iroha katakana katakana-iroha""",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")}
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type",
servo_restyle_damage="rebuild_and_reflow")}
% else:
${helpers.predefined_type("list-style-type",
"ListStyleType",
@ -36,7 +38,8 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
initial_specified_value="specified::ListStyleType::disc()",
animation_value_type="discrete",
boxed=True,
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")}
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type",
servo_restyle_damage="rebuild_and_reflow")}
% endif
${helpers.predefined_type("list-style-image",
@ -45,13 +48,15 @@ ${helpers.predefined_type("list-style-image",
initial_specified_value="specified::ListStyleImage::none()",
animation_value_type="discrete",
boxed=product == "gecko",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image")}
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("quotes",
"Quotes",
"computed::Quotes::get_initial_value()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-content/#propdef-quotes")}
spec="https://drafts.csswg.org/css-content/#propdef-quotes",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("-moz-image-region",
"ClipRectOrAuto",

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

@ -18,5 +18,6 @@
allow_quirks=not side[1],
animation_value_type="ComputedValue", logical = side[1], spec = spec,
flags="APPLIES_TO_FIRST_LETTER",
allowed_in_page_rule=True)}
allowed_in_page_rule=True,
servo_restyle_damage = "reflow")}
% endfor

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

@ -21,5 +21,6 @@
logical = side[1],
spec = spec,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_PLACEHOLDER",
allow_quirks=not side[1])}
allow_quirks=not side[1],
servo_restyle_damage = "reflow rebuild_and_reflow_inline")}
% endfor

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

@ -14,7 +14,7 @@
"computed::LengthOrPercentageOrAuto::Auto",
spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side,
animation_value_type="ComputedValue",
allow_quirks=True)}
allow_quirks=True, servo_restyle_damage = "reflow_out_of_flow")}
% endfor
// offset-* logical properties, map to "top" / "left" / "bottom" / "right"
% for side in LOGICAL_SIDES:
@ -55,25 +55,29 @@ ${helpers.predefined_type("z-index", "IntegerOrAuto",
// Flex container properties
${helpers.single_keyword("flex-direction", "row row-reverse column column-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property",
extra_prefixes="webkit", animation_value_type="discrete")}
extra_prefixes="webkit", animation_value_type="discrete",
servo_restyle_damage = "reflow")}
${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
extra_prefixes="webkit", animation_value_type="discrete")}
extra_prefixes="webkit", animation_value_type="discrete",
servo_restyle_damage = "reflow")}
% if product == "servo":
// FIXME: Update Servo to support the same Syntax as Gecko.
${helpers.single_keyword("justify-content", "flex-start stretch flex-end center space-between space-around",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
% else:
${helpers.predefined_type(name="justify-content",
type="JustifyContent",
initial_value="specified::JustifyContent(specified::ContentDistribution::normal())",
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
extra_prefixes="webkit",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
% endif
% if product == "servo":
@ -81,27 +85,31 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
${helpers.single_keyword("align-items",
"stretch flex-start flex-end center baseline",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
% else:
${helpers.predefined_type(name="align-content",
type="AlignContent",
initial_value="specified::AlignContent(specified::ContentDistribution::normal())",
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
extra_prefixes="webkit",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
${helpers.predefined_type(name="align-items",
type="AlignItems",
initial_value="specified::AlignItems::normal()",
spec="https://drafts.csswg.org/css-align/#propdef-align-items",
extra_prefixes="webkit",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
#[cfg(feature = "gecko")]
impl_align_conversions!(::values::specified::align::AlignItems);
@ -121,13 +129,15 @@ ${helpers.predefined_type("flex-grow", "NonNegativeNumber",
"From::from(0.0)",
spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
extra_prefixes="webkit",
animation_value_type="NonNegativeNumber")}
animation_value_type="NonNegativeNumber",
servo_restyle_damage = "reflow")}
${helpers.predefined_type("flex-shrink", "NonNegativeNumber",
"From::from(1.0)",
spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property",
extra_prefixes="webkit",
animation_value_type="NonNegativeNumber")}
animation_value_type="NonNegativeNumber",
servo_restyle_damage = "reflow")}
// https://drafts.csswg.org/css-align/#align-self-property
% if product == "servo":
@ -135,7 +145,8 @@ ${helpers.predefined_type("flex-shrink", "NonNegativeNumber",
${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center baseline",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
% else:
${helpers.predefined_type(name="align-self",
type="AlignSelf",
@ -158,7 +169,8 @@ ${helpers.predefined_type("flex-shrink", "NonNegativeNumber",
${helpers.predefined_type("order", "Integer", "0",
extra_prefixes="webkit",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-flexbox/#order-property")}
spec="https://drafts.csswg.org/css-flexbox/#order-property",
servo_restyle_damage = "reflow")}
% if product == "gecko":
// FIXME: Gecko doesn't support content value yet.
@ -173,7 +185,8 @@ ${helpers.predefined_type("order", "Integer", "0",
extra_prefixes="webkit",
animation_value_type="MozLength",
allow_quirks=True,
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property"
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
servo_restyle_damage = "reflow"
)}
% else:
// FIXME: This property should be animatable.
@ -182,7 +195,8 @@ ${helpers.predefined_type("order", "Integer", "0",
"computed::FlexBasis::auto()",
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
extra_prefixes="webkit",
animation_value_type="none")}
animation_value_type="none",
servo_restyle_damage = "reflow")}
% endif
% for (size, logical) in ALL_SIZES:
<%
@ -208,7 +222,8 @@ ${helpers.predefined_type("order", "Integer", "0",
logical=logical,
allow_quirks=not logical,
spec=spec % size,
animation_value_type="MozLength"
animation_value_type="MozLength",
servo_restyle_damage = "reflow"
)}
// min-width, min-height, min-block-size, min-inline-size,
${helpers.predefined_type(
@ -219,7 +234,8 @@ ${helpers.predefined_type("order", "Integer", "0",
logical=logical,
allow_quirks=not logical,
spec=spec % size,
animation_value_type="MozLength"
animation_value_type="MozLength",
servo_restyle_damage = "reflow"
)}
${helpers.predefined_type(
"max-%s" % size,
@ -230,6 +246,7 @@ ${helpers.predefined_type("order", "Integer", "0",
allow_quirks=not logical,
spec=spec % size,
animation_value_type="MaxLength",
servo_restyle_damage = "reflow"
)}
% else:
// servo versions (no keyword support)
@ -239,7 +256,8 @@ ${helpers.predefined_type("order", "Integer", "0",
"parse_non_negative",
spec=spec % size,
allow_quirks=not logical,
animation_value_type="ComputedValue", logical = logical)}
animation_value_type="ComputedValue", logical = logical,
servo_restyle_damage = "reflow")}
${helpers.predefined_type("min-%s" % size,
"LengthOrPercentage",
"computed::LengthOrPercentage::Length(computed::Length::new(0.))",
@ -247,7 +265,8 @@ ${helpers.predefined_type("order", "Integer", "0",
spec=spec % ("min-%s" % size),
animation_value_type="ComputedValue",
logical=logical,
allow_quirks=not logical)}
allow_quirks=not logical,
servo_restyle_damage = "reflow")}
${helpers.predefined_type("max-%s" % size,
"LengthOrPercentageOrNone",
"computed::LengthOrPercentageOrNone::None",
@ -255,7 +274,8 @@ ${helpers.predefined_type("order", "Integer", "0",
spec=spec % ("min-%s" % size),
animation_value_type="ComputedValue",
logical=logical,
allow_quirks=not logical)}
allow_quirks=not logical,
servo_restyle_damage = "reflow")}
% endif
% endfor
@ -265,7 +285,8 @@ ${helpers.single_keyword("box-sizing",
spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
gecko_enum_prefix="StyleBoxSizing",
custom_consts={ "content-box": "Content", "border-box": "Border" },
animation_value_type="discrete")}
animation_value_type="discrete",
servo_restyle_damage = "reflow")}
${helpers.single_keyword("object-fit", "fill contain cover none scale-down",
products="gecko", animation_value_type="discrete",

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

@ -8,7 +8,8 @@
${helpers.single_keyword("table-layout", "auto fixed",
gecko_ffi_name="mLayoutStrategy", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-table-layout")}
spec="https://drafts.csswg.org/css-tables/#propdef-table-layout",
servo_restyle_damage = "reflow")}
${helpers.predefined_type("-x-span",
"XSpan",

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

@ -18,12 +18,14 @@ ${helpers.predefined_type("text-overflow",
animation_value_type="discrete",
boxed=True,
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow")}
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword("unicode-bidi",
"normal embed isolate bidi-override isolate-override plaintext",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-unicode-bidi")}
spec="https://drafts.csswg.org/css-writing-modes/#propdef-unicode-bidi",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.predefined_type("text-decoration-line",
"TextDecorationLine",
@ -31,7 +33,8 @@ ${helpers.predefined_type("text-decoration-line",
initial_specified_value="specified::TextDecorationLine::none()",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line")}
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line",
servo_restyle_damage="rebuild_and_reflow")}
${helpers.single_keyword("text-decoration-style",
"solid double dotted dashed wavy -moz-none",

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

@ -3870,3 +3870,28 @@ macro_rules! longhand_properties_idents {
}
}
}
% if product == "servo":
% for effect_name in ["repaint", "reflow_out_of_flow", "reflow", "rebuild_and_reflow_inline", "rebuild_and_reflow"]:
macro_rules! restyle_damage_${effect_name} {
($old: ident, $new: ident, $damage: ident, [ $($effect:expr),* ]) => ({
if
% for style_struct in data.active_style_structs():
% for longhand in style_struct.longhands:
% if effect_name in longhand.servo_restyle_damage.split() and not longhand.logical:
$old.get_${style_struct.name_lower}().${longhand.ident} !=
$new.get_${style_struct.name_lower}().${longhand.ident} ||
% endif
% endfor
% endfor
false {
$damage.insert($($effect)|*);
true
} else {
false
}
})
}
% endfor
% endif

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

@ -175,119 +175,32 @@ impl fmt::Display for ServoRestyleDamage {
}
}
// NB: We need the braces inside the RHS due to Rust #8012. This particular
// version of this macro might be safe anyway, but we want to avoid silent
// breakage on modifications.
macro_rules! add_if_not_equal(
($old:ident, $new:ident, $damage:ident,
[ $($effect:path),* ], [ $($style_struct_getter:ident.$name:ident),* ]) => ({
if $( ($old.$style_struct_getter().$name != $new.$style_struct_getter().$name) )||* {
$damage.insert($($effect)|*);
true
} else {
false
}
})
);
fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDamage {
let mut damage = ServoRestyleDamage::empty();
// This should check every CSS property, as enumerated in the fields of
// http://doc.servo.org/style/properties/struct.ComputedValues.html
// FIXME: Test somehow that every property is included.
add_if_not_equal!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW,
ServoRestyleDamage::RECONSTRUCT_FLOW], [
get_box.clear, get_box.float, get_box.display, get_box.position, get_counters.content,
get_counters.counter_reset, get_counters.counter_increment,
get_list.quotes, get_list.list_style_type,
// If these text or font properties change, we need to reconstruct the flow so that
// text shaping is re-run.
get_inheritedtext.letter_spacing, get_inheritedtext.text_rendering,
get_inheritedtext.text_transform, get_inheritedtext.word_spacing,
get_inheritedtext.overflow_wrap, get_inheritedtext.text_justify,
get_inheritedtext.white_space, get_inheritedtext.word_break, get_text.text_overflow,
get_font.font_family, get_font.font_style, get_font.font_variant_caps, get_font.font_weight,
get_font.font_size, get_font.font_stretch,
get_inheritedbox.direction, get_inheritedbox.writing_mode,
get_text.text_decoration_line, get_text.unicode_bidi,
get_inheritedtable.empty_cells, get_inheritedtable.caption_side,
get_column.column_width, get_column.column_count
]) || (new.get_box().display == Display::Inline &&
add_if_not_equal!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW,
ServoRestyleDamage::RECONSTRUCT_FLOW], [
// For inline boxes only, border/padding styles are used in flow construction (to decide
// whether to create fragments for empty flows).
get_border.border_top_width, get_border.border_right_width,
get_border.border_bottom_width, get_border.border_left_width,
get_padding.padding_top, get_padding.padding_right,
get_padding.padding_bottom, get_padding.padding_left
])) || add_if_not_equal!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW],
[get_border.border_top_width, get_border.border_right_width,
get_border.border_bottom_width, get_border.border_left_width,
get_margin.margin_top, get_margin.margin_right,
get_margin.margin_bottom, get_margin.margin_left,
get_padding.padding_top, get_padding.padding_right,
get_padding.padding_bottom, get_padding.padding_left,
get_position.width, get_position.height,
get_inheritedtext.line_height,
get_inheritedtext.text_align, get_inheritedtext.text_indent,
get_table.table_layout,
get_inheritedtable.border_collapse,
get_inheritedtable.border_spacing,
get_column.column_gap,
get_position.flex_direction,
get_position.flex_wrap,
get_position.justify_content,
get_position.align_items,
get_position.align_content,
get_position.order,
get_position.flex_basis,
get_position.flex_grow,
get_position.flex_shrink,
get_position.align_self
]) || add_if_not_equal!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::REFLOW_OUT_OF_FLOW],
[get_position.top, get_position.left,
get_position.right, get_position.bottom,
get_effects.opacity,
get_box.transform, get_box.transform_style, get_box.transform_origin,
get_box.perspective, get_box.perspective_origin
]) || add_if_not_equal!(old, new, damage,
[ServoRestyleDamage::REPAINT], [
get_color.color, get_background.background_color,
get_background.background_image, get_background.background_position_x,
get_background.background_position_y, get_background.background_repeat,
get_background.background_attachment, get_background.background_clip,
get_background.background_origin, get_background.background_size,
get_border.border_top_color, get_border.border_right_color,
get_border.border_bottom_color, get_border.border_left_color,
get_border.border_top_style, get_border.border_right_style,
get_border.border_bottom_style, get_border.border_left_style,
get_border.border_top_left_radius, get_border.border_top_right_radius,
get_border.border_bottom_left_radius, get_border.border_bottom_right_radius,
get_position.z_index, get_box._servo_overflow_clip_box,
get_inheritedtext.text_decorations_in_effect,
get_pointing.cursor, get_pointing.pointer_events,
get_effects.box_shadow, get_effects.clip, get_inheritedtext.text_shadow, get_effects.filter,
get_effects.mix_blend_mode, get_inheritedbox.image_rendering,
// Note: May require REFLOW et al. if `visibility: collapse` is implemented.
get_inheritedbox.visibility
]);
restyle_damage_rebuild_and_reflow!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW,
ServoRestyleDamage::RECONSTRUCT_FLOW]) ||
(new.get_box().display == Display::Inline &&
restyle_damage_rebuild_and_reflow_inline!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW,
ServoRestyleDamage::RECONSTRUCT_FLOW])) ||
restyle_damage_reflow!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW]) ||
restyle_damage_reflow_out_of_flow!(old, new, damage,
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::REFLOW_OUT_OF_FLOW]) ||
restyle_damage_repaint!(old, new, damage,
[ServoRestyleDamage::REPAINT]);
// Paint worklets may depend on custom properties,