mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix combinations of border-radius
and background-clip
This commit is contained in:
parent
9fedade396
commit
ea4882a1c5
3 changed files with 153 additions and 35 deletions
|
@ -240,6 +240,44 @@ impl<T> flow_relative::Sides<T> {
|
|||
{
|
||||
self.block_start + self.block_end
|
||||
}
|
||||
|
||||
pub fn to_physical(&self, mode: WritingMode) -> PhysicalSides<T>
|
||||
where
|
||||
T: Clone,
|
||||
{
|
||||
let top;
|
||||
let right;
|
||||
let bottom;
|
||||
let left;
|
||||
if mode.is_vertical() {
|
||||
if mode.is_vertical_lr() {
|
||||
left = self.block_start.clone();
|
||||
right = self.block_end.clone();
|
||||
} else {
|
||||
right = self.block_start.clone();
|
||||
left = self.block_end.clone();
|
||||
}
|
||||
|
||||
if mode.is_inline_tb() {
|
||||
top = self.inline_start.clone();
|
||||
bottom = self.inline_end.clone();
|
||||
} else {
|
||||
bottom = self.inline_start.clone();
|
||||
top = self.inline_end.clone();
|
||||
}
|
||||
} else {
|
||||
top = self.block_start.clone();
|
||||
bottom = self.block_end.clone();
|
||||
if mode.is_bidi_ltr() {
|
||||
left = self.inline_start.clone();
|
||||
right = self.inline_end.clone();
|
||||
} else {
|
||||
right = self.inline_start.clone();
|
||||
left = self.inline_end.clone();
|
||||
}
|
||||
}
|
||||
PhysicalSides::new(top, right, bottom, left)
|
||||
}
|
||||
}
|
||||
|
||||
impl flow_relative::Sides<LengthPercentage> {
|
||||
|
@ -342,3 +380,15 @@ impl ToWebRender for PhysicalRect<Length> {
|
|||
webrender_api::units::LayoutRect::new(self.origin.to_webrender(), self.size.to_webrender())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToWebRender for PhysicalSides<Length> {
|
||||
type Type = webrender_api::units::LayoutSideOffsets;
|
||||
fn to_webrender(&self) -> Self::Type {
|
||||
webrender_api::units::LayoutSideOffsets::new(
|
||||
self.top.px(),
|
||||
self.right.px(),
|
||||
self.bottom.px(),
|
||||
self.left.px(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue