Use the new style system

Credits to:
    Deokjin Kim
    Ilyong Cho
    Jaeman Park
    Junyoung Cho
    Ryan Choi
    Sangeun Kim
    Yongjin Kim
    Youngmin Yoo
    Youngsoo Son
This commit is contained in:
Seo Sanghyeon 2013-10-21 22:56:44 +09:00
parent f3f6e62f7f
commit b2431912d3
28 changed files with 353 additions and 494 deletions

View file

@ -13,7 +13,7 @@ use dom::document::AbstractDocument;
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};
use newcss::stylesheet::Stylesheet;
use style;
use servo_util::tree::{TreeNodeRef, ElementLike};
use js::jsapi::{JSContext, JSObject};
@ -27,7 +27,7 @@ pub struct Element {
tag_name: ~str, // TODO: This should be an atom, not a ~str.
attrs: HashMap<~str, ~str>,
attrs_list: ~[~str], // store an order of attributes.
style_attribute: Option<Stylesheet>,
style_attribute: Option<style::PropertyDeclarationBlock>,
}
impl Reflectable for Element {
@ -173,10 +173,8 @@ impl<'self> Element {
});
if "style" == name {
self.style_attribute = Some(
Stylesheet::from_attribute(
FromStr::from_str("http://www.example.com/").unwrap(),
null_str_as_empty_ref(raw_value)));
self.style_attribute = Some(style::parse_style_attribute(
null_str_as_empty_ref(raw_value)));
}
// TODO: update owner document's id hashmap for `document.getElementById()`

View file

@ -25,7 +25,8 @@ use std::unstable::raw::Box;
use extra::arc::Arc;
use js::jsapi::{JSObject, JSContext};
use netsurfcss::util::VoidPtrLike;
use newcss::complete::CompleteSelectResults;
use style::ComputedValues;
use style::properties::PropertyDeclaration;
use servo_util::tree::{TreeNode, TreeNodeRef, TreeNodeRefAsElement};
use servo_util::range::Range;
use gfx::display_list::DisplayList;
@ -904,8 +905,11 @@ pub struct DisplayBoxes {
/// Data that layout associates with a node.
pub struct LayoutData {
/// The results of CSS matching for this node.
applicable_declarations: ~[@[PropertyDeclaration]],
/// The results of CSS styling for this node.
style: Option<CompleteSelectResults>,
style: Option<ComputedValues>,
/// Description of how to account for recent style changes.
restyle_damage: Option<int>,
@ -919,6 +923,7 @@ impl LayoutData {
/// Creates new layout data.
pub fn new() -> LayoutData {
LayoutData {
applicable_declarations: ~[],
style: None,
restyle_damage: None,
boxes: DisplayBoxes { display_list: None, range: None },