mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Stylo: Bug 1350175 - Support getting line / column number of CSS rules
Fix font_cache_thread test
This commit is contained in:
parent
58253f545b
commit
bc156cfe1c
12 changed files with 151 additions and 56 deletions
|
@ -10,6 +10,7 @@ path = "lib.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
cssparser = "0.13.3"
|
||||
gfx = {path = "../../../components/gfx"}
|
||||
ipc-channel = "0.7"
|
||||
style = {path = "../../../components/style"}
|
||||
|
|
|
@ -2,6 +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/. */
|
||||
|
||||
use cssparser::SourceLocation;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::ipc;
|
||||
use style::computed_values::font_family::FamilyName;
|
||||
|
@ -23,6 +24,10 @@ fn test_local_web_font() {
|
|||
let font_face_rule = FontFaceRuleData {
|
||||
family: Some(family_name.clone()),
|
||||
sources: Some(vec![Source::Local(variant_name)]),
|
||||
source_location: SourceLocation {
|
||||
line: 0,
|
||||
column: 0,
|
||||
},
|
||||
};
|
||||
|
||||
font_cache_thread.add_web_font(
|
||||
|
|
|
@ -2,6 +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/. */
|
||||
|
||||
extern crate cssparser;
|
||||
extern crate gfx;
|
||||
extern crate ipc_channel;
|
||||
extern crate style;
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
use cssparser::{self, Parser as CssParser, SourcePosition};
|
||||
use cssparser::{self, Parser as CssParser, SourcePosition, SourceLocation};
|
||||
use html5ever::{Namespace as NsAtom};
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use parking_lot::RwLock;
|
||||
|
@ -82,7 +82,11 @@ fn test_parse_stylesheet() {
|
|||
rules: CssRules::new(vec![
|
||||
CssRule::Namespace(Arc::new(stylesheet.shared_lock.wrap(NamespaceRule {
|
||||
prefix: None,
|
||||
url: NsAtom::from("http://www.w3.org/1999/xhtml")
|
||||
url: NsAtom::from("http://www.w3.org/1999/xhtml"),
|
||||
source_location: SourceLocation {
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
}))),
|
||||
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
|
||||
selectors: SelectorList(vec![
|
||||
|
@ -116,6 +120,10 @@ fn test_parse_stylesheet() {
|
|||
DeclaredValueOwned::CSSWideKeyword(CSSWideKeyword::Inherit)),
|
||||
Importance::Important),
|
||||
]))),
|
||||
source_location: SourceLocation {
|
||||
line: 3,
|
||||
column: 31,
|
||||
},
|
||||
}))),
|
||||
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
|
||||
selectors: SelectorList(vec![
|
||||
|
@ -152,6 +160,10 @@ fn test_parse_stylesheet() {
|
|||
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::block),
|
||||
Importance::Normal),
|
||||
]))),
|
||||
source_location: SourceLocation {
|
||||
line: 11,
|
||||
column: 27,
|
||||
},
|
||||
}))),
|
||||
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
|
||||
selectors: SelectorList(vec![
|
||||
|
@ -220,6 +232,10 @@ fn test_parse_stylesheet() {
|
|||
::get_initial_specified_value()])),
|
||||
Importance::Normal),
|
||||
]))),
|
||||
source_location: SourceLocation {
|
||||
line: 15,
|
||||
column: 20,
|
||||
},
|
||||
}))),
|
||||
CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule {
|
||||
name: KeyframesName::Ident(CustomIdent("foo".into())),
|
||||
|
|
|
@ -2,6 +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/. */
|
||||
|
||||
use cssparser::SourceLocation;
|
||||
use html5ever::LocalName;
|
||||
use selectors::parser::LocalName as LocalNameSelector;
|
||||
use selectors::parser::Selector;
|
||||
|
@ -32,6 +33,10 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
|
|||
longhands::display::SpecifiedValue::block),
|
||||
Importance::Normal
|
||||
))),
|
||||
source_location: SourceLocation {
|
||||
line: 0,
|
||||
column: 0,
|
||||
},
|
||||
}));
|
||||
|
||||
let guard = shared_lock.read();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue