[Webkit-unassigned] [Bug 266025] New: Using setDragImage with html element containing transparency generates incorrect bitmap preview

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 7 15:03:22 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=266025

            Bug ID: 266025
           Summary: Using setDragImage with html element containing
                    transparency generates incorrect bitmap preview
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Mac (Apple Silicon)
                OS: macOS 14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: sthompson2 at atlassian.com

When using setDragImage and passing it a HTMLElement which has a transparent background. The resulting bitmap preview contains baked in text elements from the underlying page which were not children of the HTMLElement. If the HTMLElement is opaque then the resulting snapshot doesn't contain any text elements from the page.

Our HTMLElement has the following styles set before being passed to setDragImage;
{
  position: 'fixed',
  top: 0,
  left: 0,
  zIndex: 2147483647,
  pointerEvents: 'none',
}

If the web page contains text near the 0,0 coords within the bounds of the HTMLElement Rect, then that text will be included in the snapshot.

This is different behaviour when compared to chrome and firefox. They only take a snapshot of the element, and don't include text from the web page outside the element.

This bug can be worked around by offsetting the container negative left by the container width-0.0001px. If we offset by -width then the drag operation will be cancelled which is why we need to leave a fraction of the container still within the viewport bounds.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231207/eed4ca23/attachment.htm>


More information about the webkit-unassigned mailing list