mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -29,7 +29,9 @@ use app_units::Au;
|
|||
pub use flow::BoxTree;
|
||||
pub use fragment_tree::FragmentTree;
|
||||
use geom::AuOrAuto;
|
||||
use style::logical_geometry::WritingMode;
|
||||
use style::properties::ComputedValues;
|
||||
use style_ext::ComputedValuesExt;
|
||||
|
||||
use crate::geom::LogicalVec2;
|
||||
|
||||
|
@ -39,11 +41,23 @@ pub struct ContainingBlock<'a> {
|
|||
style: &'a ComputedValues,
|
||||
}
|
||||
|
||||
impl<'a> ContainingBlock<'a> {
|
||||
pub(crate) fn effective_writing_mode(&self) -> WritingMode {
|
||||
self.style.effective_writing_mode()
|
||||
}
|
||||
}
|
||||
|
||||
struct DefiniteContainingBlock<'a> {
|
||||
size: LogicalVec2<Au>,
|
||||
style: &'a ComputedValues,
|
||||
}
|
||||
|
||||
impl<'a> DefiniteContainingBlock<'a> {
|
||||
pub(crate) fn effective_writing_mode(&self) -> WritingMode {
|
||||
self.style.effective_writing_mode()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'_ DefiniteContainingBlock<'a>> for ContainingBlock<'a> {
|
||||
fn from(definite: &DefiniteContainingBlock<'a>) -> Self {
|
||||
ContainingBlock {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue