<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[278614] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/278614">278614</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2021-06-08 09:53:06 -0700 (Tue, 08 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace`
https://bugs.webkit.org/show_bug.cgi?id=226756

Reviewed by Sam Weinig.

Don't wrap `PixelFormat` or `DestinationColorSpace` with `std::optional` as we want each
callsite to explicity configure them. This makes it easier to find where values for each
are used as there's no implicit behavior.

No behavior change. Followup after <a href="http://trac.webkit.org/projects/webkit/changeset/278565">r278565</a>.

Source/WebCore:

* page/FrameSnapshotting.h:
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRect):
(WebCore::snapshotFrameRectWithClip):
(WebCore::snapshotNode):
(WebCore::snapshotSelection):

* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::snapshotNode):
(WebCore::InspectorPageAgent::snapshotRect):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::screenshot):
* page/TextIndicator.cpp:
(WebCore::snapshotOptionsForTextIndicatorOptions):
(WebCore::takeSnapshots):
* platform/DragImage.cpp:
(WebCore::createDragImageForNode):
(WebCore::createDragImageForSelection):
(WebCore::createDragImageForRange):
(WebCore::createDragImageForImage):

Source/WebKit:

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSelectionSnapshot const):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsInspectorPageAgentcpp">trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameSnapshottingcpp">trunk/Source/WebCore/page/FrameSnapshotting.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameSnapshottingh">trunk/Source/WebCore/page/FrameSnapshotting.h</a></li>
<li><a href="#trunkSourceWebCorepagePageConsoleClientcpp">trunk/Source/WebCore/page/PageConsoleClient.cpp</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformDragImagecpp">trunk/Source/WebCore/platform/DragImage.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebFramecpp">trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/ChangeLog      2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2021-06-08  Devin Rousso  <drousso@apple.com>
+
+        Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace`
+        https://bugs.webkit.org/show_bug.cgi?id=226756
+
+        Reviewed by Sam Weinig.
+
+        Don't wrap `PixelFormat` or `DestinationColorSpace` with `std::optional` as we want each
+        callsite to explicity configure them. This makes it easier to find where values for each
+        are used as there's no implicit behavior.
+
+        No behavior change. Followup after r278565.
+
+        * page/FrameSnapshotting.h:
+        * page/FrameSnapshotting.cpp:
+        (WebCore::snapshotFrameRect):
+        (WebCore::snapshotFrameRectWithClip):
+        (WebCore::snapshotNode):
+        (WebCore::snapshotSelection):
+
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::snapshotNode):
+        (WebCore::InspectorPageAgent::snapshotRect):
+        * page/PageConsoleClient.cpp:
+        (WebCore::PageConsoleClient::screenshot):
+        * page/TextIndicator.cpp:
+        (WebCore::snapshotOptionsForTextIndicatorOptions):
+        (WebCore::takeSnapshots):
+        * platform/DragImage.cpp:
+        (WebCore::createDragImageForNode):
+        (WebCore::createDragImageForSelection):
+        (WebCore::createDragImageForRange):
+        (WebCore::createDragImageForImage):
+
</ins><span class="cx"> 2021-06-08  Sam Weinig  <weinig@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Move some hand rolled CSSProperty predicates to be generated based on new CSSProperties.json properties
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp     2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp        2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -1072,7 +1072,7 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return makeUnexpected(errorString);
</span><span class="cx"> 
</span><del>-    auto snapshot = WebCore::snapshotNode(m_inspectedPage.mainFrame(), *node);
</del><ins>+    auto snapshot = WebCore::snapshotNode(m_inspectedPage.mainFrame(), *node, { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() });
</ins><span class="cx">     if (!snapshot)
</span><span class="cx">         return makeUnexpected("Could not capture snapshot"_s);
</span><span class="cx"> 
</span><span class="lines">@@ -1081,7 +1081,7 @@
</span><span class="cx"> 
</span><span class="cx"> Protocol::ErrorStringOr<String> InspectorPageAgent::snapshotRect(int x, int y, int width, int height, Protocol::Page::CoordinateSystem coordinateSystem)
</span><span class="cx"> {
</span><del>-    SnapshotOptions options;
</del><ins>+    SnapshotOptions options { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() };
</ins><span class="cx">     if (coordinateSystem == Protocol::Page::CoordinateSystem::Viewport)
</span><span class="cx">         options.flags.add(SnapshotFlags::InViewCoordinates);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameSnapshotting.cpp (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.cpp  2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/page/FrameSnapshotting.cpp     2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "FrameSnapshotting.h"
</span><span class="cx"> 
</span><del>-#include "DestinationColorSpace.h"
</del><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "FloatRect.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="lines">@@ -40,7 +39,6 @@
</span><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "Page.h"
</span><del>-#include "PixelFormat.h"
</del><span class="cx"> #include "RenderObject.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include <wtf/OptionSet.h>
</span><span class="lines">@@ -114,7 +112,7 @@
</span><span class="cx">     if (options.flags.contains(SnapshotFlags::PaintWithIntegralScaleFactor))
</span><span class="cx">         scaleFactor = ceilf(scaleFactor);
</span><span class="cx"> 
</span><del>-    auto buffer = ImageBuffer::create(imageRect.size(), RenderingMode::Unaccelerated, scaleFactor, options.colorSpace.value_or(DestinationColorSpace::SRGB()), options.pixelFormat.value_or(PixelFormat::BGRA8));
</del><ins>+    auto buffer = ImageBuffer::create(imageRect.size(), RenderingMode::Unaccelerated, scaleFactor, options.colorSpace, options.pixelFormat);
</ins><span class="cx">     if (!buffer)
</span><span class="cx">         return nullptr;
</span><span class="cx">     buffer->context().translate(-imageRect.x(), -imageRect.y());
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameSnapshotting.h (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.h    2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/page/FrameSnapshotting.h       2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -29,19 +29,18 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include "DestinationColorSpace.h"
+#include "PixelFormat.h"
</ins><span class="cx"> #include <memory>
</span><del>-#include <optional>
</del><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class DestinationColorSpace;
</del><span class="cx"> class FloatRect;
</span><span class="cx"> class Frame;
</span><span class="cx"> class IntRect;
</span><span class="cx"> class ImageBuffer;
</span><span class="cx"> class Node;
</span><del>-enum class PixelFormat : uint8_t;
</del><span class="cx"> 
</span><span class="cx"> enum class SnapshotFlags : uint8_t {
</span><span class="cx">     ExcludeSelectionHighlighting = 1 << 0,
</span><span class="lines">@@ -54,14 +53,14 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct SnapshotOptions {
</span><del>-    OptionSet<SnapshotFlags> flags { };
-    std::optional<PixelFormat> pixelFormat { };
-    std::optional<DestinationColorSpace> colorSpace { };
</del><ins>+    OptionSet<SnapshotFlags> flags;
+    PixelFormat pixelFormat;
+    DestinationColorSpace colorSpace;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-WEBCORE_EXPORT RefPtr<ImageBuffer> snapshotFrameRect(Frame&, const IntRect&, SnapshotOptions&& = { });
-RefPtr<ImageBuffer> snapshotFrameRectWithClip(Frame&, const IntRect&, const Vector<FloatRect>& clipRects, SnapshotOptions&& = { });
-RefPtr<ImageBuffer> snapshotNode(Frame&, Node&, SnapshotOptions&& = { });
-WEBCORE_EXPORT RefPtr<ImageBuffer> snapshotSelection(Frame&, SnapshotOptions&& = { });
</del><ins>+WEBCORE_EXPORT RefPtr<ImageBuffer> snapshotFrameRect(Frame&, const IntRect&, SnapshotOptions&&);
+RefPtr<ImageBuffer> snapshotFrameRectWithClip(Frame&, const IntRect&, const Vector<FloatRect>& clipRects, SnapshotOptions&&);
+RefPtr<ImageBuffer> snapshotNode(Frame&, Node&, SnapshotOptions&&);
+WEBCORE_EXPORT RefPtr<ImageBuffer> snapshotSelection(Frame&, SnapshotOptions&&);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageConsoleClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConsoleClient.cpp (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConsoleClient.cpp  2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/page/PageConsoleClient.cpp     2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx"> 
</span><span class="cx">                 if (dataURL.isEmpty()) {
</span><span class="cx">                     if (!snapshot)
</span><del>-                        snapshot = WebCore::snapshotNode(m_page.mainFrame(), *node);
</del><ins>+                        snapshot = WebCore::snapshotNode(m_page.mainFrame(), *node, { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() });
</ins><span class="cx"> 
</span><span class="cx">                     if (snapshot)
</span><span class="cx">                         dataURL = snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes);
</span><span class="lines">@@ -404,7 +404,7 @@
</span><span class="cx">         if (!target) {
</span><span class="cx">             // If no target is provided, capture an image of the viewport.
</span><span class="cx">             IntRect imageRect(IntPoint::zero(), m_page.mainFrame().view()->sizeForVisibleContent());
</span><del>-            if (auto snapshot = WebCore::snapshotFrameRect(m_page.mainFrame(), imageRect, { { SnapshotFlags::InViewCoordinates } }))
</del><ins>+            if (auto snapshot = WebCore::snapshotFrameRect(m_page.mainFrame(), imageRect, { { SnapshotFlags::InViewCoordinates }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() }))
</ins><span class="cx">                 dataURL = snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp      2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/page/TextIndicator.cpp 2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -127,8 +127,7 @@
</span><span class="cx"> 
</span><span class="cx"> static SnapshotOptions snapshotOptionsForTextIndicatorOptions(OptionSet<TextIndicatorOption> options)
</span><span class="cx"> {
</span><del>-    SnapshotOptions snapshotOptions;
-    snapshotOptions.flags.add(SnapshotFlags::PaintWithIntegralScaleFactor);
</del><ins>+    SnapshotOptions snapshotOptions { { SnapshotFlags::PaintWithIntegralScaleFactor }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() };
</ins><span class="cx"> 
</span><span class="cx">     if (!options.contains(TextIndicatorOption::PaintAllContent)) {
</span><span class="cx">         if (options.contains(TextIndicatorOption::PaintBackgrounds))
</span><span class="lines">@@ -162,7 +161,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (data.options.contains(TextIndicatorOption::IncludeSnapshotWithSelectionHighlight)) {
</span><span class="cx">         float snapshotScaleFactor;
</span><del>-        data.contentImageWithHighlight = takeSnapshot(frame, snapshotRect, { }, snapshotScaleFactor, clipRectsInDocumentCoordinates);
</del><ins>+        data.contentImageWithHighlight = takeSnapshot(frame, snapshotRect, { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() }, snapshotScaleFactor, clipRectsInDocumentCoordinates);
</ins><span class="cx">         ASSERT(!data.contentImageWithHighlight || data.contentImageScaleFactor >= snapshotScaleFactor);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -169,7 +168,7 @@
</span><span class="cx">     if (data.options.contains(TextIndicatorOption::IncludeSnapshotOfAllVisibleContentWithoutSelection)) {
</span><span class="cx">         float snapshotScaleFactor;
</span><span class="cx">         auto snapshotRect = frame.view()->visibleContentRect();
</span><del>-        data.contentImageWithoutSelection = takeSnapshot(frame, snapshotRect, { { SnapshotFlags::PaintEverythingExcludingSelection } }, snapshotScaleFactor, { });
</del><ins>+        data.contentImageWithoutSelection = takeSnapshot(frame, snapshotRect, { { SnapshotFlags::PaintEverythingExcludingSelection }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() }, snapshotScaleFactor, { });
</ins><span class="cx">         data.contentImageWithoutSelectionRectInRootViewCoordinates = frame.view()->contentsToRootView(snapshotRect);
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDragImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/DragImage.cpp (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/DragImage.cpp      2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebCore/platform/DragImage.cpp 2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx"> DragImageRef createDragImageForNode(Frame& frame, Node& node)
</span><span class="cx"> {
</span><span class="cx">     ScopedNodeDragEnabler enableDrag(frame, node);
</span><del>-    return createDragImageFromSnapshot(snapshotNode(frame, node), &node);
</del><ins>+    return createDragImageFromSnapshot(snapshotNode(frame, node, { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() }), &node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS_FAMILY) || !ENABLE(DRAG_SUPPORT)
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx"> 
</span><span class="cx"> DragImageRef createDragImageForSelection(Frame& frame, TextIndicatorData&, bool forceBlackText)
</span><span class="cx"> {
</span><del>-    SnapshotOptions options;
</del><ins>+    SnapshotOptions options { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() };
</ins><span class="cx">     if (forceBlackText)
</span><span class="cx">         options.flags.add(SnapshotFlags::ForceBlackText);
</span><span class="cx">     return createDragImageFromSnapshot(snapshotSelection(frame, WTFMove(options)), nullptr);
</span><span class="lines">@@ -184,8 +184,7 @@
</span><span class="cx">     if (!startRenderer || !endRenderer)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    SnapshotOptions options;
-    options.flags.add(SnapshotFlags::PaintSelectionOnly);
</del><ins>+    SnapshotOptions options { { SnapshotFlags::PaintSelectionOnly }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() };
</ins><span class="cx">     if (forceBlackText)
</span><span class="cx">         options.flags.add(SnapshotFlags::ForceBlackText);
</span><span class="cx"> 
</span><span class="lines">@@ -218,7 +217,7 @@
</span><span class="cx">     elementRect = snappedIntRect(topLevelRect);
</span><span class="cx">     imageRect = paintingRect;
</span><span class="cx"> 
</span><del>-    return createDragImageFromSnapshot(snapshotNode(frame, node), &node);
</del><ins>+    return createDragImageFromSnapshot(snapshotNode(frame, node, { { }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() }), &node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS_FAMILY) || !ENABLE(DRAG_SUPPORT)
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebKit/ChangeLog       2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2021-06-08  Devin Rousso  <drousso@apple.com>
+
+        Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace`
+        https://bugs.webkit.org/show_bug.cgi?id=226756
+
+        Reviewed by Sam Weinig.
+
+        Don't wrap `PixelFormat` or `DestinationColorSpace` with `std::optional` as we want each
+        callsite to explicity configure them. This makes it easier to find where values for each
+        are used as there's no implicit behavior.
+
+        No behavior change. Followup after r278565.
+
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::createSelectionSnapshot const):
+
</ins><span class="cx"> 2021-06-08  Jean-Yves Avenard  <jya@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [MSE] Rework handling of SourceBuffer's buffer full.
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp (278613 => 278614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp      2021-06-08 16:51:42 UTC (rev 278613)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebFrame.cpp 2021-06-08 16:53:06 UTC (rev 278614)
</span><span class="lines">@@ -842,7 +842,7 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr<ShareableBitmap> WebFrame::createSelectionSnapshot() const
</span><span class="cx"> {
</span><del>-    auto snapshot = snapshotSelection(*coreFrame(), { { WebCore::SnapshotFlags::ForceBlackText } });
</del><ins>+    auto snapshot = snapshotSelection(*coreFrame(), { { WebCore::SnapshotFlags::ForceBlackText }, PixelFormat::BGRA8, DestinationColorSpace::SRGB() });
</ins><span class="cx">     if (!snapshot)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>