mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Use rust types for vertical-align.
The previous commit removed the dependence on the discriminant value, so we don't need to keep discriminants different from text-align anymore. Differential Revision: https://phabricator.services.mozilla.com/D29361
This commit is contained in:
parent
8123007717
commit
c990c9623d
5 changed files with 43 additions and 102 deletions
|
@ -38,7 +38,7 @@ use crate::gecko_bindings::bindings::{Gecko_ResetFilters, Gecko_CopyFiltersFrom}
|
|||
use crate::gecko_bindings::structs;
|
||||
use crate::gecko_bindings::structs::nsCSSPropertyID;
|
||||
use crate::gecko_bindings::structs::mozilla::PseudoStyleType;
|
||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
|
||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordDataMut};
|
||||
use crate::gecko_bindings::sugar::refptr::RefPtr;
|
||||
use crate::gecko::values::GeckoStyleCoordConvertible;
|
||||
use crate::gecko::values::round_border_to_device_pixels;
|
||||
|
@ -2505,7 +2505,7 @@ fn static_assert() {
|
|||
}
|
||||
</%def>
|
||||
|
||||
<% skip_box_longhands= """display vertical-align
|
||||
<% skip_box_longhands= """display
|
||||
animation-name animation-delay animation-duration
|
||||
animation-direction animation-fill-mode animation-play-state
|
||||
animation-iteration-count animation-timing-function
|
||||
|
@ -2561,47 +2561,6 @@ fn static_assert() {
|
|||
) %>
|
||||
${impl_keyword('clear', 'mBreakType', clear_keyword)}
|
||||
|
||||
pub fn set_vertical_align(&mut self, v: longhands::vertical_align::computed_value::T) {
|
||||
use crate::values::generics::box_::VerticalAlign;
|
||||
let value = match v {
|
||||
VerticalAlign::Baseline => structs::NS_STYLE_VERTICAL_ALIGN_BASELINE,
|
||||
VerticalAlign::Sub => structs::NS_STYLE_VERTICAL_ALIGN_SUB,
|
||||
VerticalAlign::Super => structs::NS_STYLE_VERTICAL_ALIGN_SUPER,
|
||||
VerticalAlign::Top => structs::NS_STYLE_VERTICAL_ALIGN_TOP,
|
||||
VerticalAlign::TextTop => structs::NS_STYLE_VERTICAL_ALIGN_TEXT_TOP,
|
||||
VerticalAlign::Middle => structs::NS_STYLE_VERTICAL_ALIGN_MIDDLE,
|
||||
VerticalAlign::Bottom => structs::NS_STYLE_VERTICAL_ALIGN_BOTTOM,
|
||||
VerticalAlign::TextBottom => structs::NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM,
|
||||
VerticalAlign::MozMiddleWithBaseline => {
|
||||
structs::NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE
|
||||
},
|
||||
VerticalAlign::Length(length) => {
|
||||
self.gecko.mVerticalAlign.set(length);
|
||||
return;
|
||||
},
|
||||
};
|
||||
self.gecko.mVerticalAlign.set_value(CoordDataValue::Enumerated(value));
|
||||
}
|
||||
|
||||
pub fn clone_vertical_align(&self) -> longhands::vertical_align::computed_value::T {
|
||||
use crate::values::computed::LengthPercentage;
|
||||
use crate::values::generics::box_::VerticalAlign;
|
||||
|
||||
let gecko = &self.gecko.mVerticalAlign;
|
||||
match gecko.as_value() {
|
||||
CoordDataValue::Enumerated(value) => VerticalAlign::from_gecko_keyword(value),
|
||||
_ => {
|
||||
VerticalAlign::Length(
|
||||
LengthPercentage::from_gecko_style_coord(gecko).expect(
|
||||
"expected <length-percentage> for vertical-align",
|
||||
),
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
<%call expr="impl_coord_copy('vertical_align', 'mVerticalAlign')"></%call>
|
||||
|
||||
${impl_style_coord("scroll_snap_points_x", "mScrollSnapPointsX")}
|
||||
${impl_style_coord("scroll_snap_points_y", "mScrollSnapPointsY")}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue