[webkit-changes] [WebKit/WebKit] 9da873: InteractionRegion layers are sometimes slightly of...

Etienne Segonzac noreply at github.com
Fri Dec 15 08:17:09 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9da873dd42b7bc9ac5610c7ba063fa0cea2402c4
      https://github.com/WebKit/WebKit/commit/9da873dd42b7bc9ac5610c7ba063fa0cea2402c4
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2023-12-15 (Fri, 15 Dec 2023)

  Changed paths:
    M LayoutTests/interaction-region/border-radii-expected.txt
    M LayoutTests/interaction-region/button-in-link-expected.txt
    M LayoutTests/interaction-region/consolidated-nested-regions-expected.txt
    M LayoutTests/interaction-region/display-table-expected.txt
    M LayoutTests/interaction-region/icon-inside-button-single-region-expected.txt
    M LayoutTests/interaction-region/ignore-catch-all-body-expected.txt
    M LayoutTests/interaction-region/inline-link-dark-background-expected.txt
    M LayoutTests/interaction-region/inline-link-expected.txt
    M LayoutTests/interaction-region/inline-link-in-composited-iframe-expected.txt
    M LayoutTests/interaction-region/inline-link-in-layer-expected.txt
    M LayoutTests/interaction-region/inline-link-in-non-composited-iframe-expected.txt
    M LayoutTests/interaction-region/inline-link-with-pointer-events-none-content-expected.txt
    M LayoutTests/interaction-region/input-type-range-region-expected.txt
    M LayoutTests/interaction-region/labels-expected.txt
    M LayoutTests/interaction-region/layer-tree-expected.txt
    M LayoutTests/interaction-region/position-only-update-expected.txt
    M LayoutTests/interaction-region/split-inline-link-expected.txt
    M LayoutTests/interaction-region/wrapped-inline-link-expected.txt
    M Source/WebCore/page/DebugPageOverlays.cpp
    M Source/WebCore/page/InteractionRegion.cpp
    M Source/WebCore/page/InteractionRegion.h
    M Source/WebCore/platform/graphics/FloatRoundedRect.cpp
    M Source/WebCore/platform/graphics/FloatRoundedRect.h
    M Source/WebCore/platform/graphics/RoundedRect.cpp
    M Source/WebCore/platform/graphics/RoundedRect.h
    M Source/WebCore/rendering/EventRegion.cpp
    M Source/WebCore/rendering/EventRegion.h
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/TextBoxPainter.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  InteractionRegion layers are sometimes slightly offset from their element
https://bugs.webkit.org/show_bug.cgi?id=266024
<rdar://119259340>

Reviewed by Tim Horton.

Instead of using a ceil'ed/floor'ed "enclosing IntRect" to determine
the frame of an InteractionRegion layer, send over a more precise
FloatRect.
(We still use IntRects for tracking Hash*/Regions.)

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::updateLayersForInteractionRegions):
Use the new FloatRect to set the layer frame.
Compute the enclosing IntRect to generate the key.

* Source/WebCore/page/InteractionRegion.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Switch `rectInLayerCoordinates` from an IntRect to a FloatRect.
* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::interactionRegionForRenderedRegion):
Take a FloatRect instead of a Region as input.
The Checked `area()` method on IntRects used to implicitly cap the
maximum size of occlusion layers. This is now an explicit check.

* Source/WebCore/rendering/EventRegion.h:
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegionContext::unite):
The EventRegionContext now takes a FloatRoundedRect as input. In order
to keep the border radius data required for scrollers hit-testing
(210690 at main).
It continues to generate an approximate Region for the EventRegion itself,
but passes a FloatRect to Interaction Regions (where the border-radius is
handled separately and read from style).
The FloatRect is snapped to device pixels if needed, based on the
renderer (`snapRectToDevicePixelsIfNeeded`).
(WebCore::guardRectForRegionBounds):
Update the `regionBounds` type from IntRect to FloatRect, no code change.
(WebCore::EventRegionContext::uniteInteractionRegions):
Re-order the parameters to match the other methods (RenderObject first).
Use a FloatRect as input instead of a Region.
Compute an enclosing IntRect from the InteractionRegion for the various
tracking variables (HashSets, HashMaps...).
(WebCore::EventRegionContext::shouldConsolidateInteractionRegion):
Re-order the parameters to match the other methods (RenderObject first).
(WebCore::EventRegionContext::shrinkWrapInteractionRegions):
Compute an enclosing IntRect from the InteractionRegion to keep the rest
of the code unchanged.
(This method will be removed in rdar://119259119).
(WebCore::EventRegionContext::removeSuperfluousInteractionRegions):
Compute an enclosing IntRect from the Guard to work with the tracked Region.

* Source/WebCore/rendering/RenderLayerBacking.cpp:
Stop rounding the offsetFromRenderer to an IntSize.
Pass a FloatRoundedRect to the EventRegionContext.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
(WebCore::RenderLayerBacking::updateEventRegion):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollLayerClipping):
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter<TextBoxPath>::paint):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::updateScrollingExtents):
Pass a FloatRoundedRect to EventRegionContext.

* Source/WebCore/platform/graphics/RoundedRect.h:
* Source/WebCore/platform/graphics/RoundedRect.cpp:
(WebCore::approximateAsRegion): Deleted.
* Source/WebCore/platform/graphics/FloatRoundedRect.h:
* Source/WebCore/platform/graphics/FloatRoundedRect.cpp:
(WebCore::approximateAsRegion):
Move the method to FloatRoundedRect since we only use it for EventRegions.
And update it to work on a FloatRect.

* Source/WebCore/page/DebugPageOverlays.cpp:
(WebCore::pathsForRect):
Update the `rect` type from IntRect to FloatRect, no code change.

* LayoutTests/interaction-region/border-radii-expected.txt:
* LayoutTests/interaction-region/button-in-link-expected.txt:
* LayoutTests/interaction-region/consolidated-nested-regions-expected.txt:
* LayoutTests/interaction-region/display-table-expected.txt:
* LayoutTests/interaction-region/icon-inside-button-single-region-expected.txt:
* LayoutTests/interaction-region/ignore-catch-all-body-expected.txt:
* LayoutTests/interaction-region/inline-link-dark-background-expected.txt:
* LayoutTests/interaction-region/inline-link-expected.txt:
* LayoutTests/interaction-region/inline-link-in-composited-iframe-expected.txt:
* LayoutTests/interaction-region/inline-link-in-layer-expected.txt:
* LayoutTests/interaction-region/inline-link-in-non-composited-iframe-expected.txt:
* LayoutTests/interaction-region/inline-link-with-pointer-events-none-content-expected.txt:
* LayoutTests/interaction-region/input-type-range-region-expected.txt:
* LayoutTests/interaction-region/labels-expected.txt:
* LayoutTests/interaction-region/layer-tree-expected.txt:
* LayoutTests/interaction-region/position-only-update-expected.txt:
* LayoutTests/interaction-region/split-inline-link-expected.txt:
* LayoutTests/interaction-region/wrapped-inline-link-expected.txt:
Update test expectations with float rects.

Canonical link: https://commits.webkit.org/272118@main




More information about the webkit-changes mailing list