mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
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.
This commit is contained in:
parent
44064b1439
commit
66edef8065
4 changed files with 34 additions and 41 deletions
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::convert::TryInto;
|
||||
|
||||
use app_units::Au;
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
|
@ -92,8 +90,8 @@ impl IndependentFormattingContext {
|
|||
contents: Contents,
|
||||
propagated_text_decoration_line: TextDecorationLine,
|
||||
) -> Self {
|
||||
match contents.try_into() {
|
||||
Ok(non_replaced_contents) => {
|
||||
match contents {
|
||||
Contents::NonReplaced(non_replaced_contents) => {
|
||||
let contents = match display_inside {
|
||||
DisplayInside::Flow { is_list_item } |
|
||||
DisplayInside::FlowRoot { is_list_item } => {
|
||||
|
@ -131,7 +129,7 @@ impl IndependentFormattingContext {
|
|||
contents,
|
||||
})
|
||||
},
|
||||
Err(contents) => {
|
||||
Contents::Replaced(contents) => {
|
||||
let mut base_fragment_info: BaseFragmentInfo = node_and_style_info.into();
|
||||
base_fragment_info.flags.insert(FragmentFlags::IS_REPLACED);
|
||||
Self::Replaced(ReplacedFormattingContext {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue