gecko-dev/layout
L. David Baron 86687429ea Bug 1347759 - Fix conditions under which we reflow absolutely positioned element due to size change of its container for everything other than horizontal LTR. r=jfkthame
I found this problem because I was debugging the failure of
layout/reftests/w3c-css/received/css-writing-modes-3/clearance-calculations-vrl-008.xht
with my patch for bug 1308876.  It was failing because the red reference
box that was intended to be covered up was being mispositioned leftwards
by the width of the scrollbar, since we were not reflowing it when we
decided that the viewport did not need scrollbars.  This patch fixes
that failure.

This led me to this bug, where
nsAbsoluteContainingBlock::FrameDependsOnContainer was incorrectly
testing conditions for when the values of 'top', 'right', 'bottom', and
'left' require reflow due to changes in the size of the containing
block.

The old code is incorrect in a number of cases, such as:
1. in RTL, with 'right: 100px', it will say that the frame does not
   depend on its container's width since 'right' (offset-inline-start)
   is a fixed offset and 'left' is 'auto'.  However, since the
   positioning is relative to the right edge, a change in container size
   does require that the absolutely positioned element be repositioned
   relative to the container's left edge.
2. In vertical-rl, again with 'right: 100px', it will make the same
   mistake, since 'right' (now offset-block-start) is a fixed offset.
   This is the case from the test I was debugging.
3. In vertical-rl with rtl direction and 'bottom: 100px', we will make
   the same mistake because 'bottom' (inline-start) is fixed and 'top'
   is 'auto', and we use 'bottom' rather than 'top'.

However, in cases (1) and (3) we actually avoid hitting the bug in these
simple-ish cases because ReflowInput::ShouldReflowAllKids() returns true
whenever IsIResize() is true, which means that
nsAbsoluteContainingBlock::Reflow doesn't even call
FrameDependsOnContainer.  However, FrameDependsOnContainer should still
do the right thing because it's needed for
nsAbsoluteContainingBlock::MarkSizeDependentFramesDirty, which is only
used (from nsBlockFrame) when we reflow again for clearance or for
interruptible reflow.  I haven't attempted to write a testcase for that
because it seems likely to require spending hours in the debugger trying
to trigger the right code.

This means that the only test that fails prior to the patch is
dynamic-offset-vrl-001.html, which exercises case (2), and also happens
to be the most similar to problem in clearance-calculations-vrl-008.xht.

This patch also makes the tests stricter so that we do optimize away
resizes in some cases where we're able to do so, such as
'left: 100px; right: auto' in RTL.  (Or, rather, we would if it weren't
for the IsIResize() in ShouldReflowAllKids().)

MozReview-Commit-ID: 8xm1AHC21oh

--HG--
extra : transplant_source : %06%B4%40%EB%A9%C8M%F3%99%80%A9%DE%1F%1E%90%D3%F1%04W.
2017-03-16 09:39:19 -07:00
..
base Merge m-c to autoland, a=merge 2017-03-15 14:29:24 -07:00
build Bug 1299500 - Get rid of DeviceStorage API - part 10 - DeviceStorage, r=ehsan, r=billm 2017-03-08 20:15:45 +01:00
doc
forms Bug 1301312 - Part 5: Handle input element's attribute change explicitly. r=smaug 2017-03-15 11:39:02 +08:00
generic Bug 1347759 - Fix conditions under which we reflow absolutely positioned element due to size change of its container for everything other than horizontal LTR. r=jfkthame 2017-03-16 09:39:19 -07:00
inspector Bug 1342880 : Remove class inSearchLoop from the tree. r=heycam 2017-03-15 11:48:41 +08:00
ipc Remove references to the Direct3D9 compositor. (bug 1318558 part 1, r=mattwoodrow) 2017-03-08 00:17:36 -08:00
mathml Bug 775624 Part 22 - Remove NS_FRAME_COMPLETE. r=dholbert 2017-02-14 17:55:48 +08:00
media Bug 1332937 - Allow libcubeb and other media libs to set the moz crash reason. r=glandium 2017-02-09 14:27:29 +01:00
painting Merge m-c to graphics 2017-03-13 13:13:37 -04:00
printing Bug 1342994 Part 2 - Use UniquePtr to replace explicit new/delete and non-owing pointers in printing APIs. r=dholbert 2017-03-06 16:28:20 +08:00
reftests Bug 1347759 - Fix conditions under which we reflow absolutely positioned element due to size change of its container for everything other than horizontal LTR. r=jfkthame 2017-03-16 09:39:19 -07:00
style Backed out changeset 8a1c36e9ba80 (bug 1341008) 2017-03-16 17:29:18 +01:00
svg Bug 1320036 - Part 1. Correct objectBoundingBox region of a filter applied to an outer SVG element. r=jwatt 2017-03-15 18:36:53 +08:00
tables Merge inbound to central, a=merge 2017-03-14 17:18:59 -07:00
tools Bug 1346692 - Clarify reftest documentation about combining <failure-type>s. No review. 2017-03-13 19:08:28 -07:00
xul Bug 1343977 - Extract nsAutoRollup into a more self-contained class and clean it up some. No functional changes intended. r=enndeakin+6102 2017-03-13 10:44:56 -04:00
moz.build