mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Shape text only once (#31146)
Shape text during InlineFormattingContext construction rather than doing it twice during fragment tree construction. This is a step on the way toward proper font fallback. This also moves all `TextRun` related code into `text_run.rs` to try to trim down the size of `inline.rs`. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because this should only have performance impacts. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
parent
bb04c97f15
commit
094f7845b1
6 changed files with 289 additions and 268 deletions
|
@ -126,21 +126,6 @@ impl IndependentFormattingContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn construct_for_text_runs<'dom>(
|
||||
node_and_style_info: &NodeAndStyleInfo<impl NodeExt<'dom>>,
|
||||
runs: impl Iterator<Item = crate::flow::inline::TextRun>,
|
||||
propagated_text_decoration_line: TextDecorationLine,
|
||||
) -> Self {
|
||||
let bfc =
|
||||
BlockFormattingContext::construct_for_text_runs(runs, propagated_text_decoration_line);
|
||||
Self::NonReplaced(NonReplacedFormattingContext {
|
||||
base_fragment_info: node_and_style_info.into(),
|
||||
style: Arc::clone(&node_and_style_info.style),
|
||||
content_sizes: None,
|
||||
contents: NonReplacedFormattingContextContents::Flow(bfc),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn style(&self) -> &Arc<ComputedValues> {
|
||||
match self {
|
||||
Self::NonReplaced(inner) => &inner.style,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue