Skip to content

Commit

Permalink
Missing layout invalidation for position-fallback changes
Browse files Browse the repository at this point in the history
When the position-fallback property changes, the layout may change. Add
the property to computed_style_diff_functions.json5.

Bug: 1381609
Change-Id: I3d3d88ef7cbb512ca4e6ca3ad0213d8b872bd9a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4020512
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1070568}
  • Loading branch information
Rune Lillesveen authored and Chromium LUCI CQ committed Nov 11, 2022
1 parent 5effd94 commit dcc4b23
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
"BaselineShiftType", "baseline-shift", "dominant-baseline",
"CssDominantBaseline", "text-anchor",
"stroke-width", "stroke-miterlimit", "stroke-linecap", "stroke-linejoin",
"marker-end", "marker-mid", "marker-start", "scrollbar-width", "object-view-box"],
"marker-end", "marker-mid", "marker-start", "scrollbar-width", "object-view-box",
"position-fallback"],
methods_to_diff: [
{
method: "BorderLeftWidth()",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>CSS Anchor Positioning Test: Dynamically change position via position-fallback property</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body { margin: 0; }

@position-fallback --fallback1 {
@try {
left: anchor(--a1 right);
}
}
#anchor {
anchor-name: --a1;
width: 100px;
height: 100px;
}
#anchored {
position: absolute;
width: 100px;
height: 100px;
}
</style>
<div id="anchor"></div>
<div id="anchored"></div>
<script>
test(() => {
assert_equals(anchored.offsetLeft, 0);
}, "Initial static left position is 0");

test(() => {
anchored.style.positionFallback = "--fallback1";
assert_equals(anchored.offsetLeft, 100);
}, "Left position set to right edge of anchor with @position-fallback");
</script>

0 comments on commit dcc4b23

Please sign in to comment.