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

Implement Box-model Computations #507

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
09292be
Update rust-geom
pcwalton May 29, 2013
11efed6
Implement the beginnings of the box model for render boxes
pcwalton May 29, 2013
43c83d2
Add horizontal borders, margins and padding. Broken until rust-css su…
May 30, 2013
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
b6dd3f6
Refactor a bit and compute vertical margins as well.
May 30, 2013
2e4cecc
Add flows if requested to the display list info.
pcwalton May 30, 2013
25fb1e5
Add comments and compute heights properly
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
4a2171c
Update border rendering
May 31, 2013
708f9b4
Fix method names and dynamic borrow check failures
pcwalton May 31, 2013
e3290a3
Merge
May 31, 2013
d6a9bc7
Fix merge problems
May 31, 2013
ff8d33e
Fix borrow-check and repo errors.
Jun 3, 2013
3e80e97
Compute percent widths/margins properly and fix numerous small visual…
Jun 4, 2013
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Fix borrow-check and repo errors.

  • Loading branch information
Eric Atkinson
Eric Atkinson committed Jun 3, 2013
commit ff8d33e751fc434d6648d7b189688e0e349f955e
@@ -48,6 +48,15 @@ impl SelectHandler<AbstractNode<LayoutView>> for NodeSelectHandler {
node.parent_node()
}

//Stub implementations. TODO: fill out by merging PR 499
fn node_has_class(&self, node: &AbstractNode<LayoutView>, class: &str) -> bool{
false
}

fn with_node_classes<R>(&self, node: &AbstractNode<LayoutView>, f: &fn(Option<&str>) -> R) -> R{
f(Some(""))
}

// TODO: Use a Bloom filter.
fn named_ancestor_node(&self, node: &AbstractNode<LayoutView>, name: &str)
-> Option<AbstractNode<LayoutView>> {
@@ -106,8 +106,9 @@ impl BlockFlowData {
these widths will not include child elements, just padding etc. */
self.box.map(|&box| {
//Can compute border width here since it doesn't depend on anything
let style = &box.style();
do box.with_model |model| {
model.compute_borders(box.style())
model.compute_borders(*style);
}
min_width = min_width.add(&box.get_min_width(ctx));
pref_width = pref_width.add(&box.get_pref_width(ctx));
@@ -184,20 +185,21 @@ impl BlockFlowData {
let mut x_offset = Au(0);

self.box.map(|&box| {
let style = &box.style();
do box.with_model |model| {
//Can compute padding here since we know containing block width
model.compute_padding(box.style(), remaining_width);
model.compute_padding(*style, remaining_width);

//Margins are 0 right now so model.noncontent_width() is just borders + padding.
let available_width = remaining_width - model.noncontent_width();

//Top and bottom margins for blocks are 0 if auto
let margin_top = MaybeAuto::from_margin(box.style().margin_top()).spec_or_default(Au(0));
let margin_bottom = MaybeAuto::from_margin(box.style().margin_bottom()).spec_or_default(Au(0));
let margin_top = MaybeAuto::from_margin(style.margin_top()).spec_or_default(Au(0));
let margin_bottom = MaybeAuto::from_margin(style.margin_bottom()).spec_or_default(Au(0));

let (width, margin_left, margin_right) = (MaybeAuto::from_width(box.style().width()),
MaybeAuto::from_margin(box.style().margin_left()),
MaybeAuto::from_margin(box.style().margin_right()));
let (width, margin_left, margin_right) = (MaybeAuto::from_width(style.width()),
MaybeAuto::from_margin(style.margin_left()),
MaybeAuto::from_margin(style.margin_right()));

let (width, margin_left, margin_right) =
self.compute_horiz(width, margin_left, margin_right, available_width);
@@ -449,7 +449,7 @@ pub impl RenderBox {
}

fn with_model<R>(&self, callback: &fn(&mut BoxModel) -> R) -> R {
do self.with_imm_base |base| {
do self.with_mut_base |base| {
callback(&mut base.model)
}
}
@@ -126,7 +126,7 @@ impl BoxModel {
}
}

priv fn compute_padding(&self, padding: CSSPadding, cb_width: Au) -> Au{
priv fn compute_padding_length(&self, padding: CSSPadding, cb_width: Au) -> Au{
match padding {
CSSPaddingLength(Px(v)) |
CSSPaddingLength(Pt(v)) |
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.