Mail appears to be double inverting code copied from Notes, Xcode, or Terminal.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Sep 2019 02:52:40 +0000 (02:52 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Sep 2019 02:52:40 +0000 (02:52 +0000)
commit6e9a9baf8ff05a8a88c47db021613f666998cbca
tree835d628eb752670c4d81ef3b07c79db809fc99df
parent86fade7add38c5a308748b8c94359e190fa1f78f
Mail appears to be double inverting code copied from Notes, Xcode, or Terminal.
https://bugs.webkit.org/show_bug.cgi?id=201368
rdar://problem/40529867

Reviewed by Ryosuke Niwa.

Source/WebCore:

Dark mode content that is pasted should have the inline styles inverse color
transformed by the color filter to match the color filtered document contents.

Layout Test: editing/pasteboard/paste-dark-mode-color-filtered.html
API Tests: PasteHTML.TransformColorsOfDarkContent, PasteHTML.DoesNotTransformColorsOfLightContent,
    PasteRTFD.TransformColorsOfDarkContent, PasteRTFD.DoesNotTransformColorsOfLightContent

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::inverseTransformColorIfNeeded): Added caret-color to the transformed properties.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::fragmentNeedsColorTransformed): Added.
(WebCore::ReplaceSelectionCommand::inverseTransformColor): Added.
(WebCore::ReplaceSelectionCommand::doApply): Call fragmentNeedsColorTransformed() and inverseTransformColor().
* editing/ReplaceSelectionCommand.h:

Tools:

Added Tests: PasteHTML.TransformColorsOfDarkContent, PasteHTML.DoesNotTransformColorsOfLightContent,
    PasteRTFD.TransformColorsOfDarkContent, PasteRTFD.DoesNotTransformColorsOfLightContent

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm:
(createWebViewWithCustomPasteboardDataSetting): Added argument to enable color filter.
* TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm:
(createWebViewWithCustomPasteboardDataEnabled): Added argument to enable color filter.
* TestWebKitAPI/Tests/WebKitCocoa/rich-color-filtered.html: Added.
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView forceDarkMode]):

LayoutTests:

* TestExpectations:
* editing/pasteboard/paste-dark-mode-color-filtered-expected.txt: Added.
* editing/pasteboard/paste-dark-mode-color-filtered.html: Added.
* platform/ios-12/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/editing/pasteboard/paste-dark-mode-color-filtered-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/paste-dark-mode-color-filtered.html [new file with mode: 0644]
LayoutTests/platform/ios-12/TestExpectations
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/ReplaceSelectionCommand.cpp
Source/WebCore/editing/ReplaceSelectionCommand.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteRTFD.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/rich-color-filtered.html [new file with mode: 0644]
Tools/TestWebKitAPI/cocoa/TestWKWebView.h
Tools/TestWebKitAPI/cocoa/TestWKWebView.mm