mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a
This commit is contained in:
parent
26045d7fcb
commit
d1b433a3b3
160 changed files with 1427 additions and 1162 deletions
|
@ -25,7 +25,7 @@
|
|||
//!
|
||||
//! http://dev.w3.org/csswg/css-sizing/
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use construct::FlowConstructor;
|
||||
use context::LayoutContext;
|
||||
|
@ -37,7 +37,7 @@ use flow::{MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal, mut_
|
|||
use flow;
|
||||
use fragment::{Fragment, ImageFragment, InlineBlockFragment, FragmentBoundsIterator};
|
||||
use fragment::ScannedTextFragment;
|
||||
use incremental::{Reflow, ReflowOutOfFlow};
|
||||
use incremental::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use layout_debug;
|
||||
use model::{Auto, IntrinsicISizes, MarginCollapseInfo, MarginsCollapse, MarginsCollapseThrough};
|
||||
use model::{MaybeAuto, NoCollapsibleMargins, Specified, specified, specified_or_none};
|
||||
|
@ -394,7 +394,7 @@ impl Iterator<MaybeAuto> for CandidateBSizeIterator {
|
|||
Some(Specified(self.min_block_size))
|
||||
}
|
||||
FoundCandidateBSizeStatus => None,
|
||||
InitialCandidateBSizeStatus => fail!(),
|
||||
InitialCandidateBSizeStatus => panic!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
|
|||
}
|
||||
|
||||
assert!(block_flow.base.flags.is_absolutely_positioned());
|
||||
if !block_flow.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
|
||||
if !block_flow.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ pub struct BlockFlow {
|
|||
bitflags! {
|
||||
flags BlockFlowFlags: u8 {
|
||||
#[doc="If this is set, then this block flow is the root flow."]
|
||||
static IsRoot = 0x01,
|
||||
const IS_ROOT = 0x01,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
let (block_start_margin_value, block_end_margin_value) = match self.base.collapsible_margins {
|
||||
MarginsCollapseThrough(_) => fail!("Margins unexpectedly collapsed through root flow."),
|
||||
MarginsCollapseThrough(_) => panic!("Margins unexpectedly collapsed through root flow."),
|
||||
MarginsCollapse(block_start_margin, block_end_margin) => {
|
||||
(block_start_margin.collapse(), block_end_margin.collapse())
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ impl BlockFlow {
|
|||
margins_may_collapse: MarginsMayCollapseFlag) {
|
||||
let _scope = layout_debug_scope!("assign_block_size_block_base {:x}", self.base.debug_id());
|
||||
|
||||
if self.base.restyle_damage.contains(Reflow) {
|
||||
if self.base.restyle_damage.contains(REFLOW) {
|
||||
// Our current border-box position.
|
||||
let mut cur_b = Au(0);
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ impl BlockFlow {
|
|||
// size has not yet been computed. (See `assign_inline_position_for_formatting_context()`.)
|
||||
if !self.base.flags.is_absolutely_positioned() &&
|
||||
self.formatting_context_type() == NonformattingContext {
|
||||
self.base.restyle_damage.remove(ReflowOutOfFlow | Reflow);
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1213,7 @@ impl BlockFlow {
|
|||
self.fragment.border_box.size.block = block_size;
|
||||
self.base.position.size.block = block_size;
|
||||
|
||||
self.base.restyle_damage.remove(ReflowOutOfFlow | Reflow);
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
}
|
||||
|
||||
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
|
||||
|
@ -1405,7 +1405,7 @@ impl BlockFlow {
|
|||
fn assign_inline_position_for_formatting_context(&mut self) {
|
||||
debug_assert!(self.formatting_context_type() != NonformattingContext);
|
||||
|
||||
if !self.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
|
||||
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ impl Flow for BlockFlow {
|
|||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id());
|
||||
|
||||
if !self.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
|
||||
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1619,7 +1619,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
if self.base.flags.impacted_by_floats() {
|
||||
if self.base.restyle_damage.intersects(ReflowOutOfFlow | Reflow) {
|
||||
if self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
self.assign_block_size(layout_context);
|
||||
// Don't remove the restyle damage; `assign_block_size` decides whether that is
|
||||
// appropriate (which in the case of e.g. absolutely-positioned flows, it is not).
|
||||
|
@ -1731,7 +1731,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
fn mark_as_root(&mut self) {
|
||||
self.flags.insert(IsRoot)
|
||||
self.flags.insert(IS_ROOT)
|
||||
}
|
||||
|
||||
/// Return true if store overflow is delayed for this flow.
|
||||
|
@ -1742,7 +1742,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
fn is_root(&self) -> bool {
|
||||
self.flags.contains(IsRoot)
|
||||
self.flags.contains(IS_ROOT)
|
||||
}
|
||||
|
||||
fn is_float(&self) -> bool {
|
||||
|
@ -2325,7 +2325,7 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced {
|
|||
|
||||
let inline_size = match computed_inline_size {
|
||||
Specified(w) => w,
|
||||
_ => fail!("{} {}",
|
||||
_ => panic!("{} {}",
|
||||
"The used value for inline_size for absolute replaced flow",
|
||||
"should have already been calculated by now.")
|
||||
};
|
||||
|
@ -2436,7 +2436,7 @@ impl ISizeAndMarginsComputer for BlockReplaced {
|
|||
-> ISizeConstraintSolution {
|
||||
match input.computed_inline_size {
|
||||
Specified(_) => {},
|
||||
Auto => fail!("BlockReplaced: inline_size should have been computed by now")
|
||||
Auto => panic!("BlockReplaced: inline_size should have been computed by now")
|
||||
};
|
||||
self.solve_block_inline_size_constraints(block, input)
|
||||
}
|
||||
|
@ -2491,7 +2491,7 @@ impl ISizeAndMarginsComputer for FloatReplaced {
|
|||
let margin_inline_end = inline_end_margin.specified_or_zero();
|
||||
let inline_size = match computed_inline_size {
|
||||
Specified(w) => w,
|
||||
Auto => fail!("FloatReplaced: inline_size should have been computed by now")
|
||||
Auto => panic!("FloatReplaced: inline_size should have been computed by now")
|
||||
};
|
||||
debug!("assign_inline_sizes_float -- inline_size: {}", inline_size);
|
||||
ISizeConstraintSolution::new(inline_size, margin_inline_start, margin_inline_end)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//! maybe it's an absolute or fixed position thing that hasn't found its containing block yet.
|
||||
//! Construction items bubble up the tree from children to parents until they find their homes.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use css::node_style::StyledNode;
|
||||
use block::BlockFlow;
|
||||
|
@ -27,7 +27,7 @@ use fragment::{InlineAbsoluteHypotheticalFragmentInfo, InlineBlockFragment};
|
|||
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, TableCellFragment};
|
||||
use fragment::{TableColumnFragment, TableColumnFragmentInfo, TableFragment, TableRowFragment};
|
||||
use fragment::{TableWrapperFragment, UnscannedTextFragment, UnscannedTextFragmentInfo};
|
||||
use incremental::{ReconstructFlow, RestyleDamage};
|
||||
use incremental::{RECONSTRUCT_FLOW, RestyleDamage};
|
||||
use inline::InlineFlow;
|
||||
use parallel;
|
||||
use table_wrapper::TableWrapperFlow;
|
||||
|
@ -38,7 +38,7 @@ use table_rowgroup::TableRowGroupFlow;
|
|||
use table_row::TableRowFlow;
|
||||
use table_cell::TableCellFlow;
|
||||
use text::TextRunScanner;
|
||||
use util::{HasNewlyConstructedFlow, LayoutDataAccess, OpaqueNodeMethods, LayoutDataWrapper};
|
||||
use util::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataAccess, OpaqueNodeMethods, LayoutDataWrapper};
|
||||
use wrapper::{PostorderNodeMutTraversal, TLayoutNode, ThreadSafeLayoutNode};
|
||||
use wrapper::{Before, After, Normal};
|
||||
|
||||
|
@ -53,9 +53,9 @@ use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, ProcessingInstruc
|
|||
use script::dom::node::{TextNodeTypeId};
|
||||
use script::dom::htmlobjectelement::is_image_data;
|
||||
use servo_util::opts;
|
||||
use std::collections::{DList, Deque};
|
||||
use std::collections::DList;
|
||||
use std::mem;
|
||||
use std::sync::atomics::Relaxed;
|
||||
use std::sync::atomic::Relaxed;
|
||||
use style::ComputedValues;
|
||||
use style::computed_values::{display, position, float};
|
||||
use sync::Arc;
|
||||
|
@ -193,7 +193,7 @@ impl InlineFragmentsAccumulator {
|
|||
|
||||
fn to_dlist(self) -> DList<Fragment> {
|
||||
let InlineFragmentsAccumulator {
|
||||
fragments: mut fragments,
|
||||
mut fragments,
|
||||
enclosing_style
|
||||
} = self;
|
||||
|
||||
|
@ -403,7 +403,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
}
|
||||
ConstructionItemConstructionResult(InlineFragmentsConstructionItem(
|
||||
InlineFragmentsConstructionResult {
|
||||
splits: splits,
|
||||
splits,
|
||||
fragments: successor_fragments,
|
||||
abs_descendants: kid_abs_descendants,
|
||||
})) => {
|
||||
|
@ -412,7 +412,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
// Pull apart the {ib} split object and push its predecessor fragments
|
||||
// onto the list.
|
||||
let InlineBlockSplit {
|
||||
predecessors: predecessors,
|
||||
predecessors,
|
||||
flow: kid_flow
|
||||
} = split;
|
||||
inline_fragment_accumulator.push_all(predecessors);
|
||||
|
@ -461,7 +461,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
whitespace_style,
|
||||
whitespace_damage,
|
||||
fragment_info);
|
||||
inline_fragment_accumulator.fragments.push(fragment);
|
||||
inline_fragment_accumulator.fragments.push_back(fragment);
|
||||
}
|
||||
ConstructionItemConstructionResult(TableColumnFragmentConstructionItem(_)) => {
|
||||
// TODO: Implement anonymous table objects for missing parents
|
||||
|
@ -490,7 +490,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
node.type_id() == Some(ElementNodeTypeId(HTMLInputElementTypeId)) {
|
||||
let fragment_info = UnscannedTextFragment(UnscannedTextFragmentInfo::new(node));
|
||||
let fragment = Fragment::new_from_specific_info(node, fragment_info);
|
||||
inline_fragment_accumulator.fragments.push(fragment);
|
||||
inline_fragment_accumulator.fragments.push_back(fragment);
|
||||
first_fragment = false;
|
||||
}
|
||||
|
||||
|
@ -586,12 +586,12 @@ impl<'a> FlowConstructor<'a> {
|
|||
InlineFragmentsAccumulator::from_inline_node(node)).to_dlist(),
|
||||
flow: flow,
|
||||
};
|
||||
opt_inline_block_splits.push(split);
|
||||
opt_inline_block_splits.push_back(split);
|
||||
abs_descendants.push_descendants(kid_abs_descendants);
|
||||
}
|
||||
ConstructionItemConstructionResult(InlineFragmentsConstructionItem(
|
||||
InlineFragmentsConstructionResult {
|
||||
splits: splits,
|
||||
splits,
|
||||
fragments: successors,
|
||||
abs_descendants: kid_abs_descendants,
|
||||
})) => {
|
||||
|
@ -599,7 +599,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
// Bubble up {ib} splits.
|
||||
for split in splits.into_iter() {
|
||||
let InlineBlockSplit {
|
||||
predecessors: predecessors,
|
||||
predecessors,
|
||||
flow: kid_flow
|
||||
} = split;
|
||||
fragment_accumulator.push_all(predecessors);
|
||||
|
@ -611,7 +611,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
.to_dlist(),
|
||||
flow: kid_flow,
|
||||
};
|
||||
opt_inline_block_splits.push(split)
|
||||
opt_inline_block_splits.push_back(split)
|
||||
}
|
||||
|
||||
// Push residual fragments.
|
||||
|
@ -629,7 +629,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
whitespace_style,
|
||||
whitespace_damage,
|
||||
fragment_info);
|
||||
fragment_accumulator.fragments.push(fragment)
|
||||
fragment_accumulator.fragments.push_back(fragment)
|
||||
}
|
||||
ConstructionItemConstructionResult(TableColumnFragmentConstructionItem(_)) => {
|
||||
// TODO: Implement anonymous table objects for missing parents
|
||||
|
@ -684,7 +684,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
};
|
||||
|
||||
let mut fragments = DList::new();
|
||||
fragments.push(fragment);
|
||||
fragments.push_back(fragment);
|
||||
|
||||
let construction_item = InlineFragmentsConstructionItem(InlineFragmentsConstructionResult {
|
||||
splits: DList::new(),
|
||||
|
@ -706,7 +706,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
let fragment = Fragment::new_from_specific_info(node, fragment_info);
|
||||
|
||||
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
|
||||
fragment_accumulator.fragments.push(fragment);
|
||||
fragment_accumulator.fragments.push_back(fragment);
|
||||
|
||||
let construction_item = InlineFragmentsConstructionItem(InlineFragmentsConstructionResult {
|
||||
splits: DList::new(),
|
||||
|
@ -731,7 +731,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
let fragment = Fragment::new_from_specific_info(node, fragment_info);
|
||||
|
||||
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node);
|
||||
fragment_accumulator.fragments.push(fragment);
|
||||
fragment_accumulator.fragments.push_back(fragment);
|
||||
|
||||
let construction_item = InlineFragmentsConstructionItem(InlineFragmentsConstructionResult {
|
||||
splits: DList::new(),
|
||||
|
@ -949,14 +949,14 @@ impl<'a> FlowConstructor<'a> {
|
|||
pub fn repair_if_possible(&mut self, node: &ThreadSafeLayoutNode) -> bool {
|
||||
// We can skip reconstructing the flow if we don't have to reconstruct and none of our kids
|
||||
// did either.
|
||||
if node.restyle_damage().contains(ReconstructFlow) {
|
||||
if node.restyle_damage().contains(RECONSTRUCT_FLOW) {
|
||||
return false
|
||||
}
|
||||
|
||||
let mut need_to_reconstruct = false;
|
||||
for kid in node.children() {
|
||||
if kid.flags().contains(HasNewlyConstructedFlow) {
|
||||
kid.remove_flags(HasNewlyConstructedFlow);
|
||||
if kid.flags().contains(HAS_NEWLY_CONSTRUCTED_FLOW) {
|
||||
kid.remove_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
need_to_reconstruct = true
|
||||
}
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
|
|||
}
|
||||
};
|
||||
|
||||
debug!("building flow for node: {:?} {:?}", display, float);
|
||||
debug!("building flow for node: {} {}", display, float);
|
||||
|
||||
// Switch on display and floatedness.
|
||||
match (display, float, positioning) {
|
||||
|
@ -1124,7 +1124,7 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
node.insert_flags(HasNewlyConstructedFlow);
|
||||
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -1285,7 +1285,7 @@ pub fn strip_ignorable_whitespace_from_end(this: &mut DList<Fragment>) {
|
|||
|
||||
while !this.is_empty() && this.back().as_ref().unwrap().is_ignorable_whitespace() {
|
||||
debug!("stripping ignorable whitespace from end");
|
||||
drop(this.pop());
|
||||
drop(this.pop_back());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -602,7 +602,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
|
|||
|
||||
let mut layout_data_ref = self.mutate_layout_data();
|
||||
match &mut *layout_data_ref {
|
||||
&None => fail!("no layout data"),
|
||||
&None => panic!("no layout data"),
|
||||
&Some(ref mut layout_data) => {
|
||||
match self.type_id() {
|
||||
Some(TextNodeTypeId) => {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
|
||||
//! paint.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
|
@ -578,8 +578,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
// Create special per-fragment-type display items.
|
||||
match self.specific {
|
||||
UnscannedTextFragment(_) => fail!("Shouldn't see unscanned fragments here."),
|
||||
TableColumnFragment(_) => fail!("Shouldn't see table column fragments here."),
|
||||
UnscannedTextFragment(_) => panic!("Shouldn't see unscanned fragments here."),
|
||||
TableColumnFragment(_) => panic!("Shouldn't see table column fragments here."),
|
||||
ScannedTextFragment(ref text_fragment) => {
|
||||
// Create the text display item.
|
||||
let orientation = if self.style.writing_mode.is_vertical() {
|
||||
|
@ -733,7 +733,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
Size2D(geometry::to_frac_px(content_size.width) as f32,
|
||||
geometry::to_frac_px(content_size.height) as f32));
|
||||
|
||||
debug!("finalizing position and size of iframe for {:?},{:?}",
|
||||
debug!("finalizing position and size of iframe for {},{}",
|
||||
iframe_fragment.pipeline_id,
|
||||
iframe_fragment.subpage_id);
|
||||
let ConstellationChan(ref chan) = layout_context.shared.constellation_chan;
|
||||
|
@ -841,7 +841,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
background_color: color::rgba(1.0, 1.0, 1.0, 0.0),
|
||||
scroll_policy: scroll_policy,
|
||||
};
|
||||
self.base.layers.push(new_layer)
|
||||
self.base.layers.push_back(new_layer)
|
||||
}
|
||||
|
||||
fn build_display_list_for_floating_block(&mut self, layout_context: &LayoutContext) {
|
||||
|
|
|
@ -21,7 +21,7 @@ pub enum FloatKind {
|
|||
impl FloatKind {
|
||||
pub fn from_property(property: float::T) -> FloatKind {
|
||||
match property {
|
||||
float::none => fail!("can't create a float type from an unfloated property"),
|
||||
float::none => panic!("can't create a float type from an unfloated property"),
|
||||
float::left => FloatLeft,
|
||||
float::right => FloatRight,
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ struct Float {
|
|||
|
||||
impl fmt::Show for Float {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "bounds={} kind={:?}", self.bounds, self.kind)
|
||||
write!(f, "bounds={} kind={}", self.bounds, self.kind)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ pub struct PlacementInfo {
|
|||
impl fmt::Show for PlacementInfo {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f,
|
||||
"size={} ceiling={} max_inline_size={} kind={:?}",
|
||||
"size={} ceiling={} max_inline_size={} kind={}",
|
||||
self.size,
|
||||
self.ceiling,
|
||||
self.max_inline_size,
|
||||
|
@ -232,7 +232,7 @@ impl Floats {
|
|||
(max(block_start, r_block_start), r_block_end)
|
||||
}
|
||||
(None, None, None, None) => return None,
|
||||
_ => fail!("Reached unreachable state when computing float area")
|
||||
_ => panic!("Reached unreachable state when computing float area")
|
||||
};
|
||||
|
||||
// FIXME(eatkinson): This assertion is too strong and fails in some cases. It is OK to
|
||||
|
@ -261,7 +261,7 @@ impl Floats {
|
|||
}
|
||||
}
|
||||
|
||||
debug!("add_float: added float with info {:?}", new_info);
|
||||
debug!("add_float: added float with info {}", new_info);
|
||||
|
||||
let new_float = Float {
|
||||
bounds: LogicalRect::from_point_size(
|
||||
|
@ -332,7 +332,7 @@ impl Floats {
|
|||
let maybe_location = self.available_rect(float_b,
|
||||
info.size.block,
|
||||
info.max_inline_size);
|
||||
debug!("place_float: Got available rect: {:?} for y-pos: {}", maybe_location, float_b);
|
||||
debug!("place_float: Got available rect: {} for y-pos: {}", maybe_location, float_b);
|
||||
match maybe_location {
|
||||
// If there are no floats blocking us, return the current location
|
||||
// TODO(eatkinson): integrate with overflow
|
||||
|
|
|
@ -32,7 +32,7 @@ use floats::Floats;
|
|||
use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{Fragment, FragmentBoundsIterator, TableRowFragment, TableCellFragment};
|
||||
use incremental::{ReconstructFlow, Reflow, ReflowOutOfFlow, RestyleDamage};
|
||||
use incremental::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage};
|
||||
use inline::InlineFlow;
|
||||
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
|
||||
use parallel::FlowParallelInfo;
|
||||
|
@ -59,7 +59,7 @@ use std::num::Zero;
|
|||
use std::fmt;
|
||||
use std::iter::Zip;
|
||||
use std::raw;
|
||||
use std::sync::atomics::{AtomicUint, SeqCst};
|
||||
use std::sync::atomic::{AtomicUint, SeqCst};
|
||||
use std::slice::MutItems;
|
||||
use style::computed_values::{clear, float, position, text_align};
|
||||
use style::ComputedValues;
|
||||
|
@ -80,94 +80,94 @@ pub trait Flow: fmt::Show + ToString + Sync {
|
|||
/// If this is a block flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
fail!("called as_immutable_block() on a non-block flow")
|
||||
panic!("called as_immutable_block() on a non-block flow")
|
||||
}
|
||||
|
||||
/// If this is a block flow, returns the underlying object. Fails otherwise.
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
debug!("called as_block() on a flow of type {}", self.class());
|
||||
fail!("called as_block() on a non-block flow")
|
||||
panic!("called as_block() on a non-block flow")
|
||||
}
|
||||
|
||||
/// If this is an inline flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_inline<'a>(&'a self) -> &'a InlineFlow {
|
||||
fail!("called as_immutable_inline() on a non-inline flow")
|
||||
panic!("called as_immutable_inline() on a non-inline flow")
|
||||
}
|
||||
|
||||
/// If this is an inline flow, returns the underlying object. Fails otherwise.
|
||||
fn as_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
||||
fail!("called as_inline() on a non-inline flow")
|
||||
panic!("called as_inline() on a non-inline flow")
|
||||
}
|
||||
|
||||
/// If this is a table wrapper flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
||||
fail!("called as_table_wrapper() on a non-tablewrapper flow")
|
||||
panic!("called as_table_wrapper() on a non-tablewrapper flow")
|
||||
}
|
||||
|
||||
/// If this is a table wrapper flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
||||
fail!("called as_immutable_table_wrapper() on a non-tablewrapper flow")
|
||||
panic!("called as_immutable_table_wrapper() on a non-tablewrapper flow")
|
||||
}
|
||||
|
||||
/// If this is a table flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
||||
fail!("called as_table() on a non-table flow")
|
||||
panic!("called as_table() on a non-table flow")
|
||||
}
|
||||
|
||||
/// If this is a table flow, returns the underlying object, borrowed immutably. Fails otherwise.
|
||||
fn as_immutable_table<'a>(&'a self) -> &'a TableFlow {
|
||||
fail!("called as_table() on a non-table flow")
|
||||
panic!("called as_table() on a non-table flow")
|
||||
}
|
||||
|
||||
/// If this is a table colgroup flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
||||
fail!("called as_table_colgroup() on a non-tablecolgroup flow")
|
||||
panic!("called as_table_colgroup() on a non-tablecolgroup flow")
|
||||
}
|
||||
|
||||
/// If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
||||
fail!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||
panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||
}
|
||||
|
||||
/// If this is a table rowgroup flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
||||
fail!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||
panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||
}
|
||||
|
||||
/// If this is a table row flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
||||
fail!("called as_table_row() on a non-tablerow flow")
|
||||
panic!("called as_table_row() on a non-tablerow flow")
|
||||
}
|
||||
|
||||
/// If this is a table row flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
||||
fail!("called as_table_row() on a non-tablerow flow")
|
||||
panic!("called as_table_row() on a non-tablerow flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
||||
fail!("called as_table_caption() on a non-tablecaption flow")
|
||||
panic!("called as_table_caption() on a non-tablecaption flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
||||
fail!("called as_table_cell() on a non-tablecell flow")
|
||||
panic!("called as_table_cell() on a non-tablecell flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
||||
fail!("called as_table_cell() on a non-tablecell flow")
|
||||
panic!("called as_table_cell() on a non-tablecell flow")
|
||||
}
|
||||
|
||||
/// If this is a table row or table rowgroup or table flow, returns column inline-sizes.
|
||||
/// Fails otherwise.
|
||||
fn column_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnInlineSize> {
|
||||
fail!("called column_inline_sizes() on non-table flow")
|
||||
panic!("called column_inline_sizes() on non-table flow")
|
||||
}
|
||||
|
||||
// Main methods
|
||||
|
@ -179,17 +179,17 @@ pub trait Flow: fmt::Show + ToString + Sync {
|
|||
/// This function must decide minimum/preferred inline-sizes based on its children's inline-
|
||||
/// sizes and the dimensions of any boxes it is responsible for flowing.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
fail!("bubble_inline_sizes not yet implemented")
|
||||
panic!("bubble_inline_sizes not yet implemented")
|
||||
}
|
||||
|
||||
/// Pass 2 of reflow: computes inline-size.
|
||||
fn assign_inline_sizes(&mut self, _ctx: &LayoutContext) {
|
||||
fail!("assign_inline_sizes not yet implemented")
|
||||
panic!("assign_inline_sizes not yet implemented")
|
||||
}
|
||||
|
||||
/// Pass 3a of reflow: computes block-size.
|
||||
fn assign_block_size<'a>(&mut self, _ctx: &'a LayoutContext<'a>) {
|
||||
fail!("assign_block_size not yet implemented")
|
||||
panic!("assign_block_size not yet implemented")
|
||||
}
|
||||
|
||||
/// Assigns block-sizes in-order; or, if this is a float, places the float. The default
|
||||
|
@ -201,7 +201,7 @@ pub trait Flow: fmt::Show + ToString + Sync {
|
|||
let impacted = base(&*self).flags.impacted_by_floats();
|
||||
if impacted {
|
||||
self.assign_block_size(layout_context);
|
||||
mut_base(&mut *self).restyle_damage.remove(ReflowOutOfFlow | Reflow);
|
||||
mut_base(&mut *self).restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
}
|
||||
impacted
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ pub trait Flow: fmt::Show + ToString + Sync {
|
|||
/// Return the dimensions of the containing block generated by this flow for absolutely-
|
||||
/// positioned descendants. For block flows, this is the padding box.
|
||||
fn generated_containing_block_rect(&self) -> LogicalRect<Au> {
|
||||
fail!("generated_containing_block_position not yet implemented for this flow")
|
||||
panic!("generated_containing_block_position not yet implemented for this flow")
|
||||
}
|
||||
|
||||
/// Returns a layer ID for the given fragment.
|
||||
|
@ -301,26 +301,6 @@ pub trait Flow: fmt::Show + ToString + Sync {
|
|||
fn repair_style(&mut self, new_style: &Arc<ComputedValues>);
|
||||
}
|
||||
|
||||
impl<'a, E, S: Encoder<E>> Encodable<S, E> for &'a Flow + 'a {
|
||||
fn encode(&self, e: &mut S) -> Result<(), E> {
|
||||
e.emit_struct("flow", 0, |e| {
|
||||
try!(e.emit_struct_field("class", 0, |e| self.class().encode(e)))
|
||||
e.emit_struct_field("data", 1, |e| {
|
||||
match self.class() {
|
||||
BlockFlowClass => self.as_immutable_block().encode(e),
|
||||
InlineFlowClass => self.as_immutable_inline().encode(e),
|
||||
TableFlowClass => self.as_immutable_table().encode(e),
|
||||
TableWrapperFlowClass => self.as_immutable_table_wrapper().encode(e),
|
||||
TableRowGroupFlowClass => self.as_immutable_table_rowgroup().encode(e),
|
||||
TableRowFlowClass => self.as_immutable_table_row().encode(e),
|
||||
TableCellFlowClass => self.as_immutable_table_cell().encode(e),
|
||||
_ => { Ok(()) } // TODO: Support captions
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Base access
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -832,7 +812,24 @@ impl<E, S: Encoder<E>> Encodable<S, E> for BaseFlow {
|
|||
e.emit_struct_field("children", 4, |e| {
|
||||
e.emit_seq(self.children.len(), |e| {
|
||||
for (i, c) in self.children.iter().enumerate() {
|
||||
try!(e.emit_seq_elt(i, |e| c.encode(e)))
|
||||
try!(e.emit_seq_elt(i, |e| {
|
||||
try!(e.emit_struct("flow", 0, |e| {
|
||||
try!(e.emit_struct_field("class", 0, |e| c.class().encode(e)))
|
||||
e.emit_struct_field("data", 1, |e| {
|
||||
match c.class() {
|
||||
BlockFlowClass => c.as_immutable_block().encode(e),
|
||||
InlineFlowClass => c.as_immutable_inline().encode(e),
|
||||
TableFlowClass => c.as_immutable_table().encode(e),
|
||||
TableWrapperFlowClass => c.as_immutable_table_wrapper().encode(e),
|
||||
TableRowGroupFlowClass => c.as_immutable_table_rowgroup().encode(e),
|
||||
TableRowFlowClass => c.as_immutable_table_row().encode(e),
|
||||
TableCellFlowClass => c.as_immutable_table_cell().encode(e),
|
||||
_ => { Ok(()) } // TODO: Support captions
|
||||
}
|
||||
})
|
||||
}))
|
||||
Ok(())
|
||||
}))
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
|
@ -846,7 +843,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for BaseFlow {
|
|||
impl Drop for BaseFlow {
|
||||
fn drop(&mut self) {
|
||||
if self.ref_count.load(SeqCst) != 0 {
|
||||
fail!("Flow destroyed before its ref count hit zero—this is unsafe!")
|
||||
panic!("Flow destroyed before its ref count hit zero—this is unsafe!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +881,7 @@ impl BaseFlow {
|
|||
|
||||
// New flows start out as fully damaged.
|
||||
let mut damage = RestyleDamage::all();
|
||||
damage.remove(ReconstructFlow);
|
||||
damage.remove(RECONSTRUCT_FLOW);
|
||||
|
||||
BaseFlow {
|
||||
ref_count: AtomicUint::new(1),
|
||||
|
@ -1057,7 +1054,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow + 'a {
|
|||
box TableCellFlow::from_node_and_fragment(node, fragment) as Box<Flow>
|
||||
},
|
||||
_ => {
|
||||
fail!("no need to generate a missing child")
|
||||
panic!("no need to generate a missing child")
|
||||
}
|
||||
};
|
||||
FlowRef::new(flow)
|
||||
|
@ -1283,7 +1280,7 @@ impl ContainingBlockLink {
|
|||
#[inline]
|
||||
pub fn generated_containing_block_rect(&mut self) -> LogicalRect<Au> {
|
||||
match self.link {
|
||||
None => fail!("haven't done it"),
|
||||
None => panic!("haven't done it"),
|
||||
Some(ref mut link) => link.generated_containing_block_rect(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use flow::Flow;
|
||||
use flow_ref::FlowRef;
|
||||
|
||||
use std::collections::{Deque, dlist, DList};
|
||||
use std::collections::{dlist, DList};
|
||||
|
||||
// This needs to be reworked now that we have dynamically-sized types in Rust.
|
||||
// Until then, it's just a wrapper around DList.
|
||||
|
@ -22,19 +22,6 @@ pub struct MutFlowListIterator<'a> {
|
|||
it: dlist::MutItems<'a, FlowRef>,
|
||||
}
|
||||
|
||||
impl Collection for FlowList {
|
||||
/// O(1)
|
||||
#[inline]
|
||||
fn is_empty(&self) -> bool {
|
||||
self.flows.is_empty()
|
||||
}
|
||||
/// O(1)
|
||||
#[inline]
|
||||
fn len(&self) -> uint {
|
||||
self.flows.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl FlowList {
|
||||
/// Provide a reference to the front element, or None if the list is empty
|
||||
#[inline]
|
||||
|
@ -78,7 +65,7 @@ impl FlowList {
|
|||
///
|
||||
/// O(1)
|
||||
pub fn push_back(&mut self, new_tail: FlowRef) {
|
||||
self.flows.push(new_tail);
|
||||
self.flows.push_back(new_tail);
|
||||
}
|
||||
|
||||
/// Create an empty list
|
||||
|
@ -104,6 +91,18 @@ impl FlowList {
|
|||
it: self.flows.iter_mut(),
|
||||
}
|
||||
}
|
||||
|
||||
/// O(1)
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.flows.is_empty()
|
||||
}
|
||||
|
||||
/// O(1)
|
||||
#[inline]
|
||||
pub fn len(&self) -> uint {
|
||||
self.flows.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator<&'a Flow + 'a> for FlowListIterator<'a> {
|
||||
|
|
|
@ -12,7 +12,7 @@ use flow;
|
|||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::raw;
|
||||
use std::sync::atomics::SeqCst;
|
||||
use std::sync::atomic::SeqCst;
|
||||
|
||||
#[unsafe_no_drop_flag]
|
||||
pub struct FlowRef {
|
||||
|
@ -33,18 +33,18 @@ impl FlowRef {
|
|||
}
|
||||
}
|
||||
|
||||
impl Deref<Flow + 'static> for FlowRef {
|
||||
fn deref<'a>(&'a self) -> &'a Flow + 'static {
|
||||
impl<'a> Deref<Flow + 'a> for FlowRef {
|
||||
fn deref(&self) -> &Flow + 'a {
|
||||
unsafe {
|
||||
mem::transmute_copy::<raw::TraitObject, &'a Flow + 'static>(&self.object)
|
||||
mem::transmute_copy::<raw::TraitObject, &Flow + 'a>(&self.object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut<Flow + 'static> for FlowRef {
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut Flow + 'static {
|
||||
impl<'a> DerefMut<Flow + 'a> for FlowRef {
|
||||
fn deref_mut<'a>(&mut self) -> &mut Flow + 'a {
|
||||
unsafe {
|
||||
mem::transmute_copy::<raw::TraitObject, &'a mut Flow + 'static>(&self.object)
|
||||
mem::transmute_copy::<raw::TraitObject, &mut Flow + 'a>(&self.object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! The `Fragment` type, which represents the leaves of the layout tree.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use css::node_style::StyledNode;
|
||||
use construct::FlowConstructor;
|
||||
|
@ -639,18 +639,18 @@ impl Fragment {
|
|||
QuantitiesIncludedInIntrinsicInlineSizes::all()
|
||||
}
|
||||
TableFragment | TableCellFragment => {
|
||||
IntrinsicInlineSizeIncludesPadding |
|
||||
IntrinsicInlineSizeIncludesBorder |
|
||||
IntrinsicInlineSizeIncludesSpecified
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_BORDER |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED
|
||||
}
|
||||
TableWrapperFragment => {
|
||||
IntrinsicInlineSizeIncludesMargins |
|
||||
IntrinsicInlineSizeIncludesBorder |
|
||||
IntrinsicInlineSizeIncludesSpecified
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_BORDER |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED
|
||||
}
|
||||
TableRowFragment => {
|
||||
IntrinsicInlineSizeIncludesBorder |
|
||||
IntrinsicInlineSizeIncludesSpecified
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_BORDER |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED
|
||||
}
|
||||
ScannedTextFragment(_) | TableColumnFragment(_) | UnscannedTextFragment(_) |
|
||||
InlineAbsoluteHypotheticalFragment(_) => {
|
||||
|
@ -670,7 +670,7 @@ impl Fragment {
|
|||
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
|
||||
// This will likely need to be done by pushing down definite sizes during selector
|
||||
// cascading.
|
||||
let margin = if flags.contains(IntrinsicInlineSizeIncludesMargins) {
|
||||
let margin = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS) {
|
||||
let margin = style.logical_margin();
|
||||
(MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() +
|
||||
MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero())
|
||||
|
@ -681,7 +681,7 @@ impl Fragment {
|
|||
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
|
||||
// This will likely need to be done by pushing down definite sizes during selector
|
||||
// cascading.
|
||||
let padding = if flags.contains(IntrinsicInlineSizeIncludesPadding) {
|
||||
let padding = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_PADDING) {
|
||||
let padding = style.logical_padding();
|
||||
(model::specified(padding.inline_start, Au(0)) +
|
||||
model::specified(padding.inline_end, Au(0)))
|
||||
|
@ -689,7 +689,7 @@ impl Fragment {
|
|||
Au(0)
|
||||
};
|
||||
|
||||
let border = if flags.contains(IntrinsicInlineSizeIncludesBorder) {
|
||||
let border = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_BORDER) {
|
||||
self.border_width().inline_start_end()
|
||||
} else {
|
||||
Au(0)
|
||||
|
@ -703,7 +703,7 @@ impl Fragment {
|
|||
fn style_specified_intrinsic_inline_size(&self) -> IntrinsicISizesContribution {
|
||||
let flags = self.quantities_included_in_intrinsic_inline_size();
|
||||
let style = self.style();
|
||||
let specified = if flags.contains(IntrinsicInlineSizeIncludesSpecified) {
|
||||
let specified = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
|
||||
MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero()
|
||||
} else {
|
||||
Au(0)
|
||||
|
@ -983,7 +983,7 @@ impl Fragment {
|
|||
})
|
||||
}
|
||||
UnscannedTextFragment(..) => {
|
||||
fail!("Unscanned text fragments should have been scanned by now!")
|
||||
panic!("Unscanned text fragments should have been scanned by now!")
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1021,8 +1021,8 @@ impl Fragment {
|
|||
let text_bounds = run.metrics_for_range(range).bounding_box;
|
||||
text_bounds.size.width
|
||||
}
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
|
||||
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
|
||||
TableColumnFragment(_) => panic!("Table column fragments do not have inline_size"),
|
||||
UnscannedTextFragment(_) => panic!("Unscanned text fragments should have been scanned by now!"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1039,8 +1039,8 @@ impl Fragment {
|
|||
// Compute the block-size based on the line-block-size and font size.
|
||||
self.calculate_line_height(layout_context)
|
||||
}
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have block_size"),
|
||||
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
|
||||
TableColumnFragment(_) => panic!("Table column fragments do not have block_size"),
|
||||
UnscannedTextFragment(_) => panic!("Unscanned text fragments should have been scanned by now!"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,10 +1066,10 @@ impl Fragment {
|
|||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | ImageFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment => None,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not need to split"),
|
||||
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
|
||||
TableColumnFragment(_) => panic!("Table column fragments do not need to split"),
|
||||
UnscannedTextFragment(_) => panic!("Unscanned text fragments should have been scanned by now!"),
|
||||
InlineBlockFragment(_) | InlineAbsoluteHypotheticalFragment(_) => {
|
||||
fail!("Inline blocks or inline absolute hypothetical fragments do not get split")
|
||||
panic!("Inline blocks or inline absolute hypothetical fragments do not get split")
|
||||
}
|
||||
ScannedTextFragment(ref text_fragment_info) => {
|
||||
let mut new_line_pos = text_fragment_info.new_line_pos.clone();
|
||||
|
@ -1115,9 +1115,9 @@ impl Fragment {
|
|||
GenericFragment | IframeFragment(_) | ImageFragment(_) | TableFragment |
|
||||
TableCellFragment | TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) |
|
||||
InlineAbsoluteHypotheticalFragment(_) => None,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
|
||||
TableColumnFragment(_) => panic!("Table column fragments do not have inline_size"),
|
||||
UnscannedTextFragment(_) => {
|
||||
fail!("Unscanned text fragments should have been scanned by now!")
|
||||
panic!("Unscanned text fragments should have been scanned by now!")
|
||||
}
|
||||
ScannedTextFragment(ref text_fragment_info) => {
|
||||
let mut pieces_processed_count: uint = 0;
|
||||
|
@ -1165,7 +1165,7 @@ impl Fragment {
|
|||
// the inline-end chunk.
|
||||
let inline_end_range_end = text_fragment_info.range.end() - slice_begin;
|
||||
inline_end_range = Some(Range::new(slice_begin, inline_end_range_end));
|
||||
debug!("split_to_inline_size: case=splitting remainder with inline_end range={:?}",
|
||||
debug!("split_to_inline_size: case=splitting remainder with inline_end range={}",
|
||||
inline_end_range);
|
||||
}
|
||||
}
|
||||
|
@ -1218,9 +1218,9 @@ impl Fragment {
|
|||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment => return,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
|
||||
TableColumnFragment(_) => panic!("Table column fragments do not have inline_size"),
|
||||
UnscannedTextFragment(_) => {
|
||||
fail!("Unscanned text fragments should have been scanned by now!")
|
||||
panic!("Unscanned text fragments should have been scanned by now!")
|
||||
}
|
||||
ImageFragment(_) | ScannedTextFragment(_) | InlineBlockFragment(_) |
|
||||
InlineAbsoluteHypotheticalFragment(_) => {}
|
||||
|
@ -1299,7 +1299,7 @@ impl Fragment {
|
|||
self.border_box.size.inline = inline_size + noncontent_inline_size;
|
||||
image_fragment_info.computed_inline_size = Some(inline_size);
|
||||
}
|
||||
_ => fail!("this case should have been handled above"),
|
||||
_ => panic!("this case should have been handled above"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1311,9 +1311,9 @@ impl Fragment {
|
|||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment => return,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have block_size"),
|
||||
TableColumnFragment(_) => panic!("Table column fragments do not have block_size"),
|
||||
UnscannedTextFragment(_) => {
|
||||
fail!("Unscanned text fragments should have been scanned by now!")
|
||||
panic!("Unscanned text fragments should have been scanned by now!")
|
||||
}
|
||||
ImageFragment(_) | ScannedTextFragment(_) | InlineBlockFragment(_) |
|
||||
InlineAbsoluteHypotheticalFragment(_) => {}
|
||||
|
@ -1368,7 +1368,7 @@ impl Fragment {
|
|||
let block_flow = info.flow_ref.as_block();
|
||||
self.border_box.size.block = block_flow.base.position.size.block;
|
||||
}
|
||||
_ => fail!("should have been handled above"),
|
||||
_ => panic!("should have been handled above"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1501,10 +1501,10 @@ impl fmt::Show for Fragment {
|
|||
|
||||
bitflags! {
|
||||
flags QuantitiesIncludedInIntrinsicInlineSizes: u8 {
|
||||
static IntrinsicInlineSizeIncludesMargins = 0x01,
|
||||
static IntrinsicInlineSizeIncludesPadding = 0x02,
|
||||
static IntrinsicInlineSizeIncludesBorder = 0x04,
|
||||
static IntrinsicInlineSizeIncludesSpecified = 0x08,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS = 0x01,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_PADDING = 0x02,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_BORDER = 0x04,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED = 0x08,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,25 +14,25 @@ bitflags! {
|
|||
flags RestyleDamage: u8 {
|
||||
#[doc = "Repaint the node itself."]
|
||||
#[doc = "Currently unused; need to decide how this propagates."]
|
||||
static Repaint = 0x01,
|
||||
const REPAINT = 0x01,
|
||||
|
||||
#[doc = "Recompute intrinsic inline_sizes (minimum and preferred)."]
|
||||
#[doc = "Propagates down the flow tree because the computation is"]
|
||||
#[doc = "bottom-up."]
|
||||
static BubbleISizes = 0x02,
|
||||
const BUBBLE_ISIZES = 0x02,
|
||||
|
||||
#[doc = "Recompute actual inline-sizes and block-sizes, only taking out-of-flow children \
|
||||
into account. \
|
||||
Propagates up the flow tree because the computation is top-down."]
|
||||
static ReflowOutOfFlow = 0x04,
|
||||
const REFLOW_OUT_OF_FLOW = 0x04,
|
||||
|
||||
#[doc = "Recompute actual inline_sizes and block_sizes."]
|
||||
#[doc = "Propagates up the flow tree because the computation is"]
|
||||
#[doc = "top-down."]
|
||||
static Reflow = 0x08,
|
||||
const REFLOW = 0x08,
|
||||
|
||||
#[doc = "The entire flow needs to be reconstructed."]
|
||||
static ReconstructFlow = 0x10
|
||||
const RECONSTRUCT_FLOW = 0x10
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ bitflags! {
|
|||
flags SpecialRestyleDamage: u8 {
|
||||
#[doc="If this flag is set, we need to reflow the entire document. This is more or less a \
|
||||
temporary hack to deal with cases that we don't handle incrementally yet."]
|
||||
static ReflowEntireDocument = 0x01,
|
||||
const REFLOW_ENTIRE_DOCUMENT = 0x01,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,9 @@ impl RestyleDamage {
|
|||
/// we should add to the *parent* of this flow.
|
||||
pub fn damage_for_parent(self, child_is_absolutely_positioned: bool) -> RestyleDamage {
|
||||
if child_is_absolutely_positioned {
|
||||
self & (Repaint | ReflowOutOfFlow)
|
||||
self & (REPAINT | REFLOW_OUT_OF_FLOW)
|
||||
} else {
|
||||
self & (Repaint | Reflow | ReflowOutOfFlow)
|
||||
self & (REPAINT | REFLOW | REFLOW_OUT_OF_FLOW)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,20 +66,20 @@ impl RestyleDamage {
|
|||
// Absolute children are out-of-flow and therefore insulated from changes.
|
||||
//
|
||||
// FIXME(pcwalton): Au contraire, if the containing block dimensions change!
|
||||
self & Repaint
|
||||
self & REPAINT
|
||||
}
|
||||
(true, false) => {
|
||||
// Changing the position of an absolutely-positioned block requires us to reflow
|
||||
// its kids.
|
||||
if self.contains(ReflowOutOfFlow) {
|
||||
self | Reflow
|
||||
if self.contains(REFLOW_OUT_OF_FLOW) {
|
||||
self | REFLOW
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// TODO(pcwalton): Take floatedness into account.
|
||||
self & (Repaint | Reflow)
|
||||
self & (REPAINT | REFLOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,11 +90,11 @@ impl fmt::Show for RestyleDamage {
|
|||
let mut first_elem = true;
|
||||
|
||||
let to_iter =
|
||||
[ (Repaint, "Repaint")
|
||||
, (BubbleISizes, "BubbleISizes")
|
||||
, (ReflowOutOfFlow, "ReflowOutOfFlow")
|
||||
, (Reflow, "Reflow")
|
||||
, (ReconstructFlow, "ReconstructFlow")
|
||||
[ (REPAINT, "Repaint")
|
||||
, (BUBBLE_ISIZES, "BubbleISizes")
|
||||
, (REFLOW_OUT_OF_FLOW, "ReflowOutOfFlow")
|
||||
, (REFLOW, "Reflow")
|
||||
, (RECONSTRUCT_FLOW, "ReconstructFlow")
|
||||
];
|
||||
|
||||
for &(damage, damage_str) in to_iter.iter() {
|
||||
|
@ -141,20 +141,20 @@ pub fn compute_damage(old: &Option<Arc<ComputedValues>>, new: &ComputedValues) -
|
|||
// FIXME: We can short-circuit more of this.
|
||||
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[ Repaint ], [
|
||||
[ REPAINT ], [
|
||||
get_color.color, get_background.background_color,
|
||||
get_border.border_top_color, get_border.border_right_color,
|
||||
get_border.border_bottom_color, get_border.border_left_color
|
||||
]);
|
||||
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[ Repaint, ReflowOutOfFlow ], [
|
||||
[ REPAINT, REFLOW_OUT_OF_FLOW ], [
|
||||
get_positionoffsets.top, get_positionoffsets.left,
|
||||
get_positionoffsets.right, get_positionoffsets.bottom
|
||||
]);
|
||||
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[ Repaint, BubbleISizes, ReflowOutOfFlow, Reflow ], [
|
||||
[ REPAINT, BUBBLE_ISIZES, REFLOW_OUT_OF_FLOW, REFLOW ], [
|
||||
get_border.border_top_width, get_border.border_right_width,
|
||||
get_border.border_bottom_width, get_border.border_left_width,
|
||||
get_margin.margin_top, get_margin.margin_right,
|
||||
|
@ -167,7 +167,7 @@ pub fn compute_damage(old: &Option<Arc<ComputedValues>>, new: &ComputedValues) -
|
|||
]);
|
||||
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[ Repaint, BubbleISizes, ReflowOutOfFlow, Reflow, ReconstructFlow ],
|
||||
[ REPAINT, BUBBLE_ISIZES, REFLOW_OUT_OF_FLOW, REFLOW, RECONSTRUCT_FLOW ],
|
||||
[ get_box.float, get_box.display, get_box.position ]);
|
||||
|
||||
// FIXME: test somehow that we checked every CSS property
|
||||
|
@ -203,8 +203,8 @@ impl<'a> LayoutDamageComputation for &'a mut Flow+'a {
|
|||
|
||||
let self_base = flow::base(self);
|
||||
if self_base.flags.float_kind() != float::none &&
|
||||
self_base.restyle_damage.intersects(Reflow) {
|
||||
special_damage.insert(ReflowEntireDocument);
|
||||
self_base.restyle_damage.intersects(REFLOW) {
|
||||
special_damage.insert(REFLOW_ENTIRE_DOCUMENT);
|
||||
}
|
||||
|
||||
special_damage
|
||||
|
@ -213,7 +213,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow+'a {
|
|||
fn reflow_entire_document(self) {
|
||||
let self_base = flow::mut_base(self);
|
||||
self_base.restyle_damage.insert(RestyleDamage::all());
|
||||
self_base.restyle_damage.remove(ReconstructFlow);
|
||||
self_base.restyle_damage.remove(RECONSTRUCT_FLOW);
|
||||
for kid in self_base.children.iter_mut() {
|
||||
kid.reflow_entire_document();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use css::node_style::StyledNode;
|
||||
use context::LayoutContext;
|
||||
|
@ -13,12 +13,12 @@ use flow;
|
|||
use fragment::{Fragment, InlineAbsoluteHypotheticalFragment, InlineBlockFragment};
|
||||
use fragment::{FragmentBoundsIterator, ScannedTextFragment, ScannedTextFragmentInfo};
|
||||
use fragment::SplitInfo;
|
||||
use incremental::{Reflow, ReflowOutOfFlow};
|
||||
use incremental::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use layout_debug;
|
||||
use model::IntrinsicISizesContribution;
|
||||
use text;
|
||||
|
||||
use collections::{Deque, RingBuf};
|
||||
use collections::{RingBuf};
|
||||
use geom::{Rect, Size2D};
|
||||
use gfx::display_list::ContentLevel;
|
||||
use gfx::font::FontMetrics;
|
||||
|
@ -273,7 +273,7 @@ impl LineBreaker {
|
|||
}
|
||||
|
||||
fn flush_current_line(&mut self) {
|
||||
debug!("LineBreaker: Flushing line {:u}: {:?}",
|
||||
debug!("LineBreaker: Flushing line {:u}: {}",
|
||||
self.lines.len(), self.pending_line);
|
||||
|
||||
// clear line and add line mapping
|
||||
|
@ -325,7 +325,7 @@ impl LineBreaker {
|
|||
|
||||
let line_bounds = self.floats.place_between_floats(&info);
|
||||
|
||||
debug!("LineBreaker: found position for line: {} using placement_info: {:?}",
|
||||
debug!("LineBreaker: found position for line: {} using placement_info: {}",
|
||||
line_bounds,
|
||||
info);
|
||||
|
||||
|
@ -623,7 +623,7 @@ impl InlineFragments {
|
|||
|
||||
/// A convenience function to return a mutable reference to the fragment at a given index.
|
||||
pub fn get_mut<'a>(&'a mut self, index: uint) -> &'a mut Fragment {
|
||||
self.fragments.get_mut(index)
|
||||
&mut self.fragments[index]
|
||||
}
|
||||
|
||||
/// This function merges previously-line-broken fragments back into their
|
||||
|
@ -944,7 +944,7 @@ impl Flow for InlineFlow {
|
|||
// TODO: Combine this with `LineBreaker`'s walk in the fragment list, or put this into
|
||||
// `Fragment`.
|
||||
|
||||
debug!("InlineFlow::assign_inline_sizes: floats in: {:?}", self.base.floats);
|
||||
debug!("InlineFlow::assign_inline_sizes: floats in: {}", self.base.floats);
|
||||
|
||||
self.base.position.size.inline = self.base.block_container_inline_size;
|
||||
|
||||
|
@ -984,7 +984,7 @@ impl Flow for InlineFlow {
|
|||
// element to determine its block-size for computing the line's own block-size.
|
||||
//
|
||||
// TODO(pcwalton): Cache the line scanner?
|
||||
debug!("assign_block_size_inline: floats in: {:?}", self.base.floats);
|
||||
debug!("assign_block_size_inline: floats in: {}", self.base.floats);
|
||||
|
||||
// assign block-size for inline fragments
|
||||
let containing_block_block_size =
|
||||
|
@ -1028,11 +1028,11 @@ impl Flow for InlineFlow {
|
|||
mut largest_block_size_for_bottom_fragments) = (Au(0), Au(0));
|
||||
|
||||
for fragment_index in range(line.range.begin(), line.range.end()) {
|
||||
let fragment = self.fragments.fragments.get_mut(fragment_index.to_uint());
|
||||
let fragment = &mut self.fragments.fragments[fragment_index.to_uint()];
|
||||
|
||||
let InlineMetrics {
|
||||
block_size_above_baseline: mut block_size_above_baseline,
|
||||
depth_below_baseline: mut depth_below_baseline,
|
||||
mut block_size_above_baseline,
|
||||
mut depth_below_baseline,
|
||||
ascent
|
||||
} = fragment.inline_metrics(layout_context);
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ impl Flow for InlineFlow {
|
|||
Au(0),
|
||||
-self.base.position.size.block));
|
||||
|
||||
self.base.restyle_damage.remove(ReflowOutOfFlow | Reflow);
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self) {
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
#![macro_escape]
|
||||
|
||||
use flow_ref::FlowRef;
|
||||
use flow;
|
||||
use serialize::json;
|
||||
use std::cell::RefCell;
|
||||
use std::io::File;
|
||||
use std::sync::atomics::{AtomicUint, SeqCst, INIT_ATOMIC_UINT};
|
||||
use std::sync::atomic::{AtomicUint, SeqCst, INIT_ATOMIC_UINT};
|
||||
|
||||
local_data_key!(state_key: RefCell<State>)
|
||||
|
||||
|
@ -62,7 +63,7 @@ impl Scope {
|
|||
match maybe_refcell {
|
||||
Some(refcell) => {
|
||||
let mut state = refcell.borrow_mut();
|
||||
let flow_trace = json::encode(&state.flow_root.deref());
|
||||
let flow_trace = json::encode(&flow::base(state.flow_root.deref()));
|
||||
let data = box ScopeData::new(name, flow_trace);
|
||||
state.scope_stack.push(data);
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ impl Drop for Scope {
|
|||
Some(refcell) => {
|
||||
let mut state = refcell.borrow_mut();
|
||||
let mut current_scope = state.scope_stack.pop().unwrap();
|
||||
current_scope.post = json::encode(&state.flow_root.deref());
|
||||
current_scope.post = json::encode(&flow::base(state.flow_root.deref()));
|
||||
let previous_scope = state.scope_stack.last_mut().unwrap();
|
||||
previous_scope.children.push(current_scope);
|
||||
}
|
||||
|
@ -101,7 +102,7 @@ pub fn generate_unique_debug_id() -> u16 {
|
|||
pub fn begin_trace(flow_root: FlowRef) {
|
||||
assert!(state_key.get().is_none());
|
||||
|
||||
let flow_trace = json::encode(&flow_root.deref());
|
||||
let flow_trace = json::encode(&flow::base(flow_root.deref()));
|
||||
let state = State {
|
||||
scope_stack: vec![box ScopeData::new("root".to_string(), flow_trace)],
|
||||
flow_root: flow_root,
|
||||
|
@ -117,7 +118,7 @@ pub fn end_trace() {
|
|||
let mut task_state = task_state_cell.borrow_mut();
|
||||
assert!(task_state.scope_stack.len() == 1);
|
||||
let mut root_scope = task_state.scope_stack.pop().unwrap();
|
||||
root_scope.post = json::encode(&task_state.flow_root.deref());
|
||||
root_scope.post = json::encode(&flow::base(task_state.flow_root.deref()));
|
||||
|
||||
let result = json::encode(&root_scope);
|
||||
let path = Path::new("layout_trace.json");
|
||||
|
|
|
@ -11,7 +11,7 @@ use context::SharedLayoutContext;
|
|||
use flow::{mod, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{Fragment, FragmentBoundsIterator};
|
||||
use incremental::{LayoutDamageComputation, Reflow, ReflowEntireDocument, Repaint};
|
||||
use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT};
|
||||
use layout_debug;
|
||||
use parallel::UnsafeFlow;
|
||||
use parallel;
|
||||
|
@ -183,7 +183,7 @@ impl LayoutTaskFactory for LayoutTask {
|
|||
time_profiler_chan: TimeProfilerChan,
|
||||
shutdown_chan: Sender<()>) {
|
||||
let ConstellationChan(con_chan) = constellation_chan.clone();
|
||||
spawn_named_with_send_on_failure("LayoutTask", task_state::Layout, proc() {
|
||||
spawn_named_with_send_on_failure("LayoutTask", task_state::LAYOUT, proc() {
|
||||
{ // Ensures layout task is destroyed before we send shutdown message
|
||||
let sender = chan.sender();
|
||||
let layout =
|
||||
|
@ -254,7 +254,7 @@ impl LayoutTask {
|
|||
let screen_size = Size2D(Au(0), Au(0));
|
||||
let device = Device::new(Screen, opts::get().initial_window_size.as_f32() * ScaleFactor(1.0));
|
||||
let parallel_traversal = if opts::get().layout_threads != 1 {
|
||||
Some(WorkQueue::new("LayoutWorker", task_state::Layout,
|
||||
Some(WorkQueue::new("LayoutWorker", task_state::LAYOUT,
|
||||
opts::get().layout_threads, ptr::null()))
|
||||
} else {
|
||||
None
|
||||
|
@ -339,7 +339,7 @@ impl LayoutTask {
|
|||
} else if ret == port2.id() {
|
||||
Pipeline
|
||||
} else {
|
||||
fail!("invalid select result");
|
||||
panic!("invalid select result");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -443,7 +443,7 @@ impl LayoutTask {
|
|||
break
|
||||
}
|
||||
_ => {
|
||||
fail!("layout: message that wasn't `ExitNowMsg` received after \
|
||||
panic!("layout: message that wasn't `ExitNowMsg` received after \
|
||||
`PrepareToExitMsg`")
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ impl LayoutTask {
|
|||
let _scope = layout_debug_scope!("solve_constraints_parallel");
|
||||
|
||||
match rw_data.parallel_traversal {
|
||||
None => fail!("solve_contraints_parallel() called with no parallel traversal ready"),
|
||||
None => panic!("solve_contraints_parallel() called with no parallel traversal ready"),
|
||||
Some(ref mut traversal) => {
|
||||
// NOTE: this currently computes borders, so any pruning should separate that
|
||||
// operation out.
|
||||
|
@ -665,12 +665,11 @@ impl LayoutTask {
|
|||
.background_color)
|
||||
.to_gfx_color()
|
||||
};
|
||||
match element_bg_color {
|
||||
color::rgba(0., 0., 0., 0.) => {}
|
||||
_ => {
|
||||
color = element_bg_color;
|
||||
break;
|
||||
}
|
||||
// FIXME: Add equality operators for azure color type.
|
||||
if element_bg_color.r != 0.0 || element_bg_color.g != 0.0 ||
|
||||
element_bg_color.b != 0.0 || element_bg_color.a != 0.0 {
|
||||
color = element_bg_color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -798,8 +797,8 @@ impl LayoutTask {
|
|||
self.time_profiler_chan.clone(),
|
||||
|| {
|
||||
if opts::get().nonincremental_layout ||
|
||||
layout_root.compute_layout_damage().contains(ReflowEntireDocument) {
|
||||
layout_root.reflow_entire_document()
|
||||
layout_root.deref_mut().compute_layout_damage().contains(REFLOW_ENTIRE_DOCUMENT) {
|
||||
layout_root.deref_mut().reflow_entire_document()
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -884,7 +883,7 @@ impl LayoutTask {
|
|||
}
|
||||
|
||||
fn reflow_all_nodes(flow: &mut Flow) {
|
||||
flow::mut_base(flow).restyle_damage.insert(Reflow | Repaint);
|
||||
flow::mut_base(flow).restyle_damage.insert(REFLOW | REPAINT);
|
||||
|
||||
for child in flow::child_iter(flow) {
|
||||
LayoutTask::reflow_all_nodes(child);
|
||||
|
@ -930,7 +929,7 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
/// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
|
||||
fn content_boxes(&self) -> ContentBoxesResponse {
|
||||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let mut rw_data = rw_data.lock();
|
||||
let rw_data = rw_data.lock();
|
||||
ContentBoxesResponse(rw_data.content_boxes_response.clone())
|
||||
}
|
||||
|
||||
|
@ -953,7 +952,7 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let rw_data = rw_data.lock();
|
||||
match rw_data.display_list {
|
||||
None => fail!("no display list!"),
|
||||
None => panic!("no display list!"),
|
||||
Some(ref display_list) => hit_test(point, display_list.list.iter().rev()),
|
||||
}
|
||||
};
|
||||
|
@ -984,7 +983,7 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let rw_data = rw_data.lock();
|
||||
match rw_data.display_list {
|
||||
None => fail!("no display list!"),
|
||||
None => panic!("no display list!"),
|
||||
Some(ref display_list) => {
|
||||
mouse_over_test(point, display_list.list.iter().rev(), &mut mouse_over_list);
|
||||
}
|
||||
|
|
|
@ -7,14 +7,13 @@
|
|||
|
||||
#![feature(globs, macro_rules, phase, thread_local, unsafe_destructor)]
|
||||
|
||||
#![deny(unused_imports, unused_variable)]
|
||||
#![deny(unused_imports)]
|
||||
#![deny(unused_variables)]
|
||||
#![allow(unrooted_must_root)]
|
||||
|
||||
#[phase(plugin, link)]
|
||||
extern crate log;
|
||||
|
||||
extern crate debug;
|
||||
|
||||
extern crate geom;
|
||||
extern crate gfx;
|
||||
extern crate layout_traits;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Borders, padding, and margins.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use fragment::Fragment;
|
||||
|
||||
|
@ -217,7 +217,7 @@ impl MarginCollapseInfo {
|
|||
(AccumulatingCollapsibleTopMargin, MarginsCollapse(..)) => {
|
||||
// Can't happen because the state will have been replaced with
|
||||
// `AccumulatingMarginIn` above.
|
||||
fail!("should not be accumulating collapsible block_start margins anymore!")
|
||||
panic!("should not be accumulating collapsible block_start margins anymore!")
|
||||
}
|
||||
(AccumulatingCollapsibleTopMargin, MarginsCollapseThrough(margin)) => {
|
||||
self.block_start_margin.union(margin);
|
||||
|
|
|
@ -25,7 +25,7 @@ use servo_util::time;
|
|||
use servo_util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::sync::atomics::{AtomicInt, Relaxed, SeqCst};
|
||||
use std::sync::atomic::{AtomicInt, Relaxed, SeqCst};
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn static_assertion(node: UnsafeLayoutNode) {
|
||||
|
@ -431,7 +431,7 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
|
|||
if opts::get().bubble_inline_sizes_separately {
|
||||
let layout_context = LayoutContext::new(shared_layout_context);
|
||||
let bubble_inline_sizes = BubbleISizes { layout_context: &layout_context };
|
||||
root.traverse_postorder(&bubble_inline_sizes);
|
||||
root.deref_mut().traverse_postorder(&bubble_inline_sizes);
|
||||
}
|
||||
|
||||
queue.data = shared_layout_context as *const _;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::{BlockFlow, MarginsMayNotCollapse, ISizeAndMarginsComputer};
|
||||
use block::{ISizeConstraintInput, ISizeConstraintSolution};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::BlockFlow;
|
||||
use construct::FlowConstructor;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::{BlockFlow, MarginsMayNotCollapse, ISizeAndMarginsComputer};
|
||||
use context::LayoutContext;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use context::LayoutContext;
|
||||
use css::node_style::StyledNode;
|
||||
|
@ -70,7 +70,7 @@ impl Flow for TableColGroupFlow {
|
|||
let inline_size = fragment.style().content_inline_size();
|
||||
let span: int = match fragment.specific {
|
||||
TableColumnFragment(col_fragment) => max(col_fragment.span, 1),
|
||||
_ => fail!("non-table-column fragment inside table column?!"),
|
||||
_ => panic!("non-table-column fragment inside table column?!"),
|
||||
};
|
||||
for _ in range(0, span) {
|
||||
self.inline_sizes.push(inline_size)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::BlockFlow;
|
||||
use block::ISizeAndMarginsComputer;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! CSS table formatting contexts.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::BlockFlow;
|
||||
use block::ISizeAndMarginsComputer;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//!
|
||||
//! Hereafter this document is referred to as INTRINSIC.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use block::{BlockFlow, BlockNonReplaced, FloatNonReplaced, ISizeAndMarginsComputer};
|
||||
use block::{MarginsMayNotCollapse};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Text layout.
|
||||
|
||||
#![deny(unsafe_block)]
|
||||
#![deny(unsafe_blocks)]
|
||||
|
||||
use fragment::{Fragment, ScannedTextFragmentInfo, UnscannedTextFragment};
|
||||
use inline::InlineFragments;
|
||||
|
@ -19,7 +19,7 @@ use servo_util::geometry::Au;
|
|||
use servo_util::logical_geometry::{LogicalSize, WritingMode};
|
||||
use servo_util::range::Range;
|
||||
use servo_util::smallvec::{SmallVec, SmallVec1};
|
||||
use std::collections::{DList, Deque};
|
||||
use std::collections::DList;
|
||||
use std::mem;
|
||||
use style::ComputedValues;
|
||||
use style::computed_values::{line_height, text_orientation, white_space};
|
||||
|
@ -119,7 +119,7 @@ impl TextRunScanner {
|
|||
for in_fragment in self.clump.iter() {
|
||||
let in_fragment = match in_fragment.specific {
|
||||
UnscannedTextFragment(ref text_fragment_info) => &text_fragment_info.text,
|
||||
_ => fail!("Expected an unscanned text fragment!"),
|
||||
_ => panic!("Expected an unscanned text fragment!"),
|
||||
};
|
||||
|
||||
let mut new_line_pos = Vec::new();
|
||||
|
|
|
@ -11,7 +11,7 @@ use context::LayoutContext;
|
|||
use flow::{Flow, MutableFlowUtils};
|
||||
use flow::{PreorderFlowTraversal, PostorderFlowTraversal};
|
||||
use flow;
|
||||
use incremental::{RestyleDamage, BubbleISizes, Reflow, ReflowOutOfFlow};
|
||||
use incremental::{RestyleDamage, BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode};
|
||||
use wrapper::{PostorderNodeMutTraversal, ThreadSafeLayoutNode, UnsafeLayoutNode};
|
||||
use wrapper::{PreorderDomTraversal, PostorderDomTraversal};
|
||||
|
@ -88,7 +88,7 @@ fn put_task_local_bloom_filter(bf: Box<BloomFilter>,
|
|||
layout_context: &LayoutContext) {
|
||||
match style_bloom.replace(Some((bf, *unsafe_node, layout_context.shared.generation))) {
|
||||
None => {},
|
||||
Some(_) => fail!("Putting into a never-taken task-local bloom filter"),
|
||||
Some(_) => panic!("Putting into a never-taken task-local bloom filter"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ impl PreorderFlow for FlowTreeVerification {
|
|||
if !base.flags.is_leaf() && !base.flags.is_nonleaf() {
|
||||
println!("flow tree verification failed: flow wasn't a leaf or a nonleaf!");
|
||||
flow.dump();
|
||||
fail!("flow tree verification failed")
|
||||
panic!("flow tree verification failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,12 +287,12 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
|
|||
#[inline]
|
||||
fn process(&self, flow: &mut Flow) {
|
||||
flow.bubble_inline_sizes();
|
||||
flow::mut_base(flow).restyle_damage.remove(BubbleISizes);
|
||||
flow::mut_base(flow).restyle_damage.remove(BUBBLE_ISIZES);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn should_process(&self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.contains(BubbleISizes)
|
||||
flow::base(flow).restyle_damage.contains(BUBBLE_ISIZES)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
|
|||
|
||||
#[inline]
|
||||
fn should_process(&self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.intersects(ReflowOutOfFlow | Reflow)
|
||||
flow::base(flow).restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ impl<'a> PostorderFlowTraversal for AssignBSizesAndStoreOverflow<'a> {
|
|||
|
||||
#[inline]
|
||||
fn should_process(&self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.intersects(ReflowOutOfFlow | Reflow)
|
||||
flow::base(flow).restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ impl PrivateLayoutData {
|
|||
bitflags! {
|
||||
flags LayoutDataFlags: u8 {
|
||||
#[doc="Whether a flow has been newly constructed."]
|
||||
static HasNewlyConstructedFlow = 0x01
|
||||
const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
|
|||
use script::dom::htmlinputelement::LayoutHTMLInputElementHelpers;
|
||||
use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, Node, NodeTypeId};
|
||||
use script::dom::node::{LayoutNodeHelpers, RawLayoutNodeHelpers, SharedLayoutData};
|
||||
use script::dom::node::{HasChanged, IsDirty, HasDirtySiblings, HasDirtyDescendants};
|
||||
use script::dom::node::{HAS_CHANGED, IS_DIRTY, HAS_DIRTY_SIBLINGS, HAS_DIRTY_DESCENDANTS};
|
||||
use script::dom::text::Text;
|
||||
use script::layout_interface::LayoutChan;
|
||||
use servo_msg::constellation_msg::{PipelineId, SubpageId};
|
||||
|
@ -102,7 +102,7 @@ pub trait TLayoutNode {
|
|||
unsafe {
|
||||
match HTMLImageElementCast::to_js(self.get_jsmanaged()) {
|
||||
Some(elem) => elem.image().as_ref().map(|url| (*url).clone()),
|
||||
None => fail!("not an image!")
|
||||
None => panic!("not an image!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ pub trait TLayoutNode {
|
|||
let iframe_element: JS<HTMLIFrameElement> =
|
||||
match HTMLIFrameElementCast::to_js(self.get_jsmanaged()) {
|
||||
Some(elem) => elem,
|
||||
None => fail!("not an iframe element!")
|
||||
None => panic!("not an iframe element!")
|
||||
};
|
||||
let size = (*iframe_element.unsafe_get()).size().unwrap();
|
||||
(*size.pipeline_id(), *size.subpage_id())
|
||||
|
@ -187,7 +187,7 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> {
|
|||
Some(text) => (*text.unsafe_get()).characterdata().data_for_layout().to_string(),
|
||||
None => match HTMLInputElementCast::to_js(self.get_jsmanaged()) {
|
||||
Some(input) => input.get_value_for_layout(),
|
||||
None => fail!("not text!")
|
||||
None => panic!("not text!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ impl<'ln> TNode<'ln, LayoutElement<'ln>> for LayoutNode<'ln> {
|
|||
unsafe {
|
||||
let elem: JS<Element> = match ElementCast::to_js(&self.node) {
|
||||
Some(elem) => elem,
|
||||
None => fail!("not an element")
|
||||
None => panic!("not an element")
|
||||
};
|
||||
|
||||
let element = &*elem.unsafe_get();
|
||||
|
@ -390,35 +390,35 @@ impl<'ln> TNode<'ln, LayoutElement<'ln>> for LayoutNode<'ln> {
|
|||
}
|
||||
|
||||
fn has_changed(self) -> bool {
|
||||
unsafe { self.node.get_flag(HasChanged) }
|
||||
unsafe { self.node.get_flag(HAS_CHANGED) }
|
||||
}
|
||||
|
||||
unsafe fn set_changed(self, value: bool) {
|
||||
self.node.set_flag(HasChanged, value)
|
||||
self.node.set_flag(HAS_CHANGED, value)
|
||||
}
|
||||
|
||||
fn is_dirty(self) -> bool {
|
||||
unsafe { self.node.get_flag(IsDirty) }
|
||||
unsafe { self.node.get_flag(IS_DIRTY) }
|
||||
}
|
||||
|
||||
unsafe fn set_dirty(self, value: bool) {
|
||||
self.node.set_flag(IsDirty, value)
|
||||
self.node.set_flag(IS_DIRTY, value)
|
||||
}
|
||||
|
||||
fn has_dirty_siblings(self) -> bool {
|
||||
unsafe { self.node.get_flag(HasDirtySiblings) }
|
||||
unsafe { self.node.get_flag(HAS_DIRTY_SIBLINGS) }
|
||||
}
|
||||
|
||||
unsafe fn set_dirty_siblings(self, value: bool) {
|
||||
self.node.set_flag(HasDirtySiblings, value);
|
||||
self.node.set_flag(HAS_DIRTY_SIBLINGS, value);
|
||||
}
|
||||
|
||||
fn has_dirty_descendants(self) -> bool {
|
||||
unsafe { self.node.get_flag(HasDirtyDescendants) }
|
||||
unsafe { self.node.get_flag(HAS_DIRTY_DESCENDANTS) }
|
||||
}
|
||||
|
||||
unsafe fn set_dirty_descendants(self, value: bool) {
|
||||
self.node.set_flag(HasDirtyDescendants, value)
|
||||
self.node.set_flag(HAS_DIRTY_DESCENDANTS, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,7 +752,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
unsafe {
|
||||
let element = match ElementCast::to_js(self.get_jsmanaged()) {
|
||||
Some(e) => e.unsafe_get(),
|
||||
None => fail!("not an element")
|
||||
None => panic!("not an element")
|
||||
};
|
||||
// FIXME(pcwalton): Workaround until Rust gets multiple lifetime parameters on
|
||||
// implementations.
|
||||
|
@ -888,7 +888,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
unsafe {
|
||||
match HTMLInputElementCast::to_js(self.get_jsmanaged()) {
|
||||
Some(input) => input.get_value_for_layout(),
|
||||
None => fail!("not an input element!")
|
||||
None => panic!("not an input element!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
unsafe {
|
||||
match HTMLInputElementCast::to_js(self.get_jsmanaged()) {
|
||||
Some(input) => input.get_size_for_layout(),
|
||||
None => fail!("not an input element!")
|
||||
None => panic!("not an input element!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
let mut layout_data_ref = self.mutate_layout_data();
|
||||
match &mut *layout_data_ref {
|
||||
&Some(ref mut layout_data) => layout_data.data.restyle_damage = damage,
|
||||
_ => fail!("no layout data for this node"),
|
||||
_ => panic!("no layout data for this node"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -922,7 +922,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
pub fn flags(self) -> LayoutDataFlags {
|
||||
unsafe {
|
||||
match *self.borrow_layout_data_unchecked() {
|
||||
None => fail!(),
|
||||
None => panic!(),
|
||||
Some(ref layout_data) => layout_data.data.flags,
|
||||
}
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
let mut layout_data_ref = self.mutate_layout_data();
|
||||
match &mut *layout_data_ref {
|
||||
&Some(ref mut layout_data) => layout_data.data.flags.insert(new_flags),
|
||||
_ => fail!("no layout data for this node"),
|
||||
_ => panic!("no layout data for this node"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -942,7 +942,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
let mut layout_data_ref = self.mutate_layout_data();
|
||||
match &mut *layout_data_ref {
|
||||
&Some(ref mut layout_data) => layout_data.data.flags.remove(flags),
|
||||
_ => fail!("no layout data for this node"),
|
||||
_ => panic!("no layout data for this node"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue