mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add function to convert NonTSPseudoClass to CSSPseudoClassType
This commit is contained in:
parent
83428ecef7
commit
fa27ac0544
4 changed files with 197 additions and 0 deletions
|
@ -254,6 +254,7 @@ mod bindings {
|
||||||
"mozilla::ServoStyleSheet",
|
"mozilla::ServoStyleSheet",
|
||||||
"mozilla::ServoElementSnapshot.*",
|
"mozilla::ServoElementSnapshot.*",
|
||||||
"mozilla::ConsumeStyleBehavior",
|
"mozilla::ConsumeStyleBehavior",
|
||||||
|
"mozilla::CSSPseudoClassType",
|
||||||
"mozilla::css::SheetParsingMode",
|
"mozilla::css::SheetParsingMode",
|
||||||
"mozilla::TraversalRootBehavior",
|
"mozilla::TraversalRootBehavior",
|
||||||
"mozilla::DisplayItemClip", // Needed because bindgen generates
|
"mozilla::DisplayItemClip", // Needed because bindgen generates
|
||||||
|
@ -472,6 +473,7 @@ mod bindings {
|
||||||
"ThreadSafeURIHolder",
|
"ThreadSafeURIHolder",
|
||||||
"ThreadSafePrincipalHolder",
|
"ThreadSafePrincipalHolder",
|
||||||
"ConsumeStyleBehavior",
|
"ConsumeStyleBehavior",
|
||||||
|
"CSSPseudoClassType",
|
||||||
"TraversalRootBehavior",
|
"TraversalRootBehavior",
|
||||||
"FontFamilyList",
|
"FontFamilyList",
|
||||||
"FontFamilyType",
|
"FontFamilyType",
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use element_state::ElementState;
|
use element_state::ElementState;
|
||||||
|
use gecko_bindings::structs::CSSPseudoClassType;
|
||||||
use selector_parser::{SelectorParser, PseudoElementCascadeType};
|
use selector_parser::{SelectorParser, PseudoElementCascadeType};
|
||||||
use selector_parser::{attr_equals_selector_is_shareable, attr_exists_selector_is_shareable};
|
use selector_parser::{attr_equals_selector_is_shareable, attr_exists_selector_is_shareable};
|
||||||
use selectors::parser::AttrSelector;
|
use selectors::parser::AttrSelector;
|
||||||
|
@ -197,6 +198,26 @@ impl NonTSPseudoClass {
|
||||||
Visited => ElementState::empty(),
|
Visited => ElementState::empty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.
|
||||||
|
pub fn to_gecko_pseudoclasstype(&self) -> Option<CSSPseudoClassType> {
|
||||||
|
use gecko_bindings::structs::CSSPseudoClassType::*;
|
||||||
|
use self::NonTSPseudoClass::*;
|
||||||
|
Some(match *self {
|
||||||
|
AnyLink => anyLink,
|
||||||
|
Link => link,
|
||||||
|
Visited => visited,
|
||||||
|
Active => active,
|
||||||
|
Focus => focus,
|
||||||
|
Fullscreen => fullscreen,
|
||||||
|
Hover => hover,
|
||||||
|
Enabled => enabled,
|
||||||
|
Disabled => disabled,
|
||||||
|
Checked => checked,
|
||||||
|
Indeterminate => indeterminate,
|
||||||
|
ReadWrite | ReadOnly => { return None; }
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The dummy struct we use to implement our selector parsing.
|
/// The dummy struct we use to implement our selector parsing.
|
||||||
|
|
|
@ -3204,6 +3204,93 @@ pub mod root {
|
||||||
root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>;
|
root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>;
|
||||||
pub type StyleShapeOutside =
|
pub type StyleShapeOutside =
|
||||||
root::mozilla::StyleShapeSource<root::mozilla::StyleShapeOutsideShapeBox>;
|
root::mozilla::StyleShapeSource<root::mozilla::StyleShapeOutsideShapeBox>;
|
||||||
|
#[repr(u8)]
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub enum CSSPseudoClassType {
|
||||||
|
empty = 0,
|
||||||
|
mozOnlyWhitespace = 1,
|
||||||
|
mozEmptyExceptChildrenWithLocalname = 2,
|
||||||
|
lang = 3,
|
||||||
|
mozBoundElement = 4,
|
||||||
|
root = 5,
|
||||||
|
any = 6,
|
||||||
|
firstChild = 7,
|
||||||
|
firstNode = 8,
|
||||||
|
lastChild = 9,
|
||||||
|
lastNode = 10,
|
||||||
|
onlyChild = 11,
|
||||||
|
firstOfType = 12,
|
||||||
|
lastOfType = 13,
|
||||||
|
onlyOfType = 14,
|
||||||
|
nthChild = 15,
|
||||||
|
nthLastChild = 16,
|
||||||
|
nthOfType = 17,
|
||||||
|
nthLastOfType = 18,
|
||||||
|
mozIsHTML = 19,
|
||||||
|
unresolved = 20,
|
||||||
|
mozNativeAnonymous = 21,
|
||||||
|
mozSystemMetric = 22,
|
||||||
|
mozLocaleDir = 23,
|
||||||
|
mozLWTheme = 24,
|
||||||
|
mozLWThemeBrightText = 25,
|
||||||
|
mozLWThemeDarkText = 26,
|
||||||
|
mozWindowInactive = 27,
|
||||||
|
mozTableBorderNonzero = 28,
|
||||||
|
mozBrowserFrame = 29,
|
||||||
|
scope = 30,
|
||||||
|
negation = 31,
|
||||||
|
dir = 32,
|
||||||
|
link = 33,
|
||||||
|
mozAnyLink = 34,
|
||||||
|
anyLink = 35,
|
||||||
|
visited = 36,
|
||||||
|
active = 37,
|
||||||
|
checked = 38,
|
||||||
|
disabled = 39,
|
||||||
|
enabled = 40,
|
||||||
|
focus = 41,
|
||||||
|
focusWithin = 42,
|
||||||
|
hover = 43,
|
||||||
|
mozDragOver = 44,
|
||||||
|
target = 45,
|
||||||
|
indeterminate = 46,
|
||||||
|
mozDevtoolsHighlighted = 47,
|
||||||
|
mozStyleeditorTransitioning = 48,
|
||||||
|
fullscreen = 49,
|
||||||
|
mozFullScreen = 50,
|
||||||
|
mozFocusRing = 51,
|
||||||
|
mozBroken = 52,
|
||||||
|
mozLoading = 53,
|
||||||
|
mozUserDisabled = 54,
|
||||||
|
mozSuppressed = 55,
|
||||||
|
mozHandlerClickToPlay = 56,
|
||||||
|
mozHandlerVulnerableUpdatable = 57,
|
||||||
|
mozHandlerVulnerableNoUpdate = 58,
|
||||||
|
mozHandlerDisabled = 59,
|
||||||
|
mozHandlerBlocked = 60,
|
||||||
|
mozHandlerCrashed = 61,
|
||||||
|
mozMathIncrementScriptLevel = 62,
|
||||||
|
required = 63,
|
||||||
|
optional = 64,
|
||||||
|
valid = 65,
|
||||||
|
invalid = 66,
|
||||||
|
inRange = 67,
|
||||||
|
outOfRange = 68,
|
||||||
|
defaultPseudo = 69,
|
||||||
|
placeholderShown = 70,
|
||||||
|
mozReadOnly = 71,
|
||||||
|
mozReadWrite = 72,
|
||||||
|
mozSubmitInvalid = 73,
|
||||||
|
mozUIInvalid = 74,
|
||||||
|
mozUIValid = 75,
|
||||||
|
mozMeterOptimum = 76,
|
||||||
|
mozMeterSubOptimum = 77,
|
||||||
|
mozMeterSubSubOptimum = 78,
|
||||||
|
mozPlaceholder = 79,
|
||||||
|
Count = 80,
|
||||||
|
NotPseudo = 81,
|
||||||
|
MAX = 82,
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn __bindgen_test_layout_template_3() {
|
fn __bindgen_test_layout_template_3() {
|
||||||
assert_eq!(::std::mem::size_of::<root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>>()
|
assert_eq!(::std::mem::size_of::<root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>>()
|
||||||
|
|
|
@ -3186,6 +3186,93 @@ pub mod root {
|
||||||
root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>;
|
root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>;
|
||||||
pub type StyleShapeOutside =
|
pub type StyleShapeOutside =
|
||||||
root::mozilla::StyleShapeSource<root::mozilla::StyleShapeOutsideShapeBox>;
|
root::mozilla::StyleShapeSource<root::mozilla::StyleShapeOutsideShapeBox>;
|
||||||
|
#[repr(u8)]
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub enum CSSPseudoClassType {
|
||||||
|
empty = 0,
|
||||||
|
mozOnlyWhitespace = 1,
|
||||||
|
mozEmptyExceptChildrenWithLocalname = 2,
|
||||||
|
lang = 3,
|
||||||
|
mozBoundElement = 4,
|
||||||
|
root = 5,
|
||||||
|
any = 6,
|
||||||
|
firstChild = 7,
|
||||||
|
firstNode = 8,
|
||||||
|
lastChild = 9,
|
||||||
|
lastNode = 10,
|
||||||
|
onlyChild = 11,
|
||||||
|
firstOfType = 12,
|
||||||
|
lastOfType = 13,
|
||||||
|
onlyOfType = 14,
|
||||||
|
nthChild = 15,
|
||||||
|
nthLastChild = 16,
|
||||||
|
nthOfType = 17,
|
||||||
|
nthLastOfType = 18,
|
||||||
|
mozIsHTML = 19,
|
||||||
|
unresolved = 20,
|
||||||
|
mozNativeAnonymous = 21,
|
||||||
|
mozSystemMetric = 22,
|
||||||
|
mozLocaleDir = 23,
|
||||||
|
mozLWTheme = 24,
|
||||||
|
mozLWThemeBrightText = 25,
|
||||||
|
mozLWThemeDarkText = 26,
|
||||||
|
mozWindowInactive = 27,
|
||||||
|
mozTableBorderNonzero = 28,
|
||||||
|
mozBrowserFrame = 29,
|
||||||
|
scope = 30,
|
||||||
|
negation = 31,
|
||||||
|
dir = 32,
|
||||||
|
link = 33,
|
||||||
|
mozAnyLink = 34,
|
||||||
|
anyLink = 35,
|
||||||
|
visited = 36,
|
||||||
|
active = 37,
|
||||||
|
checked = 38,
|
||||||
|
disabled = 39,
|
||||||
|
enabled = 40,
|
||||||
|
focus = 41,
|
||||||
|
focusWithin = 42,
|
||||||
|
hover = 43,
|
||||||
|
mozDragOver = 44,
|
||||||
|
target = 45,
|
||||||
|
indeterminate = 46,
|
||||||
|
mozDevtoolsHighlighted = 47,
|
||||||
|
mozStyleeditorTransitioning = 48,
|
||||||
|
fullscreen = 49,
|
||||||
|
mozFullScreen = 50,
|
||||||
|
mozFocusRing = 51,
|
||||||
|
mozBroken = 52,
|
||||||
|
mozLoading = 53,
|
||||||
|
mozUserDisabled = 54,
|
||||||
|
mozSuppressed = 55,
|
||||||
|
mozHandlerClickToPlay = 56,
|
||||||
|
mozHandlerVulnerableUpdatable = 57,
|
||||||
|
mozHandlerVulnerableNoUpdate = 58,
|
||||||
|
mozHandlerDisabled = 59,
|
||||||
|
mozHandlerBlocked = 60,
|
||||||
|
mozHandlerCrashed = 61,
|
||||||
|
mozMathIncrementScriptLevel = 62,
|
||||||
|
required = 63,
|
||||||
|
optional = 64,
|
||||||
|
valid = 65,
|
||||||
|
invalid = 66,
|
||||||
|
inRange = 67,
|
||||||
|
outOfRange = 68,
|
||||||
|
defaultPseudo = 69,
|
||||||
|
placeholderShown = 70,
|
||||||
|
mozReadOnly = 71,
|
||||||
|
mozReadWrite = 72,
|
||||||
|
mozSubmitInvalid = 73,
|
||||||
|
mozUIInvalid = 74,
|
||||||
|
mozUIValid = 75,
|
||||||
|
mozMeterOptimum = 76,
|
||||||
|
mozMeterSubOptimum = 77,
|
||||||
|
mozMeterSubSubOptimum = 78,
|
||||||
|
mozPlaceholder = 79,
|
||||||
|
Count = 80,
|
||||||
|
NotPseudo = 81,
|
||||||
|
MAX = 82,
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn __bindgen_test_layout_template_3() {
|
fn __bindgen_test_layout_template_3() {
|
||||||
assert_eq!(::std::mem::size_of::<root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>>()
|
assert_eq!(::std::mem::size_of::<root::mozilla::StyleShapeSource<root::mozilla::StyleGeometryBox>>()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue