Title: [262454] branches/safari-610.1.15-branch/Source/WebCore
Revision
262454
Author
alanc...@apple.com
Date
2020-06-02 14:58:34 -0700 (Tue, 02 Jun 2020)

Log Message

Cherry-pick r262428. rdar://problem/63891546

    UIColor and NSColor WebCore::Color factories should return invalid colors for nil input colors
    https://bugs.webkit.org/show_bug.cgi?id=212631

    Reviewed by Anders Carlsson.

    * platform/graphics/mac/ColorMac.mm:
    (WebCore::colorFromNSColor):
    (WebCore::semanticColorFromNSColor):
    * platform/ios/ColorIOS.mm:
    (WebCore::colorFromUIColor):
    This doesn't affect any code currently in WebKit, but it is very, very surprising
    that these functions happily accept a null color, assert in debug, but in release
    do crazy things like try to paint the null color into a small bitmap to figure out
    what it really is.

    Also, this matches the behavior of the Color constructors that take CGColorRef.

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

Modified Paths

Diff

Modified: branches/safari-610.1.15-branch/Source/WebCore/ChangeLog (262453 => 262454)


--- branches/safari-610.1.15-branch/Source/WebCore/ChangeLog	2020-06-02 21:58:32 UTC (rev 262453)
+++ branches/safari-610.1.15-branch/Source/WebCore/ChangeLog	2020-06-02 21:58:34 UTC (rev 262454)
@@ -1,5 +1,47 @@
 2020-06-02  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r262428. rdar://problem/63891546
+
+    UIColor and NSColor WebCore::Color factories should return invalid colors for nil input colors
+    https://bugs.webkit.org/show_bug.cgi?id=212631
+    
+    Reviewed by Anders Carlsson.
+    
+    * platform/graphics/mac/ColorMac.mm:
+    (WebCore::colorFromNSColor):
+    (WebCore::semanticColorFromNSColor):
+    * platform/ios/ColorIOS.mm:
+    (WebCore::colorFromUIColor):
+    This doesn't affect any code currently in WebKit, but it is very, very surprising
+    that these functions happily accept a null color, assert in debug, but in release
+    do crazy things like try to paint the null color into a small bitmap to figure out
+    what it really is.
+    
+    Also, this matches the behavior of the Color constructors that take CGColorRef.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262428 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-06-02  Tim Horton  <timothy_hor...@apple.com>
+
+            UIColor and NSColor WebCore::Color factories should return invalid colors for nil input colors
+            https://bugs.webkit.org/show_bug.cgi?id=212631
+
+            Reviewed by Anders Carlsson.
+
+            * platform/graphics/mac/ColorMac.mm:
+            (WebCore::colorFromNSColor):
+            (WebCore::semanticColorFromNSColor):
+            * platform/ios/ColorIOS.mm:
+            (WebCore::colorFromUIColor):
+            This doesn't affect any code currently in WebKit, but it is very, very surprising
+            that these functions happily accept a null color, assert in debug, but in release
+            do crazy things like try to paint the null color into a small bitmap to figure out
+            what it really is.
+
+            Also, this matches the behavior of the Color constructors that take CGColorRef.
+
+2020-06-02  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r262398. rdar://problem/63891512
 
     TextManipulationController should put one Node in only one paragraph

Modified: branches/safari-610.1.15-branch/Source/WebCore/platform/graphics/mac/ColorMac.mm (262453 => 262454)


--- branches/safari-610.1.15-branch/Source/WebCore/platform/graphics/mac/ColorMac.mm	2020-06-02 21:58:32 UTC (rev 262453)
+++ branches/safari-610.1.15-branch/Source/WebCore/platform/graphics/mac/ColorMac.mm	2020-06-02 21:58:34 UTC (rev 262454)
@@ -92,11 +92,21 @@
 
 Color colorFromNSColor(NSColor *color)
 {
+    if (!color)
+        return { };
+
+    // FIXME: ExtendedColor - needs to handle color spaces.
+
     return Color(makeRGBAFromNSColor(color));
 }
 
 Color semanticColorFromNSColor(NSColor *color)
 {
+    if (!color)
+        return { };
+
+    // FIXME: ExtendedColor - needs to handle color spaces.
+
     return Color(makeRGBAFromNSColor(color), Color::Semantic);
 }
 

Modified: branches/safari-610.1.15-branch/Source/WebCore/platform/ios/ColorIOS.mm (262453 => 262454)


--- branches/safari-610.1.15-branch/Source/WebCore/platform/ios/ColorIOS.mm	2020-06-02 21:58:32 UTC (rev 262453)
+++ branches/safari-610.1.15-branch/Source/WebCore/platform/ios/ColorIOS.mm	2020-06-02 21:58:34 UTC (rev 262454)
@@ -34,6 +34,9 @@
 
 Color colorFromUIColor(UIColor *color)
 {
+    if (!color)
+        return { };
+
     // FIXME: Make this work for a UIColor that was created from a pattern or a DispayP3 color.
     CGFloat redComponent;
     CGFloat greenComponent;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to