Assorted cleanups in gfx and layout

@pcwalton r?
Can you change this to:

    let is_whitespace_only = fragment.is_whitespace_only();
    if is_whitespace_only {
        ...debug...
    }
    is_whitespace_only