Title: [274310] trunk/Source/WebKit
Revision
274310
Author
[email protected]
Date
2021-03-11 16:22:08 -0800 (Thu, 11 Mar 2021)

Log Message

[macOS] override the background color of PDF documents to match PDFKit
https://bugs.webkit.org/show_bug.cgi?id=223091
<rdar://problem/74584770>

Reviewed by Tim Horton.

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (274309 => 274310)


--- trunk/Source/WebKit/ChangeLog	2021-03-12 00:12:09 UTC (rev 274309)
+++ trunk/Source/WebKit/ChangeLog	2021-03-12 00:22:08 UTC (rev 274310)
@@ -1,3 +1,14 @@
+2021-03-11  Devin Rousso  <[email protected]>
+
+        [macOS] override the background color of PDF documents to match PDFKit
+        https://bugs.webkit.org/show_bug.cgi?id=223091
+        <rdar://problem/74584770>
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::PDFPlugin):
+
 2021-03-11  Chris Dumez  <[email protected]>
 
         Introduce WorkQueue::main() to get the main thread's work queue

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (274309 => 274310)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2021-03-12 00:12:09 UTC (rev 274309)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2021-03-12 00:22:08 UTC (rev 274310)
@@ -29,6 +29,7 @@
 #if ENABLE(PDFKIT_PLUGIN)
 
 #import "ArgumentCoders.h"
+#import "CocoaColor.h"
 #import "DataReference.h"
 #import "FrameInfoData.h"
 #import "Logging.h"
@@ -58,7 +59,10 @@
 #import <QuartzCore/QuartzCore.h>
 #import <WebCore/AXObjectCache.h>
 #import <WebCore/ArchiveResource.h>
+#import <WebCore/CSSPropertyNames.h>
 #import <WebCore/Chrome.h>
+#import <WebCore/Color.h>
+#import <WebCore/ColorSerialization.h>
 #import <WebCore/Cursor.h>
 #import <WebCore/DictionaryLookup.h>
 #import <WebCore/DocumentLoader.h>
@@ -69,6 +73,7 @@
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameView.h>
 #import <WebCore/GraphicsContext.h>
+#import <WebCore/HTMLBodyElement.h>
 #import <WebCore/HTMLElement.h>
 #import <WebCore/HTMLFormElement.h>
 #import <WebCore/HTMLPlugInElement.h>
@@ -611,6 +616,13 @@
     m_pdfLayerController.get().delegate = m_pdfLayerControllerDelegate.get();
     m_pdfLayerController.get().parentLayer = m_contentLayer.get();
 
+    if (isFullFramePlugin()) {
+        auto* document = frame.coreFrame()->document();
+
+        // FIXME: <rdar://problem/75332948> get the background color from PDFKit instead of hardcoding it
+        document->bodyOrFrameset()->setInlineStyleProperty(WebCore::CSSPropertyBackgroundColor, WebCore::serializationForHTML([CocoaColor grayColor].CGColor));
+    }
+
     if (supportsForms()) {
         auto* document = frame.coreFrame()->document();
         m_annotationContainer = document->createElement(divTag, false);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to