aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/inline.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2015-08-14 14:33:58 +0200
committerSimon Sapin <simon.sapin@exyr.org>2015-08-20 16:24:26 +0200
commit2d22aa8e7e99ef52198e0f5918a2a16483aaba0e (patch)
treeca64fce823cba10b02aaeb35ba589575a98bce2d /components/layout/inline.rs
parenta5fbb2f2a6fa79755f975feff2435abb6a5dd0e9 (diff)
downloadservo-2d22aa8e7e99ef52198e0f5918a2a16483aaba0e.tar.gz
servo-2d22aa8e7e99ef52198e0f5918a2a16483aaba0e.zip
Replace the unsound `impl DerefMut for FlowRef` with an unsafe function.
See #6503.
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r--components/layout/inline.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index 3a23634aa40..966cf5f9bff 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -10,6 +10,7 @@ use display_list_builder::{FragmentDisplayListBuilding, InlineFlowDisplayListBui
use floats::{FloatKind, Floats, PlacementInfo};
use flow::{MutableFlowUtils, OpaqueFlow};
use flow::{self, BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, IS_ABSOLUTELY_POSITIONED};
+use flow_ref;
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT};
use layout_debug;
@@ -1596,6 +1597,7 @@ impl Flow for InlineFlow {
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
}
+ #[allow(unsafe_code)]
fn compute_absolute_position(&mut self, _: &LayoutContext) {
// First, gather up the positions of all the containing blocks (if any).
//
@@ -1656,9 +1658,10 @@ impl Flow for InlineFlow {
let is_positioned = fragment.is_positioned();
match fragment.specific {
SpecificFragmentInfo::InlineBlock(ref mut info) => {
- flow::mut_base(&mut *info.flow_ref).clip = clip;
+ let flow = unsafe { flow_ref::deref_mut(&mut info.flow_ref) };
+ flow::mut_base(flow).clip = clip;
- let block_flow = info.flow_ref.as_mut_block();
+ let block_flow = flow.as_mut_block();
block_flow.base.absolute_position_info = self.base.absolute_position_info;
let stacking_relative_position = self.base.stacking_relative_position;
@@ -1676,9 +1679,9 @@ impl Flow for InlineFlow {
self.base.stacking_relative_position_of_display_port;
}
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) => {
- flow::mut_base(&mut *info.flow_ref).clip = clip;
-
- let block_flow = info.flow_ref.as_mut_block();
+ let flow = unsafe { flow_ref::deref_mut(&mut info.flow_ref) };
+ flow::mut_base(flow).clip = clip;
+ let block_flow = flow.as_mut_block();
block_flow.base.absolute_position_info = self.base.absolute_position_info;
block_flow.base.stacking_relative_position =
@@ -1687,9 +1690,10 @@ impl Flow for InlineFlow {
self.base.stacking_relative_position_of_display_port;
}
SpecificFragmentInfo::InlineAbsolute(ref mut info) => {
- flow::mut_base(&mut *info.flow_ref).clip = clip;
+ let flow = unsafe { flow_ref::deref_mut(&mut info.flow_ref) };
+ flow::mut_base(flow).clip = clip;
- let block_flow = info.flow_ref.as_mut_block();
+ let block_flow = flow.as_mut_block();
block_flow.base.absolute_position_info = self.base.absolute_position_info;
let stacking_relative_position = self.base.stacking_relative_position;