(doc: Document)
| 132 | } |
| 133 | |
| 134 | function parseResolutionFromHtml(doc: Document): CanvasResolution | null { |
| 135 | const htmlEl = doc.documentElement; |
| 136 | if (!htmlEl) return null; |
| 137 | const resolutionAttr = htmlEl.getAttribute("data-resolution"); |
| 138 | if ( |
| 139 | resolutionAttr === "landscape" || |
| 140 | resolutionAttr === "portrait" || |
| 141 | resolutionAttr === "landscape-4k" || |
| 142 | resolutionAttr === "portrait-4k" || |
| 143 | resolutionAttr === "square" || |
| 144 | resolutionAttr === "square-4k" |
| 145 | ) { |
| 146 | return resolutionAttr; |
| 147 | } |
| 148 | |
| 149 | const widthAttr = htmlEl.getAttribute("data-composition-width"); |
| 150 | const heightAttr = htmlEl.getAttribute("data-composition-height"); |
| 151 | if (widthAttr && heightAttr) { |
| 152 | const width = parseInt(widthAttr, 10); |
| 153 | const height = parseInt(heightAttr, 10); |
| 154 | if (width && height) { |
| 155 | return resolveResolutionFromDimensions(width, height); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | return null; |
| 160 | } |
| 161 | |
| 162 | const UHD_SQUARE_MIN = 2160; |
| 163 | const UHD_RECT_MIN = 3840; |
no test coverage detected