Fix regression bug 'default size' change on alignment

* Corrected the condition that set default size only if the image
  wasn't smaller than the default.
* Added a couple of sanity check conditions for the OO.Compare
  condition

Bug: 62586
Bug: 62581
Change-Id: I4db996cec33ac9d53ef485b53568100e3912c4ae
(cherry picked from commit 1948ed8403a086696ab572566ebffd850aa98bfb)