Skip to content

Commit

Permalink
Convert layout code to use logical directions.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Jul 18, 2014
1 parent 94b630e commit 1807c29
Show file tree
Hide file tree
Showing 23 changed files with 2,427 additions and 2,268 deletions.
3 changes: 2 additions & 1 deletion src/components/embedding/core.rs
Expand Up @@ -56,13 +56,14 @@ pub extern "C" fn cef_run_message_loop() {
device_pixels_per_px: None,
time_profiler_period: None,
memory_profiler_period: None,
enable_experimental: false,
layout_threads: 1,
//layout_threads: cmp::max(rt::default_sched_threads() * 3 / 4, 1),
exit_after_load: false,
output_file: None,
headless: false,
hard_fail: false,
bubble_widths_separately: false,
bubble_inline_sizes_separately: false,
};
native::start(0, 0 as **u8, proc() {
servo::run(opts);
Expand Down
1,962 changes: 984 additions & 978 deletions src/components/layout/block.rs

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/components/layout/construct.rs
Expand Up @@ -294,7 +294,7 @@ impl<'a> FlowConstructor<'a> {

let mut inline_flow = box InlineFlow::from_fragments((*node).clone(), fragments);
let (ascent, descent) = inline_flow.compute_minimum_ascent_and_descent(self.font_context(), &**node.style());
inline_flow.minimum_height_above_baseline = ascent;
inline_flow.minimum_block_size_above_baseline = ascent;
inline_flow.minimum_depth_below_baseline = descent;
let mut inline_flow = inline_flow as Box<Flow>;
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
Expand Down Expand Up @@ -1037,10 +1037,10 @@ pub trait FlowConstructionUtils {
fn add_new_child(&mut self, new_child: FlowRef);

/// Finishes a flow. Once a flow is finished, no more child flows or boxes may be added to it.
/// This will normally run the bubble-widths (minimum and preferred -- i.e. intrinsic -- width)
/// calculation, unless the global `bubble_widths_separately` flag is on.
/// This will normally run the bubble-inline-sizes (minimum and preferred -- i.e. intrinsic -- inline-size)
/// calculation, unless the global `bubble_inline-sizes_separately` flag is on.
///
/// All flows must be finished at some point, or they will not have their intrinsic widths
/// All flows must be finished at some point, or they will not have their intrinsic inline-sizes
/// properly computed. (This is not, however, a memory safety problem.)
fn finish(&mut self, context: &mut LayoutContext);
}
Expand All @@ -1062,16 +1062,16 @@ impl FlowConstructionUtils for FlowRef {
}

/// Finishes a flow. Once a flow is finished, no more child flows or fragments may be added to
/// it. This will normally run the bubble-widths (minimum and preferred -- i.e. intrinsic --
/// width) calculation, unless the global `bubble_widths_separately` flag is on.
/// it. This will normally run the bubble-inline-sizes (minimum and preferred -- i.e. intrinsic --
/// inline-size) calculation, unless the global `bubble_inline-sizes_separately` flag is on.
///
/// All flows must be finished at some point, or they will not have their intrinsic widths
/// All flows must be finished at some point, or they will not have their intrinsic inline-sizes
/// properly computed. (This is not, however, a memory safety problem.)
///
/// This must not be public because only the layout constructor can do this.
fn finish(&mut self, context: &mut LayoutContext) {
if !context.opts.bubble_widths_separately {
self.get_mut().bubble_widths(context)
if !context.opts.bubble_inline_sizes_separately {
self.get_mut().bubble_inline_sizes(context)
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/layout/context.rs
Expand Up @@ -6,8 +6,7 @@

use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};

use geom::rect::Rect;
use geom::size::Size2D;
use geom::{Rect, Size2D};
use gfx::display_list::OpaqueNode;
use gfx::font_context::FontContext;
use gfx::font_cache_task::FontCacheTask;
Expand Down

0 comments on commit 1807c29

Please sign in to comment.