Pass HTMLDocument to convertToData

Change-Id: Ia7db42b7727b8ca16ae837b2f7c2aa56fb17576e
(cherry picked from commit df29ea9c017dd1537308741c3015b8c021daf5c5)