mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -165,15 +165,16 @@ impl BoxFragment {
|
|||
/// Get the baselines for this [`BoxFragment`] if they are compatible with the given [`WritingMode`].
|
||||
/// If they are not compatible, [`Baselines::default()`] is returned.
|
||||
pub fn baselines(&self, writing_mode: WritingMode) -> Baselines {
|
||||
let mut baselines =
|
||||
if writing_mode.is_horizontal() == self.style.writing_mode.is_horizontal() {
|
||||
self.baselines
|
||||
} else {
|
||||
// If the writing mode of the container requesting baselines is not
|
||||
// compatible, ensure that the baselines established by this fragment are
|
||||
// not used.
|
||||
Baselines::default()
|
||||
};
|
||||
let mut baselines = if writing_mode.is_horizontal() ==
|
||||
self.style.effective_writing_mode().is_horizontal()
|
||||
{
|
||||
self.baselines
|
||||
} else {
|
||||
// If the writing mode of the container requesting baselines is not
|
||||
// compatible, ensure that the baselines established by this fragment are
|
||||
// not used.
|
||||
Baselines::default()
|
||||
};
|
||||
|
||||
// From the https://drafts.csswg.org/css-align-3/#baseline-export section on "block containers":
|
||||
// > However, for legacy reasons if its baseline-source is auto (the initial
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue