Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Issue 1315353005: Avoid duplicated code in LayoutBlockChild::layoutBlockChild(). (Closed)

Created:
5 years, 3 months ago by mstensho (USE GERRIT)
Modified:
5 years, 3 months ago
CC:
blink-reviews, blink-reviews-rendering, eae+blinkwatch, jchaffraix+rendering, leviw+renderwatch, pdr+renderingwatchlist_chromium.org, szager+layoutwatch_chromium.org, zoltan1
Target Ref:
refs/remotes/origin/master
Project:
blink
Visibility:
Public.

Description

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 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=201866

Patch Set 1 #

Total comments: 6

Patch Set 2 : code review: worded up a comment. #

Patch Set 3 : Turn tests into check-layout.js tests #

Patch Set 4 : Add some body style, to make fewer assumptions. #

Patch Set 5 : Resurrected comment about first layout pass and improved it. #

Messages

Total messages: 8 (2 generated)
mstensho (USE GERRIT)
Time for some Friday cleanup and accidental bugfixing. :)
5 years, 3 months ago (2015-09-04 13:34:17 UTC) #1
Julien - ping for review
lgtm https://codereview.chromium.org/1315353005/diff/1/LayoutTests/fast/block/margin-collapse/bfc-beside-float-complex-margin-collapsing.html File LayoutTests/fast/block/margin-collapse/bfc-beside-float-complex-margin-collapsing.html (right): https://codereview.chromium.org/1315353005/diff/1/LayoutTests/fast/block/margin-collapse/bfc-beside-float-complex-margin-collapsing.html#newcode27 LayoutTests/fast/block/margin-collapse/bfc-beside-float-complex-margin-collapsing.html:27: <div style="overflow:hidden; height:9em; background:navy;"> The tests really look ...
5 years, 3 months ago (2015-09-04 17:40:10 UTC) #2
mstensho (USE GERRIT)
check-layout.js tests coming up! In the meantime we can discuss the comment that I removed. ...
5 years, 3 months ago (2015-09-04 18:31:49 UTC) #3
mstensho (USE GERRIT)
https://codereview.chromium.org/1315353005/diff/1/Source/core/layout/LayoutBlockFlow.cpp File Source/core/layout/LayoutBlockFlow.cpp (left): https://codereview.chromium.org/1315353005/diff/1/Source/core/layout/LayoutBlockFlow.cpp#oldcode527 Source/core/layout/LayoutBlockFlow.cpp:527: // Go ahead and position the child as though ...
5 years, 3 months ago (2015-09-07 08:03:38 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1315353005/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1315353005/80001
5 years, 3 months ago (2015-09-07 08:03:54 UTC) #7
commit-bot: I haz the power
5 years, 3 months ago (2015-09-07 09:07:54 UTC) #8
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=201866

Powered by Google App Engine
This is Rietveld 408576698