I am going to attach a patch including test cases.
Created attachment 7375 [details] Patch
Comment on attachment 7375 [details] Patch Looks good to me, but also I think lots of layout code is crying out for use of overflowRect as opposed to the separate overflowLeft, Top, Width, Height functions. r=me
Verified in r13675 nightly.