Move UA stylesheet to src/components/style

This commit is contained in:
Simon Sapin 2014-08-12 16:57:40 +01:00
parent 7e635946c2
commit 06efa195e8
6 changed files with 14 additions and 25 deletions

View file

@ -348,7 +348,7 @@ RFLAGS_style = $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components
MAKO_ZIP = $(S)src/components/style/Mako-0.9.1.zip
MAKO_style = $(S)src/components/style/properties/mod.rs
MAKO_SRC_style = $(MAKO_style).mako
SRC_style = $(call rwildcard,$(S)src/components/style/,*.rs) $(call rwildcard,$(S)src/compontents/style/properties/*.rs) $(MAKO_style)
SRC_style = $(call rwildcard,$(S)src/components/style/,*.rs) $(call rwildcard,$(S)src/compontents/style/properties/*.rs) $(MAKO_style) $(S)src/components/style/user-agent.css
CRATE_style = $(S)src/components/style/style.rs
DONE_style = $(B)src/components/style/libstyle.dummy
@ -364,7 +364,7 @@ DEPS_layout_traits = $(CRATE_layout_traits) $(SRC_layout_traits) $(DONE_script_t
RFLAGS_layout = $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros -L$(B)src/components/layout_traits -L $(B)src/components/script_traits
SRC_layout = $(call rwildcard,$(S)src/components/layout/,*.rs) $(S)src/components/layout/css/user-agent.css
SRC_layout = $(call rwildcard,$(S)src/components/layout/,*.rs)
CRATE_layout = $(S)src/components/layout/layout.rs
DONE_layout = $(B)src/components/layout/liblayout.dummy

View file

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
use style::{Stylesheet, Stylist, UserAgentOrigin, with_errors_silenced};
use url::Url;
pub fn new_stylist() -> Stylist {
let mut stylist = Stylist::new();
let ua_stylesheet = Stylesheet::from_bytes(
include_bin!("user-agent.css"),
Url::parse("chrome:///user-agent.css").unwrap(),
None,
None);
stylist.add_stylesheet(ua_stylesheet, UserAgentOrigin);
stylist
}

View file

@ -62,7 +62,6 @@ pub mod extra;
pub mod css {
mod node_util;
pub mod select;
pub mod matching;
pub mod node_style;
}

View file

@ -6,7 +6,6 @@
//! rendered.
use css::matching::{ApplicableDeclarations, MatchMethods};
use css::select::new_stylist;
use css::node_style::StyledNode;
use construct::{FlowConstructionResult, NoConstructionResult};
use context::{LayoutContext, SharedLayoutContext};
@ -347,7 +346,7 @@ impl LayoutTask {
screen_size: screen_size,
display_list: None,
stylist: box new_stylist(),
stylist: box Stylist::new(),
parallel_traversal: parallel_traversal,
time_profiler_chan: time_profiler_chan,
opts: opts.clone(),

View file

@ -7,6 +7,8 @@ use std::ascii::StrAsciiExt;
use std::num::div_rem;
use sync::Arc;
use url::Url;
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::smallvec::VecLike;
@ -287,12 +289,19 @@ pub struct Stylist {
impl Stylist {
#[inline]
pub fn new() -> Stylist {
Stylist {
let mut stylist = Stylist {
element_map: PerPseudoElementSelectorMap::new(),
before_map: PerPseudoElementSelectorMap::new(),
after_map: PerPseudoElementSelectorMap::new(),
rules_source_order: 0u,
}
};
let ua_stylesheet = Stylesheet::from_bytes(
include_bin!("user-agent.css"),
Url::parse("chrome:///user-agent.css").unwrap(),
None,
None);
stylist.add_stylesheet(ua_stylesheet, UserAgentOrigin);
stylist
}
pub fn add_stylesheet(&mut self, stylesheet: Stylesheet, origin: StylesheetOrigin) {