Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 48d3a2b6aeb68c595ab0a00d54828145095e09c6
      
https://github.com/WebKit/WebKit/commit/48d3a2b6aeb68c595ab0a00d54828145095e09c6
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-03-11 (Tue, 11 Mar 2025)

  Changed paths:
    A 
LayoutTests/fast/page-color-sampling/color-sampling-ignores-non-fixed-content-expected.txt
    A 
LayoutTests/fast/page-color-sampling/color-sampling-ignores-non-fixed-content.html
    A 
LayoutTests/fast/page-color-sampling/color-sampling-ignores-text-expected.txt
    A LayoutTests/fast/page-color-sampling/color-sampling-ignores-text.html
    A 
LayoutTests/fast/page-color-sampling/color-sampling-includes-subframes-expected.txt
    A 
LayoutTests/fast/page-color-sampling/color-sampling-includes-subframes.html
    M Source/WebCore/page/FrameSnapshotting.cpp
    M Source/WebCore/page/FrameSnapshotting.h
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/PageColorSampler.cpp
    M Source/WebCore/page/TextIndicator.cpp
    M Source/WebCore/rendering/PaintPhase.h
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/TextBoxPainter.cpp

  Log Message:
  -----------
  [Cocoa] Continue fine-tuning fixed-position page sampling heuristics
https://bugs.webkit.org/show_bug.cgi?id=289573
rdar://146801107

Reviewed by Abrar Rahman Protyasha.

Make various adjustments to the page color sampling heuristic. See below for 
more details.

* 
LayoutTests/fast/page-color-sampling/color-sampling-ignores-non-fixed-content-expected.txt:
 Added.
* 
LayoutTests/fast/page-color-sampling/color-sampling-ignores-non-fixed-content.html:
 Added.

Add a test to verify that sampling doesn't include content behind the 
fixed-position container, if
the fixed-position container is partially transparent.

* 
LayoutTests/fast/page-color-sampling/color-sampling-ignores-text-expected.txt: 
Added.
* LayoutTests/fast/page-color-sampling/color-sampling-ignores-text.html: Added.

Add a test to verify that text painting is skipped for the purposes of color 
sampling. To check
this, we include lots of white text inside an orange fixed-position container 
(with a fairly large
font size, and also decreased `letter-spacing` to maximize the likelihood of 
sampling the text). At
various offsets relative to the top of the viewport, the sampled color should 
always remain orange.

* 
LayoutTests/fast/page-color-sampling/color-sampling-includes-subframes-expected.txt:
 Added.
* LayoutTests/fast/page-color-sampling/color-sampling-includes-subframes.html: 
Added.

Add a test to verify that content inside subframes in fixed-position containers 
are included in the
sampled color.

* Source/WebCore/page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* Source/WebCore/page/FrameSnapshotting.h:

Make several changes to the frame snapshotting flags:

•   `ExcludeReplacedContent`: rename this to 
`ExcludeReplacedContentExceptForIFrames`. Adjust
    `RenderReplaced::shouldPaint` below to avoid bailing for subframes.

•   `ExcludeText`: add a flag to exclude text from being painted in the 
snapshot. This is passed
    down as a `PaintBehavior` flag, and eventually checked in 
`TextBoxPainter::paint`.

•   `FixedAndStickyLayersOnly`: add a flag to limit painting to content in 
fixed and sticky layers,
    or layers underneath fixed layers. Add a FIXME to include layers inside 
sticky layers, once we
    have the ability to (quickly) check if we have a sticky ancestor.

* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::willPaintContents):
* Source/WebCore/page/PageColorSampler.cpp:
(WebCore::PageColorSampler::predominantColor):

If the sampled color is close to being totally transparent, revert to returning 
an invalid color.

* Source/WebCore/page/TextIndicator.cpp:
(WebCore::snapshotOptionsForTextIndicatorOptions):
* Source/WebCore/rendering/PaintPhase.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintForegroundForFragments):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paint):

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