Title: [277663] branches/safari-612.1.12-branch
Revision
277663
Author
[email protected]
Date
2021-05-18 10:55:21 -0700 (Tue, 18 May 2021)

Log Message

Cherry-pick r277030. rdar://problem/78160475

    Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
    https://bugs.webkit.org/show_bug.cgi?id=225323

    Reviewed by Beth Dakin.

    Source/WebCore:

    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
    color needs to extend in order for us to not bail. If the value > 0, we take an additional
    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
    the color across the top of the page is only a small strip, these extra snapshot comparisons
    will prevent a resulting color from being derived.

    Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
           SampledPageTopColor.VerticalGradientAboveMaxDifference

    * dom/Document.cpp:
    (WebCore::Document::determineSampledPageTopColor):

    Source/WebKit:

    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
    color needs to extend in order for us to not bail. If the value > 0, we take an additional
    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
    the color across the top of the page is only a small strip, these extra snapshot comparisons
    will prevent a resulting color from being derived.

    * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
    * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
    (-[WKWebViewConfiguration init]):
    (-[WKWebViewConfiguration copyWithZone:]):
    (-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
    (-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
    * UIProcess/API/Cocoa/WKWebView.mm:
    (-[WKWebView _setupPageConfiguration:]):
    Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.

    Source/WTF:

    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
    color needs to extend in order for us to not bail. If the value > 0, we take an additional
    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
    the color across the top of the page is only a small strip, these extra snapshot comparisons
    will prevent a resulting color from being derived.

    * Scripts/Preferences/WebPreferences.yaml:

    Tools:

    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
    (createWebViewWithSampledPageTopColorMaxDifference):
    (createHTMLGradientWithColorStops):
    (TEST.SampledPageTopColor.ZeroMaxDifference):
    (TEST.SampledPageTopColor.NegativeMaxDifference):
    (TEST.SampledPageTopColor.SolidColor):
    (TEST.SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference):
    (TEST.SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference):
    (TEST.SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference):
    (TEST.SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference):
    (TEST.SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference):
    (TEST.SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference):
    (TEST.SampledPageTopColor.VerticalGradientBelowMaxDifference): Added.
    (TEST.SampledPageTopColor.VerticalGradientAboveMaxDifference): Added.
    (TEST.SampledPageTopColor.DISABLED_DisplayP3):
    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277030 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612.1.12-branch/Source/WTF/ChangeLog (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WTF/ChangeLog	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WTF/ChangeLog	2021-05-18 17:55:21 UTC (rev 277663)
@@ -1,3 +1,99 @@
+2021-05-18  Alan Coon  <[email protected]>
+
+        Cherry-pick r277030. rdar://problem/78160475
+
+    Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+    https://bugs.webkit.org/show_bug.cgi?id=225323
+    
+    Reviewed by Beth Dakin.
+    
+    Source/WebCore:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
+           SampledPageTopColor.VerticalGradientAboveMaxDifference
+    
+    * dom/Document.cpp:
+    (WebCore::Document::determineSampledPageTopColor):
+    
+    Source/WebKit:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+    * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+    (-[WKWebViewConfiguration init]):
+    (-[WKWebViewConfiguration copyWithZone:]):
+    (-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
+    (-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _setupPageConfiguration:]):
+    Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.
+    
+    Source/WTF:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * Scripts/Preferences/WebPreferences.yaml:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (createHTMLGradientWithColorStops):
+    (TEST.SampledPageTopColor.ZeroMaxDifference):
+    (TEST.SampledPageTopColor.NegativeMaxDifference):
+    (TEST.SampledPageTopColor.SolidColor):
+    (TEST.SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference):
+    (TEST.SampledPageTopColor.VerticalGradientBelowMaxDifference): Added.
+    (TEST.SampledPageTopColor.VerticalGradientAboveMaxDifference): Added.
+    (TEST.SampledPageTopColor.DISABLED_DisplayP3):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-05  Devin Rousso  <[email protected]>
+
+            Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+            https://bugs.webkit.org/show_bug.cgi?id=225323
+
+            Reviewed by Beth Dakin.
+
+            Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+            color needs to extend in order for us to not bail. If the value > 0, we take an additional
+            snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+            comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+            compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+            the color across the top of the page is only a small strip, these extra snapshot comparisons
+            will prevent a resulting color from being derived.
+
+            * Scripts/Preferences/WebPreferences.yaml:
+
 2021-04-30  Russell Epstein  <[email protected]>
 
         Cherry-pick r276744. rdar://problem/77402549

Modified: branches/safari-612.1.12-branch/Source/WTF/Scripts/Preferences/WebPreferences.yaml (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-05-18 17:55:21 UTC (rev 277663)
@@ -1833,6 +1833,16 @@
     WebCore:
       default: 0
 
+SampledPageTopColorMinHeight:
+  type: double
+  defaultValue:
+    WebKitLegacy:
+      default: 0
+    WebKit:
+      default: 0
+    WebCore:
+      default: 0
+
 SansSerifFontFamily:
   type: String
   webKitLegacyPreferenceKey: WebKitSansSerifFont

Modified: branches/safari-612.1.12-branch/Source/WebCore/ChangeLog (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WebCore/ChangeLog	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WebCore/ChangeLog	2021-05-18 17:55:21 UTC (rev 277663)
@@ -1,5 +1,105 @@
 2021-05-18  Alan Coon  <[email protected]>
 
+        Cherry-pick r277030. rdar://problem/78160475
+
+    Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+    https://bugs.webkit.org/show_bug.cgi?id=225323
+    
+    Reviewed by Beth Dakin.
+    
+    Source/WebCore:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
+           SampledPageTopColor.VerticalGradientAboveMaxDifference
+    
+    * dom/Document.cpp:
+    (WebCore::Document::determineSampledPageTopColor):
+    
+    Source/WebKit:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+    * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+    (-[WKWebViewConfiguration init]):
+    (-[WKWebViewConfiguration copyWithZone:]):
+    (-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
+    (-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _setupPageConfiguration:]):
+    Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.
+    
+    Source/WTF:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * Scripts/Preferences/WebPreferences.yaml:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (createHTMLGradientWithColorStops):
+    (TEST.SampledPageTopColor.ZeroMaxDifference):
+    (TEST.SampledPageTopColor.NegativeMaxDifference):
+    (TEST.SampledPageTopColor.SolidColor):
+    (TEST.SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference):
+    (TEST.SampledPageTopColor.VerticalGradientBelowMaxDifference): Added.
+    (TEST.SampledPageTopColor.VerticalGradientAboveMaxDifference): Added.
+    (TEST.SampledPageTopColor.DISABLED_DisplayP3):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-05  Devin Rousso  <[email protected]>
+
+            Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+            https://bugs.webkit.org/show_bug.cgi?id=225323
+
+            Reviewed by Beth Dakin.
+
+            Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+            color needs to extend in order for us to not bail. If the value > 0, we take an additional
+            snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+            comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+            compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+            the color across the top of the page is only a small strip, these extra snapshot comparisons
+            will prevent a resulting color from being derived.
+
+            Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
+                   SampledPageTopColor.VerticalGradientAboveMaxDifference
+
+            * dom/Document.cpp:
+            (WebCore::Document::determineSampledPageTopColor):
+
+2021-05-18  Alan Coon  <[email protected]>
+
         Cherry-pick r276796. rdar://problem/78162377
 
     Unreviewed, fix crashloop after r276744

Modified: branches/safari-612.1.12-branch/Source/WebCore/dom/Document.cpp (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WebCore/dom/Document.cpp	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WebCore/dom/Document.cpp	2021-05-18 17:55:21 UTC (rev 277663)
@@ -3928,8 +3928,7 @@
     });
 
     // FIXME: <https://webkit.org/b/225167> (Sampled Page Top Color: hook into painting logic instead of taking snapshots)
-    auto pixelColorAtTopX = [&] (int x) -> Optional<Lab<float>> {
-        IntPoint location(x, 0);
+    auto pixelColor = [&] (IntPoint&& location) -> Optional<Lab<float>> {
         IntSize size(1, 1);
 
         if (isHitTestLocationThirdPartyFrame(LayoutPoint(location)))
@@ -3962,7 +3961,7 @@
     };
 
     for (size_t i = 0; i < numSnapshots; ++i) {
-        auto snapshot = pixelColorAtTopX(frameWidth * i / (numSnapshots - 1));
+        auto snapshot = pixelColor(IntPoint(frameWidth * i / (numSnapshots - 1), 0));
         if (!snapshot) {
             if (shouldStopAfterFindingNonMatchingColor(i))
                 return;
@@ -4006,6 +4005,24 @@
         }
     }
 
+    // Decrease the height by one pixel so that the last snapshot is within bounds and not off-by-one.
+    auto minHeight = settings().sampledPageTopColorMinHeight() - 1;
+    if (minHeight > 0) {
+        if (nonMatchingColorIndex) {
+            if (auto leftMiddleSnapshot = pixelColor(IntPoint(0, minHeight))) {
+                if (colorDifference(*leftMiddleSnapshot, snapshots[0]) > maxDifference)
+                    return;
+            }
+        }
+
+        if (nonMatchingColorIndex != numSnapshots - 1) {
+            if (auto rightMiddleSnapshot = pixelColor(IntPoint(frameWidth, minHeight))) {
+                if (colorDifference(*rightMiddleSnapshot, snapshots[numSnapshots - 1]) > maxDifference)
+                    return;
+            }
+        }
+    }
+
     auto snapshotsToAverage = snapshots;
     auto validSnapshotCount = numSnapshots;
     if (!nonMatchingColorIndex) {

Modified: branches/safari-612.1.12-branch/Source/WebKit/ChangeLog (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WebKit/ChangeLog	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WebKit/ChangeLog	2021-05-18 17:55:21 UTC (rev 277663)
@@ -1,3 +1,107 @@
+2021-05-18  Alan Coon  <[email protected]>
+
+        Cherry-pick r277030. rdar://problem/78160475
+
+    Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+    https://bugs.webkit.org/show_bug.cgi?id=225323
+    
+    Reviewed by Beth Dakin.
+    
+    Source/WebCore:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
+           SampledPageTopColor.VerticalGradientAboveMaxDifference
+    
+    * dom/Document.cpp:
+    (WebCore::Document::determineSampledPageTopColor):
+    
+    Source/WebKit:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+    * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+    (-[WKWebViewConfiguration init]):
+    (-[WKWebViewConfiguration copyWithZone:]):
+    (-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
+    (-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _setupPageConfiguration:]):
+    Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.
+    
+    Source/WTF:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * Scripts/Preferences/WebPreferences.yaml:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (createHTMLGradientWithColorStops):
+    (TEST.SampledPageTopColor.ZeroMaxDifference):
+    (TEST.SampledPageTopColor.NegativeMaxDifference):
+    (TEST.SampledPageTopColor.SolidColor):
+    (TEST.SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference):
+    (TEST.SampledPageTopColor.VerticalGradientBelowMaxDifference): Added.
+    (TEST.SampledPageTopColor.VerticalGradientAboveMaxDifference): Added.
+    (TEST.SampledPageTopColor.DISABLED_DisplayP3):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-05  Devin Rousso  <[email protected]>
+
+            Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+            https://bugs.webkit.org/show_bug.cgi?id=225323
+
+            Reviewed by Beth Dakin.
+
+            Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+            color needs to extend in order for us to not bail. If the value > 0, we take an additional
+            snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+            comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+            compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+            the color across the top of the page is only a small strip, these extra snapshot comparisons
+            will prevent a resulting color from being derived.
+
+            * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+            * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+            (-[WKWebViewConfiguration init]):
+            (-[WKWebViewConfiguration copyWithZone:]):
+            (-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
+            (-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _setupPageConfiguration:]):
+            Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.
+
 2021-05-13  Russell Epstein  <[email protected]>
 
         Cherry-pick r277453. rdar://problem/77996171

Modified: branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-05-18 17:55:21 UTC (rev 277663)
@@ -560,6 +560,7 @@
 #endif
 
     pageConfiguration->preferences()->setSampledPageTopColorMaxDifference([_configuration _sampledPageTopColorMaxDifference]);
+    pageConfiguration->preferences()->setSampledPageTopColorMinHeight([_configuration _sampledPageTopColorMinHeight]);
 
     if (!linkedOnOrAfter(WebCore::SDKVersion::FirstWhereSiteSpecificQuirksAreEnabledByDefault))
         pageConfiguration->preferences()->setNeedsSiteSpecificQuirks(false);

Modified: branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2021-05-18 17:55:21 UTC (rev 277663)
@@ -178,6 +178,7 @@
     BOOL _appHighlightsEnabled;
 #endif
     double _sampledPageTopColorMaxDifference;
+    double _sampledPageTopColorMinHeight;
 
     RetainPtr<NSString> _mediaContentTypesRequiringHardwareSupport;
     RetainPtr<NSArray<NSString *>> _additionalSupportedImageTypes;
@@ -278,6 +279,7 @@
 #endif
 
     _sampledPageTopColorMaxDifference = DEFAULT_VALUE_FOR_SampledPageTopColorMaxDifference;
+    _sampledPageTopColorMinHeight = DEFAULT_VALUE_FOR_SampledPageTopColorMinHeight;
 
     return self;
 }
@@ -458,6 +460,7 @@
 #endif
 
     configuration->_sampledPageTopColorMaxDifference = self->_sampledPageTopColorMaxDifference;
+    configuration->_sampledPageTopColorMinHeight = self->_sampledPageTopColorMinHeight;
 
     return configuration;
 }
@@ -1289,6 +1292,16 @@
     return _sampledPageTopColorMaxDifference;
 }
 
+- (void)_setSampledPageTopColorMinHeight:(double)value
+{
+    _sampledPageTopColorMinHeight = value;
+}
+
+- (double)_sampledPageTopColorMinHeight
+{
+    return _sampledPageTopColorMinHeight;
+}
+
 @end
 
 @implementation WKWebViewConfiguration (WKDeprecated)

Modified: branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h (277662 => 277663)


--- branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h	2021-05-18 17:55:21 UTC (rev 277663)
@@ -127,6 +127,10 @@
 // Expects 0 (disables page top color sampling entirely) or any positive number.
 @property (nonatomic, setter=_setSampledPageTopColorMaxDifference:) double _sampledPageTopColorMaxDifference WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
+// How far down the page the sampled page top color needs to extend in order to be considered valid.
+// Expects 0 (the color doesn't need to continue into the page at all) or any positive number.
+@property (nonatomic, setter=_setSampledPageTopColorMinHeight:) double _sampledPageTopColorMinHeight WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 @end
 
 #if TARGET_OS_IPHONE

Modified: branches/safari-612.1.12-branch/Tools/ChangeLog (277662 => 277663)


--- branches/safari-612.1.12-branch/Tools/ChangeLog	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Tools/ChangeLog	2021-05-18 17:55:21 UTC (rev 277663)
@@ -1,3 +1,106 @@
+2021-05-18  Alan Coon  <[email protected]>
+
+        Cherry-pick r277030. rdar://problem/78160475
+
+    Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+    https://bugs.webkit.org/show_bug.cgi?id=225323
+    
+    Reviewed by Beth Dakin.
+    
+    Source/WebCore:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    Tests: SampledPageTopColor.VerticalGradientBelowMaxDifference
+           SampledPageTopColor.VerticalGradientAboveMaxDifference
+    
+    * dom/Document.cpp:
+    (WebCore::Document::determineSampledPageTopColor):
+    
+    Source/WebKit:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+    * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+    (-[WKWebViewConfiguration init]):
+    (-[WKWebViewConfiguration copyWithZone:]):
+    (-[WKWebViewConfiguration _setSampledPageTopColorMinHeight:]): Added.
+    (-[WKWebViewConfiguration _sampledPageTopColorMinHeight]): Added.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _setupPageConfiguration:]):
+    Provide SPI to configure the `SampledPageTopColorMinHeight` preference when creating the `WKWebView`.
+    
+    Source/WTF:
+    
+    Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
+    color needs to extend in order for us to not bail. If the value > 0, we take an additional
+    snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
+    comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
+    compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
+    the color across the top of the page is only a small strip, these extra snapshot comparisons
+    will prevent a resulting color from being derived.
+    
+    * Scripts/Preferences/WebPreferences.yaml:
+    
+    Tools:
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+    (createWebViewWithSampledPageTopColorMaxDifference):
+    (createHTMLGradientWithColorStops):
+    (TEST.SampledPageTopColor.ZeroMaxDifference):
+    (TEST.SampledPageTopColor.NegativeMaxDifference):
+    (TEST.SampledPageTopColor.SolidColor):
+    (TEST.SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference):
+    (TEST.SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference):
+    (TEST.SampledPageTopColor.VerticalGradientBelowMaxDifference): Added.
+    (TEST.SampledPageTopColor.VerticalGradientAboveMaxDifference): Added.
+    (TEST.SampledPageTopColor.DISABLED_DisplayP3):
+    (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-05-05  Devin Rousso  <[email protected]>
+
+            Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
+            https://bugs.webkit.org/show_bug.cgi?id=225323
+
+            Reviewed by Beth Dakin.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
+            (createWebViewWithSampledPageTopColorMaxDifference):
+            (createHTMLGradientWithColorStops):
+            (TEST.SampledPageTopColor.ZeroMaxDifference):
+            (TEST.SampledPageTopColor.NegativeMaxDifference):
+            (TEST.SampledPageTopColor.SolidColor):
+            (TEST.SampledPageTopColor.DifferentColorsWithoutOutlierBelowMaxDifference):
+            (TEST.SampledPageTopColor.DifferentColorsWithLeftOutlierAboveMaxDifference):
+            (TEST.SampledPageTopColor.DifferentColorsWithMiddleOutlierAboveMaxDifference):
+            (TEST.SampledPageTopColor.DifferentColorsWithRightOutlierAboveMaxDifference):
+            (TEST.SampledPageTopColor.DifferentColorsIndividuallyAboveMaxDifference):
+            (TEST.SampledPageTopColor.DifferentColorsCumulativelyAboveMaxDifference):
+            (TEST.SampledPageTopColor.VerticalGradientBelowMaxDifference): Added.
+            (TEST.SampledPageTopColor.VerticalGradientAboveMaxDifference): Added.
+            (TEST.SampledPageTopColor.DISABLED_DisplayP3):
+            (TEST.SampledPageTopColor.ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor):
+
 2021-05-04  Russell Epstein  <[email protected]>
 
         Cherry-pick r276871. rdar://problem/77530347

Modified: branches/safari-612.1.12-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm (277662 => 277663)


--- branches/safari-612.1.12-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm	2021-05-18 17:55:16 UTC (rev 277662)
+++ branches/safari-612.1.12-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm	2021-05-18 17:55:21 UTC (rev 277663)
@@ -82,10 +82,11 @@
 @end
 
 enum class UseSampledPageTopColorForScrollAreaBackgroundColor : bool { Yes, No };
-static RetainPtr<TestWKWebView> createWebViewWithSampledPageTopColorMaxDifference(double sampledPageTopColorMaxDifference, UseSampledPageTopColorForScrollAreaBackgroundColor useSampledPageTopColorForScrollAreaBackgroundColor = UseSampledPageTopColorForScrollAreaBackgroundColor::No)
+static RetainPtr<TestWKWebView> createWebViewWithSampledPageTopColorMaxDifference(double sampledPageTopColorMaxDifference, double sampledPageTopColorMinHeight = 0, UseSampledPageTopColorForScrollAreaBackgroundColor useSampledPageTopColorForScrollAreaBackgroundColor = UseSampledPageTopColorForScrollAreaBackgroundColor::No)
 {
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     [configuration _setSampledPageTopColorMaxDifference:sampledPageTopColorMaxDifference];
+    [configuration _setSampledPageTopColorMinHeight:sampledPageTopColorMinHeight];
 
     for (_WKInternalDebugFeature *feature in [WKPreferences _internalDebugFeatures]) {
         if ([feature.key isEqualToString:@"UseSampledPageTopColorForScrollAreaBackgroundColor"]) {
@@ -107,12 +108,13 @@
     TestWebKitAPI::Util::run(&done);
 }
 
-static String createHTMLGradientWithColorStops(Vector<String>&& colorStops)
+static String createHTMLGradientWithColorStops(String&& direction, Vector<String>&& colorStops)
 {
     EXPECT_GE(colorStops.size(), 2UL);
 
     StringBuilder gradientBuilder;
-    gradientBuilder.append("<body style=\"background-image: linear-gradient(to right"_s);
+    gradientBuilder.append("<body style=\"background-image: linear-gradient(to "_s);
+    gradientBuilder.append(WTFMove(direction));
     for (auto&& colorStop : WTFMove(colorStops)) {
         gradientBuilder.append(", "_s);
         gradientBuilder.append(WTFMove(colorStop));
@@ -126,7 +128,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(0);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({ "red", "red" })];
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s })];
     EXPECT_NULL([webView _sampledPageTopColor]);
 }
 
@@ -135,7 +137,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(-5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({ "red", "red" })];
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s })];
     EXPECT_NULL([webView _sampledPageTopColor]);
 }
 
