Skip to content

Commit

Permalink
Revert "🐛Change check to see if amp-img has completed layout. (#21483)…
Browse files Browse the repository at this point in the history
…" (#21613)

This reverts commit a628902.
  • Loading branch information
Sepand Parhami committed Mar 28, 2019
1 parent b6e2fd7 commit 84df9c6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions extensions/amp-image-viewer/0.1/amp-image-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,21 @@ export class AmpImageViewer extends AMP.BaseElement {
return Promise.resolve();
}
const ampImg = dev().assertElement(this.sourceAmpImage_);
this.scheduleLayout(ampImg);
const isLaidOut = ampImg.hasAttribute('i-amphtml-layout') ||
ampImg.classList.contains('i-amphtml-layout');
const laidOutPromise = isLaidOut
? Promise.resolve()
: ampImg.signals().whenSignal(CommonSignals.LOAD_END);

if (!isLaidOut) {
this.scheduleLayout(ampImg);
}

return ampImg.signals()
.whenSignal(CommonSignals.LOAD_END)
this.loadPromise_ = laidOutPromise
.then(() => this.init_())
.then(() => this.resetImageDimensions_())
.then(() => this.setupGestures_());
return this.loadPromise_;
}

/** @override */
Expand Down

0 comments on commit 84df9c6

Please sign in to comment.