Allow removal of white backgrounds
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2018 23:34:42 +0000 (23:34 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2018 23:34:42 +0000 (23:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187574
<rdar://problem/41146792>

Reviewed by Simon Fraser.

Source/WebCore:

Add a drawing mode that turns white backgrounds into transparent
regions, such that a hosting app can see through to its window.

Test: css3/color-filters/punch-out-white-backgrounds.html

* page/Settings.yaml: New Setting.

* rendering/InlineFlowBox.cpp: Draw with a destination out blend mode
if the background is white and we are punching out backgrounds, which means
that it will erase the destination.
(WebCore::InlineFlowBox::paintBoxDecorations):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBackground): Ditto.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore
the composition mode if necessary.

Source/WebKit:

Add a new WebPreference for punching out white backgrounds.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode):
(WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _punchOutWhiteBackgroundsInDarkMode]):
(-[WKWebViewConfiguration _setPunchOutWhiteBackgroundsInDarkMode:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:

Source/WebKitLegacy/mac:

Add a new WebPreference for punching out white backgrounds.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences punchOutWhiteBackgroundsInDarkMode]):
(-[WebPreferences setPunchOutWhiteBackgroundsInDarkMode:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

Add a new menu item for punching out white backgrounds in MiniBrowser.
In WebKitTestRunner, expose the new setting and hook that up to
drawing a background in the WebView.

* MiniBrowser/mac/AppDelegate.m:
(defaultConfiguration): Add _punchOutWhiteBackgroundsInDarkMode.

* MiniBrowser/mac/SettingsController.h: Ditto.
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController togglePunchOutWhiteBackgroundsInDarkMode:]):
(-[SettingsController punchOutWhiteBackgroundsInDarkMode]):

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]): Set the new preference.

* WebKitTestRunner/PlatformWebView.h: Expose a drawsBackground property.
* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: Null implementation.
(WTR::PlatformWebView::drawsBackground const):
(WTR::PlatformWebView::setDrawsBackground):
* WebKitTestRunner/wpe/PlatformWebViewWPE.cpp: Ditto.
(WTR::PlatformWebView::drawsBackground const):
(WTR::PlatformWebView::setDrawsBackground):
* WebKitTestRunner/ios/PlatformWebViewIOS.mm: Call into the WKWebView and
set its SPI.
(WTR::PlatformWebView::drawsBackground const):
(WTR::PlatformWebView::setDrawsBackground):
* WebKitTestRunner/mac/PlatformWebViewMac.mm: Ditto.
(WTR::PlatformWebView::drawsBackground const):
(WTR::PlatformWebView::setDrawsBackground):

* WebKitTestRunner/TestController.cpp: Reset and copy the new preference.
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformCreateWebView): If the option for punching
out the background was set, tell the WebView to not draw its background.

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

41 files changed:
LayoutTests/TestExpectations
LayoutTests/css3/color-filters/punch-out-white-backgrounds-expected.html [new file with mode: 0644]
LayoutTests/css3/color-filters/punch-out-white-backgrounds.html [new file with mode: 0644]
LayoutTests/displaylists/extent-includes-shadow-expected.txt
LayoutTests/displaylists/extent-includes-transforms-expected.txt
LayoutTests/displaylists/layer-dispay-list-expected.txt
LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/page/Settings.yaml
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/MiniBrowser/mac/AppDelegate.m
Tools/MiniBrowser/mac/SettingsController.h
Tools/MiniBrowser/mac/SettingsController.m
Tools/MiniBrowser/mac/WK1BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/wpe/PlatformWebViewWPE.cpp

index 6e00a84..30cfb3c 100644 (file)
@@ -272,6 +272,9 @@ imported/w3c/web-platform-tests/css/css-ui/caret-color-018.html [ Skip ]
 imported/w3c/web-platform-tests/css/css-ui/caret-color-019.html [ Skip ]
 imported/w3c/web-platform-tests/css/css-ui/caret-color-020.html [ Skip ]
 
+# Only relevant on macOS
+css3/color-filters/punch-out-white-backgrounds.html [ Skip ]
+
 # This test tests a feature that only exists on iOS.
 fast/text/accessibility-bold-system-font-2.html [ Skip ]
 
diff --git a/LayoutTests/css3/color-filters/punch-out-white-backgrounds-expected.html b/LayoutTests/css3/color-filters/punch-out-white-backgrounds-expected.html
new file mode 100644 (file)
index 0000000..c353bf7
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Punch out White Backgrounds</title>
+        <link rel="author" title="Apple" href="http://www.apple.com/">
+
+        <style type="text/css">
+            body {
+                background-color: #888;
+            }
+            .test
+            {
+                width: 100px;
+                height: 100px;
+                background-color: rgb(236, 236, 236);
+            }
+            .inline-test
+            {
+                background-color: rgb(236, 236, 236);
+            }
+        </style>
+    </head>
+    <body>
+        <div class="test"></div>
+        <p>Inline element test: <span class="inline-test">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
+    </body>
+</html>
diff --git a/LayoutTests/css3/color-filters/punch-out-white-backgrounds.html b/LayoutTests/css3/color-filters/punch-out-white-backgrounds.html
new file mode 100644 (file)
index 0000000..22728ab
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html><!-- webkit-test-runner [ punchOutWhiteBackgrounds=true ] -->
+<html>
+    <head>
+        <title>Punch out White Backgrounds</title>
+        <link rel="author" title="Apple" href="http://www.apple.com/">
+        <link rel="match" href="punch-out-white-backgrounds-expected.html">
+
+        <style type="text/css">
+            body
+            {
+                background-color: #888;
+            }
+            .test
+            {
+                width: 100px;
+                height: 100px;
+                background-color: white;
+            }
+            .inline-test
+            {
+                background-color: white;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="test"></div>
+        <p>Inline element test: <span class="inline-test">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
+    </body>
+</html>
index 51ff9df..de698ae 100644 (file)
@@ -9,8 +9,10 @@
   (shadow-blur 12.00)
   (shadow-offset width=10 height=20)
   (shadows-use-legacy-radius 0))
-(fill-rect-with-color
+(fill-composited-rect
   (extent at (43,50) size 134x137)
   (rect at (50,50) size 100x100)
-  (color #0000FF))
+  (color #0000FF)
+  (composite-operation source-over)
+  (blend-mode normal))
 (restore)
index 1cbbd21..848b077 100644 (file)
   (shadow-blur 12.00)
   (shadow-offset width=10 height=20)
   (shadows-use-legacy-radius 0))
-(fill-rect-with-color
+(fill-composited-rect
   (extent at (7.14,0.20) size 184.55x185.65)
   (rect at (0,0) size 100x100)
-  (color #0000FF))
+  (color #0000FF)
+  (composite-operation source-over)
+  (blend-mode normal))
 (restore)
index 32cc71a..c5f6ac6 100644 (file)
@@ -2,10 +2,12 @@
 (translate
   (x 0.00)
   (y 0.00))
-(fill-rect-with-color
+(fill-composited-rect
   (extent at (0,0) size 104x104)
   (rect at (0,0) size 104x104)
-  (color #008000))
+  (color #008000)
+  (composite-operation source-over)
+  (blend-mode normal))
 (set-state
   (change-flags 131456)
   (fill-color #0000FF)
index 31914b5..bf7ef27 100644 (file)
@@ -2,10 +2,12 @@ recorded:
 (translate
   (x 0.00)
   (y 0.00))
-(fill-rect-with-color
+(fill-composited-rect
   (extent at (412,0) size 100x100)
   (rect at (412,0) size 100x100)
-  (color #0000FF))
+  (color #0000FF)
+  (composite-operation source-over)
+  (blend-mode normal))
 
 replayed: 
 (
index bc7dedd..3e96f53 100644 (file)
@@ -1,3 +1,31 @@
+2018-07-11  Dean Jackson  <dino@apple.com>
+
+        Allow removal of white backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=187574
+        <rdar://problem/41146792>
+
+        Reviewed by Simon Fraser.
+
+        Add a drawing mode that turns white backgrounds into transparent
+        regions, such that a hosting app can see through to its window.
+
+        Test: css3/color-filters/punch-out-white-backgrounds.html
+
+        * page/Settings.yaml: New Setting.
+
+        * rendering/InlineFlowBox.cpp: Draw with a destination out blend mode
+        if the background is white and we are punching out backgrounds, which means
+        that it will erase the destination.
+        (WebCore::InlineFlowBox::paintBoxDecorations):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintBackground): Ditto.
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore
+        the composition mode if necessary.
+
 2018-07-16  David Fenton  <david_fenton@apple.com>
 
         Unreviewed, rolling out r233867.
index d3e1d68..e65a912 100644 (file)
@@ -530,6 +530,11 @@ conicGradientsEnabled:
 
 colorFilterEnabled:
   initial: false
+  onChange: setNeedsRecalcStyleInAllFrames
+
+punchOutWhiteBackgroundsInDarkMode:
+  initial: false
+  onChange: setNeedsRecalcStyleInAllFrames
 
 treatIPAddressAsDomain:
   initial: false
index 6adc6cb..ced3645 100644 (file)
 #include "RenderRubyRun.h"
 #include "RenderRubyText.h"
 #include "RenderTableCell.h"
+#include "RenderTheme.h"
 #include "RenderView.h"
 #include "RootInlineBox.h"
+#include "Settings.h"
 #include "Text.h"
 #include <math.h>
 #include <wtf/IsoMallocInlines.h>
@@ -1358,8 +1360,15 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&
     if (!renderer().boxShadowShouldBeAppliedToBackground(adjustedPaintoffset, BackgroundBleedNone, this))
         paintBoxShadow(paintInfo, lineStyle, Normal, paintRect);
 
-    const Color& color = lineStyle.visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor);
-    paintFillLayers(paintInfo, color, lineStyle.backgroundLayers(), paintRect);
+    Color color = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor);
+
+    CompositeOperator compositeOp = CompositeSourceOver;
+    if (renderer().document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(color) && renderer().theme().usingDarkAppearance(renderer()))
+        compositeOp = CompositeDestinationOut;
+
+    color = lineStyle.colorByApplyingColorFilter(color);
+
+    paintFillLayers(paintInfo, color, lineStyle.backgroundLayers(), paintRect, compositeOp);
     paintBoxShadow(paintInfo, lineStyle, Inset, paintRect);
 
     // :first-line cannot be used to put borders on a line. Always paint borders with our
index d97318c..b661f38 100644 (file)
@@ -56,6 +56,7 @@
 #include "RenderFlexibleBox.h"
 #include "RenderFragmentContainer.h"
 #include "RenderGeometryMap.h"
+#include "RenderGrid.h"
 #include "RenderInline.h"
 #include "RenderIterator.h"
 #include "RenderLayer.h"
@@ -67,6 +68,7 @@
 #include "RuntimeApplicationChecks.h"
 #include "ScrollAnimator.h"
 #include "ScrollbarTheme.h"
+#include "Settings.h"
 #include "StyleScrollSnapPoints.h"
 #include "TransformState.h"
 #include <algorithm>
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/StackStats.h>
 
-#include "RenderGrid.h"
-
-#if PLATFORM(IOS)
-#include "Settings.h"
-#endif
-
 namespace WebCore {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(RenderBox);
@@ -1195,8 +1191,14 @@ void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo)
         return;
 
     auto& style = rootBackgroundRenderer->style();
-    auto color = style.visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor);
-    paintFillLayers(paintInfo, color, style.backgroundLayers(), view().backgroundRect(), BackgroundBleedNone, CompositeSourceOver, rootBackgroundRenderer);
+
+    auto color = style.visitedDependentColor(CSSPropertyBackgroundColor);
+
+    CompositeOperator compositeOp = CompositeSourceOver;
+    if (document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(color) && theme().usingDarkAppearance(*this))
+        compositeOp = CompositeDestinationOut;
+
+    paintFillLayers(paintInfo, style.colorByApplyingColorFilter(color), style.backgroundLayers(), view().backgroundRect(), BackgroundBleedNone, compositeOp, rootBackgroundRenderer);
 }
 
 BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsContext& context) const
@@ -1324,7 +1326,13 @@ void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& pa
     if (backgroundIsKnownToBeObscured(paintRect.location()) && !boxShadowShouldBeAppliedToBackground(paintRect.location(), bleedAvoidance))
         return;
 
-    paintFillLayers(paintInfo, style().visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor), style().backgroundLayers(), paintRect, bleedAvoidance);
+    Color backgroundColor = style().visitedDependentColor(CSSPropertyBackgroundColor);
+
+    CompositeOperator compositeOp = CompositeSourceOver;
+    if (document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(backgroundColor) && theme().usingDarkAppearance(*this))
+        compositeOp = CompositeDestinationOut;
+
+    paintFillLayers(paintInfo, style().colorByApplyingColorFilter(backgroundColor), style().backgroundLayers(), paintRect, bleedAvoidance, compositeOp);
 }
 
 bool RenderBox::getBackgroundPaintedExtent(const LayoutPoint& paintOffset, LayoutRect& paintedExtent) const
index 34eb4e5..850842e 100644 (file)
@@ -802,16 +802,24 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
         if (hasRoundedBorder && bleedAvoidance != BackgroundBleedUseTransparencyLayer) {
             FloatRoundedRect pixelSnappedBorder = backgroundRoundedRectAdjustedForBleedAvoidance(context, rect, bleedAvoidance, box, boxSize,
                 includeLeftEdge, includeRightEdge).pixelSnappedRoundedRectForPainting(deviceScaleFactor);
-            if (pixelSnappedBorder.isRenderable())
+            if (pixelSnappedBorder.isRenderable()) {
+                CompositeOperator previousOperator = context.compositeOperation();
+                bool saveRestoreCompositeOp = op != previousOperator;
+                if (saveRestoreCompositeOp)
+                    context.setCompositeOperation(op);
+
                 context.fillRoundedRect(pixelSnappedBorder, bgColor);
-            else {
+
+                if (saveRestoreCompositeOp)
+                    context.setCompositeOperation(previousOperator);
+            } else {
                 context.save();
                 clipRoundedInnerRect(context, pixelSnappedRect, pixelSnappedBorder);
-                context.fillRect(pixelSnappedBorder.rect(), bgColor);
+                context.fillRect(pixelSnappedBorder.rect(), bgColor, op);
                 context.restore();
             }
         } else
-            context.fillRect(pixelSnappedRect, bgColor);
+            context.fillRect(pixelSnappedRect, bgColor, op);
 
         return;
     }
@@ -940,7 +948,13 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
                     baseColor = baseColor.blend(bgColor);
                 context.fillRect(backgroundRectForPainting, baseColor, CompositeCopy);
             } else if (!baseBgColorOnly && bgColor.isVisible()) {
-                auto operation = shouldClearBackground ? CompositeCopy : context.compositeOperation();
+                auto operation = context.compositeOperation();
+                if (shouldClearBackground) {
+                    if (op == CompositeDestinationOut) // We're punching out the background.
+                        operation = op;
+                    else
+                        operation = CompositeCopy;
+                }
                 context.fillRect(backgroundRectForPainting, bgColor, operation);
             } else if (shouldClearBackground)
                 context.clearRect(backgroundRectForPainting);
index 93c7c63..576a450 100644 (file)
@@ -32,7 +32,9 @@
 #include "HTMLTableCellElement.h"
 #include "PaintInfo.h"
 #include "RenderTableCol.h"
+#include "RenderTheme.h"
 #include "RenderView.h"
+#include "Settings.h"
 #include "StyleProperties.h"
 #include "TransformState.h"
 #include <wtf/IsoMallocInlines.h>
@@ -1282,8 +1284,15 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, const Lay
     if (backgroundObject != this)
         adjustedPaintOffset.moveBy(location());
 
-    Color color = backgroundObject->style().visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor);
-    auto& bgLayer = backgroundObject->style().backgroundLayers();
+    const auto& style = backgroundObject->style();
+    auto& bgLayer = style.backgroundLayers();
+
+    CompositeOperator compositeOp = CompositeSourceOver;
+    Color color = style.visitedDependentColor(CSSPropertyBackgroundColor);
+    if (document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(color) && theme().usingDarkAppearance(*this))
+        compositeOp = CompositeDestinationOut;
+
+    color = style.colorByApplyingColorFilter(color);
 
     if (bgLayer.hasImage() || color.isValid()) {
         // We have to clip here because the background would paint
@@ -1295,7 +1304,7 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, const Lay
                 width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
             paintInfo.context().clip(clipRect);
         }
-        paintFillLayers(paintInfo, color, bgLayer, LayoutRect(adjustedPaintOffset, frameRect().size()), BackgroundBleedNone, CompositeSourceOver, backgroundObject);
+        paintFillLayers(paintInfo, color, bgLayer, LayoutRect(adjustedPaintOffset, frameRect().size()), BackgroundBleedNone, compositeOp, backgroundObject);
     }
 }
 
index 5232d49..84d282d 100644 (file)
@@ -38,6 +38,7 @@ class FileList;
 class FillLayer;
 class HTMLInputElement;
 class Icon;
+class Page;
 class RenderAttachment;
 class RenderBox;
 class RenderMeter;
@@ -255,6 +256,8 @@ public:
 
     virtual void drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint& origin, float width, DocumentMarkerLineStyle);
 
+    virtual bool usingDarkAppearance(const RenderObject&) const { return false; }
+
 protected:
     virtual FontCascadeDescription& cachedSystemFontDescription(CSSValueID systemFontID) const;
     virtual void updateCachedSystemFontDescription(CSSValueID systemFontID, FontCascadeDescription&) const = 0;
index 8f69b7c..3fad8c1 100644 (file)
@@ -170,6 +170,8 @@ private:
 
     void drawLineForDocumentMarker(const RenderText&, GraphicsContext&, const FloatPoint& origin, float width, DocumentMarkerLineStyle) final;
 
+    bool usingDarkAppearance(const RenderObject&) const final;
+
 private:
     String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const final;
 
index 806f9c9..9b2406b 100644 (file)
@@ -2778,6 +2778,7 @@ bool RenderThemeMac::paintAttachment(const RenderObject& renderer, const PaintIn
 
 #endif // ENABLE(ATTACHMENT_ELEMENT)
 
+<<<<<<< HEAD
 static CGColorRef colorForStyle(DocumentMarkerLineStyle style, bool useDarkMode)
 {
     switch (style) {
@@ -2822,6 +2823,16 @@ void RenderThemeMac::drawLineForDocumentMarker(const RenderText& renderer, Graph
     CGContextFillPath(ctx);
 }
 
+bool RenderThemeMac::usingDarkAppearance(const RenderObject& o) const
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    return o.page().useSystemAppearance() && o.page().useDarkAppearance();
+#else
+    UNUSED_PARAM(o);
+    return false;
+#endif
+}
+
 } // namespace WebCore
 
 #endif // PLATFORM(MAC)
index 4427f8d..c1a26b1 100644 (file)
@@ -1,3 +1,27 @@
+2018-07-11  Dean Jackson  <dino@apple.com>
+
+        Allow removal of white backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=187574
+        <rdar://problem/41146792>
+
+        Reviewed by Simon Fraser.
+
+        Add a new WebPreference for punching out white backgrounds.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode):
+        (WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration _punchOutWhiteBackgroundsInDarkMode]):
+        (-[WKWebViewConfiguration _setPunchOutWhiteBackgroundsInDarkMode:]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+
 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
 
         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
index cfa8b1a..eb0c2a3 100644 (file)
@@ -1084,6 +1084,10 @@ ColorFilterEnabled:
   type: bool
   defaultValue: false
 
+PunchOutWhiteBackgroundsInDarkMode:
+  type: bool
+  defaultValue: false
+
 IncompleteImageBorderEnabled:
   type: bool
   defaultValue: false
index 8944d83..d45619f 100644 (file)
@@ -2033,3 +2033,13 @@ bool WKPreferencesGetProcessSwapOnNavigationEnabled(WKPreferencesRef preferences
 {
     return toImpl(preferencesRef)->processSwapOnNavigationEnabled();
 }
+
+void WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setPunchOutWhiteBackgroundsInDarkMode(flag);
+}
+
+bool WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->punchOutWhiteBackgroundsInDarkMode();
+}
index f84c32d..8d0f79b 100644 (file)
@@ -569,6 +569,10 @@ WK_EXPORT bool WKPreferencesGetServerTimingEnabled(WKPreferencesRef);
 WK_EXPORT void WKPreferencesSetColorFilterEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetColorFilterEnabled(WKPreferencesRef);
 
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode(WKPreferencesRef);
+
 #ifdef __cplusplus
 }
 #endif
index 7b49dff..9e3b9c3 100644 (file)
@@ -761,6 +761,16 @@ static WebCore::EditableLinkBehavior toEditableLinkBehavior(_WKEditableLinkBehav
     return _preferences->colorFilterEnabled();
 }
 
+- (void)_setPunchOutWhiteBackgroundsInDarkMode:(BOOL)punches
+{
+    _preferences->setPunchOutWhiteBackgroundsInDarkMode(punches);
+}
+
+- (BOOL)_punchOutWhiteBackgroundsInDarkMode
+{
+    return _preferences->punchOutWhiteBackgroundsInDarkMode();
+}
+
 #if PLATFORM(MAC)
 - (void)_setJavaEnabledForLocalFiles:(BOOL)enabled
 {
index 37386d4..f68829e 100644 (file)
@@ -138,6 +138,7 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) {
 
 @property (nonatomic, setter=_setStorageAccessPromptsEnabled:) BOOL _storageAccessPromptsEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setColorFilterEnabled:) BOOL _colorFilterEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setPunchOutWhiteBackgroundsInDarkMode:) BOOL _punchOutWhiteBackgroundsInDarkMode WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 #if !TARGET_OS_IPHONE
 @property (nonatomic, setter=_setWebGLEnabled:) BOOL _webGLEnabled WK_API_AVAILABLE(macosx(10.13.4));
index f371ad2..a069a3f 100644 (file)
@@ -1,3 +1,22 @@
+2018-07-11  Dean Jackson  <dino@apple.com>
+
+        Allow removal of white backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=187574
+        <rdar://problem/41146792>
+
+        Reviewed by Simon Fraser.
+
+        Add a new WebPreference for punching out white backgrounds.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences punchOutWhiteBackgroundsInDarkMode]):
+        (-[WebPreferences setPunchOutWhiteBackgroundsInDarkMode:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2018-07-14  Kocsen Chung  <kocsen_chung@apple.com>
 
         Ensure WebKit stack is ad-hoc signed
index 5b7b9ed..41bff17 100644 (file)
 #define WebKitViewportFitEnabledPreferenceKey @"WebKitViewportFitEnabled"
 #define WebKitConstantPropertiesEnabledPreferenceKey @"WebKitConstantPropertiesEnabled"
 #define WebKitColorFilterEnabledPreferenceKey @"WebKitColorFilterEnabled"
+#define WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey @"WebKitPunchOutWhiteBackgroundsInDarkMode"
 #define WebKitFetchAPIKeepAliveEnabledPreferenceKey @"WebKitFetchAPIKeepAliveEnabled"
 #define WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey @"WebKitWebAnimationsCSSIntegrationEnabled"
 
index 18e1a39..c4d7422 100644 (file)
@@ -678,6 +678,7 @@ public:
         @YES, WebKitViewportFitEnabledPreferenceKey,
         @YES, WebKitConstantPropertiesEnabledPreferenceKey,
         @NO, WebKitColorFilterEnabledPreferenceKey,
+        @NO, WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey,
         @YES, WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey,
         @NO, WebKitInspectorAdditionsEnabledPreferenceKey,
         (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
@@ -3283,6 +3284,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitColorFilterEnabledPreferenceKey];
 }
 
+- (BOOL)punchOutWhiteBackgroundsInDarkMode
+{
+    return [self _boolValueForKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
+}
+
+- (void)setPunchOutWhiteBackgroundsInDarkMode:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
+}
+
 - (BOOL)allowMediaContentTypesRequiringHardwareSupportAsFallback
 {
     return [self _boolValueForKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
index 6fa5a84..62198da 100644 (file)
@@ -604,6 +604,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
 @property (nonatomic) BOOL viewportFitEnabled;
 @property (nonatomic) BOOL constantPropertiesEnabled;
 @property (nonatomic) BOOL colorFilterEnabled;
+@property (nonatomic) BOOL punchOutWhiteBackgroundsInDarkMode;
 @property (nonatomic) BOOL inspectorAdditionsEnabled;
 @property (nonatomic) BOOL allowMediaContentTypesRequiringHardwareSupportAsFallback;
 @property (nonatomic) BOOL accessibilityObjectModelEnabled;
index b759a60..9edb0de 100644 (file)
@@ -2958,6 +2958,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setPlugInSnapshottingEnabled([preferences plugInSnapshottingEnabled]);
     settings.setHttpEquivEnabled([preferences httpEquivEnabled]);
     settings.setColorFilterEnabled([preferences colorFilterEnabled]);
+    settings.setPunchOutWhiteBackgroundsInDarkMode([preferences punchOutWhiteBackgroundsInDarkMode]);
 
 #if PLATFORM(MAC)
     settings.setAcceleratedCompositingForFixedPositionEnabled(true);
index b6c2c57..bd4756d 100644 (file)
@@ -1,3 +1,53 @@
+2018-07-11  Dean Jackson  <dino@apple.com>
+
+        Allow removal of white backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=187574
+        <rdar://problem/41146792>
+
+        Reviewed by Simon Fraser.
+
+        Add a new menu item for punching out white backgrounds in MiniBrowser.
+        In WebKitTestRunner, expose the new setting and hook that up to
+        drawing a background in the WebView.
+
+        * MiniBrowser/mac/AppDelegate.m:
+        (defaultConfiguration): Add _punchOutWhiteBackgroundsInDarkMode.
+
+        * MiniBrowser/mac/SettingsController.h: Ditto.
+        * MiniBrowser/mac/SettingsController.m:
+        (-[SettingsController _populateMenu]):
+        (-[SettingsController validateMenuItem:]):
+        (-[SettingsController togglePunchOutWhiteBackgroundsInDarkMode:]):
+        (-[SettingsController punchOutWhiteBackgroundsInDarkMode]):
+
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController didChangeSettings]): Set the new preference.
+
+        * WebKitTestRunner/PlatformWebView.h: Expose a drawsBackground property.
+        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: Null implementation.
+        (WTR::PlatformWebView::drawsBackground const):
+        (WTR::PlatformWebView::setDrawsBackground):
+        * WebKitTestRunner/wpe/PlatformWebViewWPE.cpp: Ditto.
+        (WTR::PlatformWebView::drawsBackground const):
+        (WTR::PlatformWebView::setDrawsBackground):
+        * WebKitTestRunner/ios/PlatformWebViewIOS.mm: Call into the WKWebView and
+        set its SPI.
+        (WTR::PlatformWebView::drawsBackground const):
+        (WTR::PlatformWebView::setDrawsBackground):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm: Ditto.
+        (WTR::PlatformWebView::drawsBackground const):
+        (WTR::PlatformWebView::setDrawsBackground):
+
+        * WebKitTestRunner/TestController.cpp: Reset and copy the new preference.
+        (WTR::TestController::resetPreferencesToConsistentValues):
+        (WTR::updateTestOptionsFromTestHeader):
+        * WebKitTestRunner/TestOptions.h:
+        (WTR::TestOptions::hasSameInitializationOptions const):
+
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::platformCreateWebView): If the option for punching
+        out the background was set, tell the WebView to not draw its background.
+
 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
 
         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
index 53f8f5e..3a369a4 100644 (file)
@@ -116,7 +116,6 @@ static WKWebViewConfiguration *defaultConfiguration()
 
     configuration.suppressesIncrementalRendering = [SettingsController shared].incrementalRenderingSuppressed;
     configuration.websiteDataStore._resourceLoadStatisticsEnabled = [SettingsController shared].resourceLoadStatisticsEnabled;
-    configuration._colorFilterEnabled = [SettingsController shared].appleColorFilterEnabled;
     return configuration;
 }
 
index 4eb5062..dae71eb 100644 (file)
@@ -57,6 +57,7 @@
 @property (nonatomic, readonly) BOOL largeImageAsyncDecodingEnabled;
 @property (nonatomic, readonly) BOOL animatedImageAsyncDecodingEnabled;
 @property (nonatomic, readonly) BOOL appleColorFilterEnabled;
+@property (nonatomic, readonly) BOOL punchOutWhiteBackgroundsInDarkMode;
 @property (nonatomic, readonly) BOOL useSystemAppearance;
 @property (nonatomic, readonly) BOOL loadsAllSiteIcons;
 @property (nonatomic, readonly) BOOL usesGameControllerFramework;
index e097eff..704170d 100644 (file)
@@ -65,6 +65,7 @@ static NSString * const VisualViewportEnabledPreferenceKey = @"VisualViewportEna
 static NSString * const LargeImageAsyncDecodingEnabledPreferenceKey = @"LargeImageAsyncDecodingEnabled";
 static NSString * const AnimatedImageAsyncDecodingEnabledPreferenceKey = @"AnimatedImageAsyncDecodingEnabled";
 static NSString * const AppleColorFilterEnabledPreferenceKey = @"AppleColorFilterEnabled";
+static NSString * const PunchOutWhiteBackgroundsInDarkModePreferenceKey = @"PunchOutWhiteBackgroundsInDarkMode";
 static NSString * const UseSystemAppearancePreferenceKey = @"UseSystemAppearance";
 
 // This default name intentionally overlaps with the key that WebKit2 checks when creating a view.
@@ -172,7 +173,8 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     [self _addItemWithTitle:@"Enable Resource Load Statistics" action:@selector(toggleResourceLoadStatisticsEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Large Image Async Decoding" action:@selector(toggleLargeImageAsyncDecodingEnabled:) indented:NO];
     [self _addItemWithTitle:@"Enable Animated Image Async Decoding" action:@selector(toggleAnimatedImageAsyncDecodingEnabled:) indented:NO];
-    [self _addItemWithTitle:@"Enable -apple-color-filter" action:@selector(toggleAppleColorFilterEnabled:) indented:NO];
+    [self _addItemWithTitle:@"Enable color-filter" action:@selector(toggleAppleColorFilterEnabled:) indented:NO];
+    [self _addItemWithTitle:@"Punch Out White Backgrounds in Dark Mode" action:@selector(togglePunchOutWhiteBackgroundsInDarkMode:) indented:NO];
     [self _addItemWithTitle:@"Use System Appearance" action:@selector(toggleUseSystemAppearance:) indented:NO];
     [self _addHeaderWithTitle:@"WebKit2-only Settings"];
 
@@ -265,6 +267,8 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
         [menuItem setState:[self animatedImageAsyncDecodingEnabled] ? NSControlStateValueOn : NSControlStateValueOff];
     else if (action == @selector(toggleAppleColorFilterEnabled:))
         [menuItem setState:[self appleColorFilterEnabled] ? NSControlStateValueOn : NSControlStateValueOff];
+    else if (action == @selector(togglePunchOutWhiteBackgroundsInDarkMode:))
+        [menuItem setState:[self punchOutWhiteBackgroundsInDarkMode] ? NSControlStateValueOn : NSControlStateValueOff];
     else if (action == @selector(toggleUseSystemAppearance:))
         [menuItem setState:[self useSystemAppearance] ? NSControlStateValueOn : NSControlStateValueOff];
     else if (action == @selector(toggleVisualViewportEnabled:))
@@ -585,6 +589,16 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     return [[NSUserDefaults standardUserDefaults] boolForKey:AppleColorFilterEnabledPreferenceKey];
 }
 
+- (void)togglePunchOutWhiteBackgroundsInDarkMode:(id)sender
+{
+    [self _toggleBooleanDefault:PunchOutWhiteBackgroundsInDarkModePreferenceKey];
+}
+
+- (BOOL)punchOutWhiteBackgroundsInDarkMode
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:PunchOutWhiteBackgroundsInDarkModePreferenceKey];
+}
+
 - (void)toggleUseSystemAppearance:(id)sender
 {
     [self _toggleBooleanDefault:UseSystemAppearancePreferenceKey];
index c2c3647..384c791 100644 (file)
@@ -312,6 +312,7 @@ static BOOL areEssentiallyEqual(double a, double b)
     [[WebPreferences standardPreferences] setLargeImageAsyncDecodingEnabled:settings.largeImageAsyncDecodingEnabled];
     [[WebPreferences standardPreferences] setAnimatedImageAsyncDecodingEnabled:settings.animatedImageAsyncDecodingEnabled];
     [[WebPreferences standardPreferences] setColorFilterEnabled:settings.appleColorFilterEnabled];
+    [[WebPreferences standardPreferences] setPunchOutWhiteBackgroundsInDarkMode:settings.punchOutWhiteBackgroundsInDarkMode];
 
     _webView._useSystemAppearance = settings.useSystemAppearance;
 
index 33fab1d..841ce7b 100644 (file)
@@ -410,6 +410,8 @@ static BOOL areEssentiallyEqual(double a, double b)
     preferences._visualViewportEnabled = settings.visualViewportEnabled;
     preferences._largeImageAsyncDecodingEnabled = settings.largeImageAsyncDecodingEnabled;
     preferences._animatedImageAsyncDecodingEnabled = settings.animatedImageAsyncDecodingEnabled;
+    preferences._colorFilterEnabled = settings.appleColorFilterEnabled;
+    preferences._punchOutWhiteBackgroundsInDarkMode = settings.punchOutWhiteBackgroundsInDarkMode;
 
     _webView.configuration.websiteDataStore._resourceLoadStatisticsEnabled = settings.resourceLoadStatisticsEnabled;
 
index 4088488..ce368ff 100644 (file)
@@ -93,7 +93,10 @@ public:
     void makeWebViewFirstResponder();
     void setWindowIsKey(bool);
     bool windowIsKey() const { return m_windowIsKey; }
-    
+
+    bool drawsBackground() const;
+    void setDrawsBackground(bool);
+
     void removeFromWindow();
     void addToWindow();
 
index 221b6af..6085170 100644 (file)
@@ -719,6 +719,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetAllowCrossOriginSubresourcesToAskForCredentials(preferences, options.allowCrossOriginSubresourcesToAskForCredentials);
     WKPreferencesSetWebAnimationsCSSIntegrationEnabled(preferences, options.enableWebAnimationsCSSIntegration);
     WKPreferencesSetColorFilterEnabled(preferences, options.enableColorFilter);
+    WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode(preferences, options.punchOutWhiteBackgroundsInDarkMode);
 
     static WKStringRef defaultTextEncoding = WKStringCreateWithUTF8CString("ISO-8859-1");
     WKPreferencesSetDefaultTextEncodingName(preferences, defaultTextEncoding);
@@ -1134,6 +1135,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std:
             testOptions.enableProcessSwapOnWindowOpen = parseBooleanTestHeaderValue(value);
         else if (key == "enableColorFilter")
             testOptions.enableColorFilter = parseBooleanTestHeaderValue(value);
+        else if (key == "punchOutWhiteBackgroundsInDarkMode")
+            testOptions.punchOutWhiteBackgroundsInDarkMode = parseBooleanTestHeaderValue(value);
         else if (key == "jscOptions")
             testOptions.jscOptions = value;
         else if (key == "runSingly")
index 516d3e9..b1d46ac 100644 (file)
@@ -59,6 +59,7 @@ struct TestOptions {
     bool enableProcessSwapOnNavigation { false };
     bool enableProcessSwapOnWindowOpen { false };
     bool enableColorFilter { false };
+    bool punchOutWhiteBackgroundsInDarkMode { false };
     bool runSingly { false };
 
     float deviceScaleFactor { 1 };
@@ -95,6 +96,7 @@ struct TestOptions {
             || enableProcessSwapOnNavigation != options.enableProcessSwapOnNavigation
             || enableProcessSwapOnWindowOpen != options.enableProcessSwapOnWindowOpen
             || enableColorFilter != options.enableColorFilter
+            || punchOutWhiteBackgroundsInDarkMode != options.punchOutWhiteBackgroundsInDarkMode
             || jscOptions != options.jscOptions
             || runSingly != options.runSingly)
             return false;
index a4d511c..e40946d 100644 (file)
@@ -168,6 +168,9 @@ void TestController::platformCreateWebView(WKPageConfigurationRef, const TestOpt
     }
 
     m_mainWebView = std::make_unique<PlatformWebView>(copiedConfiguration.get(), options);
+
+    if (options.punchOutWhiteBackgroundsInDarkMode)
+        m_mainWebView->setDrawsBackground(false);
 #else
     m_mainWebView = std::make_unique<PlatformWebView>(globalWebViewConfiguration, options);
 #endif
index 47354f8..de614b4 100644 (file)
@@ -189,5 +189,14 @@ void PlatformWebView::setNavigationGesturesEnabled(bool)
 {
 }
 
+bool PlatformWebView::drawsBackground() const
+{
+    return false;
+}
+
+void PlatformWebView::setDrawsBackground(bool)
+{
+}
+
 } // namespace WTR
 
index e852292..ac9ae01 100644 (file)
@@ -294,6 +294,15 @@ void PlatformWebView::changeWindowScaleIfNeeded(float)
     // Retina only surface.
 }
 
+bool PlatformWebView::drawsBackground() const
+{
+    return false;
+}
+
+void PlatformWebView::setDrawsBackground(bool)
+{
+}
+
 #if !HAVE(IOSURFACE)
 static void releaseDataProviderData(void* info, const void*, size_t)
 {
index 82e2d03..ddd5749 100644 (file)
@@ -272,6 +272,24 @@ void PlatformWebView::makeWebViewFirstResponder()
     [m_window makeFirstResponder:platformView()];
 }
 
+bool PlatformWebView::drawsBackground() const
+{
+#if WK_API_ENABLED
+    return [m_view _drawsBackground];
+#else
+    return false;
+#endif
+}
+
+void PlatformWebView::setDrawsBackground(bool drawsBackground)
+{
+#if WK_API_ENABLED
+    [m_view _setDrawsBackground:drawsBackground];
+#else
+    UNUSED_PARAM(drawsBackground);
+#endif
+}
+
 RetainPtr<CGImageRef> PlatformWebView::windowSnapshotImage()
 {
     [platformView() display];
index 05c6568..214933e 100644 (file)
@@ -132,4 +132,13 @@ void PlatformWebView::forceWindowFramesChanged()
 {
 }
 
+bool PlatformWebView::drawsBackground() const
+{
+    return false;
+}
+
+void PlatformWebView::setDrawsBackground(bool)
+{
+}
+
 } // namespace WTR