[WPE] Add API for webview background color configuration
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 09:55:42 +0000 (09:55 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 09:55:42 +0000 (09:55 +0000)
commite76807fbe9fc1286aaa3d894b5a73a3c597446b8
tree0021d983d93bc141df791505b94d2d6168b1f60c
parent4cd2a26f9c28a243e682516c13d27dc9d8b202a6
[WPE] Add API for webview background color configuration
https://bugs.webkit.org/show_bug.cgi?id=192305

Source/WebCore:

Reviewed by Michael Catanzaro.

Adapt the FrameView API to allow a default non-white background color.

* page/Frame.cpp:
(WebCore::Frame::createView): Replace isTransparent argument with a background color one.
* page/Frame.h:
* page/FrameView.cpp:
(WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true.
(WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is
used only in non-dark-mode-css build configurations.
* page/FrameView.h:
* testing/Internals.cpp:
(WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true.

Source/WebKit:

Reviewed by Michael Catanzaro.

In the case of WPE we need to send the background color to the web process to be used as the background color of
the page. This patch adapts the GTK+ implementation to do the same, since it's a lot simpler. The patch also
removes the SetDrawsBackground message in favor of the new SetBackgroundColor message that receives an optional
color.

* PlatformWPE.cmake: Add new WPE API for WebKitColor boxed type.
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): Remove background rendering and opacity handling.
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::renderLayerTree): Remove drawsBakground and always clear the context with
transparent color.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const): Replace drawsBackground with backgroundColor.
(WebKit::WebPageCreationParameters::decode): Ditto.
* Shared/WebPageCreationParameters.h:
* SourcesWPE.txt:
* UIProcess/API/glib/WebKitWebView.cpp:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkit_web_view_set_background_color):
(webkit_web_view_get_background_color):
* UIProcess/API/wpe/WebKitColor.cpp: Added.
(webkit_color_copy):
(webkit_color_free):
(webkitColorToWebCoreColor):
(webkitColorFillFromWebCoreColor):
(webkit_color_parse):
* UIProcess/API/wpe/WebKitColor.h: Added.
* UIProcess/API/wpe/WebKitColorPrivate.h: Added.
* UIProcess/API/wpe/WebKitWebView.h: Implement webkit_web_view_set_background_color API.
* UIProcess/API/wpe/WebKitWebViewWPE.cpp: Ditto.
(webkit_web_view_set_background_color):
(webkit_web_view_get_background_color):
* UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Add new symbols.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setDrawsBackground): Set a transparent background color when false is passed.
(WebKit::WebPageProxy::setBackgroundColor): Send background color to the WebProcess.
(WebKit::WebPageProxy::creationParameters): Replace drawsBackground with backgroundColor.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::drawsBackground const):
(WebKit::WebPageProxy::backgroundColor const):
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::incorporateUpdate): Remove GTK+ code to handle background color.
* UIProcess/gtk/AcceleratedBackingStore.cpp:
* UIProcess/gtk/AcceleratedBackingStore.h: Make paint() pure virtual and remove the implementation.
* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::paint): Dot not call AcceleratedBackingStore::paint() now that is pure virtual.
* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
(WebKit::AcceleratedBackingStoreX11::paint): Ditto.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Use background color as provided by the
UIProcess when creating the FrameView.
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
* WebProcess/WebPage/AcceleratedDrawingArea.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable):
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display): Remove special case for transparent background.
* WebProcess/WebPage/LayerTreeHost.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setBackgroundColor): New API for background color configuration. Proxies to FrameView and DrawingArea.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::backgroundColor const): Read-only access to the current background color.
* WebProcess/WebPage/WebPage.messages.in: Replace SetDrawsBackground message with SetBackgroundColor.

Source/WebKitLegacy/win:

Patch by Philippe Normand <pnormand@igalia.com> on 2019-02-26
Reviewed by Michael Catanzaro.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::transitionToCommittedForNewPage): Create
FrameView with background color.

Tools:

Patch by Philippe Normand <pnormand@igalia.com> on 2019-02-26
Reviewed by Michael Catanzaro.

* MiniBrowser/wpe/main.cpp:
(main): Add a new option to configure the webview background
color. Example: --bg-color=transparent.
* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:
(testWebViewBackgroundColor): Enable background color API tests for WPE.
(beforeAll): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
53 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/testing/Internals.cpp
Source/WebKit/ChangeLog
Source/WebKit/PlatformWPE.cmake
Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h
Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/SourcesWPE.txt
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp
Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/wpe/WebKitColor.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/wpe/WebKitWebView.h
Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp
Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt
Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp
Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp
Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h
Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp
Source/WebKit/UIProcess/win/WebView.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp
Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h
Source/WebKit/WebProcess/WebPage/DrawingArea.h
Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit/WebProcess/WebPage/LayerTreeHost.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKitLegacy/win/WebFrame.cpp
Tools/ChangeLog
Tools/MiniBrowser/wpe/main.cpp
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp