* Adds a layout callback for mathml iframe. * * @return {!Promise}
()
| 52 | * @return {!Promise} |
| 53 | */ |
| 54 | layoutCallback() { |
| 55 | const iframe = getIframe(this.win, this.element, 'mathml'); |
| 56 | iframe.title = this.element.title || 'MathML formula'; |
| 57 | applyFillContent(iframe); |
| 58 | // Triggered by context.updateDimensions() inside the iframe. |
| 59 | listenFor( |
| 60 | iframe, |
| 61 | 'embed-size', |
| 62 | (data) => { |
| 63 | if (!this.element.hasAttribute('inline')) { |
| 64 | // Don't change the width if not inlined. |
| 65 | data['width'] = undefined; |
| 66 | } |
| 67 | Services.mutatorForDoc(this.getAmpDoc()).forceChangeSize( |
| 68 | this.element, |
| 69 | data['height'], |
| 70 | data['width'] |
| 71 | ); |
| 72 | }, |
| 73 | /* opt_is3P */ true |
| 74 | ); |
| 75 | this.element.appendChild(iframe); |
| 76 | this.iframe_ = iframe; |
| 77 | return this.loadPromise(iframe); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Removes mathml iframe. |
no test coverage detected