mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Auto merge of #17086 - upsuper:bug1352968, r=heycam
Add CSSOM support of @import rule for stylo This is the Servo side change of [bug 1352968](https://bugzilla.mozilla.org/show_bug.cgi?id=1352968). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17086) <!-- Reviewable:end -->
This commit is contained in:
commit
085743560c
5 changed files with 66 additions and 30 deletions
|
@ -1739,10 +1739,6 @@ extern "C" {
|
|||
quirks_mode: nsCompatibility)
|
||||
-> RawServoStyleSheetStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ImportRule_GetSheet(import_rule: RawServoImportRuleBorrowed)
|
||||
-> RawServoStyleSheetStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSheet_ClearAndUpdate(stylesheet:
|
||||
RawServoStyleSheetBorrowed,
|
||||
|
@ -1873,6 +1869,20 @@ extern "C" {
|
|||
pub fn Servo_StyleRule_GetCssText(rule: RawServoStyleRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_CssRules_GetImportRuleAt(rules: ServoCssRulesBorrowed,
|
||||
index: u32, line: *mut u32,
|
||||
column: *mut u32)
|
||||
-> RawServoImportRuleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ImportRule_Debug(rule: RawServoImportRuleBorrowed,
|
||||
result: *mut nsACString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ImportRule_GetCssText(rule: RawServoImportRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Keyframe_Debug(rule: RawServoKeyframeBorrowed,
|
||||
result: *mut nsACString);
|
||||
|
@ -2000,6 +2010,14 @@ extern "C" {
|
|||
pub fn Servo_StyleRule_GetSelectorText(rule: RawServoStyleRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ImportRule_GetHref(rule: RawServoImportRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ImportRule_GetSheet(rule: RawServoImportRuleBorrowed)
|
||||
-> *const RawServoStyleSheet;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Keyframe_GetKeyText(keyframe: RawServoKeyframeBorrowed,
|
||||
result: *mut nsAString);
|
||||
|
|
|
@ -1555,11 +1555,6 @@ pub mod root {
|
|||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ImportRule {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct Rule {
|
||||
pub _base: root::nsIDOMCSSRule,
|
||||
|
@ -3349,6 +3344,11 @@ pub mod root {
|
|||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CSSImportRule {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CSSRuleList {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
|
@ -6692,6 +6692,7 @@ pub mod root {
|
|||
pub mTitle: ::nsstring::nsStringRepr,
|
||||
pub mDocument: *mut root::nsIDocument,
|
||||
pub mOwningNode: *mut root::nsINode,
|
||||
pub mOwnerRule: *mut root::mozilla::dom::CSSImportRule,
|
||||
pub mMedia: root::RefPtr<root::mozilla::dom::MediaList>,
|
||||
pub mNext: root::RefPtr<root::mozilla::StyleSheet>,
|
||||
pub mParsingMode: root::mozilla::css::SheetParsingMode,
|
||||
|
@ -6786,7 +6787,7 @@ pub mod root {
|
|||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_StyleSheet() {
|
||||
assert_eq!(::std::mem::size_of::<StyleSheet>() , 152usize , concat
|
||||
assert_eq!(::std::mem::size_of::<StyleSheet>() , 160usize , concat
|
||||
! ( "Size of: " , stringify ! ( StyleSheet ) ));
|
||||
assert_eq! (::std::mem::align_of::<StyleSheet>() , 8usize , concat
|
||||
! ( "Alignment of " , stringify ! ( StyleSheet ) ));
|
||||
|
|
|
@ -1479,11 +1479,6 @@ pub mod root {
|
|||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ImportRule {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct Rule {
|
||||
pub _base: root::nsIDOMCSSRule,
|
||||
|
@ -3254,6 +3249,11 @@ pub mod root {
|
|||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CSSImportRule {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CSSRuleList {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
|
@ -6562,6 +6562,7 @@ pub mod root {
|
|||
pub mTitle: ::nsstring::nsStringRepr,
|
||||
pub mDocument: *mut root::nsIDocument,
|
||||
pub mOwningNode: *mut root::nsINode,
|
||||
pub mOwnerRule: *mut root::mozilla::dom::CSSImportRule,
|
||||
pub mMedia: root::RefPtr<root::mozilla::dom::MediaList>,
|
||||
pub mNext: root::RefPtr<root::mozilla::StyleSheet>,
|
||||
pub mParsingMode: root::mozilla::css::SheetParsingMode,
|
||||
|
@ -6656,7 +6657,7 @@ pub mod root {
|
|||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_StyleSheet() {
|
||||
assert_eq!(::std::mem::size_of::<StyleSheet>() , 144usize , concat
|
||||
assert_eq!(::std::mem::size_of::<StyleSheet>() , 152usize , concat
|
||||
! ( "Size of: " , stringify ! ( StyleSheet ) ));
|
||||
assert_eq! (::std::mem::align_of::<StyleSheet>() , 8usize , concat
|
||||
! ( "Alignment of " , stringify ! ( StyleSheet ) ));
|
||||
|
|
|
@ -633,6 +633,9 @@ pub struct ImportRule {
|
|||
/// It contains an empty list of rules and namespace set that is updated
|
||||
/// when it loads.
|
||||
pub stylesheet: Arc<Stylesheet>,
|
||||
|
||||
/// The line and column of the rule's source code.
|
||||
pub source_location: SourceLocation,
|
||||
}
|
||||
|
||||
impl Clone for ImportRule {
|
||||
|
@ -641,6 +644,7 @@ impl Clone for ImportRule {
|
|||
ImportRule {
|
||||
url: self.url.clone(),
|
||||
stylesheet: Arc::new(stylesheet.clone()),
|
||||
source_location: self.source_location.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1530,6 +1534,8 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
|
|||
|
||||
fn parse_prelude(&mut self, name: &str, input: &mut Parser)
|
||||
-> Result<AtRuleType<AtRulePrelude, CssRule>, ()> {
|
||||
let location = get_location_with_offset(input.current_source_location(),
|
||||
self.context.line_number_offset);
|
||||
match_ignore_ascii_case! { name,
|
||||
"import" => {
|
||||
if self.state.get() <= State::Imports {
|
||||
|
@ -1561,7 +1567,8 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
|
|||
dirty_on_viewport_size_change: AtomicBool::new(false),
|
||||
disabled: AtomicBool::new(false),
|
||||
quirks_mode: self.context.quirks_mode,
|
||||
})
|
||||
}),
|
||||
source_location: location,
|
||||
}
|
||||
}, &mut |import_rule| {
|
||||
Arc::new(self.shared_lock.wrap(import_rule))
|
||||
|
@ -1576,9 +1583,6 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
|
|||
if self.state.get() <= State::Namespaces {
|
||||
self.state.set(State::Namespaces);
|
||||
|
||||
let location = get_location_with_offset(input.current_source_location(),
|
||||
self.context.line_number_offset);
|
||||
|
||||
let prefix_result = input.try(|input| input.expect_ident());
|
||||
let url = Namespace::from(try!(input.expect_url_or_string()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue