Skip to content

Commit

Permalink
auto merge of #4757 : servo/servo/newnewnewcss, r=mbrubeck
Browse files Browse the repository at this point in the history
(Still off by default. Enable with `RUST_LOG=style`.)

r? @mbrubeck
  • Loading branch information
bors-servo committed Jan 30, 2015
2 parents 49dc60c + dfb5c52 commit 172aed5
Show file tree
Hide file tree
Showing 49 changed files with 424 additions and 351 deletions.
2 changes: 1 addition & 1 deletion components/gfx/display_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use util::smallvec::{SmallVec, SmallVec8};
use std::fmt;
use std::slice::Iter;
use std::sync::Arc;
use style::ComputedValues;
use style::properties::ComputedValues;
use style::computed_values::{border_style, cursor, filter, mix_blend_mode, pointer_events};

// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::cell::RefCell;
use util::cache::HashCache;
use util::smallvec::{SmallVec, SmallVec8};
use style::computed_values::{font_stretch, font_variant, font_weight};
use style::style_structs::Font as FontStyle;
use style::properties::style_structs::Font as FontStyle;
use std::sync::Arc;

use std::hash::Hash;
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/font_cache_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use platform::font_template::FontTemplateData;
use servo_net::resource_task::{ResourceTask, load_whole_resource};
use util::task::spawn_named;
use util::str::LowercaseString;
use style::Source;
use style::font_face::Source;

/// A list of font templates that make up a given font family.
struct FontFamily {
Expand Down
7 changes: 3 additions & 4 deletions components/layout/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ use servo_util::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize};
use servo_util::opts;
use std::cmp::{max, min};
use std::fmt;
use style::ComputedValues;
use style::computed_values::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::computed_values::{LengthOrPercentage, box_sizing, display, float};
use style::computed_values::{overflow, position};
use style::properties::ComputedValues;
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::computed_values::{overflow, position, box_sizing, display, float};
use std::sync::Arc;

/// Information specific to floated blocks.
Expand Down
4 changes: 2 additions & 2 deletions components/layout/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use std::mem;
use std::sync::atomic::Ordering;
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
use style::computed_values::{position};
use style::{self, ComputedValues};
use style::properties::{ComputedValues, make_inline};
use std::sync::Arc;
use url::Url;

Expand Down Expand Up @@ -707,7 +707,7 @@ impl<'a> FlowConstructor<'a> {
// `baz` had better not be absolutely positioned!
let mut style = (*node.style()).clone();
if style.get_box().display != display::T::inline {
style = Arc::new(style::make_inline(&*style))
style = Arc::new(make_inline(&*style))
}

// If this is generated content, then we need to initialize the accumulator with the
Expand Down
2 changes: 1 addition & 1 deletion components/layout/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::cell::Cell;
use std::mem;
use std::ptr;
use std::sync::{Arc, Mutex};
use style::Stylist;
use style::selector_matching::Stylist;
use url::Url;

struct LocalLayoutContext {
Expand Down
14 changes: 9 additions & 5 deletions components/layout/css/matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ use std::mem;
use std::hash::{Hash, Hasher, Writer};
use std::slice::Iter;
use string_cache::{Atom, Namespace};
use style::{self, PseudoElement, ComputedValues, DeclarationBlock, Stylist, TElement, TNode};
use style::{CommonStyleAffectingAttributeMode, CommonStyleAffectingAttributes, cascade};
use style::selectors::PseudoElement;
use style::selector_matching::{Stylist, DeclarationBlock};
use style::node::{TElement, TNode};
use style::properties::{ComputedValues, cascade};
use style::selector_matching::{CommonStyleAffectingAttributeMode, CommonStyleAffectingAttributes};
use style::selector_matching::{common_style_affecting_attributes, rare_style_affecting_attributes};
use std::sync::Arc;

pub struct ApplicableDeclarations {
Expand Down Expand Up @@ -156,7 +160,7 @@ pub struct StyleSharingCandidateCache {
fn create_common_style_affecting_attributes_from_element(element: &LayoutElement)
-> CommonStyleAffectingAttributes {
let mut flags = CommonStyleAffectingAttributes::empty();
for attribute_info in style::common_style_affecting_attributes().iter() {
for attribute_info in common_style_affecting_attributes().iter() {
match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if element.get_attr(&ns!(""), &attribute_info.atom).is_some() {
Expand Down Expand Up @@ -276,7 +280,7 @@ impl StyleSharingCandidate {
// FIXME(pcwalton): It's probably faster to iterate over all the element's attributes and
// use the {common, rare}-style-affecting-attributes tables as lookup tables.

for attribute_info in style::common_style_affecting_attributes().iter() {
for attribute_info in common_style_affecting_attributes().iter() {
match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if self.common_style_affecting_attributes.contains(flag) !=
Expand All @@ -303,7 +307,7 @@ impl StyleSharingCandidate {
}
}

for attribute_name in style::rare_style_affecting_attributes().iter() {
for attribute_name in rare_style_affecting_attributes().iter() {
if element.get_attr(&ns!(""), attribute_name).is_some() {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion components/layout/css/node_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use wrapper::{PseudoElementType, ThreadSafeLayoutNode};

use std::mem;
use style::ComputedValues;
use style::properties::ComputedValues;
use std::sync::Arc;

/// Node mixin providing `style` method that returns a `NodeStyle`
Expand Down
7 changes: 4 additions & 3 deletions components/layout/display_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ use std::default::Default;
use std::iter::repeat;
use std::num::Float;
use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirection};
use style::computed::{Image, LinearGradient, LengthOrPercentage};
use style::values::computed::{Image, LinearGradient, LengthOrPercentage};
use style::values::RGBA;
use style::computed_values::filter::Filter;
use style::computed_values::{background_attachment, background_repeat, border_style, overflow};
use style::computed_values::{position, visibility};
use style::style_structs::Border;
use style::{ComputedValues, RGBA};
use style::properties::style_structs::Border;
use style::properties::ComputedValues;
use std::num::ToPrimitive;
use std::sync::Arc;
use std::sync::mpsc::channel;
Expand Down
2 changes: 1 addition & 1 deletion components/layout/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use std::raw;
use std::sync::atomic::{AtomicUint, Ordering};
use std::slice::IterMut;
use style::computed_values::{clear, empty_cells, float, position, text_align};
use style::ComputedValues;
use style::properties::ComputedValues;
use std::sync::Arc;

/// Virtual methods that make up a float context.
Expand Down
7 changes: 4 additions & 3 deletions components/layout/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ use std::str::FromStr;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::Sender;
use string_cache::Atom;
use style::{ComputedValues, TElement, TNode, cascade_anonymous};
use style::computed_values::{LengthOrPercentage, LengthOrPercentageOrAuto};
use style::computed_values::{LengthOrPercentageOrNone, clear, mix_blend_mode, overflow_wrap};
use style::properties::{ComputedValues, cascade_anonymous};
use style::node::{TElement, TNode};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::computed_values::{clear, mix_blend_mode, overflow_wrap};
use style::computed_values::{position, text_align, text_decoration, vertical_align, white_space};
use style::computed_values::{word_break};
use text::TextRunScanner;
Expand Down
2 changes: 1 addition & 1 deletion components/layout/incremental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use flow::{IS_ABSOLUTELY_POSITIONED};
use std::fmt;
use std::sync::Arc;
use style::computed_values::float;
use style::ComputedValues;
use style::properties::ComputedValues;

bitflags! {
#[doc = "Individual layout actions that may be necessary after restyling."]
Expand Down
2 changes: 1 addition & 1 deletion components/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use std::ops::{Add, Sub, Mul, Div, Rem, Neg, Shl, Shr, Not, BitOr, BitAnd, BitXo
use std::u16;
use style::computed_values::{overflow, text_align, text_justify, text_overflow, vertical_align};
use style::computed_values::{white_space};
use style::ComputedValues;
use style::properties::ComputedValues;
use std::sync::Arc;

// From gfxFontConstants.h in Firefox
Expand Down
8 changes: 5 additions & 3 deletions components/layout/layout_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ use std::ops::{Deref, DerefMut};
use std::sync::mpsc::{channel, Sender, Receiver, Select};
use std::mem;
use std::ptr;
use style::selector_matching::Stylist;
use style::computed_values::{filter, mix_blend_mode};
use style::{StylesheetOrigin, Stylesheet, Stylist, TNode, iter_font_face_rules};
use style::{MediaType, Device};
use style::stylesheets::{Origin, Stylesheet, iter_font_face_rules};
use style::node::TNode;
use style::media_queries::{MediaType, Device};
use std::sync::{Arc, Mutex, MutexGuard};
use url::Url;

Expand Down Expand Up @@ -488,7 +490,7 @@ impl LayoutTask {
final_url,
protocol_encoding_label,
Some(environment_encoding),
StylesheetOrigin::Author);
Origin::Author);
self.handle_add_stylesheet(sheet, possibly_locked_rw_data);
}

Expand Down
2 changes: 1 addition & 1 deletion components/layout/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use gfx::display_list::DisplayList;
use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalRect;
use servo_util::opts;
use style::ComputedValues;
use style::properties::ComputedValues;
use style::computed_values::list_style_type;
use std::sync::Arc;

Expand Down
27 changes: 13 additions & 14 deletions components/layout/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

use fragment::Fragment;

use style::computed_values as computed;
use geom::SideOffsets2D;
use style::computed_values::{LengthOrPercentageOrAuto, LengthOrPercentage};
use style::ComputedValues;
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone, LengthOrPercentage};
use style::properties::ComputedValues;
use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalMargin;
use std::cmp::{max, min};
Expand Down Expand Up @@ -333,14 +332,14 @@ pub enum MaybeAuto {

impl MaybeAuto {
#[inline]
pub fn from_style(length: computed::LengthOrPercentageOrAuto, containing_length: Au)
pub fn from_style(length: LengthOrPercentageOrAuto, containing_length: Au)
-> MaybeAuto {
match length {
computed::LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
computed::LengthOrPercentageOrAuto::Percentage(percent) => {
LengthOrPercentageOrAuto::Auto => MaybeAuto::Auto,
LengthOrPercentageOrAuto::Percentage(percent) => {
MaybeAuto::Specified(containing_length.scale_by(percent))
}
computed::LengthOrPercentageOrAuto::Length(length) => MaybeAuto::Specified(length)
LengthOrPercentageOrAuto::Length(length) => MaybeAuto::Specified(length)
}
}

Expand All @@ -366,18 +365,18 @@ impl MaybeAuto {
}
}

pub fn specified_or_none(length: computed::LengthOrPercentageOrNone, containing_length: Au) -> Option<Au> {
pub fn specified_or_none(length: LengthOrPercentageOrNone, containing_length: Au) -> Option<Au> {
match length {
computed::LengthOrPercentageOrNone::None => None,
computed::LengthOrPercentageOrNone::Percentage(percent) => Some(containing_length.scale_by(percent)),
computed::LengthOrPercentageOrNone::Length(length) => Some(length),
LengthOrPercentageOrNone::None => None,
LengthOrPercentageOrNone::Percentage(percent) => Some(containing_length.scale_by(percent)),
LengthOrPercentageOrNone::Length(length) => Some(length),
}
}

pub fn specified(length: computed::LengthOrPercentage, containing_length: Au) -> Au {
pub fn specified(length: LengthOrPercentage, containing_length: Au) -> Au {
match length {
computed::LengthOrPercentage::Length(length) => length,
computed::LengthOrPercentage::Percentage(p) => containing_length.scale_by(p)
LengthOrPercentage::Length(length) => length,
LengthOrPercentage::Percentage(p) => containing_length.scale_by(p)
}
}

Expand Down
6 changes: 4 additions & 2 deletions components/layout/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalRect;
use std::cmp::max;
use std::fmt;
use style::{ComputedValues, CSSFloat};
use style::computed_values::{LengthOrPercentageOrAuto, table_layout};
use style::properties::ComputedValues;
use style::values::CSSFloat;
use style::values::computed::{LengthOrPercentageOrAuto};
use style::computed_values::table_layout;
use std::sync::Arc;

/// A table flow corresponded to the table's internal table fragment under a table wrapper flow.
Expand Down
2 changes: 1 addition & 1 deletion components/layout/table_caption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use geom::{Point2D, Rect};
use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalRect;
use std::fmt;
use style::ComputedValues;
use style::properties::ComputedValues;
use std::sync::Arc;

/// A table formatting context.
Expand Down
3 changes: 2 additions & 1 deletion components/layout/table_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use geom::{Point2D, Rect};
use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalRect;
use std::fmt;
use style::{UnsignedIntegerAttribute, ComputedValues};
use style::properties::ComputedValues;
use style::legacy::UnsignedIntegerAttribute;
use std::sync::Arc;

/// A table formatting context.
Expand Down
4 changes: 2 additions & 2 deletions components/layout/table_colgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use geom::{Point2D, Rect};
use servo_util::geometry::{Au, ZERO_RECT};
use std::cmp::max;
use std::fmt;
use style::computed_values::LengthOrPercentageOrAuto;
use style::ComputedValues;
use style::values::computed::LengthOrPercentageOrAuto;
use style::properties::ComputedValues;
use std::sync::Arc;

/// A table formatting context.
Expand Down
4 changes: 2 additions & 2 deletions components/layout/table_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalRect;
use std::cmp::max;
use std::fmt;
use style::ComputedValues;
use style::computed_values::LengthOrPercentageOrAuto;
use style::properties::ComputedValues;
use style::values::computed::LengthOrPercentageOrAuto;
use std::sync::Arc;

/// A single row of a table.
Expand Down
2 changes: 1 addition & 1 deletion components/layout/table_rowgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use geom::{Point2D, Rect};
use servo_util::geometry::Au;
use servo_util::logical_geometry::LogicalRect;
use std::fmt;
use style::ComputedValues;
use style::properties::ComputedValues;
use std::sync::Arc;

/// A table formatting context.
Expand Down
6 changes: 4 additions & 2 deletions components/layout/table_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ use servo_util::geometry::Au;
use std::cmp::{max, min};
use std::fmt;
use std::ops::Add;
use style::{ComputedValues, CSSFloat};
use style::computed_values::{table_layout, LengthOrPercentageOrAuto};
use style::properties::ComputedValues;
use style::computed_values::table_layout;
use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;
use std::sync::Arc;

#[derive(Copy, RustcEncodable, Show)]
Expand Down
4 changes: 2 additions & 2 deletions components/layout/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use servo_util::range::Range;
use servo_util::smallvec::{SmallVec, SmallVec1};
use std::collections::DList;
use std::mem;
use style::ComputedValues;
use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
use style::computed_values::{white_space};
use style::style_structs::Font as FontStyle;
use style::properties::ComputedValues;
use style::properties::style_structs::Font as FontStyle;
use std::sync::Arc;

/// A stack-allocated object for scanning an inline flow into `TextRun`-containing `TextFragment`s.
Expand Down
2 changes: 1 addition & 1 deletion components/layout/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use wrapper::{PreorderDomTraversal, PostorderDomTraversal};
use servo_util::bloom::BloomFilter;
use servo_util::opts;
use servo_util::tid::tid;
use style::TNode;
use style::node::TNode;

use std::cell::RefCell;
use std::mem;
Expand Down
4 changes: 2 additions & 2 deletions components/layout/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use script::layout_interface::{LayoutChan, TrustedNodeAddress};
use script_traits::UntrustedNodeAddress;
use std::mem;
use std::cell::{Ref, RefMut};
use style::ComputedValues;
use style::properties::ComputedValues;
use style;
use std::sync::Arc;

Expand Down Expand Up @@ -176,7 +176,7 @@ pub trait ToGfxColor {
fn to_gfx_color(&self) -> gfx::color::Color;
}

impl ToGfxColor for style::computed_values::RGBA {
impl ToGfxColor for style::values::RGBA {
fn to_gfx_color(&self) -> gfx::color::Color {
gfx::color::rgba(self.red, self.green, self.blue, self.alpha)
}
Expand Down
7 changes: 4 additions & 3 deletions components/layout/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ use std::mem;
use std::sync::mpsc::Sender;
use string_cache::{Atom, Namespace};
use style::computed_values::{content, display, white_space};
use style::{NamespaceConstraint, AttrSelector, IntegerAttribute};
use style::{LengthAttribute, PropertyDeclarationBlock, SimpleColorAttribute};
use style::{TElement, TElementAttributes, TNode, UnsignedIntegerAttribute};
use style::selectors::{NamespaceConstraint, AttrSelector};
use style::legacy::{LengthAttribute, SimpleColorAttribute, UnsignedIntegerAttribute, IntegerAttribute};
use style::node::{TElement, TElementAttributes, TNode};
use style::properties::PropertyDeclarationBlock;
use url::Url;

/// Allows some convenience methods on generic layout nodes.
Expand Down

0 comments on commit 172aed5

Please sign in to comment.