mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Prepare for bidi by guarding all access to writing-mode
(#33082)
We want to selectively enable right-to-left writing modes per layout context. This change makes that possible by allowing access to `writing-mode` though an interface that always returns the default horizontal top-to-bottom (implicitly left-to-right) writing mode. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
parent
3d3621b652
commit
0d94a8acd2
14 changed files with 129 additions and 88 deletions
|
@ -235,7 +235,7 @@ impl ReplacedContent {
|
|||
|
||||
fn flow_relative_intrinsic_size(&self, style: &ComputedValues) -> LogicalVec2<Option<Au>> {
|
||||
let intrinsic_size = PhysicalSize::new(self.intrinsic.width, self.intrinsic.height);
|
||||
LogicalVec2::from_physical_size(&intrinsic_size, style.writing_mode)
|
||||
LogicalVec2::from_physical_size(&intrinsic_size, style.effective_writing_mode())
|
||||
}
|
||||
|
||||
pub fn inline_size_over_block_size_intrinsic_ratio(
|
||||
|
@ -243,7 +243,7 @@ impl ReplacedContent {
|
|||
style: &ComputedValues,
|
||||
) -> Option<CSSFloat> {
|
||||
self.intrinsic.ratio.map(|width_over_height| {
|
||||
if style.writing_mode.is_vertical() {
|
||||
if style.effective_writing_mode().is_vertical() {
|
||||
1. / width_over_height
|
||||
} else {
|
||||
width_over_height
|
||||
|
@ -347,7 +347,7 @@ impl ReplacedContent {
|
|||
box_size: Option<LogicalVec2<AuOrAuto>>,
|
||||
pbm: &PaddingBorderMargin,
|
||||
) -> LogicalVec2<Au> {
|
||||
let mode = style.writing_mode;
|
||||
let mode = style.effective_writing_mode();
|
||||
let intrinsic_size = self.flow_relative_intrinsic_size(style);
|
||||
let intrinsic_ratio = style.preferred_aspect_ratio(
|
||||
self.inline_size_over_block_size_intrinsic_ratio(style),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue