codeant-ai-for-open-source[bot] commented on code in PR #44529:
URL: https://github.com/apache/superset/pull/44529#discussion_r4098488263


##########
superset-frontend/src/utils/downloadAsImage.tsx:
##########
@@ -612,6 +646,36 @@ export default function downloadAsImageOptimized(
     }
 
     try {
+      if (isSafari()) {
+        // `dom-to-image-more` serializes through SVG <foreignObject>, which
+        // WebKit does not reliably paint. html2canvas clones the document 
itself;
+        // restore the clone-path canvas and visibility work in its clone 
callback.
+        const { default: html2canvas } = await import('html2canvas');
+        const canvas = await html2canvas(elementToPrint as HTMLElement, {
+          backgroundColor:
+            bgcolor === TRANSPARENT_RGBA ? null : (bgcolor ?? null),
+          height: (elementToPrint as HTMLElement).scrollHeight,
+          width: (elementToPrint as HTMLElement).scrollWidth,
+          scale,
+          useCORS: true,
+          logging: false,
+          ignoreElements: element => !filter(element),
+          onclone: (_document, clone) => {
+            processCloneForVisibility(clone, isDashboardCapture);
+            preserveCanvasContent(elementToPrint, clone, getInstanceByDom);

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `f36feb5`.
   
   The Safari `onclone` callback now updates the capture dimensions using the 
clone’s expanded `scrollWidth` and `scrollHeight`, while preserving the 
original measurements as minimums.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



-- 
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