Set WKWebView opaque based on drawsBackground in PageConfiguration.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Aug 2019 19:04:36 +0000 (19:04 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Aug 2019 19:04:36 +0000 (19:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200528

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]): Set self.opaque = NO when !self.opaque || !pageConfiguration->drawsBackground().
It is almost impossible to have !self.opaque be NO at this point, since we are still inside initWithFrame:. A subclass could
override opaque and return NO, but checking pageConfiguration's drawsBackground is a good alternative.
* WebProcess/WebPage/WebPage.h: Remove unused m_drawsBackground member.

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/WebProcess/WebPage/WebPage.h

index b3ecdf0..52c4b4f 100644 (file)
@@ -1,3 +1,16 @@
+2019-08-08  Timothy Hatcher  <timothy@apple.com>
+
+        Set WKWebView opaque based on drawsBackground in PageConfiguration.
+        https://bugs.webkit.org/show_bug.cgi?id=200528
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]): Set self.opaque = NO when !self.opaque || !pageConfiguration->drawsBackground().
+        It is almost impossible to have !self.opaque be NO at this point, since we are still inside initWithFrame:. A subclass could
+        override opaque and return NO, but checking pageConfiguration's drawsBackground is a good alternative.
+        * WebProcess/WebPage/WebPage.h: Remove unused m_drawsBackground member.
+
 2019-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS 13] Taps that interrupt momentum scrolling are recognized as clicks
index e238cb4..b0fe0ee 100644 (file)
@@ -710,8 +710,9 @@ static void validate(WKWebViewConfiguration *configuration)
 
     _page = [_contentView page];
     [self _dispatchSetDeviceOrientation:deviceOrientation()];
-    if (!self.opaque)
-        _page->setBackgroundColor(WebCore::Color(WebCore::Color::transparent));
+
+    if (!self.opaque || !pageConfiguration->drawsBackground())
+        self.opaque = NO;
 
     [_contentView layer].anchorPoint = CGPointZero;
     [_contentView setFrame:bounds];
index 21826b9..2d1289c 100644 (file)
@@ -1631,7 +1631,6 @@ private:
     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
 
     bool m_useFixedLayout { false };
-    bool m_drawsBackground { true };
 
     WebCore::Color m_underlayColor;