Boris Zbarsky wrote:
Well, I seem to have at least some of the same pain with just the table stuff. For example:

  <div>a<span style="display: table-cell">b</span>
        <span style="display: table-cell">c</span>d</div>

followed by a script that removes the two <span>s from the DOM.

Just to follow up on this, I dealt by simply reconstructing all kids of the parent if a child is removed that has an anonymous table frame parent and is at the beginning or end of that parent.

That makes sure that we properly recompute which whitespace should and shouldn't have frames created for it.

We could probably adopt a similar approach for blocks, especially if we switch to blocks-of-blocks and blocks-of-inlines: removal of a block at the beginning or end of a block-of-blocks would need to reconstruct a bit more stuff. We might need to optimize things a bit more in that case, though, since I expect it to be a lot more common than the anonymous table case.

On a related note, the eager nature of frame construction and the fact that some cases reconstruct the parent means that there are situations where removing a bunch of kids is O(N^2) in the number of kids (each removal causes a reconstruct of all the kids). I wonder whether it's worth it to look into posting a restyle event to handle the parent reconstruct in MaybeRecreateContainerForFrameRemoval and just removing the frame normally. We can't do that sort of thing as easily on insertions, since we might not have a good place to put the new frame, but it'd work for removals...

-Boris
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to