mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Replace ConstructionResult::swap_out() with get()
It only actually swaps out in nonincremental mode (which isn't suitable for real world use), so the name is confusing.
This commit is contained in:
parent
c32181c6db
commit
198662f8cb
2 changed files with 10 additions and 15 deletions
|
@ -84,11 +84,7 @@ pub enum ConstructionResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConstructionResult {
|
impl ConstructionResult {
|
||||||
pub fn swap_out(&mut self) -> ConstructionResult {
|
pub fn get(&mut self) -> ConstructionResult {
|
||||||
if opts::get().nonincremental_layout {
|
|
||||||
return mem::replace(self, ConstructionResult::None)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME(pcwalton): Stop doing this with inline fragments. Cloning fragments is very
|
// FIXME(pcwalton): Stop doing this with inline fragments. Cloning fragments is very
|
||||||
// inefficient!
|
// inefficient!
|
||||||
(*self).clone()
|
(*self).clone()
|
||||||
|
@ -485,7 +481,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
inline_fragment_accumulator: &mut InlineFragmentsAccumulator,
|
inline_fragment_accumulator: &mut InlineFragmentsAccumulator,
|
||||||
abs_descendants: &mut AbsoluteDescendants,
|
abs_descendants: &mut AbsoluteDescendants,
|
||||||
legalizer: &mut Legalizer) {
|
legalizer: &mut Legalizer) {
|
||||||
match kid.swap_out_construction_result() {
|
match kid.get_construction_result() {
|
||||||
ConstructionResult::None => {}
|
ConstructionResult::None => {}
|
||||||
ConstructionResult::Flow(kid_flow, kid_abs_descendants) => {
|
ConstructionResult::Flow(kid_flow, kid_abs_descendants) => {
|
||||||
// If kid_flow is TableCaptionFlow, kid_flow should be added under
|
// If kid_flow is TableCaptionFlow, kid_flow should be added under
|
||||||
|
@ -784,7 +780,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
if kid.get_pseudo_element_type() != PseudoElementType::Normal {
|
if kid.get_pseudo_element_type() != PseudoElementType::Normal {
|
||||||
self.process(&kid);
|
self.process(&kid);
|
||||||
}
|
}
|
||||||
match kid.swap_out_construction_result() {
|
match kid.get_construction_result() {
|
||||||
ConstructionResult::None => {}
|
ConstructionResult::None => {}
|
||||||
ConstructionResult::Flow(flow, kid_abs_descendants) => {
|
ConstructionResult::Flow(flow, kid_abs_descendants) => {
|
||||||
if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||||
|
@ -1035,7 +1031,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
side: caption_side::T) {
|
side: caption_side::T) {
|
||||||
// Only flows that are table captions are matched here.
|
// Only flows that are table captions are matched here.
|
||||||
for kid in node.children() {
|
for kid in node.children() {
|
||||||
match kid.swap_out_construction_result() {
|
match kid.get_construction_result() {
|
||||||
ConstructionResult::Flow(kid_flow, _) => {
|
ConstructionResult::Flow(kid_flow, _) => {
|
||||||
if kid_flow.is_table_caption() &&
|
if kid_flow.is_table_caption() &&
|
||||||
kid_flow.as_block()
|
kid_flow.as_block()
|
||||||
|
@ -1304,7 +1300,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
// CSS 2.1 § 17.2.1. Treat all non-column child fragments of `table-column-group`
|
// CSS 2.1 § 17.2.1. Treat all non-column child fragments of `table-column-group`
|
||||||
// as `display: none`.
|
// as `display: none`.
|
||||||
if let ConstructionResult::ConstructionItem(ConstructionItem::TableColumnFragment(fragment)) =
|
if let ConstructionResult::ConstructionItem(ConstructionItem::TableColumnFragment(fragment)) =
|
||||||
kid.swap_out_construction_result() {
|
kid.get_construction_result() {
|
||||||
col_fragments.push(fragment)
|
col_fragments.push(fragment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1641,9 +1637,8 @@ trait NodeUtils {
|
||||||
/// Sets the construction result of a flow.
|
/// Sets the construction result of a flow.
|
||||||
fn set_flow_construction_result(self, result: ConstructionResult);
|
fn set_flow_construction_result(self, result: ConstructionResult);
|
||||||
|
|
||||||
/// Replaces the flow construction result in a node with `ConstructionResult::None` and returns
|
/// Returns the construction result for this node.
|
||||||
/// the old value.
|
fn get_construction_result(self) -> ConstructionResult;
|
||||||
fn swap_out_construction_result(self) -> ConstructionResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
||||||
|
@ -1686,9 +1681,9 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn swap_out_construction_result(self) -> ConstructionResult {
|
fn get_construction_result(self) -> ConstructionResult {
|
||||||
let mut layout_data = self.mutate_layout_data().unwrap();
|
let mut layout_data = self.mutate_layout_data().unwrap();
|
||||||
self.construction_result_mut(&mut *layout_data).swap_out()
|
self.construction_result_mut(&mut *layout_data).get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -774,7 +774,7 @@ impl LayoutThread {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
None => return None,
|
None => return None,
|
||||||
};
|
};
|
||||||
let result = data.flow_construction_result.swap_out();
|
let result = data.flow_construction_result.get();
|
||||||
|
|
||||||
let mut flow = match result {
|
let mut flow = match result {
|
||||||
ConstructionResult::Flow(mut flow, abs_descendants) => {
|
ConstructionResult::Flow(mut flow, abs_descendants) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue