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

Method layoutCallback

extensions/amp-mathml/0.1/amp-mathml.js:54–78  ·  view source on GitHub ↗

* Adds a layout callback for mathml iframe. * * @return {!Promise}

()

Source from the content-addressed store, hash-verified

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.

Callers 2

waitForRenderFunction · 0.45
getAmpMathmlFunction · 0.45

Calls 6

getIframeFunction · 0.90
applyFillContentFunction · 0.90
listenForFunction · 0.90
loadPromiseMethod · 0.80
forceChangeSizeMethod · 0.45
getAmpDocMethod · 0.45

Tested by

no test coverage detected