mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
Auto merge of #14120 - Manishearth:logical, r=emilio
Support logical properties in style Adds support for the logical block-end/inline-start/etc properties. These properties (like `border-block-end-color`) map to "physical" properties (e.g. `border-top-color`) depending on the writing mode. Todo: - [x] Handle shorthands - [x] Make geckolib setters work - [x] Handle padding/offset logical properties - [x] Perhaps handle `-block-size`, `-inline-size` type logical properties? - [x] Tests? This will overall add 16 new longhands and 4 new shorthands, taking a big bite out of the [remaining properties work](https://manishearth.github.io/css-properties-list/?stylo=hide&servo=hide&firefox=only&chrome=show&mdn=false&alexa=false) f? @emilio @SimonSapin <!-- 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/14120) <!-- Reviewable:end -->
This commit is contained in:
commit
4b9693cf81
10 changed files with 240 additions and 89 deletions
|
@ -8,6 +8,7 @@
|
|||
from data import to_rust_ident
|
||||
from data import Keyword
|
||||
%>
|
||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||
|
||||
use app_units::Au;
|
||||
use custom_properties::ComputedValuesMap;
|
||||
|
@ -401,6 +402,10 @@ def set_gecko_property(ffi_name, expr):
|
|||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="impl_logical(name, need_clone=False, **kwargs)">
|
||||
${helpers.logical_setter(name, need_clone)}
|
||||
</%def>
|
||||
|
||||
<%def name="impl_style_struct(style_struct)">
|
||||
impl ${style_struct.gecko_struct_name} {
|
||||
#[allow(dead_code, unused_variables)]
|
||||
|
@ -496,7 +501,10 @@ impl Debug for ${style_struct.gecko_struct_name} {
|
|||
need_clone=longhand.need_clone)
|
||||
|
||||
# get the method and pass additional keyword or type-specific arguments
|
||||
if longhand.keyword:
|
||||
if longhand.logical:
|
||||
method = impl_logical
|
||||
args.update(name=longhand.name)
|
||||
elif longhand.keyword:
|
||||
method = impl_keyword
|
||||
args.update(keyword=longhand.keyword)
|
||||
if "font" in longhand.ident:
|
||||
|
@ -510,7 +518,7 @@ impl Debug for ${style_struct.gecko_struct_name} {
|
|||
|
||||
picked_longhands, stub_longhands = [], []
|
||||
for x in longhands:
|
||||
if (x.keyword or x.predefined_type in predefined_types) and x.name not in force_stub:
|
||||
if (x.keyword or x.predefined_type in predefined_types or x.logical) and x.name not in force_stub:
|
||||
picked_longhands.append(x)
|
||||
else:
|
||||
stub_longhands.append(x)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue