Add stylo FFI for CSSRuleList

This commit is contained in:
Xidorn Quan 2016-11-23 10:30:48 +11:00
parent 210b1be1d0
commit 9d4ab0d3e9
5 changed files with 105 additions and 4 deletions

View file

@ -11,13 +11,13 @@
use app_units::Au;
use gecko::values::{convert_rgba_to_nscolor, StyleCoordHelpers};
use gecko_bindings::bindings::{Gecko_CreateGradient, Gecko_SetGradientImageValue, Gecko_SetUrlImageValue};
use gecko_bindings::bindings::{RawServoStyleSheet, RawServoDeclarationBlock, ServoComputedValues};
use gecko_bindings::bindings::{RawServoStyleSheet, RawServoDeclarationBlock, ServoComputedValues, ServoCssRules};
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nsStyleImage};
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordDataMut};
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI};
use parking_lot::RwLock;
use properties::{ComputedValues, PropertyDeclarationBlock};
use stylesheets::Stylesheet;
use stylesheets::{CssRule, Stylesheet};
use values::computed::{CalcLengthOrPercentage, Gradient, Image, LengthOrPercentage, LengthOrPercentageOrAuto};
unsafe impl HasFFI for Stylesheet {
@ -34,6 +34,11 @@ unsafe impl HasFFI for RwLock<PropertyDeclarationBlock> {
}
unsafe impl HasArcFFI for RwLock<PropertyDeclarationBlock> {}
unsafe impl HasFFI for RwLock<Vec<CssRule>> {
type FFIType = ServoCssRules;
}
unsafe impl HasArcFFI for RwLock<Vec<CssRule>> {}
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
fn from(other: CalcLengthOrPercentage) -> nsStyleCoord_CalcValue {
let has_percentage = other.percentage.is_some();