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

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/fast/css/cocoa/content-visibility-with-obscured-insets-expected.txt
    A LayoutTests/fast/css/cocoa/content-visibility-with-obscured-insets.html
    M LayoutTests/platform/ios/TestExpectations
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/dom/ContentVisibilityDocumentState.cpp
    M Source/WebCore/page/IntersectionObserver.cpp
    M Source/WebCore/page/IntersectionObserver.h
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm
    M Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
    M Source/WebKit/Shared/WebPreferencesDefaultValues.h

  Log Message:
  -----------
  hotels.com: images only appear after scrolling past obscured content inset 
areas
https://bugs.webkit.org/show_bug.cgi?id=290894
rdar://147346673

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

When `ContentInsetBackgroundFill` is enabled, expand the layout viewport rect 
used by the internal
`IntersectionObserver` that drives `content-visibility`, such that it includes 
all obscured content
inset rect edges.

The layout viewport currently excludes these content insets, which causes 
content (such as images on
hotels.com) to suddenly appear while scrolling, even though part of the image 
would already have
already been visible.

* LayoutTests/TestExpectations:
* 
LayoutTests/fast/css/cocoa/content-visibility-with-obscured-insets-expected.txt:
 Added.
* LayoutTests/fast/css/cocoa/content-visibility-with-obscured-insets.html: 
Added.

Add a test to exercise this change, by verifying that a red square with 
`content-visibility: auto`
that's completely within the top/left content inset area of the viewport is 
visible using
`checkVisibility({ contentVisibilityAuto: true })`.

* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

Compile in this feature flag on all platforms, so that we can consult it from 
platform-agnostic
code below without having to use a `PLATFORM(COCOA)` guard.

* Source/WebCore/dom/ContentVisibilityDocumentState.cpp:
(WebCore::ContentVisibilityDocumentState::intersectionObserver):
* Source/WebCore/page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::create):

Add a new enum flag, `IncludeObscuredInsets`, as an optional argument when 
creating an intersection
observer.

(WebCore::IntersectionObserver::IntersectionObserver):
(WebCore::IntersectionObserver::computeIntersectionState const):

Consult the above enum flag, `m_includeObscuredInsets`, and use either 
`layoutViewportRect()` or
`layoutViewportRectIncludingObscuredInsets()` depending on its state.

* Source/WebCore/page/IntersectionObserver.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::layoutViewportRectIncludingObscuredInsets const):

Add a helper method to return the layout viewport rect, expanded by obscured 
insets.

* Source/WebCore/page/LocalFrameView.h:
* Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::defaultContentInsetBackgroundFillEnabled): Deleted.
* Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultContentInsetBackgroundFillEnabled):
* Source/WebKit/Shared/WebPreferencesDefaultValues.h:

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