mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #14467 - heycam:gecko-display, r=Manishearth
stylo: Support remaining display property values. <!-- Please describe your changes on the following line: --> This has already been reviewed by Manish in https://bugzilla.mozilla.org/show_bug.cgi?id=1322185.
This commit is contained in:
commit
e11441bdbc
11 changed files with 53 additions and 28 deletions
|
@ -2596,17 +2596,17 @@ pub enum StyleDisplay {
|
||||||
Contents = 24,
|
Contents = 24,
|
||||||
WebkitBox = 25,
|
WebkitBox = 25,
|
||||||
WebkitInlineBox = 26,
|
WebkitInlineBox = 26,
|
||||||
Box = 27,
|
MozBox = 27,
|
||||||
InlineBox = 28,
|
MozInlineBox = 28,
|
||||||
XulGrid = 29,
|
MozGrid = 29,
|
||||||
InlineXulGrid = 30,
|
MozInlineGrid = 30,
|
||||||
XulGridGroup = 31,
|
MozGridGroup = 31,
|
||||||
XulGridLine = 32,
|
MozGridLine = 32,
|
||||||
Stack = 33,
|
MozStack = 33,
|
||||||
InlineStack = 34,
|
MozInlineStack = 34,
|
||||||
Deck = 35,
|
MozDeck = 35,
|
||||||
Groupbox = 36,
|
MozGroupbox = 36,
|
||||||
Popup = 37,
|
MozPopup = 37,
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A class for holding strong references to handle-managed objects.
|
* A class for holding strong references to handle-managed objects.
|
||||||
|
|
|
@ -2570,17 +2570,17 @@ pub enum StyleDisplay {
|
||||||
Contents = 24,
|
Contents = 24,
|
||||||
WebkitBox = 25,
|
WebkitBox = 25,
|
||||||
WebkitInlineBox = 26,
|
WebkitInlineBox = 26,
|
||||||
Box = 27,
|
MozBox = 27,
|
||||||
InlineBox = 28,
|
MozInlineBox = 28,
|
||||||
XulGrid = 29,
|
MozGrid = 29,
|
||||||
InlineXulGrid = 30,
|
MozInlineGrid = 30,
|
||||||
XulGridGroup = 31,
|
MozGridGroup = 31,
|
||||||
XulGridLine = 32,
|
MozGridLine = 32,
|
||||||
Stack = 33,
|
MozStack = 33,
|
||||||
InlineStack = 34,
|
MozInlineStack = 34,
|
||||||
Deck = 35,
|
MozDeck = 35,
|
||||||
Groupbox = 36,
|
MozGroupbox = 36,
|
||||||
Popup = 37,
|
MozPopup = 37,
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A class for holding strong references to handle-managed objects.
|
* A class for holding strong references to handle-managed objects.
|
||||||
|
|
|
@ -28,7 +28,9 @@ def to_camel_case(ident):
|
||||||
class Keyword(object):
|
class Keyword(object):
|
||||||
def __init__(self, name, values, gecko_constant_prefix=None,
|
def __init__(self, name, values, gecko_constant_prefix=None,
|
||||||
gecko_enum_prefix=None, custom_consts=None,
|
gecko_enum_prefix=None, custom_consts=None,
|
||||||
extra_gecko_values=None, extra_servo_values=None):
|
extra_gecko_values=None, extra_servo_values=None,
|
||||||
|
gecko_strip_moz_prefix=True,
|
||||||
|
gecko_inexhaustive=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.values = values.split()
|
self.values = values.split()
|
||||||
if gecko_constant_prefix and gecko_enum_prefix:
|
if gecko_constant_prefix and gecko_enum_prefix:
|
||||||
|
@ -39,6 +41,8 @@ class Keyword(object):
|
||||||
self.extra_gecko_values = (extra_gecko_values or "").split()
|
self.extra_gecko_values = (extra_gecko_values or "").split()
|
||||||
self.extra_servo_values = (extra_servo_values or "").split()
|
self.extra_servo_values = (extra_servo_values or "").split()
|
||||||
self.consts_map = {} if custom_consts is None else custom_consts
|
self.consts_map = {} if custom_consts is None else custom_consts
|
||||||
|
self.gecko_strip_moz_prefix = gecko_strip_moz_prefix
|
||||||
|
self.gecko_inexhaustive = gecko_inexhaustive or (gecko_enum_prefix is None)
|
||||||
|
|
||||||
def gecko_values(self):
|
def gecko_values(self):
|
||||||
return self.values + self.extra_gecko_values
|
return self.values + self.extra_gecko_values
|
||||||
|
@ -55,7 +59,7 @@ class Keyword(object):
|
||||||
raise Exception("Bad product: " + product)
|
raise Exception("Bad product: " + product)
|
||||||
|
|
||||||
def gecko_constant(self, value):
|
def gecko_constant(self, value):
|
||||||
moz_stripped = value.replace("-moz-", '')
|
moz_stripped = value.replace("-moz-", '') if self.gecko_strip_moz_prefix else value
|
||||||
parts = moz_stripped.split('-')
|
parts = moz_stripped.split('-')
|
||||||
if self.gecko_enum_prefix:
|
if self.gecko_enum_prefix:
|
||||||
parts = [p.title() for p in parts]
|
parts = [p.title() for p in parts]
|
||||||
|
|
|
@ -255,7 +255,9 @@ def set_gecko_property(ffi_name, expr):
|
||||||
% for value in keyword.values_for('gecko'):
|
% for value in keyword.values_for('gecko'):
|
||||||
structs::${keyword.gecko_constant(value)} => Keyword::${to_rust_ident(value)},
|
structs::${keyword.gecko_constant(value)} => Keyword::${to_rust_ident(value)},
|
||||||
% endfor
|
% endfor
|
||||||
|
% if keyword.gecko_inexhaustive:
|
||||||
x => panic!("Found unexpected value in style struct for ${ident} property: {:?}", x),
|
x => panic!("Found unexpected value in style struct for ${ident} property: {:?}", x),
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</%def>
|
</%def>
|
||||||
|
@ -1026,8 +1028,13 @@ fn static_assert() {
|
||||||
<% display_keyword = Keyword("display", "inline block inline-block table inline-table table-row-group " +
|
<% display_keyword = Keyword("display", "inline block inline-block table inline-table table-row-group " +
|
||||||
"table-header-group table-footer-group table-row table-column-group " +
|
"table-header-group table-footer-group table-row table-column-group " +
|
||||||
"table-column table-cell table-caption list-item flex none " +
|
"table-column table-cell table-caption list-item flex none " +
|
||||||
"-moz-box -moz-inline-box",
|
"inline-flex grid inline-grid ruby ruby-base ruby-base-container " +
|
||||||
gecko_enum_prefix="StyleDisplay") %>
|
"ruby-text ruby-text-container contents -webkit-box -webkit-inline-box " +
|
||||||
|
"-moz-box -moz-inline-box -moz-grid -moz-inline-grid -moz-grid-group " +
|
||||||
|
"-moz-grid-line -moz-stack -moz-inline-stack -moz-deck -moz-popup " +
|
||||||
|
"-moz-groupbox",
|
||||||
|
gecko_enum_prefix="StyleDisplay",
|
||||||
|
gecko_strip_moz_prefix=False) %>
|
||||||
${impl_keyword('display', 'mDisplay', display_keyword, True)}
|
${impl_keyword('display', 'mDisplay', display_keyword, True)}
|
||||||
|
|
||||||
// overflow-y is implemented as a newtype of overflow-x, so we need special handling.
|
// overflow-y is implemented as a newtype of overflow-x, so we need special handling.
|
||||||
|
|
|
@ -329,7 +329,7 @@
|
||||||
keyword_kwargs = {a: kwargs.pop(a, None) for a in [
|
keyword_kwargs = {a: kwargs.pop(a, None) for a in [
|
||||||
'gecko_constant_prefix', 'gecko_enum_prefix',
|
'gecko_constant_prefix', 'gecko_enum_prefix',
|
||||||
'extra_gecko_values', 'extra_servo_values',
|
'extra_gecko_values', 'extra_servo_values',
|
||||||
'custom_consts',
|
'custom_consts', 'gecko_inexhaustive',
|
||||||
]}
|
]}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,13 @@
|
||||||
|
|
||||||
${helpers.single_keyword("box-decoration-break", "slice clone",
|
${helpers.single_keyword("box-decoration-break", "slice clone",
|
||||||
gecko_enum_prefix="StyleBoxDecorationBreak",
|
gecko_enum_prefix="StyleBoxDecorationBreak",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
products="gecko", animatable=False)}
|
products="gecko", animatable=False)}
|
||||||
|
|
||||||
${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
||||||
gecko_ffi_name="mFloatEdge",
|
gecko_ffi_name="mFloatEdge",
|
||||||
gecko_enum_prefix="StyleFloatEdge",
|
gecko_enum_prefix="StyleFloatEdge",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
products="gecko",
|
products="gecko",
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
none
|
none
|
||||||
""".split()
|
""".split()
|
||||||
if product == "gecko":
|
if product == "gecko":
|
||||||
values += "-moz-box -moz-inline-box".split()
|
values += """inline-flex grid inline-grid ruby ruby-base ruby-base-container
|
||||||
|
ruby-text ruby-text-container contents -webkit-box -webkit-inline-box
|
||||||
|
-moz-box -moz-inline-box -moz-grid -moz-inline-grid -moz-grid-group
|
||||||
|
-moz-grid-line -moz-stack -moz-inline-stack -moz-deck -moz-popup
|
||||||
|
-moz-groupbox""".split()
|
||||||
%>
|
%>
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
pub use self::computed_value::T as SpecifiedValue;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
@ -92,6 +96,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
|
||||||
animatable="False"
|
animatable="False"
|
||||||
need_clone="True"
|
need_clone="True"
|
||||||
gecko_enum_prefix="StyleFloat"
|
gecko_enum_prefix="StyleFloat"
|
||||||
|
gecko_inexhaustive="True"
|
||||||
gecko_ffi_name="mFloat">
|
gecko_ffi_name="mFloat">
|
||||||
use values::NoViewportPercentage;
|
use values::NoViewportPercentage;
|
||||||
impl NoViewportPercentage for SpecifiedValue {}
|
impl NoViewportPercentage for SpecifiedValue {}
|
||||||
|
|
|
@ -35,6 +35,7 @@ ${helpers.predefined_type("fill-opacity", "Opacity", "1.0",
|
||||||
|
|
||||||
${helpers.single_keyword("fill-rule", "nonzero evenodd",
|
${helpers.single_keyword("fill-rule", "nonzero evenodd",
|
||||||
gecko_enum_prefix="StyleFillRule",
|
gecko_enum_prefix="StyleFillRule",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
products="gecko", animatable=False)}
|
products="gecko", animatable=False)}
|
||||||
|
|
||||||
${helpers.single_keyword("shape-rendering",
|
${helpers.single_keyword("shape-rendering",
|
||||||
|
@ -60,4 +61,5 @@ ${helpers.predefined_type("stroke-opacity", "Opacity", "1.0",
|
||||||
${helpers.single_keyword("clip-rule", "nonzero evenodd",
|
${helpers.single_keyword("clip-rule", "nonzero evenodd",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
gecko_enum_prefix="StyleFillRule",
|
gecko_enum_prefix="StyleFillRule",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
|
@ -151,15 +151,18 @@ ${helpers.single_keyword("pointer-events", "auto none", animatable=False)}
|
||||||
${helpers.single_keyword("-moz-user-input", "none enabled disabled",
|
${helpers.single_keyword("-moz-user-input", "none enabled disabled",
|
||||||
products="gecko", gecko_ffi_name="mUserInput",
|
products="gecko", gecko_ffi_name="mUserInput",
|
||||||
gecko_enum_prefix="StyleUserInput",
|
gecko_enum_prefix="StyleUserInput",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
||||||
${helpers.single_keyword("-moz-user-modify", "read-only read-write write-only",
|
${helpers.single_keyword("-moz-user-modify", "read-only read-write write-only",
|
||||||
products="gecko", gecko_ffi_name="mUserModify",
|
products="gecko", gecko_ffi_name="mUserModify",
|
||||||
gecko_enum_prefix="StyleUserModify",
|
gecko_enum_prefix="StyleUserModify",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
||||||
${helpers.single_keyword("-moz-user-focus",
|
${helpers.single_keyword("-moz-user-focus",
|
||||||
"ignore normal select-after select-before select-menu select-same select-all none",
|
"ignore normal select-after select-before select-menu select-same select-all none",
|
||||||
products="gecko", gecko_ffi_name="mUserFocus",
|
products="gecko", gecko_ffi_name="mUserFocus",
|
||||||
gecko_enum_prefix="StyleUserFocus",
|
gecko_enum_prefix="StyleUserFocus",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
|
@ -16,4 +16,5 @@ ${helpers.single_keyword("ime-mode", "normal auto active disabled inactive",
|
||||||
${helpers.single_keyword("-moz-user-select", "auto text none all", products="gecko",
|
${helpers.single_keyword("-moz-user-select", "auto text none all", products="gecko",
|
||||||
gecko_ffi_name="mUserSelect",
|
gecko_ffi_name="mUserSelect",
|
||||||
gecko_enum_prefix="StyleUserSelect",
|
gecko_enum_prefix="StyleUserSelect",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
${helpers.single_keyword("-moz-box-align", "stretch start center baseline end",
|
${helpers.single_keyword("-moz-box-align", "stretch start center baseline end",
|
||||||
products="gecko", gecko_ffi_name="mBoxAlign",
|
products="gecko", gecko_ffi_name="mBoxAlign",
|
||||||
gecko_enum_prefix="StyleBoxAlign",
|
gecko_enum_prefix="StyleBoxAlign",
|
||||||
|
gecko_inexhaustive=True,
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
||||||
${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative",
|
${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue