Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of changes #2 #512

Merged
merged 42 commits into from Jun 11, 2013
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c14a137
Update rust-geom
pcwalton May 29, 2013
233a204
Implement the beginnings of the box model for render boxes
pcwalton May 29, 2013
a1d1289
Add NSPR and NSS submodules
pcwalton May 29, 2013
0af3bbf
Add NSS and NSPR to the build
pcwalton May 29, 2013
2d1a00c
Don't clip layers to the screen area
pcwalton May 29, 2013
67eb533
Clamp scrolling to the page boundaries
pcwalton May 29, 2013
d97f002
Stop hammering on the compositor
pcwalton May 29, 2013
02c5772
Fix corrupted textures when resizing.
pcwalton May 30, 2013
dcfabb7
Don't try to remove whitespace twice if it's the only node.
pcwalton May 30, 2013
e2bcd36
Color links blue
pcwalton May 30, 2013
2e4cecc
Add flows if requested to the display list info.
pcwalton May 30, 2013
ea1a406
base and bounds methods for DisplayItem
May 25, 2013
f77eef5
Basic hit testing functionality
pcwalton May 31, 2013
facb707
Update rust-css and rust-netsurfcss
pcwalton May 31, 2013
d5e4793
Add horizontal borders, margins and padding. Broken until rust-css su…
May 30, 2013
708f9b4
Fix method names and dynamic borrow check failures
pcwalton May 31, 2013
0b91af3
Refactor a bit and compute vertical margins as well.
pcwalton May 31, 2013
72ca765
Update rust-css and fix some dynamic borrow check failures
pcwalton Jun 1, 2013
f1fcd4d
Add comments and compute heights properly
pcwalton Jun 1, 2013
cddf67a
Update border rendering
May 31, 2013
fb2ce2c
Rename `with_imm_base` to `with_base`.
pcwalton Jun 3, 2013
e6ff135
test_slam_layout, a new layout perf test case
pcwalton Jun 4, 2013
8d3b6ae
Stop rendering when script queries layout
pcwalton Jun 4, 2013
40a69fc
Address review comments
pcwalton Jun 4, 2013
7a435fc
Refactor document damage to distinguish it from layout/style damage.
pcwalton Jun 5, 2013
5750069
Use the scroll hack
pcwalton Jun 6, 2013
ae5b2df
Roll up block layout changes
pcwalton Jun 6, 2013
9c25474
Only warn, don't assert, if the node range length is zero.
pcwalton Jun 6, 2013
97eb567
Update the configure script to pass --enable-64bit
pcwalton Jun 6, 2013
c65d51f
Address review comments
pcwalton Jun 6, 2013
98a730c
Use full paths for submodules in the configure script
pcwalton Jun 6, 2013
bb6ae7a
Update NSS to fix build issues.
metajack Jun 11, 2013
5425154
Merge remote-tracking branch 'origin/master' into pcwalton-master
metajack Jun 11, 2013
a2c4f72
Fix spacing.
metajack Jun 11, 2013
4cf4302
Update nss.
metajack Jun 11, 2013
ea1c883
Fix warning.
metajack Jun 11, 2013
16ca6f2
Add missing field.
metajack Jun 11, 2013
a42cf9b
Fix types.
metajack Jun 11, 2013
b635079
Revert rust-css and rust-netsurfcss to working versions.
metajack Jun 11, 2013
f0692e5
Update rust-glut.
metajack Jun 11, 2013
a5e3605
Fix rust-css tests.
metajack Jun 11, 2013
cdd5de7
Disable tests for nspr and nss.
metajack Jun 11, 2013
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -88,3 +88,9 @@
[submodule "src/support/alert/rust-alert"]
path = src/support/alert/rust-alert
url = git://github.com/mozilla-servo/rust-alert.git
[submodule "src/support/nss/nss"]
path = src/support/nss/nss
url = git://github.com/mozilla-servo/nss.git
[submodule "src/support/nss/nspr"]
path = src/support/nss/nspr
url = git://github.com/mozilla-servo/nspr.git
@@ -411,6 +411,8 @@ CFG_SUBMODULES="\
support/libparserutils/libparserutils \
support/netsurfcss/libcss \
support/netsurfcss/rust-netsurfcss \
support/nss/nspr \
support/nss/nss \
support/opengles/rust-opengles \
support/sharegl/sharegl \
support/skia/skia \
@@ -501,14 +503,17 @@ do
# needed because Azure's configure wants "--enable-skia"
CONFIGURE_ARGS=""
ENV_VARS=""
if [ $i = "rust-azure" ]; then
if [ $i = "support/azure/rust-azure" ]; then
CONFIGURE_ARGS="--enable-skia"
fi
if [ $i = mozjs ]; then
if [ ! -z $CFG_ENABLE_DEBUG ]; then
CONFIGURE_ARGS="--enable-debug"
fi
if [ $i = "support/nss/nspr" ]; then
CONFIGURE_ARGS="--enable-64bit"
fi
if [ $i = "support/spidermonkey/mozjs" ]; then
if [ ! -z $CFG_ENABLE_DEBUG ]; then
CONFIGURE_ARGS="--enable-debug"
fi
fi

if [ -f ${CONFIGURE_SCRIPT} ]
then
@@ -26,8 +26,10 @@ reftest: $(S)src/test/harness/reftest/reftest.rs servo
contenttest: $(S)src/test/harness/contenttest/contenttest.rs servo
$(RUSTC) $(RFLAGS_servo) -o $@ $< -L .

DEPS_CHECK_TARGETS_ALL = $(addprefix check-,$(DEPS_CHECK_ALL))
DEPS_CHECK_TARGETS_FAST = $(addprefix check-,$(filter-out $(SLOW_TESTS),$(DEPS_CHECK_ALL)))

DEPS_CHECK_TESTABLE = $(filter-out $(NO_TESTS),$(DEPS_CHECK_ALL))
DEPS_CHECK_TARGETS_ALL = $(addprefix check-,$(DEPS_CHECK_TESTABLE))
DEPS_CHECK_TARGETS_FAST = $(addprefix check-,$(filter-out $(SLOW_TESTS),$(DEPS_CHECK_TESTABLE)))

.PHONY: check $(DEPS_CHECK_TARGETS_ALL)

@@ -3,6 +3,12 @@ SLOW_TESTS += \
mozjs \
$(NULL)

# Tests for these submodules do not exist.
NO_TESTS += \
nspr \
nss \
$(NULL)

# These submodules will not be cleaned by the `make clean-fast` target.
SLOW_BUILDS += \
libcss \
@@ -21,6 +27,8 @@ NATIVE_BUILDS += \
libwapcaplet \
mozjs \
skia \
nss \
nspr \
$(NULL)

# NOTE: the make magic can only compute transitive build dependencies,
@@ -40,6 +48,7 @@ DEPS_rust-glut += \

DEPS_rust-layers += \
rust-azure \
rust-cocoa \
rust-geom \
rust-glut \
rust-opengles \
@@ -128,6 +137,10 @@ DEPS_rust-layers += \
rust-core-text \
$(NULL)

DEPS_rust-glut += \
rust-cocoa \
$(NULL)

endif

ifeq ($(CFG_OSTYPE),unknown-linux-gnu)
@@ -4,6 +4,7 @@

use azure::azure_hl::{DrawTarget};
use geom::rect::Rect;
use geom::size::Size2D;

