diff options
-rw-r--r-- | components/canvas/webgl_paint_task.rs | 18 | ||||
-rw-r--r-- | components/gfx/display_list/mod.rs | 10 | ||||
-rw-r--r-- | components/layout/block.rs | 9 | ||||
-rw-r--r-- | components/layout/display_list_builder.rs | 163 | ||||
-rw-r--r-- | components/layout/inline.rs | 13 | ||||
-rw-r--r-- | components/net/fetch/request.rs | 34 | ||||
-rw-r--r-- | components/net/fetch/response.rs | 4 | ||||
-rw-r--r-- | components/net_traits/response.rs | 6 | ||||
-rw-r--r-- | components/plugins/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/BindingGen.py | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/GlobalGen.py | 2 | ||||
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 69 | ||||
-rw-r--r-- | components/script/parse/html.rs | 1 | ||||
-rw-r--r-- | components/util/opts.rs | 12 | ||||
-rw-r--r-- | python/servo/testing_commands.py | 6 | ||||
-rw-r--r-- | python/tidy.py | 35 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/css/iframe/hide_layers2.html | 2 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini | 1 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html | 6 |
19 files changed, 177 insertions, 218 deletions
diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index a765f93a109..8bef975d41a 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -23,10 +23,6 @@ pub struct WebGLPaintTask { gl_context: GLContext<NativeGLContext>, } -// This allows trying to create the PaintTask -// before creating the thread -unsafe impl Send for WebGLPaintTask {} - impl WebGLPaintTask { fn new(size: Size2D<i32>, attrs: GLContextAttributes) -> Result<WebGLPaintTask, &'static str> { let context = try!(GLContext::new(size, attrs, ColorAttachmentType::Texture, None)); @@ -193,9 +189,19 @@ impl WebGLPaintTask { -> Result<(IpcSender<CanvasMsg>, Sender<CanvasMsg>), &'static str> { let (out_of_process_chan, out_of_process_port) = ipc::channel::<CanvasMsg>().unwrap(); let (in_process_chan, in_process_port) = channel(); + let (result_chan, result_port) = channel(); ROUTER.route_ipc_receiver_to_mpsc_sender(out_of_process_port, in_process_chan.clone()); - let mut painter = try!(WebGLPaintTask::new(size, attrs)); spawn_named("WebGLTask".to_owned(), move || { + let mut painter = match WebGLPaintTask::new(size, attrs) { + Ok(task) => { + result_chan.send(Ok(())).unwrap(); + task + }, + Err(e) => { + result_chan.send(Err(e)).unwrap(); + return + } + }; painter.init(); loop { match in_process_port.recv().unwrap() { @@ -224,7 +230,7 @@ impl WebGLPaintTask { } }); - Ok((out_of_process_chan, in_process_chan)) + result_port.recv().unwrap().map(|_| (out_of_process_chan, in_process_chan)) } #[inline] diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 69b611a0919..6223a8e5f7f 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -146,6 +146,10 @@ impl DisplayList { } } + /// Adds the given display item at the specified section of this display list. + pub fn add_to_section(&mut self, display_item: DisplayItem, section: DisplayListSection) { + self.get_section_mut(section).push_back(display_item); + } /// Creates a new display list which contains a single stacking context. #[inline] @@ -554,7 +558,7 @@ impl DisplayList { } #[derive(Clone, Copy, Debug)] -enum DisplayListSection { +pub enum DisplayListSection { BackgroundAndBorders, BlockBackgroundsAndBorders, Floats, @@ -876,7 +880,7 @@ impl StackingContextLayerCreator { } } - parent_stacking_context.display_list.get_section_mut(section).push_back(item); + parent_stacking_context.display_list.add_to_section(item, section); return; } @@ -930,7 +934,7 @@ impl StackingContextLayerCreator { } if let Some(ref mut display_list) = self.display_list_for_next_layer { - display_list.get_section_mut(section).push_back(item); + display_list.add_to_section(item, section); } } diff --git a/components/layout/block.rs b/components/layout/block.rs index 7de0d52ef42..d34ecfd546d 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -45,7 +45,7 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER} use fragment::{SpecificFragmentInfo}; use gfx::display_list::{ClippingRegion, DisplayList}; use gfx_traits::LayerId; -use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; +use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT}; use layout_debug; use layout_task::DISPLAY_PORT_SIZE_FACTOR; use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none}; @@ -983,6 +983,7 @@ impl BlockFlow { self.formatting_context_type() == FormattingContextType::None) && !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) { self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } } @@ -1202,6 +1203,7 @@ impl BlockFlow { self.base.position.size.block = block_size; self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } /// Compute inline size based using the `block_container_inline_size` set by the parent flow. @@ -1430,6 +1432,7 @@ impl BlockFlow { // earlier, lay it out again. self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } fn is_inline_block(&self) -> bool { @@ -1574,7 +1577,8 @@ impl Flow for BlockFlow { LengthOrPercentageOrAuto::Length(_) => false, _ => true, }; - self.bubble_inline_sizes_for_block(consult_children) + self.bubble_inline_sizes_for_block(consult_children); + self.fragment.restyle_damage.remove(BUBBLE_ISIZES); } /// Recursively (top-down) determines the actual inline-size of child contexts and fragments. @@ -1993,6 +1997,7 @@ impl Flow for BlockFlow { self.build_display_list_for_block(box DisplayList::new(), layout_context, BorderPaintingMode::Separate); + self.fragment.restyle_damage.remove(REPAINT); if opts::get().validate_display_list_geometry { self.base.validate_display_list_geometry(); } diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 48b4a7bdff9..35c8de55fb4 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -24,7 +24,7 @@ use fragment::{CoordinateSystem, Fragment, HAS_LAYER, ImageFragmentInfo, Scanned use fragment::{SpecificFragmentInfo}; use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem}; use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion}; -use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList}; +use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList, DisplayListSection}; use gfx::display_list::{GradientDisplayItem}; use gfx::display_list::{GradientStop, ImageDisplayItem, LayeredItem, LayerInfo}; use gfx::display_list::{LineDisplayItem, OpaqueNode, SolidColorDisplayItem}; @@ -71,7 +71,7 @@ pub trait FragmentDisplayListBuilding { style: &ComputedValues, display_list: &mut DisplayList, layout_context: &LayoutContext, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion); @@ -84,21 +84,21 @@ pub trait FragmentDisplayListBuilding { -> Size2D<Au>; /// Adds the display items necessary to paint the background image of this fragment to the - /// display list at the appropriate stacking level. + /// appropriate section of the display list. fn build_display_list_for_background_image(&self, style: &ComputedValues, display_list: &mut DisplayList, layout_context: &LayoutContext, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion, image_url: &Url); /// Adds the display items necessary to paint the background linear gradient of this fragment - /// to the display list at the appropriate stacking level. + /// to the appropriate section of the display list. fn build_display_list_for_background_linear_gradient(&self, display_list: &mut DisplayList, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion, gradient: &LinearGradient, @@ -112,7 +112,7 @@ pub trait FragmentDisplayListBuilding { border_painting_mode: BorderPaintingMode, display_list: &mut DisplayList, bounds: &Rect<Au>, - level: StackingLevel, + display_list_section: DisplayListSection, clip: &ClippingRegion); /// Adds the display items necessary to paint the outline of this fragment to the display list @@ -129,7 +129,7 @@ pub trait FragmentDisplayListBuilding { style: &ComputedValues, list: &mut DisplayList, layout_context: &LayoutContext, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion); @@ -169,7 +169,7 @@ pub trait FragmentDisplayListBuilding { relative_containing_block_size: &LogicalSize<Au>, relative_containing_block_mode: WritingMode, border_painting_mode: BorderPaintingMode, - background_and_border_level: BackgroundAndBorderLevel, + display_list_section: DisplayListSection, clip: &ClippingRegion, stacking_relative_display_port: &Rect<Au>); @@ -192,7 +192,7 @@ pub trait FragmentDisplayListBuilding { fn build_display_items_for_selection_if_necessary(&self, display_list: &mut DisplayList, stacking_relative_border_box: &Rect<Au>, - level: StackingLevel, + display_list_section: DisplayListSection, clip: &ClippingRegion); /// Creates the text display item for one text fragment. This can be called multiple times for @@ -279,7 +279,7 @@ impl FragmentDisplayListBuilding for Fragment { style: &ComputedValues, display_list: &mut DisplayList, layout_context: &LayoutContext, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion) { // Adjust the clipping region as necessary to account for `border-radius`. @@ -317,14 +317,14 @@ impl FragmentDisplayListBuilding for Fragment { } } - display_list.push(DisplayItem::SolidColorClass(box SolidColorDisplayItem { + display_list.add_to_section(DisplayItem::SolidColorClass(box SolidColorDisplayItem { base: BaseDisplayItem::new(&bounds, DisplayItemMetadata::new(self.node, style, Cursor::DefaultCursor), &clip), color: background_color.to_gfx_color(), - }), level); + }), display_list_section); // The background image is painted on top of the background color. // Implements background image, per spec: @@ -334,7 +334,7 @@ impl FragmentDisplayListBuilding for Fragment { None => {} Some(computed::Image::LinearGradient(ref gradient)) => { self.build_display_list_for_background_linear_gradient(display_list, - level, + display_list_section, &bounds, &clip, gradient, @@ -344,7 +344,7 @@ impl FragmentDisplayListBuilding for Fragment { self.build_display_list_for_background_image(style, display_list, layout_context, - level, + display_list_section, &bounds, &clip, image_url) @@ -409,7 +409,7 @@ impl FragmentDisplayListBuilding for Fragment { style: &ComputedValues, display_list: &mut DisplayList, layout_context: &LayoutContext, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion, image_url: &Url) { @@ -504,7 +504,7 @@ impl FragmentDisplayListBuilding for Fragment { }; // Create the image display item. - display_list.push(DisplayItem::ImageClass(box ImageDisplayItem { + display_list.add_to_section(DisplayItem::ImageClass(box ImageDisplayItem { base: BaseDisplayItem::new(&bounds, DisplayItemMetadata::new(self.node, style, @@ -513,13 +513,13 @@ impl FragmentDisplayListBuilding for Fragment { image: image.clone(), stretch_size: Size2D::new(image_size.width, image_size.height), image_rendering: style.get_effects().image_rendering.clone(), - }), level); + }), display_list_section); } } fn build_display_list_for_background_linear_gradient(&self, display_list: &mut DisplayList, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion, gradient: &LinearGradient, @@ -633,14 +633,14 @@ impl FragmentDisplayListBuilding for Fragment { stops: stops, }); - display_list.push(gradient_display_item, level) + display_list.add_to_section(gradient_display_item, display_list_section) } fn build_display_list_for_box_shadow_if_applicable(&self, style: &ComputedValues, list: &mut DisplayList, _layout_context: &LayoutContext, - level: StackingLevel, + display_list_section: DisplayListSection, absolute_bounds: &Rect<Au>, clip: &ClippingRegion) { // NB: According to CSS-BACKGROUNDS, box shadows render in *reverse* order (front to back). @@ -652,7 +652,7 @@ impl FragmentDisplayListBuilding for Fragment { box_shadow.spread_radius); // TODO(pcwalton): Multiple border radii; elliptical border radii. - list.push(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem { + list.add_to_section(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem { base: BaseDisplayItem::new(&bounds, DisplayItemMetadata::new(self.node, style, @@ -671,7 +671,7 @@ impl FragmentDisplayListBuilding for Fragment { } else { BoxShadowClipMode::Outset }, - }), level); + }), display_list_section); } } @@ -681,7 +681,7 @@ impl FragmentDisplayListBuilding for Fragment { border_painting_mode: BorderPaintingMode, display_list: &mut DisplayList, bounds: &Rect<Au>, - level: StackingLevel, + display_list_section: DisplayListSection, clip: &ClippingRegion) { let mut border = style.logical_border_width(); @@ -723,7 +723,7 @@ impl FragmentDisplayListBuilding for Fragment { } // Append the border to the display list. - display_list.push(DisplayItem::BorderClass(box BorderDisplayItem { + display_list.add_to_section(DisplayItem::BorderClass(box BorderDisplayItem { base: BaseDisplayItem::new(&bounds, DisplayItemMetadata::new(self.node, style, @@ -736,7 +736,7 @@ impl FragmentDisplayListBuilding for Fragment { colors.left.to_gfx_color()), style: border_style, radius: build_border_radius(&bounds, border_style_struct), - }), level); + }), display_list_section); } fn build_display_list_for_outline_if_applicable(&self, @@ -862,7 +862,7 @@ impl FragmentDisplayListBuilding for Fragment { fn build_display_items_for_selection_if_necessary(&self, display_list: &mut DisplayList, stacking_relative_border_box: &Rect<Au>, - level: StackingLevel, + display_list_section: DisplayListSection, clip: &ClippingRegion) { let scanned_text_fragment_info = match self.specific { SpecificFragmentInfo::ScannedText(ref scanned_text_fragment_info) => { @@ -895,12 +895,12 @@ impl FragmentDisplayListBuilding for Fragment { cursor = Cursor::VerticalTextCursor; }; - display_list.push(DisplayItem::SolidColorClass(box SolidColorDisplayItem { + display_list.add_to_section(DisplayItem::SolidColorClass(box SolidColorDisplayItem { base: BaseDisplayItem::new(&insertion_point_bounds, DisplayItemMetadata::new(self.node, &*self.style, cursor), &clip), color: self.style().get_color().color.to_gfx_color(), - }), level); + }), display_list_section); } fn build_display_list(&mut self, @@ -910,7 +910,7 @@ impl FragmentDisplayListBuilding for Fragment { relative_containing_block_size: &LogicalSize<Au>, relative_containing_block_mode: WritingMode, border_painting_mode: BorderPaintingMode, - background_and_border_level: BackgroundAndBorderLevel, + display_list_section: DisplayListSection, clip: &ClippingRegion, stacking_relative_display_port: &Rect<Au>) { if self.style().get_inheritedbox().visibility != visibility::T::visible { @@ -947,9 +947,6 @@ impl FragmentDisplayListBuilding for Fragment { debug!("Fragment::build_display_list: intersected. Adding display item..."); if self.is_primary_fragment() { - let level = - StackingLevel::from_background_and_border_level(background_and_border_level); - // Add shadows, background, borders, and outlines, if applicable. if let Some(ref inline_context) = self.inline_context { for node in inline_context.nodes.iter().rev() { @@ -957,14 +954,14 @@ impl FragmentDisplayListBuilding for Fragment { &*node.style, display_list, layout_context, - level, + display_list_section, &stacking_relative_border_box, &clip); self.build_display_list_for_box_shadow_if_applicable( &*node.style, display_list, layout_context, - level, + display_list_section, &stacking_relative_border_box, &clip); @@ -978,7 +975,7 @@ impl FragmentDisplayListBuilding for Fragment { border_painting_mode, display_list, &stacking_relative_border_box, - level, + display_list_section, &clip); self.build_display_list_for_outline_if_applicable( @@ -993,20 +990,20 @@ impl FragmentDisplayListBuilding for Fragment { self.build_display_list_for_background_if_applicable(&*self.style, display_list, layout_context, - level, + display_list_section, &stacking_relative_border_box, &clip); self.build_display_list_for_box_shadow_if_applicable(&*self.style, display_list, layout_context, - level, + display_list_section, &stacking_relative_border_box, &clip); self.build_display_list_for_borders_if_applicable(&*self.style, border_painting_mode, display_list, &stacking_relative_border_box, - level, + display_list_section, &clip); self.build_display_list_for_outline_if_applicable(&*self.style, display_list, @@ -1017,7 +1014,7 @@ impl FragmentDisplayListBuilding for Fragment { // Paint the selection point if necessary. self.build_display_items_for_selection_if_necessary(display_list, &stacking_relative_border_box, - level, + display_list_section, &clip); } @@ -1507,12 +1504,12 @@ pub trait BlockFlowDisplayListBuilding { display_list: &mut DisplayList, layout_context: &LayoutContext, border_painting_mode: BorderPaintingMode, - background_border_level: BackgroundAndBorderLevel); + background_border_level: DisplayListSection); fn build_display_list_for_static_block(&mut self, display_list: Box<DisplayList>, layout_context: &LayoutContext, border_painting_mode: BorderPaintingMode, - background_border_level: BackgroundAndBorderLevel); + background_border_level: DisplayListSection); fn build_display_list_for_absolutely_positioned_block( &mut self, display_list: Box<DisplayList>, @@ -1533,7 +1530,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { display_list: &mut DisplayList, layout_context: &LayoutContext, border_painting_mode: BorderPaintingMode, - background_border_level: BackgroundAndBorderLevel) { + background_border_level: DisplayListSection) { // Add the box that starts the block context. let clip = if self.fragment.establishes_stacking_context() { self.base.clip.translate(&-self.base.stacking_relative_position) @@ -1567,7 +1564,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { mut display_list: Box<DisplayList>, layout_context: &LayoutContext, border_painting_mode: BorderPaintingMode, - background_border_level: BackgroundAndBorderLevel) { + background_border_level: DisplayListSection) { self.build_display_list_for_block_base(&mut *display_list, layout_context, border_painting_mode, @@ -1617,7 +1614,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { &self.base.early_absolute_position_info.relative_containing_block_size, self.base.early_absolute_position_info.relative_containing_block_mode, border_painting_mode, - BackgroundAndBorderLevel::RootOfStackingContext, + DisplayListSection::BackgroundAndBorders, &clip, &self.base.stacking_relative_position_of_display_port); @@ -1630,17 +1627,16 @@ impl BlockFlowDisplayListBuilding for BlockFlow { Some(outer_display_list_for_overflow_scroll) } _ => { - let establishes_stacking_context = self.fragment.establishes_stacking_context(); - let background_and_border_level = if establishes_stacking_context { - BackgroundAndBorderLevel::RootOfStackingContext + let display_list_section = if self.fragment.establishes_stacking_context() { + DisplayListSection::BackgroundAndBorders } else { - BackgroundAndBorderLevel::Block + DisplayListSection::BlockBackgroundsAndBorders }; self.build_display_list_for_block_base(&mut *display_list, layout_context, border_painting_mode, - background_and_border_level); + display_list_section); None } }; @@ -1692,7 +1688,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { self.build_display_list_for_block_base(&mut *display_list, layout_context, border_painting_mode, - BackgroundAndBorderLevel::RootOfStackingContext); + DisplayListSection::BackgroundAndBorders); display_list.form_float_pseudo_stacking_context(); self.base.display_list_building_result = if self.fragment.establishes_stacking_context() { @@ -1722,10 +1718,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow { layout_context, border_painting_mode); } else { - self.build_display_list_for_static_block(display_list, - layout_context, - border_painting_mode, - BackgroundAndBorderLevel::Block); + self.build_display_list_for_static_block( + display_list, + layout_context, + border_painting_mode, + DisplayListSection::BlockBackgroundsAndBorders); } } } @@ -1754,7 +1751,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow { .early_absolute_position_info .relative_containing_block_mode, BorderPaintingMode::Separate, - BackgroundAndBorderLevel::Content, + DisplayListSection::Content, &self.base.clip, &self.base.stacking_relative_position_of_display_port); @@ -1854,7 +1851,7 @@ impl ListItemFlowDisplayListBuilding for ListItemFlow { .early_absolute_position_info .relative_containing_block_mode, BorderPaintingMode::Separate, - BackgroundAndBorderLevel::Content, + DisplayListSection::Content, &self.block_flow.base.clip, &self.block_flow .base @@ -1906,7 +1903,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow { let mut color = THREAD_TINT_COLORS[thread_id as usize % THREAD_TINT_COLORS.len()]; color.a = 1.0; - display_list.push(DisplayItem::BorderClass(box BorderDisplayItem { + display_list.add_to_section(DisplayItem::BorderClass(box BorderDisplayItem { base: BaseDisplayItem::new(&stacking_context_relative_bounds.inflate(Au::from_px(2), Au::from_px(2)), DisplayItemMetadata { @@ -1918,7 +1915,7 @@ impl BaseFlowDisplayListBuilding for BaseFlow { color: SideOffsets2D::new_all_same(color), style: SideOffsets2D::new_all_same(border_style::T::solid), radius: BorderRadii::all_same(Au(0)), - }), StackingLevel::Content); + }), DisplayListSection::Content); } } @@ -1950,54 +1947,6 @@ fn position_to_offset(position: LengthOrPercentage, Au(total_length): Au) -> f32 } } -/// "Steps" as defined by CSS 2.1 § E.2. -#[derive(Clone, PartialEq, Debug, Copy)] -pub enum StackingLevel { - /// The border and backgrounds for the root of this stacking context: steps 1 and 2. - BackgroundAndBorders, - /// Borders and backgrounds for block-level descendants: step 4. - BlockBackgroundsAndBorders, - /// All non-positioned content. - Content, -} - -impl StackingLevel { - #[inline] - pub fn from_background_and_border_level(level: BackgroundAndBorderLevel) -> StackingLevel { - match level { - BackgroundAndBorderLevel::RootOfStackingContext => StackingLevel::BackgroundAndBorders, - BackgroundAndBorderLevel::Block => StackingLevel::BlockBackgroundsAndBorders, - BackgroundAndBorderLevel::Content => StackingLevel::Content, - } - } -} - -/// Which level to place backgrounds and borders in. -pub enum BackgroundAndBorderLevel { - RootOfStackingContext, - Block, - Content, -} - -trait StackingContextConstruction { - /// Adds the given display item at the specified level to this display list. - fn push(&mut self, display_item: DisplayItem, level: StackingLevel); -} - -impl StackingContextConstruction for DisplayList { - fn push(&mut self, display_item: DisplayItem, level: StackingLevel) { - match level { - StackingLevel::BackgroundAndBorders => { - self.background_and_borders.push_back(display_item) - } - StackingLevel::BlockBackgroundsAndBorders => { - self.block_backgrounds_and_borders.push_back(display_item) - } - StackingLevel::Content => self.content.push_back(display_item), - } - } -} - /// Adjusts `content_rect` as necessary for the given spread, and blur so that the resulting /// bounding rect contains all of a shadow's ink. fn shadow_bounds(content_rect: &Rect<Au>, blur_radius: Au, spread_radius: Au) -> Rect<Au> { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 232de1bb5f2..9f77ecfcb9e 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -17,7 +17,7 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFr use gfx::display_list::OpaqueNode; use gfx::font::FontMetrics; use gfx::font_context::FontContext; -use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT}; +use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RESOLVE_GENERATED_CONTENT}; use layout_debug; use model::IntrinsicISizesContribution; use std::cmp::max; @@ -1354,6 +1354,8 @@ impl Flow for InlineFlow { intrinsic_sizes_for_nonbroken_run.union_inline(&intrinsic_sizes_for_fragment); } } + + fragment.restyle_damage.remove(BUBBLE_ISIZES); } // Flush any remaining nonbroken-run and inline-run intrinsic sizes. @@ -1615,6 +1617,9 @@ impl Flow for InlineFlow { }); self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + for fragment in &mut self.fragments.fragments { + fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + } } fn compute_absolute_position(&mut self, _: &LayoutContext) { @@ -1742,7 +1747,11 @@ impl Flow for InlineFlow { fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {} fn build_display_list(&mut self, layout_context: &LayoutContext) { - self.build_display_list_for_inline(layout_context) + self.build_display_list_for_inline(layout_context); + + for fragment in &mut self.fragments.fragments { + fragment.restyle_damage.remove(REPAINT); + } } fn repair_style(&mut self, _: &Arc<ComputedValues>) {} diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index 0980e07c3e5..d0c9b964785 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -296,39 +296,37 @@ fn http_fetch(request: Rc<Request>, authentication_fetch_flag: bool) -> Response { // Step 1 - let mut response: Option<Rc<RefCell<Response>>> = None; + let mut response: Option<Rc<Response>> = None; // Step 2 - let mut actual_response: Option<Rc<RefCell<Response>>> = None; + let mut actual_response: Option<Rc<Response>> = None; // Step 3 if !request.skip_service_worker.get() && !request.is_service_worker_global_scope { // TODO: Substep 1 (handle fetch unimplemented) if let Some(ref res) = response { - let resp = res.borrow(); // Substep 2 - actual_response = match resp.internal_response { + actual_response = match res.internal_response { Some(ref internal_res) => Some(internal_res.clone()), None => Some(res.clone()) }; // Substep 3 - if (resp.response_type == ResponseType::Opaque && + if (res.response_type == ResponseType::Opaque && request.mode != RequestMode::NoCORS) || - (resp.response_type == ResponseType::OpaqueRedirect && + (res.response_type == ResponseType::OpaqueRedirect && request.redirect_mode != RedirectMode::Manual) || - resp.response_type == ResponseType::Error { + res.response_type == ResponseType::Error { return Response::network_error(); } } // Substep 4 if let Some(ref res) = actual_response { - let mut resp = res.borrow_mut(); - if resp.url_list.is_empty() { - resp.url_list = request.url_list.borrow().clone(); + if res.url_list.borrow().is_empty() { + *res.url_list.borrow_mut() = request.url_list.borrow().clone(); } } @@ -370,7 +368,7 @@ fn http_fetch(request: Rc<Request>, if preflight_result.response_type == ResponseType::Error { return Response::network_error(); } - response = Some(Rc::new(RefCell::new(preflight_result))); + response = Some(Rc::new(preflight_result)); } } @@ -394,13 +392,13 @@ fn http_fetch(request: Rc<Request>, return Response::network_error(); } - response = Some(Rc::new(RefCell::new(fetch_result))); + response = Some(Rc::new(fetch_result)); actual_response = response.clone(); } // Step 5 - let actual_response = Rc::try_unwrap(actual_response.unwrap()).ok().unwrap().into_inner(); - let response = Rc::try_unwrap(response.unwrap()).ok().unwrap(); + let actual_response = Rc::try_unwrap(actual_response.unwrap()).ok().unwrap(); + let mut response = Rc::try_unwrap(response.unwrap()).ok().unwrap(); match actual_response.status.unwrap() { @@ -445,7 +443,7 @@ fn http_fetch(request: Rc<Request>, // Step 9 RedirectMode::Manual => { - *response.borrow_mut() = actual_response.to_filtered(ResponseType::Opaque); + response = actual_response.to_filtered(ResponseType::Opaque); } // Step 10 @@ -495,7 +493,7 @@ fn http_fetch(request: Rc<Request>, // Step 1 // FIXME: Figure out what to do with request window objects if cors_flag { - return response.into_inner(); + return response; } // Step 2 @@ -531,8 +529,6 @@ fn http_fetch(request: Rc<Request>, _ => { } } - let response = response.into_inner(); - // Step 6 if authentication_fetch_flag { // TODO: Create authentication entry for this request @@ -793,7 +789,7 @@ fn http_network_fetch(request: Rc<Request>, }; // Step 6 - response.url_list = request.url_list.borrow().clone(); + *response.url_list.borrow_mut() = request.url_list.borrow().clone(); // Step 7 diff --git a/components/net/fetch/response.rs b/components/net/fetch/response.rs index ff2e909368a..42e5fe414ab 100644 --- a/components/net/fetch/response.rs +++ b/components/net/fetch/response.rs @@ -22,7 +22,7 @@ impl ResponseMethods for Response { response_type: ResponseType::Default, termination_reason: None, url: None, - url_list: Vec::new(), + url_list: RefCell::new(Vec::new()), status: Some(StatusCode::Ok), headers: Headers::new(), body: ResponseBody::Empty, @@ -42,7 +42,7 @@ impl ResponseMethods for Response { } let old_headers = self.headers.clone(); let mut response = self.clone(); - response.internal_response = Some(Rc::new(RefCell::new(self))); + response.internal_response = Some(Rc::new(self)); match filter_type { ResponseType::Default | ResponseType::Error => unreachable!(), ResponseType::Basic => { diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs index c9984afe450..0e5eb0ac46e 100644 --- a/components/net_traits/response.rs +++ b/components/net_traits/response.rs @@ -67,7 +67,7 @@ pub struct Response { pub response_type: ResponseType, pub termination_reason: Option<TerminationReason>, pub url: Option<Url>, - pub url_list: Vec<Url>, + pub url_list: RefCell<Vec<Url>>, /// `None` can be considered a StatusCode of `0`. pub status: Option<StatusCode>, pub headers: Headers, @@ -76,7 +76,7 @@ pub struct Response { pub https_state: HttpsState, /// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response /// is a filtered response - pub internal_response: Option<Rc<RefCell<Response>>>, + pub internal_response: Option<Rc<Response>>, } impl Response { @@ -85,7 +85,7 @@ impl Response { response_type: ResponseType::Error, termination_reason: None, url: None, - url_list: vec![], + url_list: RefCell::new(vec![]), status: None, headers: Headers::new(), body: ResponseBody::Empty, diff --git a/components/plugins/Cargo.toml b/components/plugins/Cargo.toml index b4900f101d9..92cd14974de 100644 --- a/components/plugins/Cargo.toml +++ b/components/plugins/Cargo.toml @@ -13,7 +13,7 @@ git = "https://github.com/Manishearth/rust-tenacious" [dependencies.clippy] git = "https://github.com/Manishearth/rust-clippy" -branch = "servo" +rev = "9dca15de3e8ea266d3e7e868c0f358ed4fa5f195" optional = true [dependencies] diff --git a/components/script/dom/bindings/codegen/BindingGen.py b/components/script/dom/bindings/codegen/BindingGen.py index 6b1f10c44e2..79576b67e58 100644 --- a/components/script/dom/bindings/codegen/BindingGen.py +++ b/components/script/dom/bindings/codegen/BindingGen.py @@ -30,8 +30,6 @@ def main(): from optparse import OptionParser usagestring = "usage: %prog configFile outputdir outputPrefix webIDLFile" o = OptionParser(usage=usagestring) - o.add_option("--verbose-errors", action='store_true', default=False, - help="When an error happens, display the Python traceback.") (options, args) = o.parse_args() if len(args) != 4: diff --git a/components/script/dom/bindings/codegen/GlobalGen.py b/components/script/dom/bindings/codegen/GlobalGen.py index 6a83d069e02..f4210331e0e 100644 --- a/components/script/dom/bindings/codegen/GlobalGen.py +++ b/components/script/dom/bindings/codegen/GlobalGen.py @@ -32,8 +32,6 @@ def main(): o = OptionParser(usage=usageString) o.add_option("--cachedir", dest='cachedir', default=None, help="Directory in which to cache lex/parse tables.") - o.add_option("--verbose-errors", action='store_true', default=False, - help="When an error happens, display the Python traceback.") (options, args) = o.parse_args() if len(args) < 2: diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index b2af1d414a4..5db616ddf2b 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -192,33 +192,33 @@ impl HTMLScriptElement { if !self.upcast::<Node>().is_in_doc() { return NextParserState::Continue; } - // Step 6, 7. + // Step 6. if !self.is_javascript() { return NextParserState::Continue; } - // Step 8. + // Step 7. if was_parser_inserted { self.parser_inserted.set(true); self.non_blocking.set(false); } - // Step 9. + // Step 8. self.already_started.set(true); - // Step 10. + // Step 9. let doc = document_from_node(self); let document_from_node_ref = doc.r(); if self.parser_inserted.get() && &*self.parser_document != document_from_node_ref { return NextParserState::Continue; } - // Step 11. + // Step 10. if !document_from_node_ref.is_scripting_enabled() { return NextParserState::Continue; } - // TODO: Step 12. + // TODO(#4577): Step 11: CSP. - // Step 13. + // Step 12. let for_attribute = element.get_attribute(&ns!(), &atom!("for")); let event_attribute = element.get_attribute(&ns!(), &atom!("event")); match (for_attribute.r(), event_attribute.r()) { @@ -238,44 +238,40 @@ impl HTMLScriptElement { (_, _) => (), } - // Step 14. + // Step 13. if let Some(ref charset) = element.get_attribute(&ns!(), &atom!("charset")) { if let Some(encodingRef) = encoding_from_whatwg_label(&charset.Value()) { *self.block_character_encoding.borrow_mut() = encodingRef; } } - // Step 15. let window = window_from_node(self); let window = window.r(); let base_url = window.get_url(); + // Step 14. let is_external = match element.get_attribute(&ns!(), &atom!("src")) { - // Step 15. Some(ref src) => { - // Step 15.1 + // Step 14.1. let src = src.value(); - // Step 15.2 + // Step 14.2. if src.is_empty() { self.queue_error_event(); return NextParserState::Continue; } - // Step 15.3 + // Step 14.3. match base_url.join(&src) { Err(_) => { - // Step 15.4 + // Step 14.4. error!("error parsing URL for script {}", &**src); self.queue_error_event(); return NextParserState::Continue; } Ok(url) => { - // Step 15.5 - // TODO: Do a potentially CORS-enabled fetch with the mode being the current - // state of the element's `crossorigin` content attribute, the origin being - // the origin of the script element's node document, and the default origin - // behaviour set to taint. + // Step 14.5-7. + // TODO(#9186): use the fetch infrastructure. let script_chan = window.networking_task_source(); let elem = Trusted::new(self, script_chan.clone()); @@ -306,9 +302,9 @@ impl HTMLScriptElement { None => false, }; - // Step 16. + // Step 15. let deferred = element.has_attribute(&atom!("defer")); - // Step 16.a, has src, has defer, was parser-inserted, is not async. + // Step 15.a: has src, has defer, was parser-inserted, is not async. if is_external && deferred && was_parser_inserted && @@ -316,13 +312,13 @@ impl HTMLScriptElement { doc.add_deferred_script(self); // Second part implemented in Document::process_deferred_scripts. return NextParserState::Continue; - // Step 16.b, has src, was parser-inserted, is not async. + // Step 15.b: has src, was parser-inserted, is not async. } else if is_external && was_parser_inserted && !async { doc.set_pending_parsing_blocking_script(Some(self)); // Second part implemented in the load result handler. - // Step 16.c, doesn't have src, was parser-inserted, is blocked on stylesheet. + // Step 15.c: doesn't have src, was parser-inserted, is blocked on stylesheet. } else if !is_external && was_parser_inserted && // TODO: check for script nesting levels. @@ -330,17 +326,17 @@ impl HTMLScriptElement { doc.set_pending_parsing_blocking_script(Some(self)); *self.load.borrow_mut() = Some(ScriptOrigin::Internal(text, base_url)); self.ready_to_be_parser_executed.set(true); - // Step 16.d, has src, isn't async, isn't non-blocking. + // Step 15.d: has src, isn't async, isn't non-blocking. } else if is_external && !async && !self.non_blocking.get() { doc.push_asap_in_order_script(self); // Second part implemented in Document::process_asap_scripts. - // Step 16.e, has src. + // Step 15.e: has src. } else if is_external { doc.add_asap_script(self); // Second part implemented in Document::process_asap_scripts. - // Step 16.f, otherwise. + // Step 15.f: otherwise. } else { assert!(!text.is_empty()); self.ready_to_be_parser_executed.set(true); @@ -384,26 +380,7 @@ impl HTMLScriptElement { // Step 2.b.1.a. ScriptOrigin::External(Ok((metadata, bytes))) => { - // Step 1. - // TODO: If the resource's Content Type metadata, if any, - // specifies a character encoding, and the user agent supports - // that encoding, then let character encoding be that encoding, - // and jump to the bottom step in this series of steps. - - // Step 2. - // TODO: If the algorithm above set the script block's - // character encoding, then let character encoding be that - // encoding, and jump to the bottom step in this series of - // steps. - - // Step 3. - // TODO: Let character encoding be the script block's fallback - // character encoding. - - // Step 4. - // TODO: Otherwise, decode the file to Unicode, using character - // encoding as the fallback encoding. - + // TODO(#9185): implement encoding determination. (DOMString::from(UTF_8.decode(&*bytes, DecoderTrap::Replace).unwrap()), true, metadata.final_url) diff --git a/components/script/parse/html.rs b/components/script/parse/html.rs index 8804010d4ba..dc201402a61 100644 --- a/components/script/parse/html.rs +++ b/components/script/parse/html.rs @@ -25,7 +25,6 @@ use dom::processinginstruction::ProcessingInstruction; use dom::servohtmlparser; use dom::servohtmlparser::{FragmentContext, ServoHTMLParser}; use dom::text::Text; -use encoding::types::Encoding; use html5ever::Attribute; use html5ever::serialize::TraversalScope; use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode}; diff --git a/components/util/opts.rs b/components/util/opts.rs index 0967dc59692..94f9e148ede 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -119,11 +119,6 @@ pub struct Opts { /// and paint. pub trace_layout: bool, - /// If true, instrument the runtime for each task created and dump - /// that information to a JSON file that can be viewed in the task - /// profile viewer. - pub profile_tasks: bool, - /// Periodically print out on which events script tasks spend their processing time. pub profile_script_events: bool, @@ -229,9 +224,6 @@ pub struct DebugOptions { /// Print notifications when there is a relayout. pub relayout_event: bool, - /// Instrument each task, writing the output to a file. - pub profile_tasks: bool, - /// Profile which events script tasks spend their time on. pub profile_script_events: bool, @@ -299,7 +291,6 @@ impl DebugOptions { "dump-display-list-optimized" => debug_options.dump_display_list_optimized = true, "dump-layer-tree" => debug_options.dump_layer_tree = true, "relayout-event" => debug_options.relayout_event = true, - "profile-tasks" => debug_options.profile_tasks = true, "profile-script-events" => debug_options.profile_script_events = true, "profile-heartbeats" => debug_options.profile_heartbeats = true, "show-compositor-borders" => debug_options.show_compositor_borders = true, @@ -342,7 +333,6 @@ pub fn print_debug_usage(app: &str) -> ! { print_option("dump-display-list-optimized", "Print optimized display list (at paint time)."); print_option("dump-layer-tree", "Print the layer tree whenever it changes."); print_option("relayout-event", "Print notifications when there is a relayout."); - print_option("profile-tasks", "Instrument each task, writing the output to a file."); print_option("profile-script-events", "Enable profiling of script-related events."); print_option("profile-heartbeats", "Enable heartbeats for all task categories."); print_option("show-compositor-borders", "Paint borders along layer and tile boundaries."); @@ -485,7 +475,6 @@ pub fn default_opts() -> Opts { dump_layer_tree: false, relayout_event: false, validate_display_list_geometry: false, - profile_tasks: false, profile_script_events: false, profile_heartbeats: false, disable_share_style_cache: false, @@ -696,7 +685,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { headless: opt_match.opt_present("z"), hard_fail: opt_match.opt_present("f"), bubble_inline_sizes_separately: bubble_inline_sizes_separately, - profile_tasks: debug_options.profile_tasks, profile_script_events: debug_options.profile_script_events, profile_heartbeats: debug_options.profile_heartbeats, trace_layout: debug_options.trace_layout, diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 73fac648b76..873627c61d5 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -256,8 +256,10 @@ class MachCommands(CommandBase): @Command('test-tidy', description='Run the source code tidiness check', category='testing') - def test_tidy(self): - return tidy.scan() + @CommandArgument('--faster', default=False, action="store_true", + help="Only check changed files and skip the WPT lint") + def test_tidy(self, faster): + return tidy.scan(faster) @Command('test-wpt-failure', description='Run the web platform tests', diff --git a/python/tidy.py b/python/tidy.py index 106db1a5e80..d3877fe9e56 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -13,6 +13,7 @@ import fnmatch import itertools import re import StringIO +import subprocess import sys from licenseck import licenses @@ -554,7 +555,6 @@ def check_reftest_html_files_in_basic_list(reftest_dir): def check_wpt_lint_errors(): - import subprocess wpt_working_dir = os.path.abspath(os.path.join(".", "tests", "wpt", "web-platform-tests")) lint_cmd = os.path.join(wpt_working_dir, "lint") try: @@ -563,20 +563,41 @@ def check_wpt_lint_errors(): yield ("WPT Lint Tool", "", "lint error(s) in Web Platform Tests: exit status {0}".format(e.returncode)) -def scan(): - all_files = (os.path.join(r, f) for r, _, files in os.walk(".") for f in files) - files_to_check = filter(should_check, all_files) +def get_file_list(directory, only_changed_files=False): + if only_changed_files: + # only check the files that have been changed since the last merge + args = ["git", "log", "-n1", "--author=bors-servo", "--format=%H"] + last_merge = subprocess.check_output(args).strip() + args = ["git", "diff", "--name-only", last_merge, directory] + file_list = subprocess.check_output(args) + # also check untracked files + args = ["git", "ls-files", "--others", "--exclude-standard", directory] + file_list += subprocess.check_output(args) + return (os.path.join(".", f) for f in file_list.splitlines()) + else: + return (os.path.join(r, f) for r, _, files in os.walk(directory) for f in files) + +def scan(faster=False): + # standard checks + files_to_check = filter(should_check, get_file_list(".", faster)) checking_functions = (check_flake8, check_lock, check_webidl_spec) line_checking_functions = (check_license, check_by_line, check_toml, check_rust, check_spec) errors = collect_errors_for_files(files_to_check, checking_functions, line_checking_functions) - reftest_files = (os.path.join(r, f) for r, _, files in os.walk(reftest_dir) for f in files) - reftest_to_check = filter(should_check_reftest, reftest_files) + # reftest checks + reftest_to_check = filter(should_check_reftest, get_file_list(reftest_dir, faster)) r_errors = check_reftest_order(reftest_to_check) not_found_in_basic_list_errors = check_reftest_html_files_in_basic_list(reftest_dir) - wpt_lint_errors = check_wpt_lint_errors() + # wpt lint checks + if faster: + print "\033[93mUsing test-tidy \033[01m--faster\033[22m, skipping WPT lint\033[0m" + wpt_lint_errors = iter([]) + else: + wpt_lint_errors = check_wpt_lint_errors() + + # collect errors errors = itertools.chain(errors, r_errors, not_found_in_basic_list_errors, wpt_lint_errors) error = None diff --git a/tests/wpt/mozilla/meta/css/iframe/hide_layers2.html b/tests/wpt/mozilla/meta/css/iframe/hide_layers2.html new file mode 100644 index 00000000000..3da4ca691c6 --- /dev/null +++ b/tests/wpt/mozilla/meta/css/iframe/hide_layers2.html @@ -0,0 +1,2 @@ +[hide_layers2.html] + disabled: too many intermittent failures in https://github.com/servo/servo/issues/8769 diff --git a/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini b/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini index 5727ab12dd7..92e5aeb2640 100644 --- a/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini @@ -1,3 +1,2 @@ [mime_sniffing_font_context.html] prefs: ['net.mime.sniff:true'] - disabled: https://github.com/servo/servo/issues/9124 diff --git a/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html b/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html index ab0bc5d81c8..8112a99f431 100644 --- a/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html +++ b/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html @@ -70,6 +70,12 @@ async_test(function() { function checkFontLoaded() { var first = document.getElementById('first'); var second = document.getElementById('second'); + // Since there's no way to be notified when the page has been marked dirty in response + // to a font having loaded, we'll just keep trying. + if (first.getBoundingClientRect().width == second.getBoundingClientRect().width) { + this.step_timeout(checkFontLoaded, 500); + return; + } assert_not_equals(first.getBoundingClientRect().width, second.getBoundingClientRect().width); assert_not_equals(first.getBoundingClientRect().height, second.getBoundingClientRect().height); this.done(); |