It finds the first and last leaf inside the inline element, then creates a box from the top left of the first element to the bottom right of the last element. This doesn't work at all if, for example, the first child is in the middle of a line and the last child is just after a line break (and is therefore on the left of the first child).
See https://bugs.webkit.org/show_bug.cgi?id=139333
Alleviated in r177035