Title: [183645] trunk/Source
Revision
183645
Author
bda...@apple.com
Date
2015-04-30 15:00:47 -0700 (Thu, 30 Apr 2015)

Log Message

Should choose UIScrollView indicatorStyle based on the document background color
https://bugs.webkit.org/show_bug.cgi?id=144473
-and corresponding-
rdar://problem/19897699

Reviewed by Simon Fraser.

Source/WebCore:

Export this function.
* platform/graphics/Color.h:

Source/WebKit2:

Update the indicator style whenever the background color changes.  
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateScrollViewBackground]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183644 => 183645)


--- trunk/Source/WebCore/ChangeLog	2015-04-30 21:26:49 UTC (rev 183644)
+++ trunk/Source/WebCore/ChangeLog	2015-04-30 22:00:47 UTC (rev 183645)
@@ -1,3 +1,15 @@
+2015-04-30  Beth Dakin  <bda...@apple.com>
+
+        Should choose UIScrollView indicatorStyle based on the document background color
+        https://bugs.webkit.org/show_bug.cgi?id=144473
+        -and corresponding-
+        rdar://problem/19897699
+
+        Reviewed by Simon Fraser.
+
+        Export this function.
+        * platform/graphics/Color.h:
+
 2015-04-30  Brent Fulgham  <bfulg...@apple.com>
 
         [Win] Allow WebKit to build without ANGLE support

Modified: trunk/Source/WebCore/platform/graphics/Color.h (183644 => 183645)


--- trunk/Source/WebCore/platform/graphics/Color.h	2015-04-30 21:26:49 UTC (rev 183644)
+++ trunk/Source/WebCore/platform/graphics/Color.h	2015-04-30 22:00:47 UTC (rev 183645)
@@ -116,7 +116,7 @@
     void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; }
     WEBCORE_EXPORT void getRGBA(float& r, float& g, float& b, float& a) const;
     WEBCORE_EXPORT void getRGBA(double& r, double& g, double& b, double& a) const;
-    void getHSL(double& h, double& s, double& l) const;
+    WEBCORE_EXPORT void getHSL(double& h, double& s, double& l) const;
 
     Color light() const;
     Color dark() const;

Modified: trunk/Source/WebKit2/ChangeLog (183644 => 183645)


--- trunk/Source/WebKit2/ChangeLog	2015-04-30 21:26:49 UTC (rev 183644)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-30 22:00:47 UTC (rev 183645)
@@ -1,3 +1,16 @@
+2015-04-30  Beth Dakin  <bda...@apple.com>
+
+        Should choose UIScrollView indicatorStyle based on the document background color
+        https://bugs.webkit.org/show_bug.cgi?id=144473
+        -and corresponding-
+        rdar://problem/19897699
+
+        Reviewed by Simon Fraser.
+
+        Update the indicator style whenever the background color changes.  
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _updateScrollViewBackground]):
+
 2015-04-30  Enrica Casucci  <enr...@apple.com>
 
         [iOS] tapping in the middle of a word in editable content should not select the word.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (183644 => 183645)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-04-30 21:26:49 UTC (rev 183644)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-04-30 22:00:47 UTC (rev 183645)
@@ -795,6 +795,14 @@
 
     auto uiBackgroundColor = adoptNS([[UIColor alloc] initWithCGColor:cachedCGColor(color, WebCore::ColorSpaceDeviceRGB)]);
     [_scrollView setBackgroundColor:uiBackgroundColor.get()];
+
+    // Update the indicator style based on the lightness/darkness of the background color.
+    double hue, saturation, lightness;
+    color.getHSL(hue, saturation, lightness);
+    if (lightness <= .5 && color.alpha() > 0)
+        [_scrollView setIndicatorStyle:UIScrollViewIndicatorStyleWhite];
+    else
+        [_scrollView setIndicatorStyle:UIScrollViewIndicatorStyleDefault];
 }
 
 - (CGPoint)_adjustedContentOffset:(CGPoint)point
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to