Title: [164382] trunk/Source
Revision
164382
Author
[email protected]
Date
2014-02-19 12:47:03 -0800 (Wed, 19 Feb 2014)

Log Message

UIProcess needs to know the color of the page's extended background
https://bugs.webkit.org/show_bug.cgi?id=129004

Source/WebCore: 

Reviewed by Brent Fulgham.

This patch adds a new ChromeClient function, 
pageExtendedBackgroundColorDidChange() which will be called whenever the extended 
background color has changed.

New function.
* page/ChromeClient.h:
(WebCore::ChromeClient::pageExtendedBackgroundColorDidChange):

Store the extended background color in a member variable so that we can know if it 
changed even if we do not have an m_layerForOverhangAreas.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
* rendering/RenderLayerCompositor.h:

Source/WebKit2: 

Reviewed by Simon Fraser and Brent Fulgham.

New method on WKWebView and WKView will return the page’s extended background 
color.
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView pageExtendedBackgroundColor]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView pageExtendedBackgroundColor]):

The color is stored in the WebPageProxy, and the ChromeClient sends a message to 
the WebPageProxy with the new color whenever it changes.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::pageExtendedBackgroundColor):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::pageExtendedBackgroundColorDidChange):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164381 => 164382)


--- trunk/Source/WebCore/ChangeLog	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebCore/ChangeLog	2014-02-19 20:47:03 UTC (rev 164382)
@@ -1,3 +1,25 @@
+2014-02-19  Beth Dakin  <[email protected]>
+
+        UIProcess needs to know the color of the page's extended background
+        https://bugs.webkit.org/show_bug.cgi?id=129004
+
+        Reviewed by Brent Fulgham.
+
+        This patch adds a new ChromeClient function, 
+        pageExtendedBackgroundColorDidChange() which will be called whenever the extended 
+        background color has changed.
+
+        New function.
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::pageExtendedBackgroundColorDidChange):
+
+        Store the extended background color in a member variable so that we can know if it 
+        changed even if we do not have an m_layerForOverhangAreas.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+        (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
+        * rendering/RenderLayerCompositor.h:
+
 2014-02-19  Dirk Schulze  <[email protected]>
 
         Missing box doesn't use border-box as reference box for clip-path

Modified: trunk/Source/WebCore/page/ChromeClient.h (164381 => 164382)


--- trunk/Source/WebCore/page/ChromeClient.h	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebCore/page/ChromeClient.h	2014-02-19 20:47:03 UTC (rev 164382)
@@ -191,6 +191,8 @@
 
     virtual Color underlayColor() const { return Color(); }
 
+    virtual void pageExtendedBackgroundColorDidChange(Color) const { }
+
 #if ENABLE(SQL_DATABASE)
     virtual void exceededDatabaseQuota(Frame*, const String& databaseName, DatabaseDetails) = 0;
 #endif

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (164381 => 164382)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2014-02-19 20:47:03 UTC (rev 164382)
@@ -260,6 +260,7 @@
     , m_obligatoryBackingStoreBytes(0)
     , m_secondaryBackingStoreBytes(0)
 #endif
+    , m_rootExtendedBackgroundColor(Color())
 {
 }
 
@@ -2937,16 +2938,22 @@
 
 void RenderLayerCompositor::setRootExtendedBackgroundColor(const Color& color)
 {
+    if (color == m_rootExtendedBackgroundColor)
+        return;
+
+    m_rootExtendedBackgroundColor = color;
+
+    if (Page* page = this->page())
+        page->chrome().client().pageExtendedBackgroundColorDidChange(color);
+
 #if ENABLE(RUBBER_BANDING)
     if (!m_layerForOverhangAreas)
         return;
 
-    m_layerForOverhangAreas->setBackgroundColor(color);
+    m_layerForOverhangAreas->setBackgroundColor(m_rootExtendedBackgroundColor);
 
-    if (!color.isValid())
+    if (!m_rootExtendedBackgroundColor.isValid())
         m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
-#else
-    UNUSED_PARAM(color);
 #endif
 }
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (164381 => 164382)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2014-02-19 20:47:03 UTC (rev 164382)
@@ -513,6 +513,8 @@
     double m_obligatoryBackingStoreBytes;
     double m_secondaryBackingStoreBytes;
 #endif
+
+    Color m_rootExtendedBackgroundColor;
 };
 
 

Modified: trunk/Source/WebKit2/ChangeLog (164381 => 164382)


--- trunk/Source/WebKit2/ChangeLog	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-19 20:47:03 UTC (rev 164382)
@@ -1,3 +1,30 @@
+2014-02-19  Beth Dakin  <[email protected]>
+
+        UIProcess needs to know the color of the page's extended background
+        https://bugs.webkit.org/show_bug.cgi?id=129004
+
+        Reviewed by Simon Fraser and Brent Fulgham.
+
+        New method on WKWebView and WKView will return the page’s extended background 
+        color.
+        * UIProcess/API/Cocoa/WKViewPrivate.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView pageExtendedBackgroundColor]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/ios/WKViewIOS.mm:
+        (-[WKView pageExtendedBackgroundColor]):
+
+        The color is stored in the WebPageProxy, and the ChromeClient sends a message to 
+        the WebPageProxy with the new color whenever it changes.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::pageExtendedBackgroundColor):
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::pageExtendedBackgroundColorDidChange):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2014-02-19  Tim Horton  <[email protected]>
 
         [wk2] REGRESSION (r162710): Open tab urls not restored after switching to new Safari build

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (164381 => 164382)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h	2014-02-19 20:47:03 UTC (rev 164382)
@@ -47,6 +47,8 @@
 // Define the inset of the scrollview unusable by the web page.
 @property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
 
+- (UIColor *)pageExtendedBackgroundColor;
+
 - (void)_beginInteractiveObscuredInsetsChange;
 - (void)_endInteractiveObscuredInsetsChange;
 

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


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-02-19 20:47:03 UTC (rev 164382)
@@ -596,6 +596,15 @@
     _obscuredInsets = obscuredInsets;
 }
 
+- (UIColor *)pageExtendedBackgroundColor
+{
+    WebCore::Color color = _data->_page->pageExtendedBackgroundColor();
+    if (!color.isValid())
+        return nil;
+
+    return [UIColor colorWithRed:(color.red() / 255.0) green:(color.green() / 255.0) blue:(color.blue() / 255.0) alpha:(color.alpha() / 255.0)];
+}
+
 - (void)_beginInteractiveObscuredInsetsChange
 {
     ASSERT(!_isChangingObscuredInsetsInteractively);

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (164381 => 164382)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2014-02-19 20:47:03 UTC (rev 164382)
@@ -69,6 +69,8 @@
 // Define the inset of the scrollview unusable by the web page.
 @property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
 
+- (UIColor *)pageExtendedBackgroundColor;
+
 - (void)_beginInteractiveObscuredInsetsChange;
 - (void)_endInteractiveObscuredInsetsChange;
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (164381 => 164382)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2014-02-19 20:47:03 UTC (rev 164382)
@@ -387,4 +387,14 @@
     _isChangingObscuredInsetsInteractively = NO;
 }
 
+- (UIColor *)pageExtendedBackgroundColor
+{
+    WebPageProxy *webPageProxy = toImpl([_contentView _pageRef]);
+    WebCore::Color color = webPageProxy->pageExtendedBackgroundColor();
+    if (!color.isValid())
+        return nil;
+
+    return [UIColor colorWithRed:(color.red() / 255.0) green:(color.green() / 255.0) blue:(color.blue() / 255.0) alpha:(color.alpha() / 255.0)];
+}
+
 @end

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (164381 => 164382)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-19 20:47:03 UTC (rev 164382)
@@ -4170,6 +4170,11 @@
     m_pageCount = pageCount;
 }
 
+void WebPageProxy::pageExtendedBackgroundColorDidChange(Color backgroundColor)
+{
+    m_pageExtendedBackgroundColor = backgroundColor;
+}
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 void WebPageProxy::didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString)
 {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (164381 => 164382)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-02-19 20:47:03 UTC (rev 164382)
@@ -422,6 +422,8 @@
     WebCore::Color underlayColor() const { return m_underlayColor; }
     void setUnderlayColor(const WebCore::Color&);
 
+    WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; }
+
     void viewWillStartLiveResize();
     void viewWillEndLiveResize();
 
@@ -994,6 +996,7 @@
     void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
     void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
     void didChangePageCount(unsigned);
+    void pageExtendedBackgroundColorDidChange(WebCore::Color);
 #if ENABLE(NETSCAPE_PLUGIN_API)
     void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
     void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
@@ -1297,6 +1300,7 @@
     bool m_drawsTransparentBackground;
 
     WebCore::Color m_underlayColor;
+    WebCore::Color m_pageExtendedBackgroundColor;
 
     bool m_areMemoryCacheClientCallsEnabled;
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (164381 => 164382)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-02-19 20:47:03 UTC (rev 164382)
@@ -71,7 +71,8 @@
     RecommendedScrollbarStyleDidChange(int32_t newStyle)
     DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
     DidChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide)
-    DidChangePageCount(unsigned pageCount);
+    DidChangePageCount(unsigned pageCount)
+    PageExtendedBackgroundColorDidChange(WebCore::Color backgroundColor)
 #if ENABLE(NETSCAPE_PLUGIN_API)
     DidFailToInitializePlugin(String mimeType, String frameURLString, String pageURLString)
     DidBlockInsecurePluginVersion(String mimeType, String pluginURLString, String frameURLString, String pageURLString, bool replacementObscured)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (164381 => 164382)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-02-19 20:47:03 UTC (rev 164382)
@@ -870,6 +870,11 @@
     return m_page->underlayColor();
 }
 
+void WebChromeClient::pageExtendedBackgroundColorDidChange(Color backgroundColor) const
+{
+    m_page->send(Messages::WebPageProxy::PageExtendedBackgroundColorDidChange(backgroundColor));
+}
+
 void WebChromeClient::numWheelEventHandlersChanged(unsigned count)
 {
     m_page->numWheelEventHandlersChanged(count);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (164381 => 164382)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-02-19 20:44:45 UTC (rev 164381)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-02-19 20:47:03 UTC (rev 164382)
@@ -255,6 +255,8 @@
     virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) override;
 
     virtual WebCore::Color underlayColor() const override;
+
+    virtual void pageExtendedBackgroundColorDidChange(WebCore::Color) const override;
     
     virtual void numWheelEventHandlersChanged(unsigned) override;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to