mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Auto merge of #14399 - Manishearth:feat-offset-logical, r=SimonSapin
Support offset- logical properties I didn't realize that these map to the top/left/bottom/right physical properties. We can just implement them. r? @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/14399) <!-- Reviewable:end -->
This commit is contained in:
commit
a88487f96a
3 changed files with 22 additions and 5 deletions
|
@ -321,6 +321,14 @@ partial interface CSSStyleDeclaration {
|
||||||
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString right;
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString right;
|
||||||
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString left;
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString left;
|
||||||
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString bottom;
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString bottom;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offset-block-start;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offsetBlockStart;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offset-block-end;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offsetBlockEnd;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offset-inline-start;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offsetInlineStart;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offset-inline-end;
|
||||||
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString offsetInlineEnd;
|
||||||
|
|
||||||
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString height;
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString height;
|
||||||
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString minHeight;
|
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString minHeight;
|
||||||
|
|
|
@ -563,13 +563,15 @@
|
||||||
side = maybe_side[0]
|
side = maybe_side[0]
|
||||||
elif len(maybe_size) == 1:
|
elif len(maybe_size) == 1:
|
||||||
size = maybe_size[0]
|
size = maybe_size[0]
|
||||||
|
def phys_ident(side, phy_side):
|
||||||
|
return to_rust_ident(name.replace(side, phy_side).replace("offset-", ""))
|
||||||
%>
|
%>
|
||||||
% if side is not None:
|
% if side is not None:
|
||||||
use logical_geometry::PhysicalSide;
|
use logical_geometry::PhysicalSide;
|
||||||
match wm.${to_rust_ident(side)}_physical_side() {
|
match wm.${to_rust_ident(side)}_physical_side() {
|
||||||
% for phy_side in PHYSICAL_SIDES:
|
% for phy_side in PHYSICAL_SIDES:
|
||||||
PhysicalSide::${phy_side.title()} => {
|
PhysicalSide::${phy_side.title()} => {
|
||||||
${caller.inner(physical_ident=to_rust_ident(name.replace(side, phy_side)))}
|
${caller.inner(physical_ident=phys_ident(side, phy_side))}
|
||||||
}
|
}
|
||||||
% endfor
|
% endfor
|
||||||
}
|
}
|
||||||
|
@ -581,9 +583,9 @@
|
||||||
physical_size = ("width", "height")
|
physical_size = ("width", "height")
|
||||||
%>
|
%>
|
||||||
if wm.is_vertical() {
|
if wm.is_vertical() {
|
||||||
${caller.inner(physical_ident=to_rust_ident(name.replace(size, physical_size[1])))}
|
${caller.inner(physical_ident=phys_ident(size, physical_size[1]))}
|
||||||
} else {
|
} else {
|
||||||
${caller.inner(physical_ident=to_rust_ident(name.replace(size, physical_size[0])))}
|
${caller.inner(physical_ident=phys_ident(size, physical_size[0]))}
|
||||||
}
|
}
|
||||||
% else:
|
% else:
|
||||||
<% raise Exception("Don't know what to do with logical property %s" % name) %>
|
<% raise Exception("Don't know what to do with logical property %s" % name) %>
|
||||||
|
|
|
@ -3,15 +3,22 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
<% from data import ALL_SIZES %>
|
<% from data import ALL_SIZES, PHYSICAL_SIDES, LOGICAL_SIDES %>
|
||||||
|
|
||||||
<% data.new_style_struct("Position", inherited=False) %>
|
<% data.new_style_struct("Position", inherited=False) %>
|
||||||
|
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
// "top" / "left" / "bottom" / "right"
|
||||||
|
% for side in PHYSICAL_SIDES:
|
||||||
${helpers.predefined_type(side, "LengthOrPercentageOrAuto",
|
${helpers.predefined_type(side, "LengthOrPercentageOrAuto",
|
||||||
"computed::LengthOrPercentageOrAuto::Auto",
|
"computed::LengthOrPercentageOrAuto::Auto",
|
||||||
animatable=True)}
|
animatable=True)}
|
||||||
% endfor
|
% endfor
|
||||||
|
// offset-* logical properties, map to "top" / "left" / "bottom" / "right"
|
||||||
|
% for side in LOGICAL_SIDES:
|
||||||
|
${helpers.predefined_type("offset-" + side, "LengthOrPercentageOrAuto",
|
||||||
|
"computed::LengthOrPercentageOrAuto::Auto",
|
||||||
|
animatable=True, logical=True)}
|
||||||
|
% endfor
|
||||||
|
|
||||||
<%helpers:longhand name="z-index" animatable="True">
|
<%helpers:longhand name="z-index" animatable="True">
|
||||||
use values::NoViewportPercentage;
|
use values::NoViewportPercentage;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue