Backed out changeset 0552fd39333b (bug 1789191) for causing mochitest failures in layout/style/test/test_revert.html CLOSED TREE

This commit is contained in:
Sandor Molnar 2022-09-10 07:11:24 +03:00
Родитель fae527abdd
Коммит e9d20af17e
9 изменённых файлов: 24 добавлений и 112 удалений

Просмотреть файл

@ -12,7 +12,4 @@
interface CSSContainerRule : CSSConditionRule {
readonly attribute UTF8String containerName;
readonly attribute UTF8String containerQuery;
// Performs a container query look-up for an element.
[ChromeOnly] Element? queryContainerFor(Element element);
};

Просмотреть файл

@ -63,11 +63,6 @@ void CSSContainerRule::GetContainerQuery(nsACString& aQuery) const {
Servo_ContainerRule_GetContainerQuery(mRawRule, &aQuery);
}
Element* CSSContainerRule::QueryContainerFor(const Element& aElement) const {
return const_cast<Element*>(
Servo_ContainerRule_QueryContainerFor(mRawRule, &aElement));
}
void CSSContainerRule::SetRawAfterClone(RefPtr<RawServoContainerRule> aRaw) {
mRawRule = std::move(aRaw);

Просмотреть файл

@ -40,8 +40,6 @@ class CSSContainerRule final : public css::ConditionRule {
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
Element* QueryContainerFor(const Element&) const;
private:
virtual ~CSSContainerRule();

Просмотреть файл

@ -9,7 +9,6 @@ prefs =
gfx.omta.background-color=true
gfx.font_loader.delay=0
layout.css.accent-color.enabled=true
layout.css.container-queries.enabled=true
layout.css.constructable-stylesheets.enabled=true
layout.css.individual-transform.enabled=true
layout.css.motion-path.enabled=true
@ -428,4 +427,3 @@ skip-if = xorigin # Crashes, Assertion failure: mInFlightProcessId == 0, at /bui
[test_use_counters.html]
skip-if = !nightly_build
[test_medialist_privilege.html]
[test_query_container_for.html]

Просмотреть файл

@ -12972,8 +12972,10 @@ if (IsCSSPropertyPrefEnabled("layout.css.container-queries.enabled")) {
other_values: [
"style",
"inline-size",
"block-size",
"size",
"style inline-size",
"block-size style",
"size style",
],
invalid_values: [
@ -12984,8 +12986,6 @@ if (IsCSSPropertyPrefEnabled("layout.css.container-queries.enabled")) {
"style style",
"inline-size style inline-size",
"inline-size block-size",
"block-size",
"block-size style",
"size inline-size",
"size block-size",
],
@ -13004,8 +13004,8 @@ if (IsCSSPropertyPrefEnabled("layout.css.container-queries.enabled")) {
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: ["container-type", "container-name"],
initial_values: ["none"],
other_values: ["foo / size", "foo bar / size", "foo / inline-size", "foo"],
invalid_values: ["size / foo", "size / foo bar"],
other_values: ["size", "size / foo bar", "inline-size style / foo"],
invalid_values: ["foo / size", "foo bar / size"],
};
}

Просмотреть файл

@ -1,62 +0,0 @@
<!doctype html>
<title>Test for bug 1789191</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<style>
@container (min-width: 0px) {
}
@container name (min-width: 0px) {
}
@container (min-height: 0px) {
}
div {
width: 100px;
height: 100px;
background-color: blue;
margin: 10px;
}
.container-height {
container-type: size;
}
.container-unnamed {
container-type: inline-size;
}
.container-named {
container-type: inline-size;
container-name: name;
}
</style>
<div id="child1"></div>
<div class="container-height" id="container1">
<div class="container-named" id="container2">
<div class="container-unnamed" id="container3">
<div id="child2"></div>
</div>
</div>
</div>
<script>
let sheet = document.querySelector("style").sheet;
let withoutFilter = SpecialPowers.wrap(sheet.cssRules[0]);
let withFilter = SpecialPowers.wrap(sheet.cssRules[1]);
let heightQuery = SpecialPowers.wrap(sheet.cssRules[2]);
// Container query selection requires up-to-date layout information.
document.body.getBoundingClientRect();
is(withoutFilter.queryContainerFor(child1), null, "No filter, no container");
is(withFilter.queryContainerFor(child1), null, "Filter, no container");
is(heightQuery.queryContainerFor(child1), null, "Height, no container");
is(SpecialPowers.unwrap(withoutFilter.queryContainerFor(child2)), container3, "No filter, container");
is(SpecialPowers.unwrap(withFilter.queryContainerFor(child2)), container2, "Filter");
is(SpecialPowers.unwrap(heightQuery.queryContainerFor(child2)), container1, "Height");
</script>

Просмотреть файл

@ -102,16 +102,6 @@ pub struct ContainerCondition {
flags: FeatureFlags,
}
/// The result of a successful container query lookup.
pub struct ContainerLookupResult<E> {
/// The relevant container.
pub element: E,
/// The sizing / writing-mode information of the container.
pub info: ContainerInfo,
/// The style of the element.
pub style: Arc<ComputedValues>,
}
impl ContainerCondition {
/// Parse a container condition.
pub fn parse<'a>(
@ -130,17 +120,17 @@ impl ContainerCondition {
Ok(Self { name, condition, flags })
}
fn valid_container_info<E>(&self, potential_container: E) -> Option<ContainerLookupResult<E>>
fn valid_container_info<E>(&self, potential_container: E) -> Option<(ContainerInfo, Arc<ComputedValues>)>
where
E: TElement,
{
use crate::values::computed::ContainerType;
fn container_type_axes(ty_: ContainerType, wm: WritingMode) -> FeatureFlags {
if ty_.contains(ContainerType::SIZE) {
if ty_.intersects(ContainerType::SIZE) {
return FeatureFlags::all_container_axes()
}
if ty_.contains(ContainerType::INLINE_SIZE) {
if ty_.intersects(ContainerType::INLINE_SIZE) {
let physical_axis = if wm.is_vertical() {
FeatureFlags::CONTAINER_REQUIRES_HEIGHT_AXIS
} else {
@ -176,21 +166,16 @@ impl ContainerCondition {
let size = potential_container.primary_box_size();
let style = style.clone();
Some(ContainerLookupResult {
element: potential_container,
info: ContainerInfo { size, wm },
style,
})
Some((ContainerInfo { size, wm }, style))
}
/// Performs container lookup for a given element.
pub fn find_container<E>(&self, mut e: E) -> Option<ContainerLookupResult<E>>
fn find_container<E>(&self, mut e: E) -> Option<(ContainerInfo, Arc<ComputedValues>)>
where
E: TElement,
{
while let Some(element) = e.traversal_parent() {
if let Some(result) = self.valid_container_info(element) {
return Some(result);
if let Some(info) = self.valid_container_info(element) {
return Some(info);
}
e = element;
}
@ -203,8 +188,7 @@ impl ContainerCondition {
where
E: TElement,
{
let result = self.find_container(element);
let info = result.map(|r| (r.info, r.style));
let info = self.find_container(element);
Context::for_container_query_evaluation(device, info, |context| {
self.condition.matches(context)
})

Просмотреть файл

@ -2983,16 +2983,6 @@ pub extern "C" fn Servo_ContainerRule_GetContainerQuery(
})
}
#[no_mangle]
pub extern "C" fn Servo_ContainerRule_QueryContainerFor(
rule: &RawServoContainerRule,
element: &RawGeckoElement,
) -> *const RawGeckoElement {
read_locked_arc(rule, |rule: &ContainerRule| {
rule.condition.find_container(GeckoElement(element)).map_or(ptr::null(), |result| result.element.0)
})
}
#[no_mangle]
pub extern "C" fn Servo_ContainerRule_GetContainerName(
rule: &RawServoContainerRule,

Просмотреть файл

@ -4,3 +4,15 @@
[c (width) for .ab-size > .size > span]
expected: FAIL
[(height: 32px) for .size > .inline > span]
expected: FAIL
[a (height: 32px) for .a-size > .b-size > .a-inline > span]
expected: FAIL
[a (block-size: 32px) for .a-size > .b-size > .a-inline > span]
expected: FAIL
[(height: 16px) for .size > .inline > span]
expected: FAIL