@@ -144,7 +146,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops({ "red", "red" }));
+    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s }));
     EXPECT_EQ(WebCore::Color([webView _sampledPageTopColor].CGColor), WebCore::Color::red);
 }
 
@@ -153,7 +155,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops({
+    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops("right"_s, {
         "lab(1% 0 0)"_s,
         "lab(2% 0 0)"_s,
         "lab(3% 0 0)"_s,
@@ -173,7 +175,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops({
+    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops("right"_s, {
         "lab(100% 0 0)"_s, // outlier
         "lab(1% 0 0)"_s,
         "lab(2% 0 0)"_s,
@@ -193,7 +195,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, {
         "lab(1% 0 0)"_s,
         "lab(2% 0 0)"_s,
         "lab(100% 0 0)"_s, // outlier
@@ -208,7 +210,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops({
+    waitForSampledPageTopColorToChangeForHTML(webView.get(), createHTMLGradientWithColorStops("right"_s, {
         "lab(1% 0 0)"_s,
         "lab(2% 0 0)"_s,
         "lab(3% 0 0)"_s,
@@ -228,7 +230,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, {
         "lab(10% 0 0)"_s,
         "lab(20% 0 0)"_s,
         "lab(30% 0 0)"_s,
@@ -243,7 +245,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, {
         "lab(1% 0 0)"_s,
         "lab(3% 0 0)"_s,
         "lab(5% 0 0)"_s,
@@ -253,6 +255,35 @@
     EXPECT_NULL([webView _sampledPageTopColor]);
 }
 
+TEST(SampledPageTopColor, VerticalGradientBelowMaxDifference)
+{
+    auto webView = createWebViewWithSampledPageTopColorMaxDifference(5, 100);
+    EXPECT_NULL([webView _sampledPageTopColor]);
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("bottom"_s, {
+        "lab(1% 0 0)"_s,
+        "lab(2% 0 0)"_s,
+        "lab(3% 0 0)"_s,
+        "lab(4% 0 0)"_s,
+        "lab(5% 0 0)"_s,
+        "lab(6% 0 0)"_s,
+    })];
+    auto components = CGColorGetComponents([webView _sampledPageTopColor].CGColor);
+    EXPECT_IN_RANGE(components[0], 0.01, 0.02);
+    EXPECT_IN_RANGE(components[1], 0.01, 0.02);
+    EXPECT_IN_RANGE(components[2], 0.01, 0.02);
+    EXPECT_EQ(components[3], 1);
+}
+
+TEST(SampledPageTopColor, VerticalGradientAboveMaxDifference)
+{
+    auto webView = createWebViewWithSampledPageTopColorMaxDifference(5, 100);
+    EXPECT_NULL([webView _sampledPageTopColor]);
+
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("bottom"_s, { "red"_s, "blue"_s })];
+    EXPECT_NULL([webView _sampledPageTopColor]);
+}
+
 // FIXME: <https://webkit.org/b/225167> (Sampled Page Top Color: hook into painting logic instead of taking snapshots)
 TEST(SampledPageTopColor, DISABLED_DisplayP3)
 {
@@ -259,7 +290,7 @@
     auto webView = createWebViewWithSampledPageTopColorMaxDifference(5);
     EXPECT_NULL([webView _sampledPageTopColor]);
 
-    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({
+    [webView synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, {
         "color(display-p3 0.99 0 0)"_s,
         "color(display-p3 0.98 0 0)"_s,
         "color(display-p3 0.97 0 0)"_s,
@@ -280,25 +311,25 @@
 
 TEST(SampledPageTopColor, ExperimentalUseSampledPageTopColorForScrollAreaBackgroundColor)
 {
-    auto webViewWithoutThemeColorForScrollAreaBackgroundColor = createWebViewWithSampledPageTopColorMaxDifference(5, UseSampledPageTopColorForScrollAreaBackgroundColor::No);
+    auto webViewWithoutThemeColorForScrollAreaBackgroundColor = createWebViewWithSampledPageTopColorMaxDifference(5, 0, UseSampledPageTopColorForScrollAreaBackgroundColor::No);
     EXPECT_NULL([webViewWithoutThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
 
-    [webViewWithoutThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({ "red", "blue" })];
+    [webViewWithoutThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, { "red"_s, "blue"_s })];
     EXPECT_NULL([webViewWithoutThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
     EXPECT_EQ(WebCore::Color([webViewWithoutThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::white);
 
-    waitForSampledPageTopColorToChangeForHTML(webViewWithoutThemeColorForScrollAreaBackgroundColor.get(), createHTMLGradientWithColorStops({ "red", "red" }));
+    waitForSampledPageTopColorToChangeForHTML(webViewWithoutThemeColorForScrollAreaBackgroundColor.get(), createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s }));
     EXPECT_EQ(WebCore::Color([webViewWithoutThemeColorForScrollAreaBackgroundColor _sampledPageTopColor].CGColor), WebCore::Color::red);
     EXPECT_EQ(WebCore::Color([webViewWithoutThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::white);
 
-    auto webViewWithThemeColorForScrollAreaBackgroundColor = createWebViewWithSampledPageTopColorMaxDifference(5, UseSampledPageTopColorForScrollAreaBackgroundColor::Yes);
+    auto webViewWithThemeColorForScrollAreaBackgroundColor = createWebViewWithSampledPageTopColorMaxDifference(5, 0, UseSampledPageTopColorForScrollAreaBackgroundColor::Yes);
     EXPECT_NULL([webViewWithThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
 
-    [webViewWithThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops({ "red", "blue" })];
+    [webViewWithThemeColorForScrollAreaBackgroundColor synchronouslyLoadHTMLStringAndWaitUntilAllImmediateChildFramesPaint:createHTMLGradientWithColorStops("right"_s, { "red"_s, "blue"_s })];
     EXPECT_NULL([webViewWithThemeColorForScrollAreaBackgroundColor _sampledPageTopColor]);
     EXPECT_EQ(WebCore::Color([webViewWithThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::white);
 
-    waitForSampledPageTopColorToChangeForHTML(webViewWithThemeColorForScrollAreaBackgroundColor.get(), createHTMLGradientWithColorStops({ "red", "red" }));
+    waitForSampledPageTopColorToChangeForHTML(webViewWithThemeColorForScrollAreaBackgroundColor.get(), createHTMLGradientWithColorStops("right"_s, { "red"_s, "red"_s }));
     EXPECT_EQ(WebCore::Color([webViewWithThemeColorForScrollAreaBackgroundColor _sampledPageTopColor].CGColor), WebCore::Color::red);
     EXPECT_EQ(WebCore::Color([webViewWithThemeColorForScrollAreaBackgroundColor scrollView].backgroundColor.CGColor), WebCore::Color::red);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to