mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add remaining keyword values of -moz-user-select (fixes #15197)
This commit is contained in:
parent
7cd4c69c40
commit
3d5b607ba5
4 changed files with 37 additions and 3 deletions
|
@ -70,7 +70,7 @@ class Keyword(object):
|
||||||
moz_stripped = value.replace("-moz-", '') if self.gecko_strip_moz_prefix else value.replace("-moz-", 'moz-')
|
moz_stripped = value.replace("-moz-", '') if self.gecko_strip_moz_prefix else value.replace("-moz-", 'moz-')
|
||||||
mapped = self.consts_map.get(value)
|
mapped = self.consts_map.get(value)
|
||||||
if self.gecko_enum_prefix:
|
if self.gecko_enum_prefix:
|
||||||
parts = moz_stripped.split('-')
|
parts = moz_stripped.replace('-', '_').split('_')
|
||||||
parts = mapped if mapped else [p.title() for p in parts]
|
parts = mapped if mapped else [p.title() for p in parts]
|
||||||
return self.gecko_enum_prefix + "::" + "".join(parts)
|
return self.gecko_enum_prefix + "::" + "".join(parts)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -16,11 +16,12 @@ ${helpers.single_keyword("ime-mode", "normal auto active disabled inactive",
|
||||||
animatable=False,
|
animatable=False,
|
||||||
spec="https://drafts.csswg.org/css-ui/#input-method-editor")}
|
spec="https://drafts.csswg.org/css-ui/#input-method-editor")}
|
||||||
|
|
||||||
${helpers.single_keyword("-moz-user-select", "auto text none all", products="gecko",
|
${helpers.single_keyword("-moz-user-select", "auto text none all element elements" +
|
||||||
|
" toggle tri_state -moz-all -moz-none -moz-text",
|
||||||
|
products="gecko",
|
||||||
alias="-webkit-user-select",
|
alias="-webkit-user-select",
|
||||||
gecko_ffi_name="mUserSelect",
|
gecko_ffi_name="mUserSelect",
|
||||||
gecko_enum_prefix="StyleUserSelect",
|
gecko_enum_prefix="StyleUserSelect",
|
||||||
gecko_inexhaustive=True,
|
|
||||||
animatable=False,
|
animatable=False,
|
||||||
spec="https://drafts.csswg.org/css-ui-4/#propdef-user-select")}
|
spec="https://drafts.csswg.org/css-ui-4/#propdef-user-select")}
|
||||||
|
|
||||||
|
|
|
@ -94,3 +94,4 @@ mod selectors;
|
||||||
mod supports;
|
mod supports;
|
||||||
mod text_overflow;
|
mod text_overflow;
|
||||||
mod transition_timing_function;
|
mod transition_timing_function;
|
||||||
|
mod ui;
|
||||||
|
|
32
tests/unit/style/parsing/ui.rs
Normal file
32
tests/unit/style/parsing/ui.rs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use cssparser::Parser;
|
||||||
|
use media_queries::CSSErrorReporterTest;
|
||||||
|
use servo_url::ServoUrl;
|
||||||
|
use style::parser::ParserContext;
|
||||||
|
use style::stylesheets::Origin;
|
||||||
|
use style_traits::ToCss;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_moz_user_select() {
|
||||||
|
use style::properties::longhands::_moz_user_select;
|
||||||
|
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "auto");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "text");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "none");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "element");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "elements");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "toggle");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "tri_state");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "-moz-all");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "-moz-none");
|
||||||
|
assert_roundtrip_with_context!(_moz_user_select::parse, "-moz-text");
|
||||||
|
|
||||||
|
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||||
|
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||||
|
|
||||||
|
let mut negative = Parser::new("potato");
|
||||||
|
assert!(_moz_user_select::parse(&context, &mut negative).is_err());
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue