Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 57a561ae10fa118c6f17ecfdf593be67f986061e
      
https://github.com/WebKit/WebKit/commit/57a561ae10fa118c6f17ecfdf593be67f986061e
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-04-29 (Tue, 29 Apr 2025)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/page/scrolling/ScrollingTreeFixedNode.cpp
    M Source/WebCore/page/scrolling/ScrollingTreeFixedNode.h
    M Source/WebCore/page/scrolling/ScrollingTreeStickyNode.cpp
    M Source/WebCore/page/scrolling/ScrollingTreeStickyNode.h
    A Source/WebCore/page/scrolling/ScrollingTreeViewportConstrainedNode.cpp
    A Source/WebCore/page/scrolling/ScrollingTreeViewportConstrainedNode.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNodeCocoa.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm
    M 
Source/WebCore/page/scrolling/coordinated/ScrollingTreeStickyNodeCoordinated.cpp

  Log Message:
  -----------
  [Viewport Clipping] [Part 2/4] Add a common base class for 
ScrollingTree{Sticky|Fixed}Node
https://bugs.webkit.org/show_bug.cgi?id=292109
rdar://150116251

Reviewed by Abrar Rahman Protyasha.

In preparation for a configuration where viewport-constrained objects in the 
mainframe are clipped
to the layout viewport rect, we introduce a base class — 
`ScrollingTreeViewportConstrainedNode` —
from which `ScrollingTreeStickyNode` and `ScrollingTreeFixedNode` both derive. 
See below for more
details.

* Source/WebCore/Headers.cmake:
* Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:

Add the new files.

* Source/WebCore/page/scrolling/ScrollingTreeFixedNode.cpp:
(WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
(WebCore::ScrollingTreeFixedNode::computeLayerPosition const): Deleted.

Move this method into `ScrollingTreeViewportConstrainedNode` (see below).

* Source/WebCore/page/scrolling/ScrollingTreeFixedNode.h:
* Source/WebCore/page/scrolling/ScrollingTreeStickyNode.cpp:
(WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
(WebCore::ScrollingTreeStickyNode::computeAnchorLayerPosition const):

Rename the existing method `computeLayerPosition` to 
`computeAnchorLayerPosition`. This seems
unnecessary at the moment, but will become important once the clipping layer is 
introduced, since
the position of the clipping layer needs to be computed separately from the 
position of the anchor
layer.

Namely, for a viewport-clipped sticky node that does not yet intersect with the 
constraining rect
(and therefore behaves as relative instead of fixed), we need to blit the 
clipping layer so it
matches the viewport rect while scrolling, and simultaneously counter-blit the 
anchor layer
underneath such that the sticky contents (visually) scroll with the rest of the 
page. Once the
constraining rect is reached and the sticky node behaves like a fixed-position 
node, only the
clipping layer continues blitting, while the anchor node offset becomes 
constant.

(WebCore::ScrollingTreeStickyNode::scrollDeltaSinceLastCommit const):
(WebCore::ScrollingTreeStickyNode::computeLayerPosition const): Deleted.
* Source/WebCore/page/scrolling/ScrollingTreeStickyNode.h:
* Source/WebCore/page/scrolling/ScrollingTreeViewportConstrainedNode.cpp: 
Copied from Source/WebCore/page/scrolling/ScrollingTreeFixedNode.cpp.
(WebCore::ScrollingTreeViewportConstrainedNode::ScrollingTreeViewportConstrainedNode):

Consolidate logic to call `fixedOrStickyNodeAdded` when creating a 
viewport-constrained node.

(WebCore::ScrollingTreeViewportConstrainedNode::computeLayerPosition const):

Move this logic into `ScrollingTreeViewportConstrainedNode`, where it can be 
used for both sticky
and fixed nodes.

* Source/WebCore/page/scrolling/ScrollingTreeViewportConstrainedNode.h: Copied 
from Source/WebCore/page/scrolling/ScrollingTreeFixedNode.h.
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm:
(WebCore::ScrollingTreeStickyNodeCocoa::applyLayerPositions):
* 
Source/WebCore/page/scrolling/coordinated/ScrollingTreeStickyNodeCoordinated.cpp:
(WebCore::ScrollingTreeStickyNodeCoordinated::applyLayerPositions):

Canonical link: https://commits.webkit.org/294285@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