mirror of
https://github.com/servo/servo.git
synced 2025-08-13 09:25:32 +01:00
style: Use Rust lengths for margin / padding / inset.
Also for the intersection observer root margin, since it was easier to fix it up and clean it up than not doing it. This is the first big step to get rid of nscoord. It duplicates a bit of logic in nsLayoutUtils since for now max/min-width/height are still represented with nsStyleCoord, but I think I prefer to land this incrementally. I didn't add helpers for the physical accessors of the style rect sides that nsStyleSides has (top/bottom/left/right) since I think we generally should encourage the logical versions, but let me know if you want me to do that. Differential Revision: https://phabricator.services.mozilla.com/D17739
This commit is contained in:
parent
13e12d23f3
commit
8dad956513
5 changed files with 64 additions and 64 deletions
|
@ -772,11 +772,12 @@ def set_gecko_property(ffi_name, expr):
|
|||
<%def name="impl_split_style_coord(ident, gecko_ffi_name, index)">
|
||||
#[allow(non_snake_case)]
|
||||
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
|
||||
v.to_gecko_style_coord(&mut self.gecko.${gecko_ffi_name}.data_at_mut(${index}));
|
||||
self.gecko.${gecko_ffi_name}.${index} = v;
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
pub fn copy_${ident}_from(&mut self, other: &Self) {
|
||||
self.gecko.${gecko_ffi_name}.data_at_mut(${index}).copy_from(&other.gecko.${gecko_ffi_name}.data_at(${index}));
|
||||
self.gecko.${gecko_ffi_name}.${index} =
|
||||
other.gecko.${gecko_ffi_name}.${index};
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
pub fn reset_${ident}(&mut self, other: &Self) {
|
||||
|
@ -785,9 +786,7 @@ def set_gecko_property(ffi_name, expr):
|
|||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
|
||||
use crate::properties::longhands::${ident}::computed_value::T;
|
||||
T::from_gecko_style_coord(&self.gecko.${gecko_ffi_name}.data_at(${index}))
|
||||
.expect("clone for ${ident} failed")
|
||||
self.gecko.${gecko_ffi_name}.${index}
|
||||
}
|
||||
</%def>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue