Do not use LazyReattachIfAttached for NG bfc reattach.

When the BFCs being re-attached were detached from that method, we
would sometimes nuke LayoutObjects later in the blocks_ vector, causing
a crash later in the iteration.

Use the new SetForceReattachLayoutTree() instead which means we do the
DetachLayoutTree() from the RebuildLayoutTree() instead. Also, store
the Elements instead of the LayoutObjects since they are traced GC
objects which is more robust.

We no longer need to check if any ancestors have already been marked
for forced legacy layout before marking for forced reattach since the
forced reattaches will be handled by the same passes over the dom tree
for style recalc and layout tree rebuild, not doing multiple layout
tree detaches.

Needed to modify the ShouldRecalcStyleFor() in order to traverse into
elements which are true for GetForceReattachLayoutTree() but not
otherwise style dirty. This is the first time we do a forced layout
tree re-attach without recalculating style.

Bug: 927983
Change-Id: Idb08f7b9a4bda81dd5a00458ef9751b754d3bd2e
Reviewed-on: https://chromium-review.googlesource.com/c/1455960
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630280}
4 files changed