mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
43cf493832
commit
25896c384f
3 changed files with 70 additions and 3 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
#![allow(non_snake_case, missing_docs)]
|
||||
|
||||
use gecko_bindings::bindings::{RawServoImportRule, RawServoSupportsRule};
|
||||
use gecko_bindings::bindings::{RawServoFontFeatureValuesRule, RawServoImportRule, RawServoSupportsRule};
|
||||
use gecko_bindings::bindings::{RawServoKeyframe, RawServoKeyframesRule};
|
||||
use gecko_bindings::bindings::{RawServoMediaRule, RawServoNamespaceRule, RawServoPageRule};
|
||||
use gecko_bindings::bindings::{RawServoRuleNode, RawServoRuleNodeStrong, RawServoDocumentRule};
|
||||
|
@ -24,7 +24,7 @@ use servo_arc::{Arc, ArcBorrow};
|
|||
use shared_lock::Locked;
|
||||
use std::{mem, ptr};
|
||||
use stylesheets::{CssRules, StylesheetContents, StyleRule, ImportRule, KeyframesRule, MediaRule};
|
||||
use stylesheets::{NamespaceRule, PageRule, SupportsRule, DocumentRule};
|
||||
use stylesheets::{FontFeatureValuesRule, NamespaceRule, PageRule, SupportsRule, DocumentRule};
|
||||
use stylesheets::keyframes_rule::Keyframe;
|
||||
|
||||
macro_rules! impl_arc_ffi {
|
||||
|
@ -88,6 +88,9 @@ impl_arc_ffi!(Locked<SupportsRule> => RawServoSupportsRule
|
|||
impl_arc_ffi!(Locked<DocumentRule> => RawServoDocumentRule
|
||||
[Servo_DocumentRule_AddRef, Servo_DocumentRule_Release]);
|
||||
|
||||
impl_arc_ffi!(Locked<FontFeatureValuesRule> => RawServoFontFeatureValuesRule
|
||||
[Servo_FontFeatureValuesRule_AddRef, Servo_FontFeatureValuesRule_Release]);
|
||||
|
||||
// RuleNode is a Arc-like type but it does not use Arc.
|
||||
|
||||
impl StrongRuleNode {
|
||||
|
|
|
@ -378,6 +378,11 @@ pub type RawServoDocumentRuleBorrowed<'a> = &'a RawServoDocumentRule;
|
|||
pub type RawServoDocumentRuleBorrowedOrNull<'a> = Option<&'a RawServoDocumentRule>;
|
||||
enum RawServoDocumentRuleVoid { }
|
||||
pub struct RawServoDocumentRule(RawServoDocumentRuleVoid);
|
||||
pub type RawServoFontFeatureValuesRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoFontFeatureValuesRule>;
|
||||
pub type RawServoFontFeatureValuesRuleBorrowed<'a> = &'a RawServoFontFeatureValuesRule;
|
||||
pub type RawServoFontFeatureValuesRuleBorrowedOrNull<'a> = Option<&'a RawServoFontFeatureValuesRule>;
|
||||
enum RawServoFontFeatureValuesRuleVoid { }
|
||||
pub struct RawServoFontFeatureValuesRule(RawServoFontFeatureValuesRuleVoid);
|
||||
pub type RawServoRuleNodeStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoRuleNode>;
|
||||
pub type RawServoRuleNodeBorrowed<'a> = &'a RawServoRuleNode;
|
||||
pub type RawServoRuleNodeBorrowedOrNull<'a> = Option<&'a RawServoRuleNode>;
|
||||
|
@ -480,6 +485,14 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_DocumentRule_Release(ptr: RawServoDocumentRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_FontFeatureValuesRule_AddRef(ptr:
|
||||
RawServoFontFeatureValuesRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_FontFeatureValuesRule_Release(ptr:
|
||||
RawServoFontFeatureValuesRuleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_RuleNode_AddRef(ptr: RawServoRuleNodeBorrowed);
|
||||
}
|
||||
|
@ -2159,6 +2172,24 @@ extern "C" {
|
|||
pub fn Servo_DocumentRule_GetRules(rule: RawServoDocumentRuleBorrowed)
|
||||
-> ServoCssRulesStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_CssRules_GetFontFeatureValuesRuleAt(rules:
|
||||
ServoCssRulesBorrowed,
|
||||
index: u32,
|
||||
line: *mut u32,
|
||||
column: *mut u32)
|
||||
-> RawServoFontFeatureValuesRuleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_FontFeatureValuesRule_Debug(rule:
|
||||
RawServoFontFeatureValuesRuleBorrowed,
|
||||
result: *mut nsACString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_FontFeatureValuesRule_GetCssText(rule:
|
||||
RawServoFontFeatureValuesRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_CssRules_GetFontFaceRuleAt(rules: ServoCssRulesBorrowed,
|
||||
index: u32)
|
||||
|
@ -2296,6 +2327,16 @@ extern "C" {
|
|||
RawServoDocumentRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_FontFeatureValuesRule_GetFontFamily(rule:
|
||||
RawServoFontFeatureValuesRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_FontFeatureValuesRule_GetValueText(rule:
|
||||
RawServoFontFeatureValuesRuleBorrowed,
|
||||
result: *mut nsAString);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ParseProperty(property: nsCSSPropertyID,
|
||||
value: *const nsACString,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue