Skip to content

Commit

Permalink
Resource=>Mutator refactor for story auto ads (#26548)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerivq committed Jan 29, 2020
1 parent 6d7ccee commit 18e868e
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -31,16 +31,16 @@ export class ButtonTextFitter {
* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc
*/
constructor(ampdoc) {
/** @private @const {!../../../src/service/resources-interface.ResourcesInterface} */
this.resources_ = Services.resourcesForDoc(ampdoc);
/** @const @private {!../../../src/service/mutator-interface.MutatorInterface} */
this.mutator_ = Services.mutatorForDoc(ampdoc);

/** @private {!Document} */
this.doc_ = ampdoc.win.document;

/** @private {!Element} */
this.measurer_ = this.doc_.createElement('div');

this.resources_.mutateElement(this.measurer_, () => {
this.mutator_.mutateElement(this.measurer_, () => {
this.doc_.body.appendChild(this.measurer_);
setStyles(this.measurer_, {
position: 'absolute',
Expand All @@ -62,7 +62,7 @@ export class ButtonTextFitter {
*/
fit(pageElement, container, content) {
let success = false;
return this.resources_
return this.mutator_
.mutateElement(container, () => {
this.measurer_.textContent = content;
const fontSize = calculateFontSize(
Expand Down

0 comments on commit 18e868e

Please sign in to comment.