* 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)
| 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. |
nothing calls this directly
no test coverage detected