MCPcopy
hub / github.com/ampproject/amphtml / updatePaddingToHtml_

Method updatePaddingToHtml_

third_party/subscriptions-project/swg.js:11285–11296  ·  view source on GitHub ↗

* Update padding-bottom on the containing page to not hide any content * behind the popup, if rendered at the bottom. For centered dialogs, there * should be no added padding. * @param {number} newHeight * @private

(newHeight)

Source from the content-addressed store, hash-verified

11283 * @private
11284 */
11285 updatePaddingToHtml_(newHeight) {
11286 if (this.shouldPositionCenter_()) {
11287 // For centered dialogs, there should be no bottom padding.
11288 this.removePaddingToHtml_();
11289 return;
11290 }
11291 const bottomPadding = newHeight + 20; // Add some extra padding.
11292 const htmlElement = this.doc_.getRootElement();
11293 setImportantStyles$1(htmlElement, {
11294 'padding-bottom': `${bottomPadding}px`,
11295 });
11296 }
11297
11298 /**
11299 * Removes previouly added bottom padding from the document.

Callers 1

resizeViewMethod · 0.95

Calls 4

shouldPositionCenter_Method · 0.95
removePaddingToHtml_Method · 0.95
setImportantStyles$1Function · 0.85
getRootElementMethod · 0.45

Tested by

no test coverage detected