mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Use the Deref traits for FlowRefs.
This patch switches FlowRefs to using the Deref and DerefMut traits, instead of the custom `get` and `get_mut` functions.
This commit is contained in:
parent
afc144aa39
commit
76ed7484eb
10 changed files with 76 additions and 74 deletions
|
@ -329,7 +329,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
}
|
||||
|
||||
{
|
||||
let inline_flow = inline_flow_ref.get_mut().as_inline();
|
||||
let inline_flow = inline_flow_ref.as_inline();
|
||||
|
||||
// We must scan for runs before computing minimum ascent and descent because scanning
|
||||
// for runs might collapse so much whitespace away that only hypothetical fragments
|
||||
|
@ -345,7 +345,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
|
||||
inline_flow_ref.finish(self.layout_context);
|
||||
|
||||
if flow.get().need_anonymous_flow(inline_flow_ref.get()) {
|
||||
if flow.need_anonymous_flow(&*inline_flow_ref) {
|
||||
flow_list.push(inline_flow_ref)
|
||||
} else {
|
||||
flow.add_new_child(inline_flow_ref)
|
||||
|
@ -366,10 +366,10 @@ impl<'a> FlowConstructor<'a> {
|
|||
FlowConstructionResult(kid_flow, kid_abs_descendants) => {
|
||||
// If kid_flow is TableCaptionFlow, kid_flow should be added under
|
||||
// TableWrapperFlow.
|
||||
if flow.get().is_table() && kid_flow.get().is_table_caption() {
|
||||
if flow.is_table() && kid_flow.deref().is_table_caption() {
|
||||
kid.set_flow_construction_result(FlowConstructionResult(kid_flow,
|
||||
Descendants::new()))
|
||||
} else if flow.get().need_anonymous_flow(kid_flow.get()) {
|
||||
} else if flow.need_anonymous_flow(&*kid_flow) {
|
||||
consecutive_siblings.push(kid_flow)
|
||||
} else {
|
||||
// Flush any inline fragments that we were gathering up. This allows us to
|
||||
|
@ -429,7 +429,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
|
||||
// Push the flow generated by the {ib} split onto our list of
|
||||
// flows.
|
||||
if flow.get().need_anonymous_flow(kid_flow.get()) {
|
||||
if flow.need_anonymous_flow(&*kid_flow) {
|
||||
consecutive_siblings.push(kid_flow)
|
||||
} else {
|
||||
flow.add_new_child(kid_flow)
|
||||
|
@ -514,8 +514,8 @@ impl<'a> FlowConstructor<'a> {
|
|||
flow.finish(self.layout_context);
|
||||
|
||||
// Set up the absolute descendants.
|
||||
let is_positioned = flow.get_mut().as_block().is_positioned();
|
||||
let is_absolutely_positioned = flow.get_mut().as_block().is_absolutely_positioned();
|
||||
let is_positioned = flow.as_block().is_positioned();
|
||||
let is_absolutely_positioned = flow.as_block().is_absolutely_positioned();
|
||||
if is_positioned {
|
||||
// This is the containing block for all the absolute descendants.
|
||||
flow.set_absolute_descendants(abs_descendants);
|
||||
|
@ -747,7 +747,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
NoConstructionResult | ConstructionItemConstructionResult(_) => {}
|
||||
FlowConstructionResult(kid_flow, _) => {
|
||||
// Only kid flows with table-caption are matched here.
|
||||
if kid_flow.get().is_table_caption() {
|
||||
if kid_flow.deref().is_table_caption() {
|
||||
table_wrapper_flow.add_new_child(kid_flow);
|
||||
}
|
||||
}
|
||||
|
@ -761,10 +761,10 @@ impl<'a> FlowConstructor<'a> {
|
|||
child_flows: Vec<FlowRef>,
|
||||
flow: &mut FlowRef,
|
||||
node: &ThreadSafeLayoutNode) {
|
||||
let mut anonymous_flow = flow.get().generate_missing_child_flow(node);
|
||||
let mut anonymous_flow = flow.generate_missing_child_flow(node);
|
||||
let mut consecutive_siblings = vec!();
|
||||
for kid_flow in child_flows.into_iter() {
|
||||
if anonymous_flow.get().need_anonymous_flow(kid_flow.get()) {
|
||||
if anonymous_flow.need_anonymous_flow(&*kid_flow) {
|
||||
consecutive_siblings.push(kid_flow);
|
||||
continue;
|
||||
}
|
||||
|
@ -823,11 +823,9 @@ impl<'a> FlowConstructor<'a> {
|
|||
|
||||
// The flow is done.
|
||||
wrapper_flow.finish(self.layout_context);
|
||||
let is_positioned = wrapper_flow.get_mut().as_block().is_positioned();
|
||||
let is_fixed_positioned = wrapper_flow.get_mut().as_block().is_fixed();
|
||||
let is_absolutely_positioned = wrapper_flow.get_mut()
|
||||
.as_block()
|
||||
.is_absolutely_positioned();
|
||||
let is_positioned = wrapper_flow.as_block().is_positioned();
|
||||
let is_fixed_positioned = wrapper_flow.as_block().is_fixed();
|
||||
let is_absolutely_positioned = wrapper_flow.as_block().is_absolutely_positioned();
|
||||
if is_positioned {
|
||||
// This is the containing block for all the absolute descendants.
|
||||
wrapper_flow.set_absolute_descendants(abs_descendants);
|
||||
|
@ -1185,10 +1183,10 @@ impl FlowConstructionUtils for FlowRef {
|
|||
///
|
||||
/// This must not be public because only the layout constructor can do this.
|
||||
fn add_new_child(&mut self, mut new_child: FlowRef) {
|
||||
let base = flow::mut_base(self.get_mut());
|
||||
let base = flow::mut_base(self.deref_mut());
|
||||
|
||||
{
|
||||
let kid_base = flow::mut_base(new_child.get_mut());
|
||||
let kid_base = flow::mut_base(new_child.deref_mut());
|
||||
kid_base.parallel.parent = parallel::mut_owned_flow_to_unsafe_flow(self);
|
||||
}
|
||||
|
||||
|
@ -1206,7 +1204,7 @@ impl FlowConstructionUtils for FlowRef {
|
|||
/// This must not be public because only the layout constructor can do this.
|
||||
fn finish(&mut self, context: &LayoutContext) {
|
||||
if !context.shared.opts.bubble_inline_sizes_separately {
|
||||
self.get_mut().bubble_inline_sizes()
|
||||
self.bubble_inline_sizes()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue