Avoid duplicated code in LayoutBlockChild::layoutBlockChild().
Before laying out, we try to estimate and set the logical top of the child, but it may turn out after one layout pass that the estimate was wrong, due to margin collapsing, float clearance or pagination. So sometimes we need to reposition and relayout once or even twice inside layoutBlockChild(). This was done with slightly poorly duplicated code. Refactor into positionAndLayoutOnceIfNeeded() (and markDescendantsWithFloatsForLayoutIfNeeded()). One instance of this duplicated code used to sit in adjustBlockChildForPagination(). Moved it into layoutBlockChild(), to make it easier to understand what's going on (and to give adjustBlockChildForPagination() one less thing to worry about - one parameter removed). Renamed |result| to |newLogicalTop| in adjustBlockChildForPagination(), and |logicalTopAfterClear| to |newLogicalTop| in layoutBlockChild(). No behavioral changes were actually intended, but when unifying almost-duplicated code, some changes are inevitable. Added some tests for something that now works, and used to fail. In the subsequent layout passes we forgot to check if the new position changed how we were affected by floats. R=jchaffraix@chromium.org,leviw@chromium.org Review URL: https://codereview.chromium.org/1315353005 git-svn-id: svn://svn.chromium.org/blink/trunk@201866 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
This diff is collapsed.
Please register or sign in to comment