Backed out 2 changesets (bug 1740230) for causing build bustages.

Backed out changeset ba8e644ee9d2 (bug 1740230)
Backed out changeset 180d03015fd1 (bug 1740230)
This commit is contained in:
Butkovits Atila 2021-11-10 02:12:26 +02:00
parent c40e648417
commit 3a33d047e8
11 changed files with 46 additions and 68 deletions

View file

@ -429,7 +429,7 @@ class UrlbarValueFormatter {
// them, which we can do by passing "currentColor". See
// nsTextPaintStyle::GetHighlightColors for details.
if (
this.document.documentElement.hasAttribute("lwtheme") ||
this.document.documentElement.querySelector(":-moz-lwtheme") ||
this.window.matchMedia("(prefers-contrast)").matches
) {
// non-default theme(s)

View file

@ -2867,15 +2867,7 @@ const RawServoSelectorList* nsINode::ParseSelectorList(
RawServoSelectorList* list = cache.GetListOrInsertFrom(aSelectorString, [&] {
// Note that we want to cache even if null was returned, because we
// want to cache the "This is not a valid selector" result.
//
// NOTE(emilio): Off-hand, getting a CallerType here might seem like a
// better idea than using IsDocumentURISchemeChrome(), but that would mean
// that we'd need to key the selector cache by that.
// IsDocumentURISchemeChrome() gives us the same semantics as any inline
// style associated to a document, which seems reasonable.
return Servo_SelectorList_Parse(&aSelectorString,
doc->IsDocumentURISchemeChrome())
.Consume();
return Servo_SelectorList_Parse(&aSelectorString).Consume();
});
if (!list) {

View file

@ -31,11 +31,6 @@ const NON_CONTENT_ACCESIBLE_PSEUDOS = [
":-moz-dir-attr-rtl",
":-moz-dir-attr-like-auto",
":-moz-autofill-preview",
":-moz-lwtheme",
":-moz-lwtheme-brighttext",
":-moz-lwtheme-darkttext",
":-moz-locale-dir(rtl)",
":-moz-locale-dir(ltr)",
"::-moz-tree-row",
"::-moz-tree-row(foo)",

View file

@ -1024,11 +1024,32 @@ function runTests() {
xul_default_ns + html_ns);
// Test -moz-locale-dir
test_balanced_unparseable(":-moz-locale-dir(ltr)");
test_balanced_unparseable(":-moz-locale-dir(rtl)");
test_balanced_unparseable(":-moz-locale-dir(rTl)");
test_balanced_unparseable(":-moz-locale-dir(LTR)");
test_balanced_unparseable(":-moz-locale-dir(other)");
test_parseable(":-moz-locale-dir(ltr)");
test_parseable(":-moz-locale-dir(rtl)");
test_parseable(":-moz-locale-dir(rTl)");
test_parseable(":-moz-locale-dir(LTR)");
test_parseable(":-moz-locale-dir(other)");
if (document.body.matches(":-moz-locale-dir(ltr)")) {
test_selector_in_html("a:-moz-locale-dir(LTr)", single_a,
set_single, empty_set);
test_selector_in_html("a:-moz-locale-dir(ltR)", single_a,
set_single, empty_set);
test_selector_in_html("a:-moz-locale-dir(LTR)", single_a,
set_single, empty_set);
test_selector_in_html("a:-moz-locale-dir(RTl)", single_a,
empty_set, set_single);
} else {
test_selector_in_html("a:-moz-locale-dir(RTl)", single_a,
set_single, empty_set);
test_selector_in_html("a:-moz-locale-dir(rtL)", single_a,
set_single, empty_set);
test_selector_in_html("a:-moz-locale-dir(RTL)", single_a,
set_single, empty_set);
test_selector_in_html("a:-moz-locale-dir(LTr)", single_a,
empty_set, set_single);
}
test_selector_in_html("a:-moz-locale-dir(other)", single_a,
empty_set, set_single);
test_balanced_unparseable(":-moz-locale-dir()");
test_balanced_unparseable(":-moz-locale-dir(())");
@ -1076,10 +1097,10 @@ function runTests() {
test_balanced_unparseable(":dir(ltr other)");
test_balanced_unparseable(":dir");
// Test chrome-only -moz-lwtheme and -moz-lwtheme-[darktext|brighttext]
test_balanced_unparseable(":-moz-lwtheme");
test_balanced_unparseable(":-moz-lwtheme-brighttext");
test_balanced_unparseable(":-moz-lwtheme-darktext");
// Test -moz-lwtheme and -moz-lwtheme-[darktext|brighttext]
test_parseable(":-moz-lwtheme");
test_parseable(":-moz-lwtheme-brighttext");
test_parseable(":-moz-lwtheme-darktext");
test_balanced_unparseable(":-moz-tree-row(selected)");
test_balanced_unparseable("::-moz-tree-row(selected)");

View file

@ -6904,20 +6904,6 @@
mirror: always
rust: true
# Whether the `:-moz-lwtheme` pseudo-class is exposed to content.
- name: layout.css.moz-lwtheme.content.enabled
type: RelaxedAtomicBool
value: false
mirror: always
rust: true
# Whether the `:-moz-locale-dir()` pseudo-class is exposed to content.
- name: layout.css.moz-locale-dir.content.enabled
type: RelaxedAtomicBool
value: false
mirror: always
rust: true
# Whether the `-moz-control-character-visibility` property is exposed to
# content.
#

View file

@ -90,9 +90,9 @@ macro_rules! apply_non_ts_list {
("-moz-use-shadow-tree-root", MozUseShadowTreeRoot, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-is-html", MozIsHTML, _, _),
("-moz-placeholder", MozPlaceholder, _, _),
("-moz-lwtheme", MozLWTheme, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-lwtheme-brighttext", MozLWThemeBrightText, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-lwtheme-darktext", MozLWThemeDarkText, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-lwtheme", MozLWTheme, _, _),
("-moz-lwtheme-brighttext", MozLWThemeBrightText, _, _),
("-moz-lwtheme-darktext", MozLWThemeDarkText, _, _),
("-moz-window-inactive", MozWindowInactive, _, _),
]
}

View file

@ -127,7 +127,7 @@ impl NonTSPseudoClass {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
match *self {
$(NonTSPseudoClass::$name => check_flag!($flags),)*
NonTSPseudoClass::MozLocaleDir(_) => check_flag!(PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
NonTSPseudoClass::MozLocaleDir(_) |
NonTSPseudoClass::Lang(_) |
NonTSPseudoClass::Dir(_) => false,
}
@ -145,12 +145,6 @@ impl NonTSPseudoClass {
if let NonTSPseudoClass::MozSubmitInvalid = *self {
return static_prefs::pref!("layout.css.moz-submit-invalid.enabled");
}
if matches!(*self, Self::MozLWTheme | Self::MozLWThemeBrightText | Self::MozLWThemeDarkText) {
return static_prefs::pref!("layout.css.moz-lwtheme.content.enabled");
}
if let NonTSPseudoClass::MozLocaleDir(..) = *self {
return static_prefs::pref!("layout.css.moz-locale-dir.content.enabled");
}
!self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME)
}

View file

@ -46,7 +46,7 @@ pub struct SelectorParser<'a> {
pub namespaces: &'a Namespaces,
/// The extra URL data of the stylesheet, which is used to look up
/// whether we are parsing a chrome:// URL style sheet.
pub url_data: &'a UrlExtraData,
pub url_data: Option<&'a UrlExtraData>,
}
impl<'a> SelectorParser<'a> {
@ -54,15 +54,14 @@ impl<'a> SelectorParser<'a> {
/// account namespaces.
///
/// This is used for some DOM APIs like `querySelector`.
pub fn parse_author_origin_no_namespace<'i>(
input: &'i str,
url_data: &UrlExtraData,
) -> Result<SelectorList<SelectorImpl>, ParseError<'i>> {
pub fn parse_author_origin_no_namespace(
input: &str,
) -> Result<SelectorList<SelectorImpl>, ParseError> {
let namespaces = Namespaces::default();
let parser = SelectorParser {
stylesheet_origin: Origin::Author,
namespaces: &namespaces,
url_data,
url_data: None,
};
let mut input = ParserInput::new(input);
SelectorList::parse(&parser, &mut CssParser::new(&mut input))
@ -76,7 +75,7 @@ impl<'a> SelectorParser<'a> {
/// Whether we're parsing selectors in a stylesheet that has chrome
/// privilege.
pub fn chrome_rules_enabled(&self) -> bool {
self.url_data.chrome_rules_enabled() ||
self.url_data.map_or(false, |d| d.chrome_rules_enabled()) ||
self.stylesheet_origin == Origin::User
}
}

View file

@ -704,7 +704,7 @@ impl<'a, 'b, 'i> QualifiedRuleParser<'i> for NestedRuleParser<'a, 'b> {
let selector_parser = SelectorParser {
stylesheet_origin: self.context.stylesheet_origin,
namespaces: self.namespaces,
url_data: self.context.url_data,
url_data: Some(self.context.url_data),
};
let selectors = SelectorList::parse(&selector_parser, input)?;
if self.context.error_reporting_enabled() {

View file

@ -335,7 +335,7 @@ impl RawSelector {
let parser = SelectorParser {
namespaces,
stylesheet_origin: context.stylesheet_origin,
url_data: context.url_data,
url_data: Some(context.url_data),
};
#[allow(unused_variables)]

View file

@ -2506,7 +2506,7 @@ pub extern "C" fn Servo_StyleRule_SetSelectorText(
let parser = SelectorParser {
stylesheet_origin: contents.origin,
namespaces: &namespaces,
url_data: &url_data,
url_data: Some(&url_data),
};
let mut parser_input = ParserInput::new(&value_str);
@ -6638,20 +6638,11 @@ pub extern "C" fn Servo_HasPendingRestyleAncestor(
#[no_mangle]
pub unsafe extern "C" fn Servo_SelectorList_Parse(
selector_list: &nsACString,
is_chrome: bool,
) -> OwnedOrNull<RawServoSelectorList> {
use style::selector_parser::SelectorParser;
let url_data = unsafe {
UrlExtraData::from_ptr_ref(if is_chrome {
&DUMMY_CHROME_URL_DATA
} else {
&DUMMY_URL_DATA
})
};
let input = selector_list.as_str_unchecked();
let selector_list = match SelectorParser::parse_author_origin_no_namespace(&input, url_data) {
let selector_list = match SelectorParser::parse_author_origin_no_namespace(&input) {
Ok(selector_list) => selector_list,
Err(..) => return OwnedOrNull::null(),
};