mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
Remove interior borders during flow construction
Instead of looking at the boundaries of the text run, set the border width to zero and the border style to none on border sides that are not the outermost for a node container that is display: inline.
This commit is contained in:
parent
8ad3c5aeb6
commit
ec2fa2558c
6 changed files with 74 additions and 9 deletions
|
@ -17,6 +17,7 @@ use util::geometry::Au;
|
|||
use url::Url;
|
||||
use cssparser::{Parser, Color, RGBA, AtRuleParser, DeclarationParser,
|
||||
DeclarationListParser, parse_important, ToCss};
|
||||
use geom::num::Zero;
|
||||
use geom::SideOffsets2D;
|
||||
|
||||
use values::specified::BorderStyle;
|
||||
|
@ -3534,6 +3535,21 @@ pub fn make_inline(style: &ComputedValues) -> ComputedValues {
|
|||
style
|
||||
}
|
||||
|
||||
/// Sets `border_${side}_width` to the passed in values.
|
||||
/// If `border_${side}_width` == 0 also sets `border_${side}_style` = none.
|
||||
#[inline]
|
||||
pub fn make_border(style: &ComputedValues, border_width: LogicalMargin<Au>) -> ComputedValues {
|
||||
let mut style = (*style).clone();
|
||||
let physical_border = LogicalMargin::to_physical(&border_width, style.writing_mode);
|
||||
% for side in ["top", "right", "bottom", "left"]:
|
||||
style.border.make_unique().border_${side}_width = physical_border.${side};
|
||||
if physical_border.${side} == Zero::zero() {
|
||||
style.border.make_unique().border_${side}_style = BorderStyle::none;
|
||||
}
|
||||
% endfor
|
||||
style
|
||||
}
|
||||
|
||||
pub fn is_supported_property(property: &str) -> bool {
|
||||
match property {
|
||||
% for property in SHORTHANDS + LONGHANDS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue