Auto merge of #16642 - upsuper:bug1355394, r=heycam

stylo: Implement access to CSSSupportsRule

Servo side change of [bug 1355394](https://bugzilla.mozilla.org/show_bug.cgi?id=1355394).

<!-- 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/16642)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-28 05:11:04 -05:00 committed by GitHub
commit 22747e2763
3 changed files with 78 additions and 15 deletions

View file

@ -9,7 +9,7 @@
#![allow(non_snake_case, missing_docs)]
use gecko_bindings::bindings::{RawServoMediaList, RawServoMediaRule, RawServoNamespaceRule, RawServoPageRule};
use gecko_bindings::bindings::{RawServoStyleSheet, RawServoImportRule};
use gecko_bindings::bindings::{RawServoStyleSheet, RawServoImportRule, RawServoSupportsRule};
use gecko_bindings::bindings::{ServoComputedValues, ServoCssRules};
use gecko_bindings::structs::{RawServoAnimationValue, RawServoAnimationValueMap};
use gecko_bindings::structs::{RawServoDeclarationBlock, RawServoStyleRule};
@ -19,7 +19,8 @@ use parking_lot::RwLock;
use properties::{ComputedValues, PropertyDeclarationBlock};
use properties::animated_properties::{AnimationValue, AnimationValueMap};
use shared_lock::Locked;
use stylesheets::{CssRules, Stylesheet, StyleRule, ImportRule, MediaRule, NamespaceRule, PageRule};
use stylesheets::{CssRules, Stylesheet, StyleRule, ImportRule, MediaRule};
use stylesheets::{NamespaceRule, PageRule, SupportsRule};
macro_rules! impl_arc_ffi {
($servo_type:ty => $gecko_type:ty [$addref:ident, $release:ident]) => {
@ -75,3 +76,6 @@ impl_arc_ffi!(Locked<NamespaceRule> => RawServoNamespaceRule
impl_arc_ffi!(Locked<PageRule> => RawServoPageRule
[Servo_PageRule_AddRef, Servo_PageRule_Release]);
impl_arc_ffi!(Locked<SupportsRule> => RawServoSupportsRule
[Servo_SupportsRule_AddRef, Servo_SupportsRule_Release]);

View file

@ -244,6 +244,11 @@ pub type RawServoPageRuleBorrowed<'a> = &'a RawServoPageRule;
pub type RawServoPageRuleBorrowedOrNull<'a> = Option<&'a RawServoPageRule>;
enum RawServoPageRuleVoid { }
pub struct RawServoPageRule(RawServoPageRuleVoid);
pub type RawServoSupportsRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoSupportsRule>;
pub type RawServoSupportsRuleBorrowed<'a> = &'a RawServoSupportsRule;
pub type RawServoSupportsRuleBorrowedOrNull<'a> = Option<&'a RawServoSupportsRule>;
enum RawServoSupportsRuleVoid { }
pub struct RawServoSupportsRule(RawServoSupportsRuleVoid);
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
@ -399,6 +404,12 @@ extern "C" {
extern "C" {
pub fn Servo_PageRule_Release(ptr: RawServoPageRuleBorrowed);
}
extern "C" {
pub fn Servo_SupportsRule_AddRef(ptr: RawServoSupportsRuleBorrowed);
}
extern "C" {
pub fn Servo_SupportsRule_Release(ptr: RawServoSupportsRuleBorrowed);
}
extern "C" {
pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned);
}
@ -1665,6 +1676,10 @@ extern "C" {
pub fn Servo_MediaRule_GetCssText(rule: RawServoMediaRuleBorrowed,
result: *mut nsAString);
}
extern "C" {
pub fn Servo_MediaRule_GetRules(rule: RawServoMediaRuleBorrowed)
-> ServoCssRulesStrong;
}
extern "C" {
pub fn Servo_CssRules_GetNamespaceRuleAt(rules: ServoCssRulesBorrowed,
index: u32)
@ -1690,6 +1705,23 @@ extern "C" {
pub fn Servo_PageRule_GetCssText(rule: RawServoPageRuleBorrowed,
result: *mut nsAString);
}
extern "C" {
pub fn Servo_CssRules_GetSupportsRuleAt(rules: ServoCssRulesBorrowed,
index: u32)
-> RawServoSupportsRuleStrong;
}
extern "C" {
pub fn Servo_SupportsRule_Debug(rule: RawServoSupportsRuleBorrowed,
result: *mut nsACString);
}
extern "C" {
pub fn Servo_SupportsRule_GetCssText(rule: RawServoSupportsRuleBorrowed,
result: *mut nsAString);
}
extern "C" {
pub fn Servo_SupportsRule_GetRules(rule: RawServoSupportsRuleBorrowed)
-> ServoCssRulesStrong;
}
extern "C" {
pub fn Servo_CssRules_GetFontFaceRuleAt(rules: ServoCssRulesBorrowed,
index: u32)
@ -1712,10 +1744,6 @@ extern "C" {
pub fn Servo_MediaRule_GetMedia(rule: RawServoMediaRuleBorrowed)
-> RawServoMediaListStrong;
}
extern "C" {
pub fn Servo_MediaRule_GetRules(rule: RawServoMediaRuleBorrowed)
-> ServoCssRulesStrong;
}
extern "C" {
pub fn Servo_NamespaceRule_GetPrefix(rule: RawServoNamespaceRuleBorrowed)
-> *mut nsIAtom;
@ -1733,6 +1761,11 @@ extern "C" {
declarations:
RawServoDeclarationBlockBorrowed);
}
extern "C" {
pub fn Servo_SupportsRule_GetConditionText(rule:
RawServoSupportsRuleBorrowed,
result: *mut nsAString);
}
extern "C" {
pub fn Servo_ParseProperty(property: nsCSSPropertyID,
value: *const nsACString,