Skip to content

Commit

Permalink
style: Add a simple CSSLayerRule implementation
Browse files Browse the repository at this point in the history
The specifics of how this is going to work are still getting spec'd /
discussed in w3c/csswg-drafts#6576, but this
allows DevTools to work fine and the feature to be complete enough for
Nightly experimentation (with the other in-flight patches).

Otherwise devtools crashes when trying to inspect pages that use them.

Differential Revision: https://phabricator.services.mozilla.com/D124656
  • Loading branch information
emilio authored and Loirooriol committed May 30, 2023
1 parent 0cc0499 commit 7108be8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
39 changes: 17 additions & 22 deletions components/style/gecko/arc_types.rs
Expand Up @@ -9,34 +9,26 @@
#![allow(non_snake_case, missing_docs)]

use crate::gecko::url::CssUrlData;
use crate::gecko_bindings::structs::RawServoAnimationValue;
use crate::gecko_bindings::structs::RawServoCounterStyleRule;
use crate::gecko_bindings::structs::RawServoCssUrlData;
use crate::gecko_bindings::structs::RawServoDeclarationBlock;
use crate::gecko_bindings::structs::RawServoFontFaceRule;
use crate::gecko_bindings::structs::RawServoFontFeatureValuesRule;
use crate::gecko_bindings::structs::RawServoImportRule;
use crate::gecko_bindings::structs::RawServoKeyframe;
use crate::gecko_bindings::structs::RawServoKeyframesRule;
use crate::gecko_bindings::structs::RawServoMediaList;
use crate::gecko_bindings::structs::RawServoMediaRule;
use crate::gecko_bindings::structs::RawServoMozDocumentRule;
use crate::gecko_bindings::structs::RawServoNamespaceRule;
use crate::gecko_bindings::structs::RawServoPageRule;
use crate::gecko_bindings::structs::RawServoStyleRule;
use crate::gecko_bindings::structs::RawServoStyleSheetContents;
use crate::gecko_bindings::structs::RawServoSupportsRule;
use crate::gecko_bindings::structs::ServoCssRules;
use crate::gecko_bindings::structs::{
RawServoAnimationValue, RawServoCounterStyleRule, RawServoCssUrlData,
RawServoDeclarationBlock, RawServoFontFaceRule,
RawServoFontFeatureValuesRule, RawServoImportRule, RawServoKeyframe,
RawServoKeyframesRule, RawServoLayerRule, RawServoMediaList,
RawServoMediaRule, RawServoMozDocumentRule, RawServoNamespaceRule,
RawServoPageRule, RawServoStyleRule, RawServoStyleSheetContents,
RawServoSupportsRule, ServoCssRules
};
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
use crate::media_queries::MediaList;
use crate::properties::animated_properties::AnimationValue;
use crate::properties::{ComputedValues, PropertyDeclarationBlock};
use crate::shared_lock::Locked;
use crate::stylesheets::keyframes_rule::Keyframe;
use crate::stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
use crate::stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule};
use crate::stylesheets::{NamespaceRule, PageRule};
use crate::stylesheets::{StyleRule, StylesheetContents, SupportsRule};
use crate::stylesheets::{
CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule,
DocumentRule, ImportRule, KeyframesRule, LayerRule, MediaRule,
NamespaceRule, PageRule, StyleRule, StylesheetContents, SupportsRule
};
use servo_arc::{Arc, ArcBorrow};
use std::{mem, ptr};

Expand Down Expand Up @@ -83,6 +75,9 @@ impl_arc_ffi!(Locked<Keyframe> => RawServoKeyframe
impl_arc_ffi!(Locked<KeyframesRule> => RawServoKeyframesRule
[Servo_KeyframesRule_AddRef, Servo_KeyframesRule_Release]);

impl_arc_ffi!(Locked<LayerRule> => RawServoLayerRule
[Servo_LayerRule_AddRef, Servo_LayerRule_Release]);

impl_arc_ffi!(Locked<MediaList> => RawServoMediaList
[Servo_MediaList_AddRef, Servo_MediaList_Release]);

Expand Down
5 changes: 3 additions & 2 deletions components/style/stylesheets/mod.rs
Expand Up @@ -310,10 +310,11 @@ impl CssRule {
/// https://drafts.csswg.org/cssom-1/#dom-cssrule-type
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, Eq, FromPrimitive, PartialEq)]
#[repr(u8)]
pub enum CssRuleType {
// https://drafts.csswg.org/cssom/#the-cssrule-interface
Style = 1,
Charset = 2,
// Charset = 2, // Historical
Import = 3,
Media = 4,
FontFace = 5,
Expand All @@ -322,7 +323,7 @@ pub enum CssRuleType {
Keyframes = 7,
Keyframe = 8,
// https://drafts.csswg.org/cssom/#the-cssrule-interface
Margin = 9,
// Margin = 9, // Not implemented yet.
Namespace = 10,
// https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface
CounterStyle = 11,
Expand Down

0 comments on commit 7108be8

Please sign in to comment.