stylo: Create ServoFontFeatureValuesRule and bind servo data

Add ServoFontFeatureValuesRule for CSSOM representation of
@font-feature-values rule and wire up with bindings.
This commit is contained in:
Nazım Can Altınova 2017-07-27 11:20:19 -07:00
parent 43cf493832
commit 25896c384f
3 changed files with 70 additions and 3 deletions

View file

@ -31,6 +31,7 @@ use style::gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoElementBo
use style::gecko_bindings::bindings::{RawGeckoKeyframeListBorrowed, RawGeckoKeyframeListBorrowedMut};
use style::gecko_bindings::bindings::{RawServoDeclarationBlockBorrowed, RawServoDeclarationBlockStrong};
use style::gecko_bindings::bindings::{RawServoDocumentRule, RawServoDocumentRuleBorrowed};
use style::gecko_bindings::bindings::{RawServoFontFeatureValuesRule, RawServoFontFeatureValuesRuleBorrowed};
use style::gecko_bindings::bindings::{RawServoImportRule, RawServoImportRuleBorrowed};
use style::gecko_bindings::bindings::{RawServoKeyframe, RawServoKeyframeBorrowed, RawServoKeyframeStrong};
use style::gecko_bindings::bindings::{RawServoKeyframesRule, RawServoKeyframesRuleBorrowed};
@ -107,7 +108,7 @@ use style::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard
use style::string_cache::Atom;
use style::style_adjuster::StyleAdjuster;
use style::stylesheets::{CssRule, CssRules, CssRuleType, CssRulesHelpers, DocumentRule};
use style::stylesheets::{ImportRule, KeyframesRule, MallocSizeOfWithGuard, MediaRule};
use style::stylesheets::{FontFeatureValuesRule, ImportRule, KeyframesRule, MallocSizeOfWithGuard, MediaRule};
use style::stylesheets::{NamespaceRule, Origin, PageRule, StyleRule, SupportsRule};
use style::stylesheets::StylesheetContents;
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
@ -1233,6 +1234,12 @@ impl_group_rule_funcs! { (Document, DocumentRule, RawServoDocumentRule),
to_css: Servo_DocumentRule_GetCssText,
}
impl_basic_rule_funcs! { (FontFeatureValues, FontFeatureValuesRule, RawServoFontFeatureValuesRule),
getter: Servo_CssRules_GetFontFeatureValuesRuleAt,
debug: Servo_FontFeatureValuesRule_Debug,
to_css: Servo_FontFeatureValuesRule_GetCssText,
}
macro_rules! impl_getter_for_embedded_rule {
($getter:ident: $name:ident -> $ty:ty) => {
#[no_mangle]
@ -1523,6 +1530,22 @@ pub extern "C" fn Servo_DocumentRule_GetConditionText(rule: RawServoDocumentRule
})
}
#[no_mangle]
pub extern "C" fn Servo_FontFeatureValuesRule_GetFontFamily(rule: RawServoFontFeatureValuesRuleBorrowed,
result: *mut nsAString) {
read_locked_arc(rule, |rule: &FontFeatureValuesRule| {
rule.font_family_to_css(unsafe { result.as_mut().unwrap() }).unwrap();
})
}
#[no_mangle]
pub extern "C" fn Servo_FontFeatureValuesRule_GetValueText(rule: RawServoFontFeatureValuesRuleBorrowed,
result: *mut nsAString) {
read_locked_arc(rule, |rule: &FontFeatureValuesRule| {
rule.value_to_css(unsafe { result.as_mut().unwrap() }).unwrap();
})
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoStyleContextBorrowedOrNull,
pseudo_tag: *mut nsIAtom,