<!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>[260547] 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/260547">260547</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2020-04-22 17:42:45 -0700 (Wed, 22 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
https://bugs.webkit.org/show_bug.cgi?id=210774

Reviewed by Dean Jackson.

Source/WebCore:

Break out the touch action region and editable element region debug overlays into their own
flags that can be passed to Settings::setVisibleDebugOverlayRegions() to toggle these overlays,
respectively. Currently both of these overlays piggyback on whether the engine will paint the
non-fast scrollable region.

* page/SettingsBase.h: Add two more enumerators.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::invalidateEventRegion const): Update the code to be more precise now that
we can target the update paint overlay hack to when we are painting touch-action or editable
element regions.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintDebugOverlays): Condition the painting of touch action region
on one enumerator and the painting of editable element region on another.
(WebCore::RenderLayerBacking::paintContents): Update the code to be more precise.

Source/WebKit:

Expose two new enumerators to toggle touch action region and editable element region
overlay painting.

* UIProcess/API/C/WKPreferencesRef.h:
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageSettingsBaseh">trunk/Source/WebCore/page/SettingsBase.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKPreferencesRefh">trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKPreferencesPrivateh">trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebCore/ChangeLog      2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2020-04-22  Daniel Bates  <dabates@apple.com>
+
+        Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
+        https://bugs.webkit.org/show_bug.cgi?id=210774
+
+        Reviewed by Dean Jackson.
+
+        Break out the touch action region and editable element region debug overlays into their own
+        flags that can be passed to Settings::setVisibleDebugOverlayRegions() to toggle these overlays,
+        respectively. Currently both of these overlays piggyback on whether the engine will paint the
+        non-fast scrollable region.
+
+        * page/SettingsBase.h: Add two more enumerators.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::invalidateEventRegion const): Update the code to be more precise now that
+        we can target the update paint overlay hack to when we are painting touch-action or editable
+        element regions.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintDebugOverlays): Condition the painting of touch action region
+        on one enumerator and the painting of editable element region on another.
+        (WebCore::RenderLayerBacking::paintContents): Update the code to be more precise.
+
</ins><span class="cx"> 2020-04-22  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ Mac wk2 ] imported/w3c/web-platform-tests/notifications/event-onclose.html is flaky failing.
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SettingsBase.h (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SettingsBase.h 2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebCore/page/SettingsBase.h    2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -69,6 +69,8 @@
</span><span class="cx"> enum DebugOverlayRegionFlags {
</span><span class="cx">     NonFastScrollableRegion = 1 << 0,
</span><span class="cx">     WheelEventHandlerRegion = 1 << 1,
</span><ins>+    TouchActionRegion = 1 << 2,
+    EditableElementRegion = 1 << 3,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum class UserInterfaceDirectionPolicy {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp   2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp      2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -7022,7 +7022,7 @@
</span><span class="cx">     if (reason == EventRegionInvalidationReason::NonCompositedFrame) {
</span><span class="cx">         auto& view = renderer().view();
</span><span class="cx">         view.setNeedsEventRegionUpdateForNonCompositedFrame();
</span><del>-        if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion)
</del><ins>+        if (renderer().settings().visibleDebugOverlayRegions() & (TouchActionRegion | EditableElementRegion))
</ins><span class="cx">             view.setNeedsRepaintHackAfterCompositingLayerUpdateForDebugOverlaysOnly();
</span><span class="cx">         view.compositor().scheduleCompositingLayerUpdate();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp    2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp       2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -3109,7 +3109,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderLayerBacking::paintDebugOverlays(const GraphicsLayer* graphicsLayer, GraphicsContext& context)
</span><span class="cx"> {
</span><del>-    if (graphicsLayer->eventRegion().isEmpty())
</del><ins>+    auto& eventRegion = graphicsLayer->eventRegion();
+    if (eventRegion.isEmpty())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     GraphicsContextStateSaver stateSaver(context);
</span><span class="lines">@@ -3118,41 +3119,46 @@
</span><span class="cx">     auto contentOffset = roundedIntSize(contentOffsetInCompositingLayer());
</span><span class="cx">     context.translate(-contentOffset);
</span><span class="cx"> 
</span><ins>+    auto visibleDebugOverlayRegions = renderer().settings().visibleDebugOverlayRegions();
+
</ins><span class="cx">     // The interactive part.
</span><span class="cx">     // Paint rects for touch action.
</span><del>-    auto& eventRegion = graphicsLayer->eventRegion();
-    Color regionColor(0, 0, 255, 50);
-    context.setFillColor(regionColor);
-    for (auto rect : eventRegion.region().rects())
-        context.fillRect(rect);
</del><ins>+    if (visibleDebugOverlayRegions & TouchActionRegion) {
+        Color regionColor(0, 0, 255, 50);
+        context.setFillColor(regionColor);
+        for (auto rect : eventRegion.region().rects())
+            context.fillRect(rect);
</ins><span class="cx"> 
</span><del>-    const TouchAction touchActionList[] = {
-        TouchAction::None,
-        TouchAction::Manipulation,
-        TouchAction::PanX,
-        TouchAction::PanY,
-        TouchAction::PinchZoom,
-    };
</del><ins>+        const TouchAction touchActionList[] = {
+            TouchAction::None,
+            TouchAction::Manipulation,
+            TouchAction::PanX,
+            TouchAction::PanY,
+            TouchAction::PinchZoom,
+        };
</ins><span class="cx"> 
</span><del>-    for (auto action : touchActionList) {
-        auto* actionRegion = graphicsLayer->eventRegion().regionForTouchAction(action);
-        if (!actionRegion)
-            continue;
</del><ins>+        for (auto action : touchActionList) {
+            auto* actionRegion = graphicsLayer->eventRegion().regionForTouchAction(action);
+            if (!actionRegion)
+                continue;
</ins><span class="cx"> 
</span><del>-        auto fillPattern = patternForTouchAction(action, contentOffsetInCompositingLayer(), context);
-        if (!fillPattern)
-            continue;
</del><ins>+            auto fillPattern = patternForTouchAction(action, contentOffsetInCompositingLayer(), context);
+            if (!fillPattern)
+                continue;
</ins><span class="cx"> 
</span><del>-        context.setFillPattern(fillPattern.releaseNonNull());
-        for (auto rect : actionRegion->rects())
-            context.fillRect(rect);
</del><ins>+            context.setFillPattern(fillPattern.releaseNonNull());
+            for (auto rect : actionRegion->rects())
+                context.fillRect(rect);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(EDITABLE_REGION)
</span><span class="cx">     // Paint rects for editable elements.
</span><del>-    context.setFillColor({ 128, 0, 128, 50 });
-    for (auto rect : eventRegion.rectsForEditableElements())
-        context.fillRect(rect);
</del><ins>+    if (visibleDebugOverlayRegions & EditableElementRegion) {
+        context.setFillColor({ 128, 0, 128, 50 });
+        for (auto rect : eventRegion.rectsForEditableElements())
+            context.fillRect(rect);
+    }
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3195,7 +3201,7 @@
</span><span class="cx"> 
</span><span class="cx">         paintIntoLayer(graphicsLayer, context, dirtyRect, behavior);
</span><span class="cx"> 
</span><del>-        if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion) // Piggy-back off the setting that shows touch handler regions.
</del><ins>+        if (renderer().settings().visibleDebugOverlayRegions() & (TouchActionRegion | EditableElementRegion))
</ins><span class="cx">             paintDebugOverlays(graphicsLayer, context);
</span><span class="cx"> 
</span><span class="cx">     } else if (graphicsLayer == layerForHorizontalScrollbar()) {
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebKit/ChangeLog       2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2020-04-22  Daniel Bates  <dabates@apple.com>
+
+        Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
+        https://bugs.webkit.org/show_bug.cgi?id=210774
+
+        Reviewed by Dean Jackson.
+
+        Expose two new enumerators to toggle touch action region and editable element region
+        overlay painting.
+
+        * UIProcess/API/C/WKPreferencesRef.h:
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
</ins><span class="cx"> 2020-04-22  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOS] Expose -_webView:willGoToBackForwardListItem:inPageCache:
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKPreferencesRefh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h   2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h      2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -46,7 +46,9 @@
</span><span class="cx"> 
</span><span class="cx"> enum WKDebugOverlayRegionFlags {
</span><span class="cx">     kWKNonFastScrollableRegion = 1 << 0,
</span><del>-    kWKWheelEventHandlerRegion = 1 << 1
</del><ins>+    kWKWheelEventHandlerRegion = 1 << 1,
+    kWKTouchActionRegion = 1 << 2,
+    kWKEditableElementRegion = 1 << 3,
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned WKDebugOverlayRegions;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKPreferencesPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h (260546 => 260547)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h   2020-04-23 00:38:55 UTC (rev 260546)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h      2020-04-23 00:42:45 UTC (rev 260547)
</span><span class="lines">@@ -34,7 +34,9 @@
</span><span class="cx"> 
</span><span class="cx"> typedef NS_OPTIONS(NSUInteger, _WKDebugOverlayRegions) {
</span><span class="cx">     _WKNonFastScrollableRegion = 1 << 0,
</span><del>-    _WKWheelEventHandlerRegion = 1 << 1
</del><ins>+    _WKWheelEventHandlerRegion = 1 << 1,
+    _WKTouchActionRegion = 1 << 2,
+    _WKEditableElementRegion = 1 << 3,
</ins><span class="cx"> } WK_API_AVAILABLE(macos(10.11), ios(9.0));
</span><span class="cx"> 
</span><span class="cx"> typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
</span></span></pre>
</div>
</div>

</body>
</html>