mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
layout: Move text decoration propagation to stacking context tree construction (#37069)
Text decorations have a special kind of propagation. Instead of propating these during box tree construction, move propagation to stacking context tree construction. This will allow for using a very easy type of incremental layout when text decorations change. For instance, when a link changes color during hovering over it, we can skip all of box and fragment tree construction. In addition, propagation works a bit better now and color and style properly move down from their originating `Fragment`s. This introduces three new failures, because now we are drawing the text-decoration with the correct color in more places, which exposes an issue we have with text-decorations not being drawn in relation to the baseline (taking into account `vertical-align`). Testing: There are tests for these changes. Fixes #31736. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
cebb1619ae
commit
9781f1241a
23 changed files with 152 additions and 142 deletions
|
@ -41,7 +41,6 @@ use malloc_size_of_derive::MallocSizeOf;
|
|||
use servo_arc::Arc as ServoArc;
|
||||
use style::logical_geometry::WritingMode;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::TextDecorationLine;
|
||||
|
||||
use crate::geom::{LogicalVec2, SizeConstraint};
|
||||
use crate::style_ext::AspectRatio;
|
||||
|
@ -163,39 +162,20 @@ impl<'a> From<&'_ DefiniteContainingBlock<'a>> for ContainingBlock<'a> {
|
|||
/// propoagation, but only during `BoxTree` construction.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct PropagatedBoxTreeData {
|
||||
text_decoration: TextDecorationLine,
|
||||
allow_percentage_column_in_tables: bool,
|
||||
}
|
||||
|
||||
impl Default for PropagatedBoxTreeData {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
text_decoration: Default::default(),
|
||||
allow_percentage_column_in_tables: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PropagatedBoxTreeData {
|
||||
pub(crate) fn union(&self, style: &ComputedValues) -> Self {
|
||||
Self {
|
||||
// FIXME(#31736): This is only taking into account the line style and not the decoration
|
||||
// color. This should collect information about both so that they can be rendered properly.
|
||||
text_decoration: self.text_decoration | style.clone_text_decoration_line(),
|
||||
allow_percentage_column_in_tables: self.allow_percentage_column_in_tables,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn without_text_decorations(&self) -> Self {
|
||||
Self {
|
||||
text_decoration: TextDecorationLine::NONE,
|
||||
allow_percentage_column_in_tables: self.allow_percentage_column_in_tables,
|
||||
}
|
||||
}
|
||||
|
||||
fn disallowing_percentage_table_columns(&self) -> PropagatedBoxTreeData {
|
||||
Self {
|
||||
text_decoration: self.text_decoration,
|
||||
allow_percentage_column_in_tables: false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue