* @param {number} id * @param {!AmpElement} element * @param {!./resources-interface.ResourcesInterface} resources
(id, element, resources)
| 125 | * @param {!./resources-interface.ResourcesInterface} resources |
| 126 | */ |
| 127 | constructor(id, element, resources) { |
| 128 | element[RESOURCE_PROP_] = this; |
| 129 | |
| 130 | /** @private {number} */ |
| 131 | this.id_ = id; |
| 132 | |
| 133 | /** @const {!AmpElement} */ |
| 134 | this.element = element; |
| 135 | |
| 136 | /** @const {string} */ |
| 137 | this.debugid = element.tagName.toLowerCase() + '#' + id; |
| 138 | |
| 139 | /** @const {!Window} */ |
| 140 | this.hostWin = toWin(element.ownerDocument.defaultView); |
| 141 | |
| 142 | /** @const @private {!./resources-interface.ResourcesInterface} */ |
| 143 | this.resources_ = resources; |
| 144 | |
| 145 | /** @const @private {boolean} */ |
| 146 | this.isPlaceholder_ = element.hasAttribute('placeholder'); |
| 147 | |
| 148 | /** @private {boolean} */ |
| 149 | this.isBuilding_ = false; |
| 150 | |
| 151 | /** @private {!AmpElement|undefined|null} */ |
| 152 | this.owner_ = undefined; |
| 153 | |
| 154 | /** @private {!ResourceState_Enum} */ |
| 155 | this.state_ = element.isBuilt() |
| 156 | ? ResourceState_Enum.NOT_LAID_OUT |
| 157 | : ResourceState_Enum.NOT_BUILT; |
| 158 | |
| 159 | // Race condition: if an element is reparented while building, it'll |
| 160 | // receive a newly constructed Resource. Make sure this Resource's |
| 161 | // internal state is also "building". |
| 162 | if (this.state_ == ResourceState_Enum.NOT_BUILT && element.isBuilding()) { |
| 163 | this.build(); |
| 164 | } |
| 165 | |
| 166 | /** @private {number} */ |
| 167 | this.priorityOverride_ = -1; |
| 168 | |
| 169 | /** @private {number} */ |
| 170 | this.layoutCount_ = 0; |
| 171 | |
| 172 | /** |
| 173 | * Used to signal that the current layoutCallback has been aborted by an |
| 174 | * unlayoutCallback. |
| 175 | * @private {?AbortController} |
| 176 | */ |
| 177 | this.abortController_ = null; |
| 178 | |
| 179 | /** @private {*} */ |
| 180 | this.lastLayoutError_ = null; |
| 181 | |
| 182 | /** @private {boolean} */ |
| 183 | this.isFixed_ = false; |
| 184 |
nothing calls this directly
no test coverage detected