Make the choice of layout runtime setting

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Martin Robinson 2023-06-28 10:07:08 +02:00
parent f11c6045e3
commit d31cdb682f
No known key found for this signature in database
GPG key ID: D56AA4FA55EFE6F8
262 changed files with 1740 additions and 3700 deletions

View file

@ -7,7 +7,7 @@ edition = "2018"
publish = false
[lib]
name = "layout"
name = "layout_2020"
path = "lib.rs"
test = false
doctest = false
@ -41,7 +41,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
servo_arc = { path = "../servo_arc" }
servo_url = { path = "../url" }
style = { path = "../style", features = ["servo", "servo-layout-2020"] }
style = { path = "../style", features = ["servo"] }
style_traits = { path = "../style_traits" }
unicode-script = { workspace = true }
webrender_api = { workspace = true }

View file

@ -638,6 +638,9 @@ impl<'a> BuilderForBoxFragment<'a> {
}
}
},
Image::PaintWorklet(_) => {
// TODO: Add support for PaintWorklet rendering.
},
// Gecko-only value, represented as a (boxed) empty enum on non-Gecko.
Image::Rect(ref rect) => match **rect {},
Image::ImageSet(..) | Image::CrossFade(..) => {

View file

@ -361,6 +361,14 @@ where
vec.push(PseudoElementContentItem::Replaced(replaced_content));
}
},
ContentItem::Counter(_, _) |
ContentItem::Counters(_, _, _) |
ContentItem::OpenQuote |
ContentItem::CloseQuote |
ContentItem::NoOpenQuote |
ContentItem::NoCloseQuote => {
// TODO: Add support for counters and quotes.
},
}
}
vec

View file

@ -473,6 +473,16 @@ impl Lines {
TextAlign::Start
}
},
TextAlignKeyword::Justify => {
// TODO: Add support for justfied text.
TextAlign::Start
},
TextAlignKeyword::ServoCenter |
TextAlignKeyword::ServoLeft |
TextAlignKeyword::ServoRight => {
// TODO: Implement these modes which seem to be used by quirks mode.
TextAlign::Start
},
};
let move_by = match text_align {
TextAlign::Start => Length::zero(),

View file

@ -33,6 +33,7 @@ where
Image::Rect(..) |
Image::Gradient(..) |
Image::CrossFade(..) |
Image::PaintWorklet(..) |
Image::None => None,
};
marker_image().or_else(|| {
@ -44,7 +45,6 @@ where
/// https://drafts.csswg.org/css-lists/#marker-string
fn marker_string(style: &style_structs::List) -> Option<&'static str> {
// FIXME: add support for counters and other style types
match style.list_style_type {
ListStyleType::None => None,
ListStyleType::Disc => Some(""),
@ -52,5 +52,36 @@ fn marker_string(style: &style_structs::List) -> Option<&'static str> {
ListStyleType::Square => Some(""),
ListStyleType::DisclosureOpen => Some(""),
ListStyleType::DisclosureClosed => Some(""),
ListStyleType::Decimal |
ListStyleType::LowerAlpha |
ListStyleType::UpperAlpha |
ListStyleType::ArabicIndic |
ListStyleType::Bengali |
ListStyleType::Cambodian |
ListStyleType::CjkDecimal |
ListStyleType::Devanagari |
ListStyleType::Gujarati |
ListStyleType::Gurmukhi |
ListStyleType::Kannada |
ListStyleType::Khmer |
ListStyleType::Lao |
ListStyleType::Malayalam |
ListStyleType::Mongolian |
ListStyleType::Myanmar |
ListStyleType::Oriya |
ListStyleType::Persian |
ListStyleType::Telugu |
ListStyleType::Thai |
ListStyleType::Tibetan |
ListStyleType::CjkEarthlyBranch |
ListStyleType::CjkHeavenlyStem |
ListStyleType::LowerGreek |
ListStyleType::Hiragana |
ListStyleType::HiraganaIroha |
ListStyleType::Katakana |
ListStyleType::KatakanaIroha => {
// TODO: Implement support for counters.
None
},
}
}

View file

@ -290,7 +290,7 @@ impl PositioningContext {
match position {
Position::Fixed => {}, // fall through
Position::Absolute => return nearest.push(box_),
Position::Static | Position::Relative => unreachable!(),
Position::Static | Position::Relative | Position::Sticky => unreachable!(),
}
}
self.for_nearest_containing_block_for_all_descendants

View file

@ -492,8 +492,9 @@ fn process_offset_parent_query_inner(
// TODO: Handle case 2
(true, _) |
(false, Position::Absolute) |
(false, Position::Fixed) |
(false, Position::Relative) |
(false, Position::Fixed) => true,
(false, Position::Sticky) => true,
// Otherwise, it's not a valid parent
(false, Position::Static) => false,

View file

@ -497,6 +497,18 @@ impl From<stylo::Display> for Display {
// These should not be values of DisplayInside, but oh well
stylo::DisplayInside::None => return Display::None,
stylo::DisplayInside::Contents => return Display::Contents,
// TODO: Implement support for tables.
stylo::DisplayInside::Table |
stylo::DisplayInside::TableRowGroup |
stylo::DisplayInside::TableColumn |
stylo::DisplayInside::TableColumnGroup |
stylo::DisplayInside::TableHeaderGroup |
stylo::DisplayInside::TableFooterGroup |
stylo::DisplayInside::TableRow |
stylo::DisplayInside::TableCell => DisplayInside::Flow {
is_list_item: packed.is_list_item(),
},
};
let outside = match packed.outside() {
stylo::DisplayOutside::Block => DisplayOutside::Block,
@ -504,6 +516,11 @@ impl From<stylo::Display> for Display {
// This should not be a value of DisplayInside, but oh well
stylo::DisplayOutside::None => return Display::None,
// TODO: Implement support for tables.
stylo::DisplayOutside::TableCaption | stylo::DisplayOutside::InternalTable => {
DisplayOutside::Block
},
};
Display::GeneratingBox(DisplayGeneratingBox::OutsideInside { outside, inside })
}