Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 79b2e213326cb5035fddf5ef403a0d50fe6b1dd5
      
https://github.com/WebKit/WebKit/commit/79b2e213326cb5035fddf5ef403a0d50fe6b1dd5
  Author: Simon Fraser <[email protected]>
  Date:   2025-06-18 (Wed, 18 Jun 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/compositing/iframes/hidpi-iframe-subpixel-compositing-expected.html
    A LayoutTests/compositing/iframes/hidpi-iframe-subpixel-compositing.html
    A LayoutTests/fast/frames/hidpi-iframe-subpixel-hit-test-expected.txt
    A LayoutTests/fast/frames/hidpi-iframe-subpixel-hit-test.html
    A LayoutTests/fast/frames/hidpi-iframe-subpixel-painting-expected.html
    A LayoutTests/fast/frames/hidpi-iframe-subpixel-painting.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/elementFromPoint-subpixel-expected.txt
    M LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2-expected.txt
    M LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2.html
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
    M Source/WebCore/rendering/HitTestLocation.cpp
    M Source/WebCore/rendering/HitTestingTransformState.cpp
    M Source/WebCore/rendering/HitTestingTransformState.h
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.h
    M Source/WebCore/rendering/RenderWidget.cpp

  Log Message:
  -----------
  Make subpixel-positioned iframes paint and hit-test correctly
https://bugs.webkit.org/show_bug.cgi?id=294571
rdar://152114545

Reviewed by Alan Baradlay.

IFrames are Widgets, and Widgets live in an integer-based hierarchy, so have 
historically
painted and hit-tested using integer coordinates. However, iframes are often 
positioned on
subpixel boundaries, which leads to pixel gaps. Some of these are very obvious, 
e.g. an
iframe inside a `position:fixed; bottom: 0` element that should align 
seamlessly with UI.

However, we can adjust iframes for painting and hit-testing to overcome the 
integral
Widget limitation. This PR does this in various places.

First, `RenderWidget::paintContents()` adjusts the CTM to account for a 
subpixel position,
which fixes painting gaps (tested by iframe-subpixel-painting.html).

Second, the compositing code needs to handle subpixel positioning of the 
iframe's layers,
fixed in `RenderLayerBacking::updateAfterWidgetResize()` and tested by
iframe-subpixel-compositing.html.

Finally, hit-testing needs to maintain fractional coordinates;
`documentPointForWindowPoint()` is fixed to use FloatPoint coordinate mapping, 
and
HitTestLocation no longer rounds the origin of m_boundingBox which is what's 
used by the
`nodeAtPoint()` code.

Removing the flooring of the point in the HitTestLocation constructor caused
`css/css-transforms/transform-scale-hittest.html` to fail; this hit-tests a 
pixel above an
element with a 100x scale. The existing code would map the 1x1px hit-test area 
through the
scale, resulting in a 100x100px hit-test area; fix to map through the inverse 
transform to
maintain the 1x1px hit-test area in screen space. This is a merge of
https://chromium.googlesource.com/chromium/src.git/+/c47a6f0b4a592c2383fb553b6169f89ab01d851d

* LayoutTests/TestExpectations: 
imported/w3c/web-platform-tests/css/selectors/focus-visible-018-2.html
fails; https://github.com/web-platform-tests/wpt/pull/53241 exists to fix this.
* 
LayoutTests/compositing/iframes/hidpi-iframe-subpixel-compositing-expected.html:
 Added.
* LayoutTests/compositing/iframes/hidpi-iframe-subpixel-compositing.html: Added.
* LayoutTests/fast/frames/hidpi-iframe-subpixel-hit-test-expected.txt: Added.
* LayoutTests/fast/frames/hidpi-iframe-subpixel-hit-test.html: Added.
* LayoutTests/fast/frames/hidpi-iframe-subpixel-painting-expected.html: Added.
* LayoutTests/fast/frames/hidpi-iframe-subpixel-painting.html: Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/elementFromPoint-subpixel-expected.txt:
* LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2-expected.txt:
* LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2.html: Tweak the 
test; browsers
have different results.
* Source/WebCore/page/EventHandler.cpp:
(WebCore::documentPointForWindowPoint):
* Source/WebCore/page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
* Source/WebCore/rendering/HitTestLocation.cpp:
(WebCore::HitTestLocation::HitTestLocation): No longer floor the point.
(WebCore::HitTestLocation::move): No longer convert to IntRect.
* Source/WebCore/rendering/HitTestingTransformState.cpp:
(WebCore::HitTestingTransformState::boundsOfMappedQuad const):
* Source/WebCore/rendering/HitTestingTransformState.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayerByApplyingTransform):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterWidgetResize):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::frameViewDidChangeLocation):
* Source/WebCore/rendering/RenderLayerCompositor.h:
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paintContents):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to