mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add insertRule/deleteRule support for stylo
This commit is contained in:
parent
22c8df150a
commit
bddd467c0e
4 changed files with 54 additions and 3 deletions
|
@ -277,7 +277,6 @@ COMPILATION_TARGETS = {
|
|||
"StyleBasicShape",
|
||||
"StyleBasicShapeType",
|
||||
"StyleClipPath",
|
||||
"nscoord",
|
||||
"nsCSSKeyword",
|
||||
"nsCSSShadowArray",
|
||||
"nsCSSValue",
|
||||
|
@ -331,6 +330,8 @@ COMPILATION_TARGETS = {
|
|||
"nsStyleVariables",
|
||||
"nsStyleVisibility",
|
||||
"nsStyleXUL",
|
||||
"nscoord",
|
||||
"nsresult",
|
||||
],
|
||||
"array_types": {
|
||||
"uintptr_t": "usize",
|
||||
|
|
|
@ -14,11 +14,12 @@ use gecko_bindings::bindings::{Gecko_CreateGradient, Gecko_SetGradientImageValue
|
|||
use gecko_bindings::bindings::{RawServoStyleSheet, RawServoDeclarationBlock, RawServoStyleRule};
|
||||
use gecko_bindings::bindings::{ServoComputedValues, ServoCssRules};
|
||||
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nsStyleImage};
|
||||
use gecko_bindings::structs::nsresult;
|
||||
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::{CssRules, Stylesheet, StyleRule};
|
||||
use stylesheets::{CssRules, RulesMutateError, Stylesheet, StyleRule};
|
||||
use values::computed::{CalcLengthOrPercentage, Gradient, Image, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
|
||||
unsafe impl HasFFI for Stylesheet {
|
||||
|
@ -497,3 +498,14 @@ pub mod basic_shape {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<RulesMutateError> for nsresult {
|
||||
fn from(other: RulesMutateError) -> Self {
|
||||
match other {
|
||||
RulesMutateError::Syntax => nsresult::NS_ERROR_DOM_SYNTAX_ERR,
|
||||
RulesMutateError::IndexSize => nsresult::NS_ERROR_DOM_INDEX_SIZE_ERR,
|
||||
RulesMutateError::HierarchyRequest => nsresult::NS_ERROR_DOM_HIERARCHY_REQUEST_ERR,
|
||||
RulesMutateError::InvalidState => nsresult::NS_ERROR_DOM_INVALID_STATE_ERR,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@ use gecko_bindings::structs::SheetParsingMode;
|
|||
use gecko_bindings::structs::StyleBasicShape;
|
||||
use gecko_bindings::structs::StyleBasicShapeType;
|
||||
use gecko_bindings::structs::StyleClipPath;
|
||||
use gecko_bindings::structs::nscoord;
|
||||
use gecko_bindings::structs::nsCSSKeyword;
|
||||
use gecko_bindings::structs::nsCSSShadowArray;
|
||||
use gecko_bindings::structs::nsCSSValue;
|
||||
|
@ -200,6 +199,8 @@ unsafe impl Sync for nsStyleVisibility {}
|
|||
use gecko_bindings::structs::nsStyleXUL;
|
||||
unsafe impl Send for nsStyleXUL {}
|
||||
unsafe impl Sync for nsStyleXUL {}
|
||||
use gecko_bindings::structs::nscoord;
|
||||
use gecko_bindings::structs::nsresult;
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1025,6 +1026,17 @@ extern "C" {
|
|||
index: u32)
|
||||
-> RawServoStyleRuleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_CssRules_InsertRule(rules: ServoCssRulesBorrowed,
|
||||
sheet: RawServoStyleSheetBorrowed,
|
||||
rule: *const nsACString_internal,
|
||||
index: u32, nested: bool,
|
||||
rule_type: *mut u16) -> nsresult;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_CssRules_DeleteRule(rules: ServoCssRulesBorrowed, index: u32)
|
||||
-> nsresult;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleRule_Debug(rule: RawServoStyleRuleBorrowed,
|
||||
result: *mut nsACString_internal);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue