Title: [246343] trunk/Source
Revision
246343
Author
[email protected]
Date
2019-06-11 17:44:40 -0700 (Tue, 11 Jun 2019)

Log Message

Flash when tapping compose button after switching to/from dark mode without restarting Mail.
https://bugs.webkit.org/show_bug.cgi?id=198769
rdar://problem/51370037

Reviewed by Tim Horton.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj: Make LocalCurrentTraitCollection.h a private header.

Source/WebKit:

Accessing a dynamic color outside a normal UIView choke point without setting
UITraitCollection.currentTraitCollection first can cause undefined results.
Use LocalCurrentTraitCollection inside scrollViewBackgroundColor when accessing
the dynamic system UIColors. Also use systemBackgroundColor instead of white.

* UIProcess/API/Cocoa/WKWebView.mm:
(scrollViewBackgroundColor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246342 => 246343)


--- trunk/Source/WebCore/ChangeLog	2019-06-12 00:24:09 UTC (rev 246342)
+++ trunk/Source/WebCore/ChangeLog	2019-06-12 00:44:40 UTC (rev 246343)
@@ -1,3 +1,13 @@
+2019-06-11  Timothy Hatcher  <[email protected]>
+
+        Flash when tapping compose button after switching to/from dark mode without restarting Mail.
+        https://bugs.webkit.org/show_bug.cgi?id=198769
+        rdar://problem/51370037
+
+        Reviewed by Tim Horton.
+
+        * WebCore.xcodeproj/project.pbxproj: Make LocalCurrentTraitCollection.h a private header.
+
 2019-06-11  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r246320.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (246342 => 246343)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-06-12 00:24:09 UTC (rev 246342)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-06-12 00:44:40 UTC (rev 246343)
@@ -621,7 +621,7 @@
 		1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C21E57B183ED1FF001C289D /* IOSurfacePool.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1C24EEA51C729CE40080F8FC /* FontFaceSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C24EEA31C729CE40080F8FC /* FontFaceSet.h */; };
 		1C24EEA91C72A7B40080F8FC /* JSFontFaceSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C24EEA71C72A7B40080F8FC /* JSFontFaceSet.h */; };
-		1C43DE6B22AB4B8A001527D9 /* LocalCurrentTraitCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C43DE6822AB4B8A001527D9 /* LocalCurrentTraitCollection.h */; };
+		1C43DE6B22AB4B8A001527D9 /* LocalCurrentTraitCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C43DE6822AB4B8A001527D9 /* LocalCurrentTraitCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1C6626111C6E7CA600AB527C /* FontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C66260F1C6E7CA600AB527C /* FontFace.h */; };
 		1C73A7132185757E004CCEA5 /* TextUnderlineOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB6B4FB217B83940093B9CD /* TextUnderlineOffset.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1C73A71521857587004CCEA5 /* TextDecorationThickness.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB6B4F8217B83930093B9CD /* TextDecorationThickness.h */; settings = {ATTRIBUTES = (Private, ); }; };

Modified: trunk/Source/WebKit/ChangeLog (246342 => 246343)


--- trunk/Source/WebKit/ChangeLog	2019-06-12 00:24:09 UTC (rev 246342)
+++ trunk/Source/WebKit/ChangeLog	2019-06-12 00:44:40 UTC (rev 246343)
@@ -1,3 +1,19 @@
+2019-06-11  Timothy Hatcher  <[email protected]>
+
+        Flash when tapping compose button after switching to/from dark mode without restarting Mail.
+        https://bugs.webkit.org/show_bug.cgi?id=198769
+        rdar://problem/51370037
+
+        Reviewed by Tim Horton.
+
+        Accessing a dynamic color outside a normal UIView choke point without setting
+        UITraitCollection.currentTraitCollection first can cause undefined results.
+        Use LocalCurrentTraitCollection inside scrollViewBackgroundColor when accessing
+        the dynamic system UIColors. Also use systemBackgroundColor instead of white.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (scrollViewBackgroundColor):
+
 2019-06-11  Megan Gardner  <[email protected]>
 
         Integrate scrollbar gestures for iOS

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (246342 => 246343)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-06-12 00:24:09 UTC (rev 246342)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-06-12 00:44:40 UTC (rev 246343)
@@ -155,6 +155,7 @@
 #import <UIKit/UIApplication.h>
 #import <WebCore/FrameLoaderTypes.h>
 #import <WebCore/InspectorOverlay.h>
+#import <WebCore/LocalCurrentTraitCollection.h>
 #import <WebCore/ScrollableArea.h>
 #import <WebCore/WebBackgroundTaskController.h>
 #import <WebCore/WebSQLiteDatabaseTrackerClient.h>
@@ -1702,11 +1703,23 @@
     if (!webView.opaque)
         return WebCore::Color::transparent;
 
+#if HAVE(OS_DARK_MODE_SUPPORT)
+    WebCore::LocalCurrentTraitCollection localTraitCollection(webView.traitCollection);
+#endif
+
     WebCore::Color color = baseScrollViewBackgroundColor(webView);
 
-    if (!color.isValid())
-        color = webView->_contentView ? [webView->_contentView backgroundColor].CGColor : UIColor.whiteColor.CGColor;
+    if (!color.isValid() && webView->_contentView)
+        color = [webView->_contentView backgroundColor].CGColor;
 
+    if (!color.isValid()) {
+#if HAVE(OS_DARK_MODE_SUPPORT)
+        color = UIColor.systemBackgroundColor.CGColor;
+#else
+        color = WebCore::Color::white;
+#endif
+    }
+
     CGFloat zoomScale = contentZoomScale(webView);
     CGFloat minimumZoomScale = [webView->_scrollView minimumZoomScale];
     if (zoomScale < minimumZoomScale) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to