[webkit-changes] [WebKit/WebKit] dc9396: Implement hit-testing changes for transform-style:...

mattwoodrow noreply at github.com
Thu Dec 1 14:08:45 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dc9396c615610f61cdefb62e3a014ee111ef3a76
      https://github.com/WebKit/WebKit/commit/dc9396c615610f61cdefb62e3a014ee111ef3a76
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2022-12-01 (Thu, 01 Dec 2022)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/3d-rendering-context-behavior-expected.txt
    M LayoutTests/platform/gtk/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt
    M LayoutTests/platform/ios/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt
    M LayoutTests/platform/mac/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt
    M LayoutTests/transforms/3d/hit-testing/overlapping-layers-hit-test-expected.txt
    M LayoutTests/transforms/3d/hit-testing/overlapping-layers-hit-test.html
    A LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2-expected.txt
    A LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2.html
    M LayoutTests/transforms/3d/point-mapping/3d-point-mapping-2.html
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayer.h
    M Source/WebCore/rendering/RenderObject.cpp

  Log Message:
  -----------
  Implement hit-testing changes for transform-style:preserve-3d and perspective to only apply to direct DOM children.
https://bugs.webkit.org/show_bug.cgi?id=248283
rdar://problem/102632592>

Reviewed by Simon Fraser.

Unfortunately this is fairly complex, due to needing to support both the new and old behaviour and switch at runtime.

The new behaviour is that all hit-testing methods return both the hit layer, as well as the depth that it was hit at.
There's no shared mutable state between calls (zOffset, zOffsetForDescendantsPtr etc), and each function is separately
responsible for determing the frontmost layer if sorting is enabled for that context.

hitTestList detects when we're about to recurse into a child that doesn't share the same 3d coordinate space as the current
layer, and passes down a flattened transformState if so. It also then overrides the returned hit depth with that of the plane
that we flattened into.

* LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/3d-rendering-context-behavior-expected.txt:
* LayoutTests/platform/mac/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt:
* LayoutTests/platform/gtk/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt:
* LayoutTests/platform/ios/transforms/3d/point-mapping/3d-point-mapping-2-expected.txt:

New test passing, but also two newly failing due to point-mapping and hit-testing being out of sync.
These will be fixed in a follow-up to implement the point-mapping changes.

* LayoutTests/transforms/3d/hit-testing/overlapping-layers-hit-test-expected.txt:
* LayoutTests/transforms/3d/hit-testing/overlapping-layers-hit-test.html:

New subtest added that has a empty spacer div inbetween the element with preserve-3d and the transformed
descendants, confirms that we hit test this without the transform being accumulated.

* LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2-expected.txt: Added.
* LayoutTests/transforms/3d/hit-testing/rotated-hit-test-2.html: Added.

New test with perspective separated from the transformed descendant with a spacer.

* LayoutTests/transforms/3d/point-mapping/3d-point-mapping-2.html:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTest):
(WebCore::parentLayerIsDOMParent):
(WebCore::isHitCandidateLegacy):
(WebCore::RenderLayer::participatesInPreserve3D const):
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestTransformedLayerInFragments):
(WebCore::RenderLayer::hitTestLayerByApplyingTransform):
(WebCore::RenderLayer::hitTestList):
(WebCore::isHitCandidate): Deleted.
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::shouldUseTransformFromContainer const):
(WebCore::RenderObject::getTransformFromContainer const):

Only include the perspective transform if the container with perspective is
the direct DOM parent.

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




More information about the webkit-changes mailing list