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

Issue 1328923002: Avoid stack overflow triggered by out-of-band layout of flexbox child. (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, mstensho (USE GERRIT), pdr+renderingwatchlist_chromium.org, szager+layoutwatch_chromium.org, zoltan1
Target Ref:
refs/remotes/origin/master
Project:
blink
Visibility:
Public.

Description

Avoid stack overflow triggered by out-of-band layout of flexbox child. Flexbox uses LayoutBlock::finishDelayUpdateScrollInfo(), which may jump to some arbitrary block in the subtree and lay it out directly. This is bad, at least for multicol, since it requires that a flow thread be entered have its children laid out without skipping any parents in the chain. LayoutMulticolFlowThread::skipColumnSpanner() was called on the wrong flow thread, which resulted in m_lastSetWorkedOn pointing to a column set that was part of an inner flow thread, and not the flow thread we called. That made columnSetAtBlockOffset() return a column set from an inner flow thread, causing an infinite recursion when walking upwards in the flow thread ancestry chain). So the spanner was in the inner flow thread, but it was the outer flow thread that got called. This happened because our LayoutState says that's the innermost flow thread being laid out at the moment, because finishDelayUpdateScrollInfo() just teleported and laid out a descendant of the inner flow thread. Luckily there's a safer way of obtaining the flow thread associated with a spanner, so do that instead. This is not a perfect fix. LayoutState still points to the wrong flow thread (we just avoid asking it). The root cause remains (out-of-band layout), and there may be other bugs caused by this. For multicol, we're still not in the clear. Since we have a skipColumnSpanner() call without laying out the flow thread, we'll get an assertion failure next time we lay out the flow thread, because it will assert that there be no m_lastSetWorkedOn (but skipColumnSpanner() has set that one while not laying out the flow thread). But at least we're getting rid of the infinite recursion. Since we now call skipColumnSpanner() on a LayoutMultiColumnFlowThread, instead of on a LayoutFlowThread, we need to make that method public (private overrides is just asking for trouble). And since this is the only caller, make it non-virtual while at it. LayoutFlowThread no longer needs this. BUG=526664 R=jchaffraix@chromium.org,leviw@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=202519

Patch Set 1 #

Patch Set 2 : rebase master #

Patch Set 3 : Update test. The previous one started to pass, because of https://codereview.chromium.org/129593300… #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -6 lines) Patch
A LayoutTests/fast/multicol/flexbox-with-overflow-auto-child-crash.html View 1 2 1 chunk +18 lines, -0 lines 0 comments Download
A + LayoutTests/fast/multicol/flexbox-with-overflow-auto-child-crash-expected.txt View 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/core/layout/LayoutBlockFlow.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M Source/core/layout/LayoutFlowThread.h View 1 chunk +0 lines, -5 lines 0 comments Download
M Source/core/layout/LayoutMultiColumnFlowThread.h View 2 chunks +5 lines, -1 line 0 comments Download

Messages

Total messages: 9 (3 generated)
mstensho (USE GERRIT)
I think LayoutBlock::finishDelayUpdateScrollInfo() is just black magic that needs to be exorcised, but in the ...
5 years, 3 months ago (2015-09-04 15:05:08 UTC) #1
mstensho (USE GERRIT)
5 years, 3 months ago (2015-09-13 06:43:31 UTC) #3
leviw_travelin_and_unemployed
szager just worked on this code, so I'll have him put the official stamp on, ...
5 years, 3 months ago (2015-09-14 09:58:46 UTC) #5
szager1
In reviewing this patch, I took my first look at the multi-column code: https://i.imgur.com/0tlqT2F.gifv Patch ...
5 years, 3 months ago (2015-09-17 18:50:12 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1328923002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1328923002/40001
5 years, 3 months ago (2015-09-18 08:32:26 UTC) #8
commit-bot: I haz the power
5 years, 3 months ago (2015-09-18 10:56:51 UTC) #9
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=202519

Powered by Google App Engine
This is Rietveld 408576698