mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #11930 - nox:die-util-die, r=SimonSapin
Remove some util stuff <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11930) <!-- Reviewable:end -->
This commit is contained in:
commit
dcc4697dde
9 changed files with 34 additions and 41 deletions
|
@ -30,6 +30,7 @@ use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragm
|
|||
use gfx::display_list::OpaqueNode;
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, InlineFragmentNodeFlags};
|
||||
use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
|
||||
use linked_list::prepend_from;
|
||||
use list_item::{ListItemFlow, ListStyleTypeContent};
|
||||
use multicol::{MulticolFlow, MulticolColumnFlow};
|
||||
use parallel;
|
||||
|
@ -57,7 +58,6 @@ use table_wrapper::TableWrapperFlow;
|
|||
use text::TextRunScanner;
|
||||
use traversal::PostorderNodeMutTraversal;
|
||||
use url::Url;
|
||||
use util::linked_list;
|
||||
use util::opts;
|
||||
use wrapper::{TextContent, ThreadSafeLayoutNodeHelpers};
|
||||
|
||||
|
@ -1805,8 +1805,7 @@ pub fn strip_ignorable_whitespace_from_start(this: &mut LinkedList<Fragment>) {
|
|||
}
|
||||
}
|
||||
}
|
||||
linked_list::prepend_from(this,
|
||||
&mut leading_fragments_consisting_of_solely_bidi_control_characters);
|
||||
prepend_from(this, &mut leading_fragments_consisting_of_solely_bidi_control_characters);
|
||||
}
|
||||
|
||||
/// Strips ignorable whitespace from the end of a list of fragments.
|
||||
|
|
|
@ -75,6 +75,7 @@ mod fragment;
|
|||
mod generated_content;
|
||||
pub mod incremental;
|
||||
mod inline;
|
||||
mod linked_list;
|
||||
mod list_item;
|
||||
mod model;
|
||||
mod multicol;
|
||||
|
|
21
components/layout/linked_list.rs
Normal file
21
components/layout/linked_list.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Utility functions for doubly-linked lists.
|
||||
|
||||
use std::collections::LinkedList;
|
||||
use std::mem;
|
||||
|
||||
/// Splits the head off a list in O(1) time, and returns the head.
|
||||
pub fn split_off_head<T>(list: &mut LinkedList<T>) -> LinkedList<T> {
|
||||
let tail = list.split_off(1);
|
||||
mem::replace(list, tail)
|
||||
}
|
||||
|
||||
/// Prepends the items in the other list to this one, leaving the other list empty.
|
||||
#[inline]
|
||||
pub fn prepend_from<T>(this: &mut LinkedList<T>, other: &mut LinkedList<T>) {
|
||||
other.append(this);
|
||||
mem::swap(this, other);
|
||||
}
|
|
@ -16,6 +16,7 @@ use gfx::text::glyph::ByteIndex;
|
|||
use gfx::text::text_run::TextRun;
|
||||
use gfx::text::util::{self, CompressionMode};
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragments, LAST_FRAGMENT_OF_ELEMENT};
|
||||
use linked_list::split_off_head;
|
||||
use range::Range;
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::LinkedList;
|
||||
|
@ -28,7 +29,6 @@ use style::properties::style_structs::ServoFont;
|
|||
use style::properties::{ComputedValues, ServoComputedValues};
|
||||
use unicode_bidi::{is_rtl, process_text};
|
||||
use unicode_script::{get_script, Script};
|
||||
use util::linked_list::split_off_head;
|
||||
|
||||
/// Returns the concatenated text of a list of unscanned text fragments.
|
||||
fn text(fragments: &LinkedList<Fragment>) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue