mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #24987 - servo:warn2020, r=nox
Un-allow and fix warnings in `components/layout_2020`
This commit is contained in:
commit
8c14802dda
13 changed files with 15 additions and 73 deletions
|
@ -5,7 +5,7 @@
|
|||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx::font_context::FontContext;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use std::cell::{RefCell, RefMut};
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Mutex;
|
||||
use style::context::SharedStyleContext;
|
||||
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
use crate::fragments::{BoxFragment, Fragment};
|
||||
use crate::geom::physical::{Rect, Vec2};
|
||||
use crate::style_ext::ComputedValuesExt;
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, SideOffsets2D};
|
||||
use gfx::text::glyph::GlyphStore;
|
||||
use servo_geometry::MaxRect;
|
||||
use std::sync::Arc;
|
||||
use style::values::computed::{BorderStyle, Length};
|
||||
use webrender_api::{self as wr, units, CommonItemProperties, PrimitiveFlags};
|
||||
|
|
|
@ -8,10 +8,9 @@ use crate::replaced::ReplacedContent;
|
|||
use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside};
|
||||
use crate::wrapper::GetRawData;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use net_traits::image::base::{Image as NetImage, ImageMetadata};
|
||||
use net_traits::image::base::Image as NetImage;
|
||||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use std::convert::TryInto;
|
||||
use std::marker::PhantomData as marker;
|
||||
use std::sync::Arc;
|
||||
use style::context::SharedStyleContext;
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::formatting_contexts::IndependentFormattingContext;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct FloatBox {
|
||||
|
|
|
@ -6,9 +6,8 @@ use crate::context::LayoutContext;
|
|||
use crate::flow::float::FloatBox;
|
||||
use crate::flow::FlowLayout;
|
||||
use crate::formatting_contexts::IndependentFormattingContext;
|
||||
use crate::fragments::{
|
||||
AnonymousFragment, BoxFragment, CollapsedBlockMargins, Fragment, TextFragment,
|
||||
};
|
||||
use crate::fragments::CollapsedBlockMargins;
|
||||
use crate::fragments::{AnonymousFragment, BoxFragment, Fragment, TextFragment};
|
||||
use crate::geom::flow_relative::{Rect, Sides, Vec2};
|
||||
use crate::positioned::{AbsolutelyPositionedBox, AbsolutelyPositionedFragment};
|
||||
use crate::style_ext::{ComputedValuesExt, Display, DisplayGeneratingBox, DisplayOutside};
|
||||
|
@ -285,7 +284,7 @@ impl<'box_tree> PartialInlineBoxFragment<'box_tree> {
|
|||
|
||||
impl TextRun {
|
||||
fn layout(&self, layout_context: &LayoutContext, ifc: &mut InlineFormattingContextState) {
|
||||
use gfx::font::{ShapingFlags, ShapingOptions};
|
||||
use gfx::font::ShapingFlags;
|
||||
use style::computed_values::text_rendering::T as TextRendering;
|
||||
use style::computed_values::word_break::T as WordBreak;
|
||||
use style::values::generics::text::LineHeight;
|
||||
|
|
|
@ -8,13 +8,11 @@ use crate::context::LayoutContext;
|
|||
use crate::flow::float::{FloatBox, FloatContext};
|
||||
use crate::flow::inline::InlineFormattingContext;
|
||||
use crate::formatting_contexts::{IndependentFormattingContext, IndependentLayout};
|
||||
use crate::fragments::{
|
||||
AnonymousFragment, BoxFragment, CollapsedBlockMargins, CollapsedMargin, Fragment,
|
||||
};
|
||||
use crate::fragments::{AnonymousFragment, BoxFragment, Fragment};
|
||||
use crate::fragments::{CollapsedBlockMargins, CollapsedMargin};
|
||||
use crate::geom::flow_relative::{Rect, Sides, Vec2};
|
||||
use crate::positioned::{
|
||||
adjust_static_positions, AbsolutelyPositionedBox, AbsolutelyPositionedFragment,
|
||||
};
|
||||
use crate::positioned::adjust_static_positions;
|
||||
use crate::positioned::{AbsolutelyPositionedBox, AbsolutelyPositionedFragment};
|
||||
use crate::replaced::ReplacedContent;
|
||||
use crate::style_ext::{ComputedValuesExt, Position};
|
||||
use crate::{relative_adjustement, ContainingBlock};
|
||||
|
@ -297,7 +295,6 @@ impl BlockLevelBox {
|
|||
},
|
||||
BlockLevelBox::Independent(contents) => match contents.as_replaced() {
|
||||
Ok(replaced) => Fragment::Box(layout_in_flow_replaced_block_level(
|
||||
layout_context,
|
||||
containing_block,
|
||||
&contents.style,
|
||||
replaced,
|
||||
|
@ -475,7 +472,6 @@ fn layout_in_flow_non_replaced_block_level<'a>(
|
|||
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-width
|
||||
/// https://drafts.csswg.org/css2/visudet.html#inline-replaced-height
|
||||
fn layout_in_flow_replaced_block_level<'a>(
|
||||
layout_context: &LayoutContext,
|
||||
containing_block: &ContainingBlock,
|
||||
style: &Arc<ComputedValues>,
|
||||
replaced: &ReplacedContent,
|
||||
|
@ -530,7 +526,7 @@ fn layout_in_flow_replaced_block_level<'a>(
|
|||
containing_block.mode, containing_block_for_children.mode,
|
||||
"Mixed writing modes are not supported yet"
|
||||
);
|
||||
let independent_layout = replaced.layout(layout_context, style, &containing_block_for_children);
|
||||
let independent_layout = replaced.layout(style, &containing_block_for_children);
|
||||
let relative_adjustement = relative_adjustement(
|
||||
style,
|
||||
inline_size,
|
||||
|
|
|
@ -14,15 +14,12 @@ use crate::geom;
|
|||
use crate::geom::flow_relative::Vec2;
|
||||
use crate::positioned::AbsolutelyPositionedBox;
|
||||
use crate::replaced::ReplacedContent;
|
||||
use crate::style_ext::{
|
||||
Direction, Display, DisplayGeneratingBox, DisplayInside, DisplayOutside, WritingMode,
|
||||
};
|
||||
use crate::style_ext::{Direction, Display, DisplayGeneratingBox, DisplayInside, WritingMode};
|
||||
use crate::{ContainingBlock, DefiniteContainingBlock};
|
||||
use rayon::iter::{IntoParallelRefIterator, ParallelExtend, ParallelIterator};
|
||||
use script_layout_interface::wrapper_traits::LayoutNode;
|
||||
use servo_arc::Arc;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{Length, LengthOrAuto};
|
||||
use style::Zero;
|
||||
use style_traits::CSSPixel;
|
||||
|
@ -137,7 +134,6 @@ impl FragmentTreeRoot {
|
|||
pub fn build_display_list(
|
||||
&self,
|
||||
builder: &mut crate::display_list::DisplayListBuilder,
|
||||
pipeline_id: msg::constellation_msg::PipelineId,
|
||||
viewport_size: webrender_api::units::LayoutSize,
|
||||
) -> IsContentful {
|
||||
let containing_block = geom::physical::Rect {
|
||||
|
|
|
@ -6,10 +6,9 @@ use crate::context::LayoutContext;
|
|||
use crate::dom_traversal::{Contents, NodeExt};
|
||||
use crate::flow::BlockFormattingContext;
|
||||
use crate::fragments::Fragment;
|
||||
use crate::geom::flow_relative::Vec2;
|
||||
use crate::positioned::AbsolutelyPositionedFragment;
|
||||
use crate::replaced::ReplacedContent;
|
||||
use crate::style_ext::{ComputedValuesExt, Direction, DisplayInside, Position, WritingMode};
|
||||
use crate::style_ext::DisplayInside;
|
||||
use crate::ContainingBlock;
|
||||
use servo_arc::Arc;
|
||||
use std::convert::TryInto;
|
||||
|
@ -83,7 +82,7 @@ impl IndependentFormattingContext {
|
|||
absolutely_positioned_fragments: &mut Vec<AbsolutelyPositionedFragment<'a>>,
|
||||
) -> IndependentLayout {
|
||||
match self.as_replaced() {
|
||||
Ok(replaced) => replaced.layout(layout_context, &self.style, containing_block),
|
||||
Ok(replaced) => replaced.layout(&self.style, containing_block),
|
||||
Err(ifc) => ifc.layout(
|
||||
layout_context,
|
||||
containing_block,
|
||||
|
|
|
@ -141,17 +141,6 @@ impl flow_relative::Vec2<Length> {
|
|||
}
|
||||
}
|
||||
|
||||
impl flow_relative::Sides<Length> {
|
||||
pub fn zero() -> Self {
|
||||
Self {
|
||||
inline_start: Length::zero(),
|
||||
inline_end: Length::zero(),
|
||||
block_start: Length::zero(),
|
||||
block_end: Length::zero(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl flow_relative::Rect<Length> {
|
||||
pub fn zero() -> Self {
|
||||
Self {
|
||||
|
@ -244,16 +233,6 @@ impl<T> flow_relative::Sides<T> {
|
|||
{
|
||||
self.block_start + self.block_end
|
||||
}
|
||||
|
||||
pub fn start_corner(&self) -> flow_relative::Vec2<T>
|
||||
where
|
||||
T: Clone,
|
||||
{
|
||||
flow_relative::Vec2 {
|
||||
inline: self.inline_start.clone(),
|
||||
block: self.block_start.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl flow_relative::Sides<LengthPercentage> {
|
||||
|
|
|
@ -2,16 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unreachable_code)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
|
||||
pub mod context;
|
||||
pub mod data;
|
||||
pub mod display_list;
|
||||
|
@ -31,15 +24,8 @@ pub mod wrapper;
|
|||
|
||||
pub use flow::{BoxTreeRoot, FragmentTreeRoot};
|
||||
|
||||
use crate::context::LayoutContext;
|
||||
use crate::dom_traversal::{Contents, NodeExt};
|
||||
use crate::flow::BlockFormattingContext;
|
||||
use crate::geom::flow_relative::Vec2;
|
||||
use crate::positioned::AbsolutelyPositionedFragment;
|
||||
use crate::replaced::ReplacedContent;
|
||||
use crate::style_ext::{ComputedValuesExt, Direction, DisplayInside, Position, WritingMode};
|
||||
use servo_arc::Arc;
|
||||
use std::convert::TryInto;
|
||||
use crate::style_ext::{ComputedValuesExt, Direction, Position, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{Length, LengthOrAuto};
|
||||
use style::Zero;
|
||||
|
|
|
@ -9,8 +9,6 @@ use crate::geom::flow_relative::{Rect, Sides, Vec2};
|
|||
use crate::style_ext::{ComputedValuesExt, Direction, WritingMode};
|
||||
use crate::{ContainingBlock, DefiniteContainingBlock};
|
||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{Length, LengthOrAuto, LengthPercentage, LengthPercentageOrAuto};
|
||||
use style::Zero;
|
||||
|
||||
|
|
|
@ -2,20 +2,16 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::context::LayoutContext;
|
||||
use crate::dom_traversal::NodeExt;
|
||||
use crate::formatting_contexts::IndependentLayout;
|
||||
use crate::fragments::{Fragment, ImageFragment};
|
||||
use crate::geom::{flow_relative, physical};
|
||||
use crate::positioned::AbsolutelyPositionedFragment;
|
||||
use crate::ContainingBlock;
|
||||
use net_traits::image::base::Image;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use std::sync::Arc;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::Length;
|
||||
use style::Zero;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ReplacedContent {
|
||||
|
@ -41,7 +37,6 @@ impl ReplacedContent {
|
|||
|
||||
pub fn layout<'a>(
|
||||
&'a self,
|
||||
layout_context: &LayoutContext,
|
||||
style: &ServoArc<ComputedValues>,
|
||||
containing_block: &ContainingBlock,
|
||||
) -> IndependentLayout {
|
||||
|
|
|
@ -1281,8 +1281,7 @@ impl LayoutThread {
|
|||
self.viewport_size.height.to_f32_px(),
|
||||
));
|
||||
let mut display_list = DisplayListBuilder::new(self.id.to_webrender(), viewport_size);
|
||||
let is_contentful =
|
||||
fragment_tree.build_display_list(&mut display_list, self.id, viewport_size);
|
||||
let is_contentful = fragment_tree.build_display_list(&mut display_list, viewport_size);
|
||||
|
||||
debug!("Layout done!");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue