- Revision
- 260547
- Author
- [email protected]
- Date
- 2020-04-22 17:42:45 -0700 (Wed, 22 Apr 2020)
Log Message
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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260546 => 260547)
--- 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)
@@ -1,3 +1,25 @@
+2020-04-22 Daniel Bates <[email protected]>
+
+ 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.
+
2020-04-22 Chris Dumez <[email protected]>
[ Mac wk2 ] imported/w3c/web-platform-tests/notifications/event-onclose.html is flaky failing.
Modified: trunk/Source/WebCore/page/SettingsBase.h (260546 => 260547)
--- 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)
@@ -69,6 +69,8 @@
enum DebugOverlayRegionFlags {
NonFastScrollableRegion = 1 << 0,
WheelEventHandlerRegion = 1 << 1,
+ TouchActionRegion = 1 << 2,
+ EditableElementRegion = 1 << 3,
};
enum class UserInterfaceDirectionPolicy {
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (260546 => 260547)
--- 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)
@@ -7022,7 +7022,7 @@
if (reason == EventRegionInvalidationReason::NonCompositedFrame) {
auto& view = renderer().view();
view.setNeedsEventRegionUpdateForNonCompositedFrame();
- if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion)
+ if (renderer().settings().visibleDebugOverlayRegions() & (TouchActionRegion | EditableElementRegion))
view.setNeedsRepaintHackAfterCompositingLayerUpdateForDebugOverlaysOnly();
view.compositor().scheduleCompositingLayerUpdate();
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (260546 => 260547)
--- 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)
@@ -3109,7 +3109,8 @@
void RenderLayerBacking::paintDebugOverlays(const GraphicsLayer* graphicsLayer, GraphicsContext& context)
{
- if (graphicsLayer->eventRegion().isEmpty())
+ auto& eventRegion = graphicsLayer->eventRegion();
+ if (eventRegion.isEmpty())
return;
GraphicsContextStateSaver stateSaver(context);
@@ -3118,41 +3119,46 @@
auto contentOffset = roundedIntSize(contentOffsetInCompositingLayer());
context.translate(-contentOffset);
+ auto visibleDebugOverlayRegions = renderer().settings().visibleDebugOverlayRegions();
+
// The interactive part.
// Paint rects for touch action.
- auto& eventRegion = graphicsLayer->eventRegion();
- Color regionColor(0, 0, 255, 50);
- context.setFillColor(regionColor);
- for (auto rect : eventRegion.region().rects())
- context.fillRect(rect);
+ if (visibleDebugOverlayRegions & TouchActionRegion) {
+ Color regionColor(0, 0, 255, 50);
+ context.setFillColor(regionColor);
+ for (auto rect : eventRegion.region().rects())
+ context.fillRect(rect);
- const TouchAction touchActionList[] = {
- TouchAction::None,
- TouchAction::Manipulation,
- TouchAction::PanX,
- TouchAction::PanY,
- TouchAction::PinchZoom,
- };
+ const TouchAction touchActionList[] = {
+ TouchAction::None,
+ TouchAction::Manipulation,
+ TouchAction::PanX,
+ TouchAction::PanY,
+ TouchAction::PinchZoom,
+ };
- for (auto action : touchActionList) {
- auto* actionRegion = graphicsLayer->eventRegion().regionForTouchAction(action);
- if (!actionRegion)
- continue;
+ for (auto action : touchActionList) {
+ auto* actionRegion = graphicsLayer->eventRegion().regionForTouchAction(action);
+ if (!actionRegion)
+ continue;
- auto fillPattern = patternForTouchAction(action, contentOffsetInCompositingLayer(), context);
- if (!fillPattern)
- continue;
+ auto fillPattern = patternForTouchAction(action, contentOffsetInCompositingLayer(), context);
+ if (!fillPattern)
+ continue;
- context.setFillPattern(fillPattern.releaseNonNull());
- for (auto rect : actionRegion->rects())
- context.fillRect(rect);
+ context.setFillPattern(fillPattern.releaseNonNull());
+ for (auto rect : actionRegion->rects())
+ context.fillRect(rect);
+ }
}
#if ENABLE(EDITABLE_REGION)
// Paint rects for editable elements.
- context.setFillColor({ 128, 0, 128, 50 });
- for (auto rect : eventRegion.rectsForEditableElements())
- context.fillRect(rect);
+ if (visibleDebugOverlayRegions & EditableElementRegion) {
+ context.setFillColor({ 128, 0, 128, 50 });
+ for (auto rect : eventRegion.rectsForEditableElements())
+ context.fillRect(rect);
+ }
#endif
}
@@ -3195,7 +3201,7 @@
paintIntoLayer(graphicsLayer, context, dirtyRect, behavior);
- if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion) // Piggy-back off the setting that shows touch handler regions.
+ if (renderer().settings().visibleDebugOverlayRegions() & (TouchActionRegion | EditableElementRegion))
paintDebugOverlays(graphicsLayer, context);
} else if (graphicsLayer == layerForHorizontalScrollbar()) {
Modified: trunk/Source/WebKit/ChangeLog (260546 => 260547)
--- 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)
@@ -1,3 +1,16 @@
+2020-04-22 Daniel Bates <[email protected]>
+
+ 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:
+
2020-04-22 Chris Dumez <[email protected]>
[iOS] Expose -_webView:willGoToBackForwardListItem:inPageCache:
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h (260546 => 260547)
--- 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)
@@ -46,7 +46,9 @@
enum WKDebugOverlayRegionFlags {
kWKNonFastScrollableRegion = 1 << 0,
- kWKWheelEventHandlerRegion = 1 << 1
+ kWKWheelEventHandlerRegion = 1 << 1,
+ kWKTouchActionRegion = 1 << 2,
+ kWKEditableElementRegion = 1 << 3,
};
typedef unsigned WKDebugOverlayRegions;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h (260546 => 260547)
--- 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)
@@ -34,7 +34,9 @@
typedef NS_OPTIONS(NSUInteger, _WKDebugOverlayRegions) {
_WKNonFastScrollableRegion = 1 << 0,
- _WKWheelEventHandlerRegion = 1 << 1
+ _WKWheelEventHandlerRegion = 1 << 1,
+ _WKTouchActionRegion = 1 << 2,
+ _WKEditableElementRegion = 1 << 3,
} WK_API_AVAILABLE(macos(10.11), ios(9.0));
typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {