Bug 877974 - reorg getTextAtOffset for line boundary, r=tbsaunde