зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c5ede12b748e (bug 1790059) for causing multiple failures container related. CLOSED TREE
This commit is contained in:
Родитель
c81a0bf5bd
Коммит
a3a61d1d43
|
@ -2242,7 +2242,6 @@ nsStyleDisplay::nsStyleDisplay(const Document& aDocument)
|
|||
mRotate(StyleRotate::None()),
|
||||
mTranslate(StyleTranslate::None()),
|
||||
mScale(StyleScale::None()),
|
||||
mContainerName(StyleContainerName::None()),
|
||||
mWillChange{{}, {0}},
|
||||
mOffsetPath(StyleOffsetPath::None()),
|
||||
mOffsetDistance(LengthPercentage::Zero()),
|
||||
|
|
|
@ -1268,7 +1268,6 @@ struct StyleAnimation {
|
|||
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
|
||||
private:
|
||||
using StyleContain = mozilla::StyleContain;
|
||||
using StyleContainerName = mozilla::StyleContainerName;
|
||||
using StyleContentVisibility = mozilla::StyleContentVisibility;
|
||||
|
||||
public:
|
||||
|
|
|
@ -171,9 +171,12 @@ impl ContainerCondition {
|
|||
return None;
|
||||
}
|
||||
|
||||
// Check on container-name.
|
||||
if !self.name.is_none() && box_style.clone_container_name() != self.name {
|
||||
return None;
|
||||
// Filter by container-name.
|
||||
let container_name = box_style.clone_container_name();
|
||||
for filter_name in self.name.0.iter() {
|
||||
if !container_name.0.contains(filter_name) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
let size = potential_container.primary_box_size();
|
||||
|
|
|
@ -1536,6 +1536,7 @@ bitflags! {
|
|||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-contain-3/#container-name
|
||||
#[repr(transparent)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
|
@ -1547,23 +1548,17 @@ bitflags! {
|
|||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum ContainerName {
|
||||
/// The query container has no query container name.
|
||||
None,
|
||||
/// Specifies a query container name as an identifier.
|
||||
Ident(CustomIdent),
|
||||
}
|
||||
pub struct ContainerName(#[css(iterable, if_empty = "none")] pub crate::OwnedSlice<CustomIdent>);
|
||||
|
||||
impl ContainerName {
|
||||
/// Return the `none` value.
|
||||
pub fn none() -> Self {
|
||||
Self::None
|
||||
Self(Default::default())
|
||||
}
|
||||
|
||||
/// Returns whether this is the `none` value.
|
||||
pub fn is_none(&self) -> bool {
|
||||
matches!(self, Self::None)
|
||||
self.0.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1572,6 +1567,7 @@ impl Parse for ContainerName {
|
|||
_: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let mut idents = vec![];
|
||||
let location = input.current_source_location();
|
||||
let first = input.expect_ident()?;
|
||||
if first.eq_ignore_ascii_case("none") {
|
||||
|
@ -1579,8 +1575,19 @@ impl Parse for ContainerName {
|
|||
}
|
||||
const DISALLOWED_CONTAINER_NAMES: &'static [&'static str] =
|
||||
&["none", "not", "or", "and", "auto", "normal"];
|
||||
|
||||
Ok(ContainerName::Ident(CustomIdent::from_ident(location, first, DISALLOWED_CONTAINER_NAMES)?))
|
||||
idents.push(CustomIdent::from_ident(
|
||||
location,
|
||||
first,
|
||||
DISALLOWED_CONTAINER_NAMES,
|
||||
)?);
|
||||
while let Ok(ident) = input.try_parse(|input| input.expect_ident_cloned()) {
|
||||
idents.push(CustomIdent::from_ident(
|
||||
location,
|
||||
&ident,
|
||||
DISALLOWED_CONTAINER_NAMES,
|
||||
)?);
|
||||
}
|
||||
Ok(ContainerName(idents.into()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
[(100px : width : 200px)]
|
||||
expected: FAIL
|
||||
|
||||
[foo (width: 100px)]
|
||||
expected: FAIL
|
||||
|
||||
[style(--my-prop: foo)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -90,3 +93,18 @@
|
|||
|
||||
[Container name: None]
|
||||
expected: FAIL
|
||||
|
||||
[name not (width <= 500px)]
|
||||
expected: FAIL
|
||||
|
||||
[Container name: foo]
|
||||
expected: FAIL
|
||||
|
||||
[Container name: foo]
|
||||
expected: FAIL
|
||||
|
||||
[Container name: foo ]
|
||||
expected: FAIL
|
||||
|
||||
[not (width: 100px)]
|
||||
expected: FAIL
|
||||
|
|
|
@ -164,7 +164,6 @@
|
|||
test_rule_valid('name not (width <= 500px)');
|
||||
test_rule_valid('not (width <= 500px)');
|
||||
|
||||
test_container_name_valid('');
|
||||
test_container_name_valid('foo');
|
||||
test_container_name_valid(' foo');
|
||||
test_container_name_valid(' foo ');
|
||||
|
|
Загрузка…
Ссылка в новой задаче