Title: [168594] trunk/Source
Revision
168594
Author
[email protected]
Date
2014-05-10 20:57:05 -0700 (Sat, 10 May 2014)

Log Message

[WKWebView _updateScrollViewBackground] churns UI-and-CGColors while repainting
https://bugs.webkit.org/show_bug.cgi?id=132793
<rdar://problem/16877870>

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateScrollViewBackground]):
Don't bypass the cache and make a copy of the CGColor just to set its alpha.
Cache the last color and don't bother creating a UIColor nor updating the
color on our views if it hasn't changed.

* WebCore.exp.in:
Export a Color convenience function.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168593 => 168594)


--- trunk/Source/WebCore/ChangeLog	2014-05-11 03:32:29 UTC (rev 168593)
+++ trunk/Source/WebCore/ChangeLog	2014-05-11 03:57:05 UTC (rev 168594)
@@ -1,3 +1,14 @@
+2014-05-10  Tim Horton  <[email protected]>
+
+        [WKWebView _updateScrollViewBackground] churns UI-and-CGColors while repainting
+        https://bugs.webkit.org/show_bug.cgi?id=132793
+        <rdar://problem/16877870>
+
+        Reviewed by Dan Bernstein.
+
+        * WebCore.exp.in:
+        Export a Color convenience function.
+
 2014-05-10  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r168578.

Modified: trunk/Source/WebCore/WebCore.exp.in (168593 => 168594)


--- trunk/Source/WebCore/WebCore.exp.in	2014-05-11 03:32:29 UTC (rev 168593)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-05-11 03:57:05 UTC (rev 168594)
@@ -933,6 +933,7 @@
 __ZN7WebCore22WheelEventDeltaTracker19beginTrackingDeltasEv
 __ZN7WebCore22WheelEventDeltaTracker21recordWheelEventDeltaERKNS_18PlatformWheelEventE
 __ZN7WebCore22WheelEventDeltaTrackerC1Ev
+__ZN7WebCore22colorWithOverrideAlphaEjf
 __ZN7WebCore22counterValueForElementEPNS_7ElementE
 __ZN7WebCore22createFragmentFromTextERNS_5RangeERKN3WTF6StringE
 __ZN7WebCore22externalRepresentationEPNS_5FrameEj

Modified: trunk/Source/WebKit2/ChangeLog (168593 => 168594)


--- trunk/Source/WebKit2/ChangeLog	2014-05-11 03:32:29 UTC (rev 168593)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-11 03:57:05 UTC (rev 168594)
@@ -1,5 +1,19 @@
 2014-05-10  Tim Horton  <[email protected]>
 
+        [WKWebView _updateScrollViewBackground] churns UI-and-CGColors while repainting
+        https://bugs.webkit.org/show_bug.cgi?id=132793
+        <rdar://problem/16877870>
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _updateScrollViewBackground]):
+        Don't bypass the cache and make a copy of the CGColor just to set its alpha.
+        Cache the last color and don't bother creating a UIColor nor updating the
+        color on our views if it hasn't changed.
+
+2014-05-10  Tim Horton  <[email protected]>
+
         Implement -forwardingTargetForSelector on WKScrollViewDelegateForwarder
         https://bugs.webkit.org/show_bug.cgi?id=132790
         <rdar://problem/16877802>

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


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-11 03:32:29 UTC (rev 168593)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-05-11 03:57:05 UTC (rev 168594)
@@ -125,6 +125,8 @@
     BOOL _allowsBackForwardNavigationGestures;
 
     RetainPtr<UIView <WKWebViewContentProvider>> _customContentView;
+
+    WebCore::Color _scrollViewBackgroundColor;
 #endif
 #if PLATFORM(MAC)
     RetainPtr<WKView> _wkView;
@@ -442,16 +444,20 @@
 - (void)_updateScrollViewBackground
 {
     WebCore::Color color = _page->pageExtendedBackgroundColor();
-    RetainPtr<CGColorRef> cgColor = cachedCGColor(color, WebCore::ColorSpaceDeviceRGB);
-
     CGFloat zoomScale = contentZoomScale(self);
     CGFloat minimumZoomScale = [_scrollView minimumZoomScale];
     if (zoomScale < minimumZoomScale) {
         CGFloat slope = 12;
         CGFloat opacity = std::max<CGFloat>(1 - slope * (minimumZoomScale - zoomScale), 0);
-        cgColor = adoptCF(CGColorCreateCopyWithAlpha(cgColor.get(), opacity));
+        color = WebCore::colorWithOverrideAlpha(color.rgb(), opacity);
     }
-    RetainPtr<UIColor*> uiBackgroundColor = adoptNS([[UIColor alloc] initWithCGColor:cgColor.get()]);
+
+    if (_scrollViewBackgroundColor == color)
+        return;
+
+    _scrollViewBackgroundColor = color;
+
+    RetainPtr<UIColor*> uiBackgroundColor = adoptNS([[UIColor alloc] initWithCGColor:cachedCGColor(color, WebCore::ColorSpaceDeviceRGB)]);
     _mainExtendedBackgroundView.backgroundColor = uiBackgroundColor.get();
     _extendedBackgroundLayerTopInset.backgroundColor = uiBackgroundColor.get();
     _extendedBackgroundLayerBottomInset.backgroundColor = uiBackgroundColor.get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to