Bug 1341275 - review: Add comment explaining FaviconView.getWidth non-zero values. r=trivial
MozReview-Commit-ID: 33RXaB4gCkK
--- a/mobile/android/base/java/org/mozilla/gecko/widget/FaviconView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/FaviconView.java
@@ -143,16 +143,20 @@ public class FaviconView extends ImageVi
/**
* Formats the image for display, if the prerequisite data are available. Upscales tiny Favicons to
* normal sized ones, replaces null bitmaps with the default Favicon, and fills all remaining space
* in this view with the coloured background.
*/
private void formatImage() {
// Both onSizeChanged and updateImage have to be called before an image can be shown.
+ //
+ // Note: getWidth/Height get their non-zero values during layout, at which point onSizeChanged will be called.
+ // Since we block for onSizeChanged (getWidth/Height != 0) and we only call getWidth/Height from this method
+ // and the ones it calls, we should have no problems with zero values for `getWidth/Height`.
final boolean canImageBeShown = (mIconBitmap != null && getWidth() != 0 && getHeight() != 0);
if (!canImageBeShown) {
showNoImage();
return;
}
mShouldShowImage = true;