Changeset 260547 in webkit


Ignore:
Timestamp:
Apr 22, 2020 5:42:45 PM (4 years ago)
Author:
dbates@webkit.org
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:
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r260535 r260547  
     12020-04-22  Daniel Bates  <dabates@apple.com>
     2
     3        Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
     4        https://bugs.webkit.org/show_bug.cgi?id=210774
     5
     6        Reviewed by Dean Jackson.
     7
     8        Break out the touch action region and editable element region debug overlays into their own
     9        flags that can be passed to Settings::setVisibleDebugOverlayRegions() to toggle these overlays,
     10        respectively. Currently both of these overlays piggyback on whether the engine will paint the
     11        non-fast scrollable region.
     12
     13        * page/SettingsBase.h: Add two more enumerators.
     14        * rendering/RenderLayer.cpp:
     15        (WebCore::RenderLayer::invalidateEventRegion const): Update the code to be more precise now that
     16        we can target the update paint overlay hack to when we are painting touch-action or editable
     17        element regions.
     18        * rendering/RenderLayerBacking.cpp:
     19        (WebCore::RenderLayerBacking::paintDebugOverlays): Condition the painting of touch action region
     20        on one enumerator and the painting of editable element region on another.
     21        (WebCore::RenderLayerBacking::paintContents): Update the code to be more precise.
     22
    1232020-04-22  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/page/SettingsBase.h

    r257862 r260547  
    7070    NonFastScrollableRegion = 1 << 0,
    7171    WheelEventHandlerRegion = 1 << 1,
     72    TouchActionRegion = 1 << 2,
     73    EditableElementRegion = 1 << 3,
    7274};
    7375
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r260445 r260547  
    70237023        auto& view = renderer().view();
    70247024        view.setNeedsEventRegionUpdateForNonCompositedFrame();
    7025         if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion)
     7025        if (renderer().settings().visibleDebugOverlayRegions() & (TouchActionRegion | EditableElementRegion))
    70267026            view.setNeedsRepaintHackAfterCompositingLayerUpdateForDebugOverlaysOnly();
    70277027        view.compositor().scheduleCompositingLayerUpdate();
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r260482 r260547  
    31103110void RenderLayerBacking::paintDebugOverlays(const GraphicsLayer* graphicsLayer, GraphicsContext& context)
    31113111{
    3112     if (graphicsLayer->eventRegion().isEmpty())
     3112    auto& eventRegion = graphicsLayer->eventRegion();
     3113    if (eventRegion.isEmpty())
    31133114        return;
    31143115
     
    31193120    context.translate(-contentOffset);
    31203121
     3122    auto visibleDebugOverlayRegions = renderer().settings().visibleDebugOverlayRegions();
     3123
    31213124    // The interactive part.
    31223125    // Paint rects for touch action.
    3123     auto& eventRegion = graphicsLayer->eventRegion();
    3124     Color regionColor(0, 0, 255, 50);
    3125     context.setFillColor(regionColor);
    3126     for (auto rect : eventRegion.region().rects())
    3127         context.fillRect(rect);
    3128 
    3129     const TouchAction touchActionList[] = {
    3130         TouchAction::None,
    3131         TouchAction::Manipulation,
    3132         TouchAction::PanX,
    3133         TouchAction::PanY,
    3134         TouchAction::PinchZoom,
    3135     };
    3136 
    3137     for (auto action : touchActionList) {
    3138         auto* actionRegion = graphicsLayer->eventRegion().regionForTouchAction(action);
    3139         if (!actionRegion)
    3140             continue;
    3141 
    3142         auto fillPattern = patternForTouchAction(action, contentOffsetInCompositingLayer(), context);
    3143         if (!fillPattern)
    3144             continue;
    3145 
    3146         context.setFillPattern(fillPattern.releaseNonNull());
    3147         for (auto rect : actionRegion->rects())
     3126    if (visibleDebugOverlayRegions & TouchActionRegion) {
     3127        Color regionColor(0, 0, 255, 50);
     3128        context.setFillColor(regionColor);
     3129        for (auto rect : eventRegion.region().rects())
    31483130            context.fillRect(rect);
     3131
     3132        const TouchAction touchActionList[] = {
     3133            TouchAction::None,
     3134            TouchAction::Manipulation,
     3135            TouchAction::PanX,
     3136            TouchAction::PanY,
     3137            TouchAction::PinchZoom,
     3138        };
     3139
     3140        for (auto action : touchActionList) {
     3141            auto* actionRegion = graphicsLayer->eventRegion().regionForTouchAction(action);
     3142            if (!actionRegion)
     3143                continue;
     3144
     3145            auto fillPattern = patternForTouchAction(action, contentOffsetInCompositingLayer(), context);
     3146            if (!fillPattern)
     3147                continue;
     3148
     3149            context.setFillPattern(fillPattern.releaseNonNull());
     3150            for (auto rect : actionRegion->rects())
     3151                context.fillRect(rect);
     3152        }
    31493153    }
    31503154
    31513155#if ENABLE(EDITABLE_REGION)
    31523156    // Paint rects for editable elements.
    3153     context.setFillColor({ 128, 0, 128, 50 });
    3154     for (auto rect : eventRegion.rectsForEditableElements())
    3155         context.fillRect(rect);
     3157    if (visibleDebugOverlayRegions & EditableElementRegion) {
     3158        context.setFillColor({ 128, 0, 128, 50 });
     3159        for (auto rect : eventRegion.rectsForEditableElements())
     3160            context.fillRect(rect);
     3161    }
    31563162#endif
    31573163}
     
    31963202        paintIntoLayer(graphicsLayer, context, dirtyRect, behavior);
    31973203
    3198         if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion) // Piggy-back off the setting that shows touch handler regions.
     3204        if (renderer().settings().visibleDebugOverlayRegions() & (TouchActionRegion | EditableElementRegion))
    31993205            paintDebugOverlays(graphicsLayer, context);
    32003206
  • trunk/Source/WebKit/ChangeLog

    r260546 r260547  
     12020-04-22  Daniel Bates  <dabates@apple.com>
     2
     3        Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
     4        https://bugs.webkit.org/show_bug.cgi?id=210774
     5
     6        Reviewed by Dean Jackson.
     7
     8        Expose two new enumerators to toggle touch action region and editable element region
     9        overlay painting.
     10
     11        * UIProcess/API/C/WKPreferencesRef.h:
     12        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
     13
    1142020-04-22  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRef.h

    r254397 r260547  
    4747enum WKDebugOverlayRegionFlags {
    4848    kWKNonFastScrollableRegion = 1 << 0,
    49     kWKWheelEventHandlerRegion = 1 << 1
     49    kWKWheelEventHandlerRegion = 1 << 1,
     50    kWKTouchActionRegion = 1 << 2,
     51    kWKEditableElementRegion = 1 << 3,
    5052};
    5153typedef unsigned WKDebugOverlayRegions;
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r260334 r260547  
    3535typedef NS_OPTIONS(NSUInteger, _WKDebugOverlayRegions) {
    3636    _WKNonFastScrollableRegion = 1 << 0,
    37     _WKWheelEventHandlerRegion = 1 << 1
     37    _WKWheelEventHandlerRegion = 1 << 1,
     38    _WKTouchActionRegion = 1 << 2,
     39    _WKEditableElementRegion = 1 << 3,
    3840} WK_API_AVAILABLE(macos(10.11), ios(9.0));
    3941
Note: See TracChangeset for help on using the changeset viewer.