mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Remove usage of unstable box syntax, except in the script crate
… because there’s a lot of it, and script still uses any other unstable features anyway.
This commit is contained in:
parent
796a8dc618
commit
aa5761a5fb
40 changed files with 195 additions and 195 deletions
|
@ -537,7 +537,7 @@ impl BlockFlow {
|
|||
None => ForceNonfloatedFlag::ForceNonfloated,
|
||||
}),
|
||||
fragment: fragment,
|
||||
float: float_kind.map(|kind| box FloatedBlockInfo::new(kind)),
|
||||
float: float_kind.map(|kind| Box::new(FloatedBlockInfo::new(kind))),
|
||||
flags: BlockFlowFlags::empty(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,15 +348,15 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
SpecificFragmentInfo::Iframe(IframeFragmentInfo::new(node))
|
||||
}
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLImageElement)) => {
|
||||
let image_info = box ImageFragmentInfo::new(node.image_url(),
|
||||
node,
|
||||
&self.layout_context);
|
||||
let image_info = Box::new(ImageFragmentInfo::new(
|
||||
node.image_url(), node, &self.layout_context
|
||||
));
|
||||
SpecificFragmentInfo::Image(image_info)
|
||||
}
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLObjectElement)) => {
|
||||
let image_info = box ImageFragmentInfo::new(node.object_data(),
|
||||
node,
|
||||
&self.layout_context);
|
||||
let image_info = Box::new(ImageFragmentInfo::new(
|
||||
node.object_data(), node, &self.layout_context
|
||||
));
|
||||
SpecificFragmentInfo::Image(image_info)
|
||||
}
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLTableElement)) => {
|
||||
|
@ -374,11 +374,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
}
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLCanvasElement)) => {
|
||||
let data = node.canvas_data().unwrap();
|
||||
SpecificFragmentInfo::Canvas(box CanvasFragmentInfo::new(data))
|
||||
SpecificFragmentInfo::Canvas(Box::new(CanvasFragmentInfo::new(data)))
|
||||
}
|
||||
Some(LayoutNodeType::Element(LayoutElementType::SVGSVGElement)) => {
|
||||
let data = node.svg_data().unwrap();
|
||||
SpecificFragmentInfo::Svg(box SvgFragmentInfo::new(data))
|
||||
SpecificFragmentInfo::Svg(Box::new(SvgFragmentInfo::new(data)))
|
||||
}
|
||||
_ => {
|
||||
// This includes pseudo-elements.
|
||||
|
@ -553,7 +553,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
// Add whitespace results. They will be stripped out later on when
|
||||
// between block elements, and retained when between inline elements.
|
||||
let fragment_info = SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(" ".to_owned(), None));
|
||||
Box::new(UnscannedTextFragmentInfo::new(" ".to_owned(), None))
|
||||
);
|
||||
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
|
||||
whitespace_pseudo,
|
||||
whitespace_style,
|
||||
|
@ -686,7 +687,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
match text_content {
|
||||
TextContent::Text(string) => {
|
||||
let info = box UnscannedTextFragmentInfo::new(string, node.selection());
|
||||
let info = Box::new(UnscannedTextFragmentInfo::new(string, node.selection()));
|
||||
let specific_fragment_info = SpecificFragmentInfo::UnscannedText(info);
|
||||
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
|
||||
node.opaque(),
|
||||
|
@ -700,11 +701,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
for content_item in content_items.into_iter() {
|
||||
let specific_fragment_info = match content_item {
|
||||
ContentItem::String(string) => {
|
||||
let info = box UnscannedTextFragmentInfo::new(string, None);
|
||||
let info = Box::new(UnscannedTextFragmentInfo::new(string, None));
|
||||
SpecificFragmentInfo::UnscannedText(info)
|
||||
}
|
||||
content_item => {
|
||||
let content_item = box GeneratedContentInfo::ContentItem(content_item);
|
||||
let content_item = Box::new(GeneratedContentInfo::ContentItem(content_item));
|
||||
SpecificFragmentInfo::GeneratedContent(content_item)
|
||||
}
|
||||
};
|
||||
|
@ -821,7 +822,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
whitespace_damage)) => {
|
||||
// Instantiate the whitespace fragment.
|
||||
let fragment_info = SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(" ".to_owned(), None));
|
||||
Box::new(UnscannedTextFragmentInfo::new(" ".to_owned(), None))
|
||||
);
|
||||
let fragment =
|
||||
Fragment::from_opaque_node_and_style(whitespace_node,
|
||||
whitespace_pseudo,
|
||||
|
@ -842,7 +844,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
if is_empty && node_style.has_padding_or_border() {
|
||||
// An empty inline box needs at least one fragment to draw its background and borders.
|
||||
let info = SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(String::new(), None));
|
||||
Box::new(UnscannedTextFragmentInfo::new(String::new(), None))
|
||||
);
|
||||
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
||||
node.get_pseudo_element_type().strip(),
|
||||
node_style.clone(),
|
||||
|
@ -1199,9 +1202,9 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
let flotation = FloatKind::from_property(flotation);
|
||||
let marker_fragments = match node.style(self.style_context()).get_list().list_style_image {
|
||||
list_style_image::computed_value::T(Either::First(ref url_value)) => {
|
||||
let image_info = box ImageFragmentInfo::new(url_value.url().map(|u| u.clone()),
|
||||
node,
|
||||
&self.layout_context);
|
||||
let image_info = Box::new(ImageFragmentInfo::new(
|
||||
url_value.url().map(|u| u.clone()), node, &self.layout_context
|
||||
));
|
||||
vec![Fragment::new(node, SpecificFragmentInfo::Image(image_info), self.layout_context)]
|
||||
}
|
||||
list_style_image::computed_value::T(Either::Second(_none)) => {
|
||||
|
@ -1215,7 +1218,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
unscanned_marker_fragments.push_back(Fragment::new(
|
||||
node,
|
||||
SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(text, None)),
|
||||
Box::new(UnscannedTextFragmentInfo::new(text, None))
|
||||
),
|
||||
self.layout_context));
|
||||
let marker_fragments =
|
||||
with_thread_local_font_context(self.layout_context, |mut font_context| {
|
||||
|
@ -1825,7 +1829,8 @@ fn control_chars_to_fragment(node: &InlineFragmentNodeInfo,
|
|||
restyle_damage: RestyleDamage)
|
||||
-> Fragment {
|
||||
let info = SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(String::from(text), None));
|
||||
Box::new(UnscannedTextFragmentInfo::new(String::from(text), None))
|
||||
);
|
||||
let text_style = context.stylist.style_for_anonymous(
|
||||
&context.guards, &PseudoElement::ServoText, &node.style);
|
||||
Fragment::from_opaque_node_and_style(node.address,
|
||||
|
|
|
@ -986,10 +986,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
style.get_cursor(Cursor::Default),
|
||||
display_list_section);
|
||||
state.add_display_item(
|
||||
DisplayItem::SolidColor(box SolidColorDisplayItem {
|
||||
DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
||||
base: base,
|
||||
color: background_color.to_gfx_color(),
|
||||
}));
|
||||
})));
|
||||
|
||||
// The background image is painted on top of the background color.
|
||||
// Implements background image, per spec:
|
||||
|
@ -1231,14 +1231,14 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
display_list_section);
|
||||
|
||||
debug!("(building display list) adding background image.");
|
||||
state.add_display_item(DisplayItem::Image(box ImageDisplayItem {
|
||||
state.add_display_item(DisplayItem::Image(Box::new(ImageDisplayItem {
|
||||
base: base,
|
||||
webrender_image: webrender_image,
|
||||
image_data: None,
|
||||
stretch_size: stretch_size,
|
||||
tile_spacing: tile_spacing,
|
||||
image_rendering: style.get_inheritedbox().image_rendering.clone(),
|
||||
}));
|
||||
})));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1430,10 +1430,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
&gradient.items[..],
|
||||
angle_or_corner,
|
||||
gradient.repeating);
|
||||
DisplayItem::Gradient(box GradientDisplayItem {
|
||||
DisplayItem::Gradient(Box::new(GradientDisplayItem {
|
||||
base: base,
|
||||
gradient: gradient,
|
||||
})
|
||||
}))
|
||||
}
|
||||
GradientKind::Radial(ref shape, ref center, _angle) => {
|
||||
let gradient = self.convert_radial_gradient(&bounds,
|
||||
|
@ -1441,10 +1441,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
shape,
|
||||
center,
|
||||
gradient.repeating);
|
||||
DisplayItem::RadialGradient(box RadialGradientDisplayItem {
|
||||
DisplayItem::RadialGradient(Box::new(RadialGradientDisplayItem {
|
||||
base: base,
|
||||
gradient: gradient,
|
||||
})
|
||||
}))
|
||||
}
|
||||
};
|
||||
state.add_display_item(display_item);
|
||||
|
@ -1473,7 +1473,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
style.get_cursor(Cursor::Default),
|
||||
display_list_section);
|
||||
state.add_display_item(DisplayItem::BoxShadow(box BoxShadowDisplayItem {
|
||||
state.add_display_item(DisplayItem::BoxShadow(Box::new(BoxShadowDisplayItem {
|
||||
base: base,
|
||||
box_bounds: *absolute_bounds,
|
||||
color: box_shadow.base.color.unwrap_or(style.get_color().color).to_gfx_color(),
|
||||
|
@ -1489,7 +1489,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
} else {
|
||||
BoxShadowClipMode::Outset
|
||||
},
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
match border_style_struct.border_image_source {
|
||||
Either::First(_) => {
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
|
@ -1568,7 +1568,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
style: border_style,
|
||||
radius: build_border_radius(&bounds, border_style_struct),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
Either::Second(Image::Gradient(ref gradient)) => {
|
||||
match gradient.kind {
|
||||
|
@ -1578,7 +1578,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
&angle_or_corner,
|
||||
gradient.repeating);
|
||||
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Gradient(display_list::GradientBorder {
|
||||
|
@ -1587,7 +1587,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// TODO(gw): Support border-image-outset
|
||||
outset: SideOffsets2D::zero(),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
GradientKind::Radial(ref shape, ref center, _angle) => {
|
||||
let grad = self.convert_radial_gradient(&bounds,
|
||||
|
@ -1595,7 +1595,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
shape,
|
||||
center,
|
||||
gradient.repeating);
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::RadialGradient(
|
||||
|
@ -1605,7 +1605,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// TODO(gw): Support border-image-outset
|
||||
outset: SideOffsets2D::zero(),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1619,7 +1619,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
if let Some(webrender_image) = webrender_image {
|
||||
let corners = &border_style_struct.border_image_slice.offsets;
|
||||
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Image(ImageBorder {
|
||||
|
@ -1634,7 +1634,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
repeat_horizontal: convert_repeat_mode(border_style_struct.border_image_repeat.0),
|
||||
repeat_vertical: convert_repeat_mode(border_style_struct.border_image_repeat.1),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
Either::Second(Image::Rect(..)) => {
|
||||
|
@ -1652,7 +1652,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
if let Some(webrender_image) = webrender_image {
|
||||
let corners = &border_style_struct.border_image_slice.offsets;
|
||||
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: border.to_physical(style.writing_mode),
|
||||
details: BorderDetails::Image(ImageBorder {
|
||||
|
@ -1667,7 +1667,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
repeat_horizontal: convert_repeat_mode(border_style_struct.border_image_repeat.0),
|
||||
repeat_vertical: convert_repeat_mode(border_style_struct.border_image_repeat.1),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1708,7 +1708,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Outlines);
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(width),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
|
@ -1716,7 +1716,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
style: SideOffsets2D::new_all_same(outline_style),
|
||||
radius: Default::default(),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
fn build_debug_borders_around_text_fragments(&self,
|
||||
|
@ -1735,7 +1735,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
|
@ -1743,7 +1743,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
style: SideOffsets2D::new_all_same(border_style::T::solid),
|
||||
radius: Default::default(),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
|
||||
// Draw a rectangle representing the baselines.
|
||||
let mut baseline = LogicalRect::from_physical(self.style.writing_mode,
|
||||
|
@ -1758,11 +1758,11 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
state.add_display_item(DisplayItem::Line(box LineDisplayItem {
|
||||
state.add_display_item(DisplayItem::Line(Box::new(LineDisplayItem {
|
||||
base: base,
|
||||
color: ColorF::rgb(0, 200, 0),
|
||||
style: LineStyle::Dashed,
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
fn build_debug_borders_around_fragment(&self,
|
||||
|
@ -1775,7 +1775,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
self.style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
|
@ -1783,7 +1783,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
style: SideOffsets2D::new_all_same(border_style::T::solid),
|
||||
radius: Default::default(),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
fn build_display_items_for_selection_if_necessary(&self,
|
||||
|
@ -1810,10 +1810,11 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.style.get_cursor(Cursor::Default),
|
||||
display_list_section);
|
||||
state.add_display_item(
|
||||
DisplayItem::SolidColor(box SolidColorDisplayItem {
|
||||
DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
||||
base: base,
|
||||
color: background_color.to_gfx_color(),
|
||||
}));
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
// Draw a caret at the insertion point.
|
||||
|
@ -1848,10 +1849,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
self.style.get_cursor(cursor),
|
||||
display_list_section);
|
||||
state.add_display_item(DisplayItem::SolidColor(box SolidColorDisplayItem {
|
||||
state.add_display_item(DisplayItem::SolidColor(Box::new(SolidColorDisplayItem {
|
||||
base: base,
|
||||
color: self.style().get_color().color.to_gfx_color(),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
fn build_display_list(&mut self,
|
||||
|
@ -2068,10 +2069,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
self.style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
let item = DisplayItem::Iframe(box IframeDisplayItem {
|
||||
let item = DisplayItem::Iframe(Box::new(IframeDisplayItem {
|
||||
base: base,
|
||||
iframe: pipeline_id,
|
||||
});
|
||||
}));
|
||||
|
||||
let size = Size2D::new(item.bounds().size.width.to_f32_px(),
|
||||
item.bounds().size.height.to_f32_px());
|
||||
|
@ -2090,14 +2091,14 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
self.style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
state.add_display_item(DisplayItem::Image(box ImageDisplayItem {
|
||||
state.add_display_item(DisplayItem::Image(Box::new(ImageDisplayItem {
|
||||
base: base,
|
||||
webrender_image: WebRenderImageInfo::from_image(image),
|
||||
image_data: Some(Arc::new(image.bytes.clone())),
|
||||
stretch_size: stacking_relative_content_box.size,
|
||||
tile_spacing: Size2D::zero(),
|
||||
image_rendering: self.style.get_inheritedbox().image_rendering.clone(),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
SpecificFragmentInfo::Canvas(ref canvas_fragment_info) => {
|
||||
|
@ -2128,7 +2129,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.node,
|
||||
self.style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
let display_item = DisplayItem::Image(box ImageDisplayItem {
|
||||
let display_item = DisplayItem::Image(Box::new(ImageDisplayItem {
|
||||
base: base,
|
||||
webrender_image: WebRenderImageInfo {
|
||||
width: computed_width as u32,
|
||||
|
@ -2140,7 +2141,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
stretch_size: stacking_relative_content_box.size,
|
||||
tile_spacing: Size2D::zero(),
|
||||
image_rendering: image_rendering::T::auto,
|
||||
});
|
||||
}));
|
||||
|
||||
state.add_display_item(display_item);
|
||||
}
|
||||
|
@ -2249,12 +2250,12 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
// Shadows
|
||||
for shadow in text_shadows.iter().rev() {
|
||||
state.add_display_item(DisplayItem::PushTextShadow(box PushTextShadowDisplayItem {
|
||||
state.add_display_item(DisplayItem::PushTextShadow(Box::new(PushTextShadowDisplayItem {
|
||||
base: base.clone(),
|
||||
blur_radius: Au::from(shadow.blur),
|
||||
offset: Vector2D::new(Au::from(shadow.horizontal), Au::from(shadow.vertical)),
|
||||
color: shadow.color.unwrap_or(self.style().get_color().color).to_gfx_color(),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2296,14 +2297,14 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
}
|
||||
|
||||
// Text
|
||||
state.add_display_item(DisplayItem::Text(box TextDisplayItem {
|
||||
state.add_display_item(DisplayItem::Text(Box::new(TextDisplayItem {
|
||||
base: base.clone(),
|
||||
text_run: text_fragment.run.clone(),
|
||||
range: text_fragment.range,
|
||||
text_color: text_color.to_gfx_color(),
|
||||
orientation: orientation,
|
||||
baseline_origin: baseline_origin,
|
||||
}));
|
||||
})));
|
||||
|
||||
|
||||
// TODO(#17715): emit text-emphasis marks here.
|
||||
|
@ -2326,9 +2327,9 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
// Pair all the PushTextShadows
|
||||
for _ in text_shadows {
|
||||
state.add_display_item(DisplayItem::PopTextShadow(box PopTextShadowDisplayItem {
|
||||
state.add_display_item(DisplayItem::PopTextShadow(Box::new(PopTextShadowDisplayItem {
|
||||
base: base.clone(),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2348,11 +2349,11 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
self.style.get_cursor(Cursor::Default),
|
||||
DisplayListSection::Content);
|
||||
|
||||
state.add_display_item(DisplayItem::Line(box LineDisplayItem {
|
||||
state.add_display_item(DisplayItem::Line(Box::new(LineDisplayItem {
|
||||
base: base,
|
||||
color: color.to_gfx_color(),
|
||||
style: LineStyle::Solid,
|
||||
}));
|
||||
})));
|
||||
}
|
||||
|
||||
fn unique_id(&self, id_type: IdType) -> u64 {
|
||||
|
@ -3110,7 +3111,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
|
|||
node,
|
||||
None,
|
||||
DisplayListSection::Content);
|
||||
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
|
||||
state.add_display_item(DisplayItem::Border(Box::new(BorderDisplayItem {
|
||||
base: base,
|
||||
border_widths: SideOffsets2D::new_all_same(Au::from_px(2)),
|
||||
details: BorderDetails::Normal(NormalBorder {
|
||||
|
@ -3118,7 +3119,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
|
|||
style: SideOffsets2D::new_all_same(border_style::T::solid),
|
||||
radius: BorderRadii::all_same(Au(0)),
|
||||
}),
|
||||
}));
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -790,12 +790,13 @@ impl Fragment {
|
|||
},
|
||||
_ => (ScannedTextFlags::empty(), None)
|
||||
};
|
||||
let info = box ScannedTextFragmentInfo::new(
|
||||
let info = Box::new(ScannedTextFragmentInfo::new(
|
||||
text_run,
|
||||
split.range,
|
||||
size,
|
||||
insertion_point,
|
||||
flags);
|
||||
flags,
|
||||
));
|
||||
self.transform(size, SpecificFragmentInfo::ScannedText(info))
|
||||
}
|
||||
|
||||
|
@ -808,7 +809,9 @@ impl Fragment {
|
|||
let mut ellipsis_fragment = self.transform(
|
||||
self.border_box.size,
|
||||
SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(text_overflow_string, None)));
|
||||
Box::new(UnscannedTextFragmentInfo::new(text_overflow_string, None))
|
||||
)
|
||||
);
|
||||
unscanned_ellipsis_fragments.push_back(ellipsis_fragment);
|
||||
let ellipsis_fragments = with_thread_local_font_context(layout_context, |font_context| {
|
||||
TextRunScanner::new().scan_for_runs(font_context, unscanned_ellipsis_fragments)
|
||||
|
@ -1706,10 +1709,10 @@ impl Fragment {
|
|||
(LogicalSize::zero(self.style.writing_mode), None)
|
||||
};
|
||||
let mut result = self.transform(size, SpecificFragmentInfo::Generic);
|
||||
result.specific = SpecificFragmentInfo::TruncatedFragment(box TruncatedFragmentInfo {
|
||||
result.specific = SpecificFragmentInfo::TruncatedFragment(Box::new(TruncatedFragmentInfo {
|
||||
text_info: text_info,
|
||||
full: self,
|
||||
});
|
||||
}));
|
||||
result
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {
|
|||
// so that it isn't processed again on the next layout. FIXME (mbrubeck): When
|
||||
// processing an inline flow, this traversal should be allowed to insert or remove
|
||||
// fragments. Then we can just remove these fragments rather than adding placeholders.
|
||||
None => SpecificFragmentInfo::GeneratedContent(box GeneratedContentInfo::Empty)
|
||||
None => SpecificFragmentInfo::GeneratedContent(Box::new(GeneratedContentInfo::Empty))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,8 @@ fn render_text(layout_context: &LayoutContext,
|
|||
-> Option<SpecificFragmentInfo> {
|
||||
let mut fragments = LinkedList::new();
|
||||
let info = SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(string, None));
|
||||
Box::new(UnscannedTextFragmentInfo::new(string, None))
|
||||
);
|
||||
fragments.push_back(Fragment::from_opaque_node_and_style(node,
|
||||
pseudo,
|
||||
style.clone(),
|
||||
|
|
|
@ -64,7 +64,7 @@ impl Scope {
|
|||
STATE_KEY.with(|ref r| {
|
||||
if let Some(ref mut state) = *r.borrow_mut() {
|
||||
let flow_trace = to_value(&flow::base(&*state.flow_root)).unwrap();
|
||||
let data = box ScopeData::new(name.clone(), flow_trace);
|
||||
let data = Box::new(ScopeData::new(name.clone(), flow_trace));
|
||||
state.scope_stack.push(data);
|
||||
}
|
||||
});
|
||||
|
@ -102,7 +102,7 @@ pub fn begin_trace(flow_root: FlowRef) {
|
|||
STATE_KEY.with(|ref r| {
|
||||
let flow_trace = to_value(&flow::base(&*flow_root)).unwrap();
|
||||
let state = State {
|
||||
scope_stack: vec![box ScopeData::new("root".to_owned(), flow_trace)],
|
||||
scope_stack: vec![Box::new(ScopeData::new("root".to_owned(), flow_trace))],
|
||||
flow_root: flow_root.clone(),
|
||||
};
|
||||
*r.borrow_mut() = Some(state);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(conservative_impl_trait)]
|
||||
#![feature(nonzero)]
|
||||
#![feature(raw)]
|
||||
|
|
|
@ -235,7 +235,7 @@ impl ListStyleTypeContent {
|
|||
let text = generated_content::static_representation(list_style_type);
|
||||
ListStyleTypeContent::StaticText(text)
|
||||
}
|
||||
_ => ListStyleTypeContent::GeneratedContent(box GeneratedContentInfo::ListItem),
|
||||
_ => ListStyleTypeContent::GeneratedContent(Box::new(GeneratedContentInfo::ListItem)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -377,12 +377,13 @@ impl TextRunScanner {
|
|||
None
|
||||
};
|
||||
|
||||
let mut new_text_fragment_info = box ScannedTextFragmentInfo::new(
|
||||
let mut new_text_fragment_info = Box::new(ScannedTextFragmentInfo::new(
|
||||
scanned_run.run,
|
||||
byte_range,
|
||||
text_size,
|
||||
insertion_point,
|
||||
flags);
|
||||
flags
|
||||
));
|
||||
|
||||
let new_metrics = new_text_fragment_info.run.metrics_for_range(&byte_range);
|
||||
let writing_mode = old_fragment.style.writing_mode;
|
||||
|
@ -506,10 +507,12 @@ fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragm
|
|||
}
|
||||
};
|
||||
}
|
||||
first_fragment.transform(first_fragment.border_box.size,
|
||||
SpecificFragmentInfo::UnscannedText(
|
||||
box UnscannedTextFragmentInfo::new(string_before,
|
||||
selection_before)))
|
||||
first_fragment.transform(
|
||||
first_fragment.border_box.size,
|
||||
SpecificFragmentInfo::UnscannedText(Box::new(
|
||||
UnscannedTextFragmentInfo::new(string_before, selection_before)
|
||||
))
|
||||
)
|
||||
};
|
||||
|
||||
fragments.push_front(new_fragment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue