<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - No reliable way to get a snapshot of WKWebView (macOS)"
   href="https://bugs.webkit.org/show_bug.cgi?id=161450">161450</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>No reliable way to get a snapshot of WKWebView (macOS)
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebKit API
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dasau&#64;microsoft.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The cocoa API -[NSView cacheDisplayInRect:(NSRect)rect toBitmapImageRep:(NSBitmapImageRep *)bitmapImageRep] does not work for WKWebView, it only returns an empty image. We need a way to get the visible contents of the web page on macOS. The UI is rendered in a separate process, there should be an API to grab the visible bitmap from the UI process and expose it as a method on WKWebView that the embedding application can consume. We need to be able to grab the web page contents regardless if the WKWebView is hidden or overlapped by other views, CGWindowListCreateImage will not work for that scenario.

For iOS, you can use the -[UIView drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates] API to get the web page contents.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>