[css-grid] Check in an initial rewrite of the layout algorithm. (This should be shorter and more understandable, but may need to be checked for accuracy.)