Don't force black text when TextIndicator draws backgrounds or all content.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2018 23:23:32 +0000 (23:23 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2018 23:23:32 +0000 (23:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187161
rdar://problem/40434644

Reviewed by Tim Horton.

* page/TextIndicator.cpp:
(WebCore::snapshotOptionsForTextIndicatorOptions):
Only set SnapshotOptionsForceBlackText when TextIndicatorOptionRespectTextColor and
TextIndicatorOptionPaintBackgrounds are not set.

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

Source/WebCore/ChangeLog
Source/WebCore/page/TextIndicator.cpp

index 3a39482..b878061 100644 (file)
@@ -1,5 +1,18 @@
 2018-06-28  Timothy Hatcher  <timothy@apple.com>
 
+        Don't force black text when TextIndicator draws backgrounds or all content.
+        https://bugs.webkit.org/show_bug.cgi?id=187161
+        rdar://problem/40434644
+
+        Reviewed by Tim Horton.
+
+        * page/TextIndicator.cpp:
+        (WebCore::snapshotOptionsForTextIndicatorOptions):
+        Only set SnapshotOptionsForceBlackText when TextIndicatorOptionRespectTextColor and
+        TextIndicatorOptionPaintBackgrounds are not set.
+
+2018-06-28  Timothy Hatcher  <timothy@apple.com>
+
         Find on page selection color isn't adapted for dark mode.
         https://bugs.webkit.org/show_bug.cgi?id=187072
 
index 7954651..611585d 100644 (file)
@@ -134,14 +134,16 @@ static bool hasNonInlineOrReplacedElements(const Range& range)
 static SnapshotOptions snapshotOptionsForTextIndicatorOptions(TextIndicatorOptions options)
 {
     SnapshotOptions snapshotOptions = SnapshotOptionsNone;
-    if (!(options & TextIndicatorOptionRespectTextColor))
-        snapshotOptions |= SnapshotOptionsForceBlackText;
 
     if (!(options & TextIndicatorOptionPaintAllContent)) {
         if (options & TextIndicatorOptionPaintBackgrounds)
             snapshotOptions |= SnapshotOptionsPaintSelectionAndBackgroundsOnly;
-        else
+        else {
             snapshotOptions |= SnapshotOptionsPaintSelectionOnly;
+
+            if (!(options & TextIndicatorOptionRespectTextColor))
+                snapshotOptions |= SnapshotOptionsForceBlackText;
+        }
     } else
         snapshotOptions |= SnapshotOptionsExcludeSelectionHighlighting;