mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
style: Derive more length stuff, and shrink MaxLength / MozLength's repr(C) representation.
This patch: * Makes LengthPercentageOrAuto generic, and removes a bunch of code fo LengthPercentageOrNone, which was used only for servo and now can use the normal MaxLength (with a cfg() guard for the ExtremumLength variant). * Shrinks MaxLength / MozLength's repr(C) reperesentation by reducing enum nesting. The shrinking is in preparation for using them from C++ too, though that'd be a different bug. * Moves NonNegative usage to the proper places so that stuff for them can be derived. I did this on top of bug 1523071 to prove both that it could be possible and that stuff wasn't too messy. It got a bit messy, but just because of a bug I had fixed in bindgen long time ago already, so this updates bindgen's patch version to grab a fix instead of ugly workarounds :) Differential Revision: https://phabricator.services.mozilla.com/D17762
This commit is contained in:
parent
8dad956513
commit
a68bc29b96
17 changed files with 337 additions and 520 deletions
|
@ -3016,7 +3016,7 @@ impl ComputedValuesInner {
|
|||
|
||||
/// Get the logical computed inline size.
|
||||
#[inline]
|
||||
pub fn content_inline_size(&self) -> computed::LengthPercentageOrAuto {
|
||||
pub fn content_inline_size(&self) -> computed::NonNegativeLengthPercentageOrAuto {
|
||||
let position_style = self.get_position();
|
||||
if self.writing_mode.is_vertical() {
|
||||
position_style.height
|
||||
|
@ -3027,35 +3027,35 @@ impl ComputedValuesInner {
|
|||
|
||||
/// Get the logical computed block size.
|
||||
#[inline]
|
||||
pub fn content_block_size(&self) -> computed::LengthPercentageOrAuto {
|
||||
pub fn content_block_size(&self) -> computed::NonNegativeLengthPercentageOrAuto {
|
||||
let position_style = self.get_position();
|
||||
if self.writing_mode.is_vertical() { position_style.width } else { position_style.height }
|
||||
}
|
||||
|
||||
/// Get the logical computed min inline size.
|
||||
#[inline]
|
||||
pub fn min_inline_size(&self) -> computed::LengthPercentage {
|
||||
pub fn min_inline_size(&self) -> computed::NonNegativeLengthPercentage {
|
||||
let position_style = self.get_position();
|
||||
if self.writing_mode.is_vertical() { position_style.min_height } else { position_style.min_width }
|
||||
}
|
||||
|
||||
/// Get the logical computed min block size.
|
||||
#[inline]
|
||||
pub fn min_block_size(&self) -> computed::LengthPercentage {
|
||||
pub fn min_block_size(&self) -> computed::NonNegativeLengthPercentage {
|
||||
let position_style = self.get_position();
|
||||
if self.writing_mode.is_vertical() { position_style.min_width } else { position_style.min_height }
|
||||
}
|
||||
|
||||
/// Get the logical computed max inline size.
|
||||
#[inline]
|
||||
pub fn max_inline_size(&self) -> computed::LengthPercentageOrNone {
|
||||
pub fn max_inline_size(&self) -> computed::MaxLength {
|
||||
let position_style = self.get_position();
|
||||
if self.writing_mode.is_vertical() { position_style.max_height } else { position_style.max_width }
|
||||
}
|
||||
|
||||
/// Get the logical computed max block size.
|
||||
#[inline]
|
||||
pub fn max_block_size(&self) -> computed::LengthPercentageOrNone {
|
||||
pub fn max_block_size(&self) -> computed::MaxLength {
|
||||
let position_style = self.get_position();
|
||||
if self.writing_mode.is_vertical() { position_style.max_width } else { position_style.max_height }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue