Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement access to CSSStyleRule for stylo #14330

Merged
merged 5 commits into from Nov 24, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add stylo FFI for cssText getters of CSSStyleRule

  • Loading branch information
upsuper committed Nov 23, 2016
commit 66669e48effa1e3d099c7a94fbf6a98f07c0de21
@@ -1010,6 +1010,14 @@ extern "C" {
index: u32)
-> RawServoStyleRuleStrong;
}
extern "C" {
pub fn Servo_StyleRule_GetCssText(rule: RawServoStyleRuleBorrowed,
result: *mut nsAString_internal);
}
extern "C" {
pub fn Servo_StyleRule_GetSelectorText(rule: RawServoStyleRuleBorrowed,
result: *mut nsAString_internal);
}
extern "C" {
pub fn Servo_ParseProperty(property: *const nsACString_internal,
value: *const nsACString_internal,
@@ -4,6 +4,7 @@

use app_units::Au;
use cssparser::Parser;
use cssparser::ToCss as ParserToCss;
use env_logger;
use euclid::Size2D;
use parking_lot::RwLock;
@@ -323,6 +324,18 @@ pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> ()
unsafe { RwLock::<StyleRule>::release(rule) };
}

#[no_mangle]
pub extern "C" fn Servo_StyleRule_GetCssText(rule: RawServoStyleRuleBorrowed, result: *mut nsAString) -> () {
let rule = RwLock::<StyleRule>::as_arc(&rule);
rule.read().to_css(unsafe { result.as_mut().unwrap() }).unwrap();
}

#[no_mangle]
pub extern "C" fn Servo_StyleRule_GetSelectorText(rule: RawServoStyleRuleBorrowed, result: *mut nsAString) -> () {
let rule = RwLock::<StyleRule>::as_arc(&rule);
rule.read().selectors.to_css(unsafe { result.as_mut().unwrap() }).unwrap();
}

#[no_mangle]
pub extern "C" fn Servo_ComputedValues_Get(node: RawGeckoNodeBorrowed)
-> ServoComputedValuesStrong {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.