gecko-dev/layout/reftests/css-grid/grid-measuring-reflow-resiz...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 строки
692 B
HTML
Исходник Обычный вид История

Bug 1351359 - Make nsGridContainerFrame call ReflowInput::SetBResize(true) because of auto-block-size swapping between measuring reflows and regular reflows. r=mats This fixes the failure of layout/reftests/css-grid/grid-min-max-content-sizing-002.html with the primary patch in bug 1308876 (which causes a child whose parent is dirty to pick up the dirty bit from the parent only the first reflow of the child if the parent reflows the child multiple times). A simplified testcase for that failure is https://bugzilla.mozilla.org/attachment.cgi?id=8849771 . The failure was caused by an error in height calculation of the first <x> in the test. The div that is the parent of that x has a definite height (presumably due to rules in grid), and the x has a specified height. The div gets three reflows: two measuring reflows (from MinContentContribution and then from MaxContentContribution) and then a final reflow from nsGridContainerFrame::ReflowInFlowChild. Prior to the primary patch in this bug, the div was marked dirty on all three reflows, but with it it is marked dirty only on the first. This means that, without the block-resize flag, the div optimizes away the reflow of its children, since ShouldReflowAllKids returns false because IsBResize() is false, even though NS_FRAME_CONTAINS_RELATIVE_BSIZE is correctly set. In order to fix this, we need to make sure the BResize flag on the reflow state in at least some cases (see the comments in the patch for when, and for how the cases could be optimized in the future). Note that: * when the dirty bit is set on the grid container, the new behavior (with the combination of the patches) is strictly more efficient than the old, since we will sometimes do non-dirty reflows on the grid items (with the b-resize flag) * when the dirty bit is *not* set on the grid container, the new behavior is less efficient than the old, since we will set the b-resize flag when we did not do so before. However, this slowdown fixes existing bugs such as the one in the reftest. Given that I was able to construct a reftest that triggers the failure without the changes from bug 1308876, I've moved this to a separate bug. Without the patch, grid-measuring-reflow-resize-dynamic-001.html fails, but grid-measuring-reflow-resize-static-001.html passes. With the patch both tests pass. (And without the patch, doing a text zoom on the dynamic test fixes the layout error.) MozReview-Commit-ID: JQOdVTQIkU0 --HG-- extra : transplant_source : %8B%2ARO%3B%D0%7B%EC%C9_%B3%60Sp%F9T%14X%85%DC
2017-03-31 05:56:14 +03:00
<!DOCTYPE HTML>
<title>Testcase simplified from layout/reftests/css-grid/grid-min-max-content-sizing-002.html</title>
<style type="text/css">
html { overflow: hidden }
body { margin: 0 }
.grid {
display: grid;
grid-template-columns: minmax(min-content,max-content);
grid-template-rows: minmax(min-content,max-content);
}
.grid > div {
border: 1px solid fuchsia;
}
span {
display: block;
border: 4px solid blue;
width: 100%;
height: 100%;
}
</style>
<div class="grid">
<div>
<span id="s"></span>
</div>
</div>
<script>
var s = document.getElementById("s");
s.offsetWidth; // flush layout
s.textContent = "blue should overflow fuchsia on right/bottom";
</script>