There were many places when we have to check the edge cases for xOffset. I've externalized the mechanics. patch to follow.
Created attachment 193271 [details] Patch
Committed r145894: <http://trac.webkit.org/changeset/145894>