summaryrefslogtreecommitdiff
path: root/src/library/layout/flow.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-06-12 17:45:52 +0200
committerLaurenz <laurmaedje@gmail.com>2022-06-12 20:51:31 +0200
commit7660978ee5d842648e244e2972273264d94ca37b (patch)
tree74e1c8bc578afa616ddcd6c4c9e79c3c3d311d78 /src/library/layout/flow.rs
parent6e3b1a2c80428d581d00b9d65e1c45401df2e210 (diff)
Move `Arc` into `Frame`
Diffstat (limited to 'src/library/layout/flow.rs')
-rw-r--r--src/library/layout/flow.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/library/layout/flow.rs b/src/library/layout/flow.rs
index b6844f55..c6d2999e 100644
--- a/src/library/layout/flow.rs
+++ b/src/library/layout/flow.rs
@@ -28,7 +28,7 @@ impl Layout for FlowNode {
ctx: &mut Context,
regions: &Regions,
styles: StyleChain,
- ) -> TypResult<Vec<Arc<Frame>>> {
+ ) -> TypResult<Vec<Frame>> {
let mut layouter = FlowLayouter::new(regions);
for (child, map) in self.0.iter() {
@@ -92,7 +92,7 @@ pub struct FlowLayouter {
/// Spacing and layouted nodes.
items: Vec<FlowItem>,
/// Finished frames for previous regions.
- finished: Vec<Arc<Frame>>,
+ finished: Vec<Frame>,
}
/// A prepared item in a flow layout.
@@ -102,9 +102,9 @@ enum FlowItem {
/// Fractional spacing between other items.
Fractional(Fraction),
/// A frame for a layouted child node and how to align it.
- Frame(Arc<Frame>, Spec<Align>),
+ Frame(Frame, Spec<Align>),
/// An absolutely placed frame.
- Placed(Arc<Frame>),
+ Placed(Frame),
}
impl FlowLayouter {
@@ -184,9 +184,7 @@ impl FlowLayouter {
let len = frames.len();
for (i, mut frame) in frames.into_iter().enumerate() {
// Set the generic block role.
- if frame.role().map_or(true, Role::is_weak) {
- Arc::make_mut(&mut frame).apply_role(Role::GenericBlock);
- }
+ frame.apply_role(Role::GenericBlock);
// Grow our size, shrink the region and save the frame for later.
let size = frame.size();
@@ -248,11 +246,11 @@ impl FlowLayouter {
self.full = self.regions.first;
self.used = Size::zero();
self.fr = Fraction::zero();
- self.finished.push(Arc::new(output));
+ self.finished.push(output);
}
/// Finish layouting and return the resulting frames.
- pub fn finish(mut self) -> Vec<Arc<Frame>> {
+ pub fn finish(mut self) -> Vec<Frame> {
if self.expand.y {
while self.regions.backlog.len() > 0 {
self.finish_region();