Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6cd098bb14207f0c94b6dfa91bea70c12ba6b904
      
https://github.com/WebKit/WebKit/commit/6cd098bb14207f0c94b6dfa91bea70c12ba6b904
  Author: Wenson Hsieh <[email protected]>
  Date:   2023-04-10 (Mon, 10 Apr 2023)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailViewInternal.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKThumbnailView.mm

  Log Message:
  -----------
  [UI-side compositing] Tab thumbnail sometimes offset by top content inset 
when entering tab overview
https://bugs.webkit.org/show_bug.cgi?id=255152

Reviewed by Tim Horton.

Even after the fixes in 262649@main, the temporary root layer reparenting in 
`_WKThumbnailView`
results in the page content being vertically offset by an amount equal to the 
web view's top content
inset, in the case where the web view has `_automaticallyAdjustsContentInsets` 
set to `NO`, as well
as a non-zero top content inset. This appears to affect both UI-side 
compositing and non-UI-side
compositing (I verified this by artificially deferring the call to 
`-[_WKThumbnailView
_didTakeSnapshot:]`).

This patch fixes this by offsetting the root layer's sublayer transform by the 
top content inset,
such that the reparented layers are visually consistent with the final 
`_WKThumbnailView`'s contents
once the snapshot image arrives.

Test: 
WebKit.WKThumbnailViewLayerReparentingWithUISideCompositingAndTopContentInset

* Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView _viewWasUnparented]):
(-[_WKThumbnailView _viewWasParented]):

Set the vertical translation amount when the layer is parented.

(-[_WKThumbnailView setScale:]):
(-[_WKThumbnailView _setSublayerVerticalTranslationAmount:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailViewInternal.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKThumbnailView.mm:
(TestWebKitAPI::leftCornerColorsForThumbnailView):
(TestWebKitAPI::checkThumbnailViewSnapshotConsistency):
(TestWebKitAPI::TEST):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to