[New Multicolumn] Support dynamic insertion and removal of multicol content.

Special attention is required when a dynamic change requires a column spanner
placeholder to be inserted. When a spanner is inserted, we need to create a
placeholder. If the spanner was inserted in the middle of regular column
content, it means that there's a column set there that we need to split, so
that we get one column row before the spanner and one column row after. We may
also have to create an additional column set when inserting column set, e.g.
when it's inserted between adjacent spanners.

Removal of spanners was already being handled properly (in terms of merging any
surrounding column sets). But removing superfluous column sets when column
content is removed wasn't taken care of until this CL.

Also had to fix how spanner placeholders are torn down, as we cannot notify the
flow thread both in RenderBox and RenderObject, when a spanner is removed. If
we first did it in RenderBox, the spanner placeholder would be destroyed at
that time. This would mean that when we finally got to
RenderObject::removeFromRenderFlowThreadRecursive(), the ex-spanner would
notify the thread again for the same renderer (which is bad in any regard), and
this time the flow thread would think that we're removing actual column content
(since there's no longer a placeholder associated with it). The unit test
MultiColumnTreeModifyingTest.InsertSpannerAndRemove would assert without this
change, as we wouldn't be able to find a column set to remove (since there is
none in that case, since the multicol container only contains a sole spanner).

Added a bunch of layout and unit tests. The unit tests need to modify the
render tree on their own, so we need to tell the document that this needs to be
allowed.

BUG=347325
R=jchaffraix@chromium.org

Review URL: https://codereview.chromium.org/869583002

git-svn-id: svn://svn.chromium.org/blink/trunk@188883 bbb929c8-8fbe-4397-9dbb-9b2b20218538
81 files changed
tree: 27f7b3a61101c47bafbea89ec90ccf5d019fe49f
  1. third_party/