Title: [234270] trunk/Source
Revision
234270
Author
[email protected]
Date
2018-07-26 13:30:08 -0700 (Thu, 26 Jul 2018)

Log Message

Use the Page's appearance when converting pasteboard attributed strings.
https://bugs.webkit.org/show_bug.cgi?id=188067
rdar://problem/42632246

Reviewed by Wenson Hsieh.

Source/WebCore:

* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::createFragment): Create a LocalDefaultSystemAppearance based on the Page.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebEditorClient.mm:
(_WebCreateFragment): Create a LocalDefaultSystemAppearance based on the Page.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234269 => 234270)


--- trunk/Source/WebCore/ChangeLog	2018-07-26 19:49:23 UTC (rev 234269)
+++ trunk/Source/WebCore/ChangeLog	2018-07-26 20:30:08 UTC (rev 234270)
@@ -1,3 +1,14 @@
+2018-07-26  Timothy Hatcher  <[email protected]>
+
+        Use the Page's appearance when converting pasteboard attributed strings.
+        https://bugs.webkit.org/show_bug.cgi?id=188067
+        rdar://problem/42632246
+
+        Reviewed by Wenson Hsieh.
+
+        * editing/cocoa/WebContentReaderCocoa.mm:
+        (WebCore::createFragment): Create a LocalDefaultSystemAppearance based on the Page.
+
 2018-07-26  Eric Carlson  <[email protected]>
 
         Switching tabs should not close PiP window

Modified: trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (234269 => 234270)


--- trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2018-07-26 19:49:23 UTC (rev 234269)
+++ trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2018-07-26 20:30:08 UTC (rev 234270)
@@ -61,6 +61,10 @@
 #import <pal/spi/cocoa/NSAttributedStringSPI.h>
 #import <wtf/SoftLinking.h>
 
+#if PLATFORM(MAC)
+#include "LocalDefaultSystemAppearance.h"
+#endif
+
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
 @interface NSAttributedString ()
 - (NSString *)_htmlDocumentFragmentString:(NSRange)range documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources;
@@ -120,6 +124,11 @@
     FragmentAndResources result;
     Document& document = *frame.document();
 
+#if PLATFORM(MAC)
+    auto* page = frame.page();
+    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->useDarkAppearance());
+#endif
+
     NSArray *subresources = nil;
     NSString *fragmentString = [string _htmlDocumentFragmentString:NSMakeRange(0, [string length]) documentAttributes:attributesForAttributedStringConversion() subresources:&subresources];
     auto fragment = DocumentFragment::create(document);

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (234269 => 234270)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-07-26 19:49:23 UTC (rev 234269)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-07-26 20:30:08 UTC (rev 234270)
@@ -1,3 +1,14 @@
+2018-07-26  Timothy Hatcher  <[email protected]>
+
+        Use the Page's appearance when converting pasteboard attributed strings.
+        https://bugs.webkit.org/show_bug.cgi?id=188067
+        rdar://problem/42632246
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (_WebCreateFragment): Create a LocalDefaultSystemAppearance based on the Page.
+
 2018-07-25  Chris Dumez  <[email protected]>
 
         navigator.userAgent may return outdated value after webView.customUserAgent is set

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (234269 => 234270)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2018-07-26 19:49:23 UTC (rev 234269)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2018-07-26 20:30:08 UTC (rev 234270)
@@ -92,6 +92,10 @@
 #import "WebUIKitDelegate.h"
 #endif
 
+#if PLATFORM(MAC)
+#import <WebCore/LocalDefaultSystemAppearance.h>
+#endif
+
 using namespace WebCore;
 
 using namespace HTMLNames;
@@ -473,6 +477,11 @@
 
 void _WebCreateFragment(Document& document, NSAttributedString *string, FragmentAndResources& result)
 {
+#if PLATFORM(MAC)
+    auto* page = document.page();
+    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->useDarkAppearance());
+#endif
+
     static NSDictionary *documentAttributes = [attributesForAttributedStringConversion() retain];
     NSArray *subresources;
     DOMDocumentFragment* fragment = [string _documentFromRange:NSMakeRange(0, [string length])
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to