aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow/construct.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-06-21 12:13:31 +0200
committerGitHub <noreply@github.com>2024-06-21 10:13:31 +0000
commit66edef806579fd0b386f4ceba473e6a9f7d0ca34 (patch)
tree830c4bb55c77f933ccd7808c91491c76c3ee85b1 /components/layout_2020/flow/construct.rs
parent44064b14392838fd7da148000b58c9a3cc07d4e7 (diff)
downloadservo-66edef806579fd0b386f4ceba473e6a9f7d0ca34.tar.gz
servo-66edef806579fd0b386f4ceba473e6a9f7d0ca34.zip
layout: Simplify `Contents` a little (#32487)
Instead of duplicating some of `NonReplacedContents` in `Contents`, divide it into either replaced and non-replaced content, since this is how the layout system processes `Contents` always. In addition, stop using `TryInto` to match replaced or non-replaced contents, as it is quite confusing to handle an `Err` as a success case.
Diffstat (limited to 'components/layout_2020/flow/construct.rs')
-rw-r--r--components/layout_2020/flow/construct.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs
index 5a53bbd12d9..986ae3e46d7 100644
--- a/components/layout_2020/flow/construct.rs
+++ b/components/layout_2020/flow/construct.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::borrow::Cow;
-use std::convert::{TryFrom, TryInto};
+use std::convert::TryFrom;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use servo_arc::Arc;
@@ -401,7 +401,7 @@ where
DisplayInside::Flow {
is_list_item: false,
},
- Contents::OfPseudoElement(contents),
+ NonReplacedContents::OfPseudoElement(contents).into(),
BoxSlot::dummy(),
);
}
@@ -494,8 +494,8 @@ where
}
let propagated_text_decoration_line = self.text_decoration_line;
- let kind = match contents.try_into() {
- Ok(contents) => match display_inside {
+ let kind = match contents {
+ Contents::NonReplaced(contents) => match display_inside {
DisplayInside::Flow { is_list_item }
if !info.style.establishes_block_formatting_context() =>
{
@@ -513,7 +513,7 @@ where
propagated_text_decoration_line,
},
},
- Err(contents) => {
+ Contents::Replaced(contents) => {
let contents = Contents::Replaced(contents);
BlockLevelCreator::Independent {
display_inside,