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

Method overflowCallback

src/custom-element.js:2100–2129  ·  view source on GitHub ↗

* Hides or shows the overflow, if available. This function must only * be called inside a mutate context. * @param {boolean} overflown * @param {number|undefined} requestedHeight * @param {number|undefined} requestedWidth * @package @final

(overflown, requestedHeight, requestedWidth)

Source from the content-addressed store, hash-verified

2098 * @package @final
2099 */
2100 overflowCallback(overflown, requestedHeight, requestedWidth) {
2101 this.getOverflowElement();
2102 if (!this.overflowElement_) {
2103 if (overflown && this.warnOnMissingOverflow) {
2104 user().warn(
2105 TAG,
2106 'Cannot resize element and overflow is not available',
2107 this
2108 );
2109 }
2110 } else {
2111 this.overflowElement_.classList.toggle('amp-visible', overflown);
2112
2113 if (overflown) {
2114 this.overflowElement_.onclick = () => {
2115 const mutator = Services.mutatorForDoc(this.getAmpDoc());
2116 mutator.forceChangeSize(this, requestedHeight, requestedWidth);
2117 mutator.mutateElement(this, () => {
2118 this.overflowCallback(
2119 /* overflown */ false,
2120 requestedHeight,
2121 requestedWidth
2122 );
2123 });
2124 };
2125 } else {
2126 this.overflowElement_.onclick = null;
2127 }
2128 }
2129 }
2130
2131 /**
2132 * Mutates the element using resources if available.

Callers

nothing calls this directly

Calls 7

getOverflowElementMethod · 0.95
getAmpDocMethod · 0.95
userFunction · 0.90
warnMethod · 0.80
toggleMethod · 0.45
forceChangeSizeMethod · 0.45
mutateElementMethod · 0.45

Tested by

no test coverage detected