hadimobarra commented on code in PR #44529:
URL: https://github.com/apache/superset/pull/44529#discussion_r4098551029


##########
superset-frontend/src/utils/downloadAsImage.tsx:
##########
@@ -559,14 +571,36 @@ export default function downloadAsImageOptimized(
           }),
         };
 
-        const dataUrl = isPng
-          ? await domToImage.toPng(agRootWrapper, agImageOptions)
-          : await domToImage.toJpeg(agRootWrapper, agImageOptions);
+        let dataUrl: string;
+        if (isSafari()) {
+          // `dom-to-image-more` relies on SVG <foreignObject>, which WebKit 
does
+          // not reliably paint. Keep the ag-grid preparation above, then use a
+          // DOM painter for the actual Safari capture.
+          const { default: html2canvas } = await import('html2canvas');
+          const canvas = await html2canvas(agRootWrapper, {
+            backgroundColor:
+              bgcolor === TRANSPARENT_RGBA ? null : (bgcolor ?? null),
+            height: imageHeight,
+            width: originalWidth,
+            scale,
+            useCORS: true,

Review Comment:
   Assessed: `useCORS: true` includes remote images when their server grants 
CORS access. A browser cannot render an image from a server without those 
headers into an exportable canvas; enabling `allowTaint` would instead taint 
the canvas and make `toDataURL()` fail, preventing the whole download. The 
Safari path therefore preserves the existing dom-to-image behavior of omitting 
inaccessible images while exporting everything else. No client-side change is 
appropriate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to