pub struct LayerBuffer {
draw_target: DrawTarget,
@@ -24,6 +25,6 @@ pub struct LayerBufferSet {
/// The interface used to by the renderer to acquire draw targets for each rendered frame and
/// submit them to be drawn to the display.
pub trait Compositor {
fn paint(&self, layer_buffer_set: LayerBufferSet);
fn paint(&self, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>);
}

@@ -19,27 +19,28 @@ use geometry::Au;
use render_context::RenderContext;
use text::SendableTextRun;

use core::cast::transmute_region;
use geom::{Point2D, Rect, Size2D};
use servo_net::image::base::Image;
use servo_util::range::Range;
use std::arc::ARC;
use std::arc;

/// A list of rendering operations to be performed.
pub struct DisplayList {
priv list: ~[DisplayItem]
pub struct DisplayList<E> {
list: ~[DisplayItem<E>]
}

impl DisplayList {
impl<E> DisplayList<E> {
/// Creates a new display list.
pub fn new() -> DisplayList {
pub fn new() -> DisplayList<E> {
DisplayList {
list: ~[]
}
}

/// Appends the given item to the display list.
pub fn append_item(&mut self, item: DisplayItem) {
pub fn append_item(&mut self, item: DisplayItem<E>) {
// FIXME(Issue #150): crashes
//debug!("Adding display item %u: %?", self.len(), item);
self.list.push(item)
@@ -58,51 +59,54 @@ impl DisplayList {
}

/// One drawing command in the list.
pub enum DisplayItem {
SolidColorDisplayItemClass(~SolidColorDisplayItem),
TextDisplayItemClass(~TextDisplayItem),
ImageDisplayItemClass(~ImageDisplayItem),
BorderDisplayItemClass(~BorderDisplayItem),
pub enum DisplayItem<E> {
SolidColorDisplayItemClass(~SolidColorDisplayItem<E>),
TextDisplayItemClass(~TextDisplayItem<E>),
ImageDisplayItemClass(~ImageDisplayItem<E>),
BorderDisplayItemClass(~BorderDisplayItem<E>),
}

/// Information common to all display items.
pub struct BaseDisplayItem {
pub struct BaseDisplayItem<E> {
/// The boundaries of the display item.
///
/// TODO: Which coordinate system should this use?
bounds: Rect<Au>,

/// Extra data: either the originating flow (for hit testing) or nothing (for rendering).
extra: E,
}

/// Renders a solid color.
pub struct SolidColorDisplayItem {
base: BaseDisplayItem,
pub struct SolidColorDisplayItem<E> {
base: BaseDisplayItem<E>,
color: Color,
}

/// Renders text.
pub struct TextDisplayItem {
base: BaseDisplayItem,
pub struct TextDisplayItem<E> {
base: BaseDisplayItem<E>,
text_run: ~SendableTextRun,
range: Range,
color: Color,
}

/// Renders an image.
pub struct ImageDisplayItem {
base: BaseDisplayItem,
pub struct ImageDisplayItem<E> {
base: BaseDisplayItem<E>,
image: ARC<~Image>,
}

/// Renders a border.
pub struct BorderDisplayItem {
base: BaseDisplayItem,
pub struct BorderDisplayItem<E> {
base: BaseDisplayItem<E>,
/// The width of the border.
width: Au,
/// The color of the border.
color: Color,
}

impl DisplayItem {
impl<E> DisplayItem<E> {
/// Renders this display item into the given render context.
fn draw_into_context(&self, render_context: &RenderContext) {
match *self {
@@ -148,5 +152,21 @@ impl DisplayItem {
}
}
}

fn base<'a>(&'a self) -> &'a BaseDisplayItem<E> {
// FIXME(tkuehn): Workaround for Rust region bug.
unsafe {
match *self {
SolidColorDisplayItemClass(ref solid_color) => transmute_region(&solid_color.base),
TextDisplayItemClass(ref text) => transmute_region(&text.base),
ImageDisplayItemClass(ref image_item) => transmute_region(&image_item.base),
BorderDisplayItemClass(ref border) => transmute_region(&border.base)
}
}
}

fn bounds(&self) -> Rect<Au> {
self.base().bounds
}
}

@@ -6,7 +6,7 @@ use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;

use core::num::NumCast;
use core::num::{NumCast, One, Zero};

pub struct Au(i32);

@@ -46,6 +46,17 @@ impl cmp::Eq for Au {
fn ne(&self, other: &Au) -> bool { **self != **other }
}

impl One for Au {
fn one() -> Au { Au(1) }
}

impl Zero for Au {
fn zero() -> Au { Au(0) }
fn is_zero(&self) -> bool { **self == 0 }
}

impl Num for Au {}

pub fn min(x: Au, y: Au) -> Au { if x < y { x } else { y } }
pub fn max(x: Au, y: Au) -> Au { if x > y { x } else { y } }

@@ -14,8 +14,12 @@ use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;

/// The type representing the lack of extra display list data. This is used when sending display
/// list data off to be rendered.
pub type Nothing = ();

pub struct RenderLayer {
display_list: DisplayList,
display_list: DisplayList<Nothing>,
size: Size2D<uint>
}

@@ -50,8 +54,6 @@ pub fn render_layers(layer_ref: *RenderLayer,
let width = right - x;
let height = bottom - y;

let tile_rect = Rect(Point2D(x, y), Size2D(width, height));

// Round the width up the nearest 32 pixels for DMA on the Mac.
let aligned_width = if width % 32 == 0 {
width
@@ -63,6 +65,8 @@ pub fn render_layers(layer_ref: *RenderLayer,

debug!("tile aligned_width %u", aligned_width);

let tile_rect = Rect(Point2D(x, y), Size2D(aligned_width, height));

let buffer;
// FIXME: Try harder to search for a matching tile.
// FIXME: Don't use shift; it's bad for perf. Maybe reverse and pop.
@@ -75,7 +79,7 @@ pub fn render_layers(layer_ref: *RenderLayer,

let size = Size2D(aligned_width as i32, height as i32);
// FIXME: This may not be always true.
let stride = size.width * 4;
let stride = (aligned_width as i32) * 4;

let mut data: ~[u8] = ~[0];
let offset;
@@ -162,7 +162,7 @@ impl<C: Compositor + Owned> Renderer<C> {
};

debug!("renderer: returning surface");
self.compositor.paint(layer_buffer_set);
self.compositor.paint(layer_buffer_set, render_layer.size);
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.