Resolves: rhbz#1096747 crash/hang on format-page on html document

Change-Id: I9a989620375eb210e553b84b7a642a0360c8f03f
(cherry picked from commit 655377e90c57bb68e5000f06f76531baf9eeaa37)