mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
layout: Improve fixed table layout (#35170)
If `width` is indefinite, treat the outer size as zero, instead of treating the content size as zero and then adding padding and borders. Also, we don't want a default minimum of zero to get added padding and borders, and then defeat the point baove. So just ignore minimums and maximums. That seems to roughly match what other browsers do, but as usual, the details are not interoperable, e.g. some browsers may obey min or max sizing properties in some cases. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
859cc6ab9b
commit
d5fcc5a5d5
16 changed files with 69 additions and 96 deletions
|
@ -10,7 +10,7 @@ use std::ops::{Add, AddAssign, Neg, Sub, SubAssign};
|
|||
use app_units::Au;
|
||||
use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode};
|
||||
use style::values::computed::{
|
||||
CSSPixelLength, LengthPercentage, MaxSize as StyleMaxSize, Size as StyleSize,
|
||||
CSSPixelLength, LengthPercentage, MaxSize as StyleMaxSize, Percentage, Size as StyleSize,
|
||||
};
|
||||
use style::values::generics::length::GenericLengthPercentageOrAuto as AutoOr;
|
||||
use style::Zero;
|
||||
|
@ -672,11 +672,6 @@ impl<T> Default for Size<T> {
|
|||
}
|
||||
|
||||
impl<T> Size<T> {
|
||||
#[inline]
|
||||
pub(crate) fn is_numeric(&self) -> bool {
|
||||
matches!(self, Self::Numeric(_))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn is_initial(&self) -> bool {
|
||||
matches!(self, Self::Initial)
|
||||
|
@ -747,6 +742,14 @@ impl From<StyleMaxSize> for Size<LengthPercentage> {
|
|||
}
|
||||
}
|
||||
|
||||
impl Size<LengthPercentage> {
|
||||
#[inline]
|
||||
pub(crate) fn to_percentage(&self) -> Option<Percentage> {
|
||||
self.to_numeric()
|
||||
.and_then(|length_percentage| length_percentage.to_percentage())
|
||||
}
|
||||
}
|
||||
|
||||
impl LogicalVec2<Size<LengthPercentage>> {
|
||||
pub(crate) fn maybe_percentages_relative_to_basis(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue