Skip to content

Commit

Permalink
Merge in servo/master
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdanfox committed Mar 5, 2015
2 parents 3441b2c + caf5663 commit 19686ac
Show file tree
Hide file tree
Showing 78 changed files with 2,004 additions and 993 deletions.
8 changes: 4 additions & 4 deletions components/compositing/compositor.rs
Expand Up @@ -274,8 +274,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.change_page_title(pipeline_id, title);
}

(Msg::ChangePageLoadData(frame_id, load_data), ShutdownState::NotShuttingDown) => {
self.change_page_load_data(frame_id, load_data);
(Msg::ChangePageUrl(frame_id, url), ShutdownState::NotShuttingDown) => {
self.change_page_url(frame_id, url);
}

(Msg::PaintMsgDiscarded, ShutdownState::NotShuttingDown) => {
Expand Down Expand Up @@ -441,8 +441,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}

fn change_page_load_data(&mut self, _: FrameId, load_data: LoadData) {
self.window.set_page_load_data(load_data);
fn change_page_url(&mut self, _: FrameId, url: Url) {
self.window.set_page_url(url);
}

fn all_pipelines_in_idle_paint_state(&self) -> bool {
Expand Down
9 changes: 5 additions & 4 deletions components/compositing/compositor_task.rs
Expand Up @@ -20,8 +20,9 @@ use layers::layers::LayerBufferSet;
use pipeline::CompositionPipeline;
use msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState};
use msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy};
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId};
use msg::constellation_msg::{ConstellationChan, PipelineId};
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
use url::Url;
use util::cursor::Cursor;
use util::geometry::PagePx;
use util::memory::MemoryProfilerChan;
Expand Down Expand Up @@ -200,8 +201,8 @@ pub enum Msg {
ChangePaintState(PipelineId, PaintState),
/// Alerts the compositor that the current page has changed its title.
ChangePageTitle(PipelineId, Option<String>),
/// Alerts the compositor that the current page has changed its load data (including URL).
ChangePageLoadData(FrameId, LoadData),
/// Alerts the compositor that the current page has changed its URL.
ChangePageUrl(FrameId, Url),
/// Alerts the compositor that a `PaintMsg` has been discarded.
PaintMsgDiscarded,
/// Replaces the current frame tree, typically called during main frame navigation.
Expand Down Expand Up @@ -237,7 +238,7 @@ impl Debug for Msg {
Msg::ChangeReadyState(..) => write!(f, "ChangeReadyState"),
Msg::ChangePaintState(..) => write!(f, "ChangePaintState"),
Msg::ChangePageTitle(..) => write!(f, "ChangePageTitle"),
Msg::ChangePageLoadData(..) => write!(f, "ChangePageLoadData"),
Msg::ChangePageUrl(..) => write!(f, "ChangePageUrl"),
Msg::PaintMsgDiscarded(..) => write!(f, "PaintMsgDiscarded"),
Msg::SetFrameTree(..) => write!(f, "SetFrameTree"),
Msg::CreateRootLayerForPipeline(..) => write!(f, "CreateRootLayerForPipeline"),
Expand Down
11 changes: 5 additions & 6 deletions components/compositing/constellation.rs
Expand Up @@ -334,9 +334,9 @@ impl NavigationContext {
/// compositor of the new URLs.
fn set_current(&mut self, new_frame: Rc<FrameTree>, compositor_proxy: &mut CompositorProxy) {
self.current = Some(new_frame.clone());
compositor_proxy.send(CompositorMsg::ChangePageLoadData(
compositor_proxy.send(CompositorMsg::ChangePageUrl(
new_frame.id,
new_frame.pipeline.borrow().load_data.clone()));
new_frame.pipeline.borrow().url.clone()));
}
}

Expand Down Expand Up @@ -407,8 +407,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.time_profiler_chan.clone(),
self.window_size,
script_pipeline,
load_data.clone());
pipe.load();
load_data);
Rc::new(pipe)
}

Expand Down Expand Up @@ -763,7 +762,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
source Id of ScriptLoadedURLInIFrameMsg does have an associated pipeline in
constellation. This should be impossible.").clone();

let source_url = source_pipeline.load_data.url.clone();
let source_url = source_pipeline.url.clone();

let same_script = (source_url.host() == url.host() &&
source_url.port() == url.port()) &&
Expand Down Expand Up @@ -876,7 +875,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
};

for frame in destination_frame.iter() {
frame.pipeline.borrow().load();
frame.pipeline.borrow().activate();
frame.pipeline.borrow().thaw();
}
self.send_frame_tree_and_grant_paint_permission(destination_frame);
Expand Down
2 changes: 1 addition & 1 deletion components/compositing/headless.rs
Expand Up @@ -113,7 +113,7 @@ impl CompositorEventListener for NullCompositor {
Msg::PaintMsgDiscarded(..) |
Msg::ScrollTimeout(..) |
Msg::ChangePageTitle(..) |
Msg::ChangePageLoadData(..) |
Msg::ChangePageUrl(..) |
Msg::KeyEvent(..) |
Msg::SetCursor(..) => {}
Msg::PaintTaskExited(..) => {}
Expand Down
21 changes: 11 additions & 10 deletions components/compositing/pipeline.rs
Expand Up @@ -16,6 +16,7 @@ use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
use net::image_cache_task::ImageCacheTask;
use net::resource_task::ResourceTask;
use net::storage_task::StorageTask;
use url::Url;
use util::time::TimeProfilerChan;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, channel};
Expand All @@ -29,8 +30,8 @@ pub struct Pipeline {
pub paint_chan: PaintChan,
pub layout_shutdown_port: Receiver<()>,
pub paint_shutdown_port: Receiver<()>,
/// Load data corresponding to the most recently-loaded page.
pub load_data: LoadData,
/// URL corresponding to the most recently-loaded page.
pub url: Url,
/// The title of the most recently-loaded page.
pub title: Option<String>,
}
Expand Down Expand Up @@ -88,7 +89,8 @@ impl Pipeline {
storage_task.clone(),
image_cache_task.clone(),
devtools_chan,
window_size);
window_size,
load_data.clone());
ScriptControlChan(script_chan)
}
Some(spipe) => {
Expand All @@ -97,6 +99,7 @@ impl Pipeline {
new_pipeline_id: id,
subpage_id: parent.expect("script_pipeline != None but subpage_id == None").1,
layout_chan: ScriptTaskFactory::clone_layout_channel(None::<&mut STF>, &layout_pair),
load_data: load_data.clone(),
};

let ScriptControlChan(ref chan) = spipe.script_chan;
Expand Down Expand Up @@ -135,7 +138,7 @@ impl Pipeline {
paint_chan,
layout_shutdown_port,
paint_shutdown_port,
load_data)
load_data.url)
}

pub fn new(id: PipelineId,
Expand All @@ -145,7 +148,7 @@ impl Pipeline {
paint_chan: PaintChan,
layout_shutdown_port: Receiver<()>,
paint_shutdown_port: Receiver<()>,
load_data: LoadData)
url: Url)
-> Pipeline {
Pipeline {
id: id,
Expand All @@ -155,16 +158,14 @@ impl Pipeline {
paint_chan: paint_chan,
layout_shutdown_port: layout_shutdown_port,
paint_shutdown_port: paint_shutdown_port,
load_data: load_data,
url: url,
title: None,
}
}

pub fn load(&self) {
pub fn activate(&self) {
let ScriptControlChan(ref chan) = self.script_chan;
chan.send(ConstellationControlMsg::Load(self.id,
self.parent,
self.load_data.clone())).unwrap();
chan.send(ConstellationControlMsg::Activate(self.id)).unwrap();
}

pub fn grant_paint_permission(&self) {
Expand Down
5 changes: 3 additions & 2 deletions components/compositing/windowing.rs
Expand Up @@ -12,7 +12,8 @@ use geom::size::TypedSize2D;
use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata;
use msg::compositor_msg::{PaintState, ReadyState};
use msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
use url::Url;
use util::cursor::Cursor;
use util::geometry::ScreenPx;
use std::fmt::{Error, Formatter, Debug};
Expand Down Expand Up @@ -105,7 +106,7 @@ pub trait WindowMethods {
/// Sets the page title for the current page.
fn set_page_title(&self, title: Option<String>);
/// Sets the load data for the current page.
fn set_page_load_data(&self, load_data: LoadData);
fn set_page_url(&self, url: Url);
/// Called when the browser is done loading a frame.
fn load_end(&self);

Expand Down
11 changes: 9 additions & 2 deletions components/gfx/display_list/mod.rs
Expand Up @@ -42,8 +42,9 @@ use util::smallvec::{SmallVec, SmallVec8};
use std::fmt;
use std::slice::Iter;
use std::sync::Arc;
use style::computed_values::{border_style, cursor, filter, image_rendering, mix_blend_mode};
use style::computed_values::{pointer_events};
use style::properties::ComputedValues;
use style::computed_values::{border_style, cursor, filter, mix_blend_mode, pointer_events};

// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
// layout to use.
Expand Down Expand Up @@ -763,6 +764,10 @@ pub struct ImageDisplayItem {
/// the bounds of this display item, then the image will be repeated in the appropriate
/// direction to tile the entire bounds.
pub stretch_size: Size2D<Au>,

/// The algorithm we should use to stretch the image. See `image_rendering` in CSS-IMAGES-3 §
/// 5.3.
pub image_rendering: image_rendering::T,
}

/// Paints a gradient.
Expand Down Expand Up @@ -937,7 +942,9 @@ impl DisplayItem {
bounds.origin.y = bounds.origin.y + y_offset;
bounds.size = image_item.stretch_size;

paint_context.draw_image(&bounds, image_item.image.clone());
paint_context.draw_image(&bounds,
image_item.image.clone(),
image_item.image_rendering.clone());

x_offset = x_offset + image_item.stretch_size.width;
}
Expand Down
19 changes: 16 additions & 3 deletions components/gfx/paint_context.rs
Expand Up @@ -37,7 +37,7 @@ use std::mem;
use std::num::Float;
use std::ptr;
use std::sync::Arc;
use style::computed_values::{border_style, filter, mix_blend_mode};
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
use util::geometry::{self, Au, MAX_RECT, ZERO_RECT};
use util::opts;
use util::range::Range;
Expand Down Expand Up @@ -127,7 +127,10 @@ impl<'a> PaintContext<'a> {
self.draw_target.pop_clip();
}

pub fn draw_image(&self, bounds: &Rect<Au>, image: Arc<Box<Image>>) {
pub fn draw_image(&self,
bounds: &Rect<Au>,
image: Arc<Box<Image>>,
image_rendering: image_rendering::T) {
let size = Size2D(image.width as i32, image.height as i32);
let (pixel_width, pixels, source_format) = match image.pixels {
PixelsByColorType::RGBA8(ref pixels) => (4, pixels.as_slice(), SurfaceFormat::B8G8R8A8),
Expand All @@ -146,7 +149,17 @@ impl<'a> PaintContext<'a> {
let source_rect = Rect(Point2D(0.0, 0.0),
Size2D(image.width as AzFloat, image.height as AzFloat));
let dest_rect = bounds.to_azure_rect();
let draw_surface_options = DrawSurfaceOptions::new(Filter::Linear, true);

// TODO(pcwalton): According to CSS-IMAGES-3 § 5.3, nearest-neighbor interpolation is a
// conforming implementation of `crisp-edges`, but it is not the best we could do.
// Something like Scale2x would be ideal.
let draw_surface_options = match image_rendering {
image_rendering::T::Auto => DrawSurfaceOptions::new(Filter::Linear, true),
image_rendering::T::CrispEdges | image_rendering::T::Pixelated => {
DrawSurfaceOptions::new(Filter::Point, true)
}
};

let draw_options = DrawOptions::new(1.0, 0);
draw_target_ref.draw_surface(azure_surface,
dest_rect,
Expand Down
15 changes: 12 additions & 3 deletions components/layout/block.rs
Expand Up @@ -52,14 +52,16 @@ use geom::{Point2D, Rect, Size2D};
use gfx::display_list::{ClippingRegion, DisplayList};
use rustc_serialize::{Encoder, Encodable};
use msg::compositor_msg::LayerId;
use msg::constellation_msg::ConstellationChan;
use servo_util::geometry::{Au, MAX_AU};
use servo_util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize};
use servo_util::opts;
use std::cmp::{max, min};
use std::fmt;
use style::computed_values::{overflow_x, overflow_y, position, box_sizing, display, float};
use style::properties::ComputedValues;
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::computed_values::{overflow, position, box_sizing, display, float};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
use style::values::computed::{LengthOrPercentageOrNone};
use std::sync::Arc;

/// Information specific to floated blocks.
Expand Down Expand Up @@ -1431,7 +1433,10 @@ impl BlockFlow {
display::T::inline_block => {
FormattingContextType::Other
}
_ if style.get_box().overflow != overflow::T::visible => FormattingContextType::Block,
_ if style.get_box().overflow_x != overflow_x::T::visible ||
style.get_box().overflow_y != overflow_y::T(overflow_x::T::visible) => {
FormattingContextType::Block
}
_ => FormattingContextType::None,
}
}
Expand Down Expand Up @@ -1915,6 +1920,10 @@ impl Flow for BlockFlow {
CoordinateSystem::Parent)
.translate(stacking_context_position));
}

fn remove_compositor_layers(&self, constellation_chan: ConstellationChan) {
self.fragment.remove_compositor_layers(constellation_chan);
}
}

impl fmt::Debug for BlockFlow {
Expand Down

0 comments on commit 19686ac

Please sign in to comment.