Work around DOM corruption for default-sized images

This doesn't really fix the underlying issue that the
width and height are overridden to be the default size
in the DM even if that's wrong (in the case the image's
original size is smaller than the default thumbnail size),
but it fixes the DOM corruption by storing the original
width&height and restoring them if the image still has
defaultSize=true on the way out.

Bug: 62172
Change-Id: Iaee798c5bb501310e52d0ac832b2e7cd833fc438
(cherry picked from commit c0380f16a498d7fc4de9036636ecbda1e6f25e04)