WebKit Bugzilla
Attachment 359477 Details for
Bug 192305
: [WPE] Add API for webview background color configuration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Try to fix win builds
wk2-bg-color.diff (text/plain), 68.34 KB, created by
Carlos Garcia Campos
on 2019-01-18 05:10:04 PST
(
hide
)
Description:
Try to fix win builds
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2019-01-18 05:10:04 PST
Size:
68.34 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7223fc5fd78..6f8921b843e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-18 Philippe Normand <pnormand@igalia.com> and Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [WPE] Add API for webview background color configuration >+ https://bugs.webkit.org/show_bug.cgi?id=192305 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ > 2019-01-18 Simon Fraser <simon.fraser@apple.com> > > ScrollingCoordinator::scrollableAreaScrollLayerDidChange() can be removed >diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp >index 73bafdb4660..ae60049b0e9 100644 >--- a/Source/WebCore/page/Frame.cpp >+++ b/Source/WebCore/page/Frame.cpp >@@ -902,7 +902,7 @@ RefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint) > return nullptr; > } > >-void Frame::createView(const IntSize& viewportSize, bool transparent, >+void Frame::createView(const IntSize& viewportSize, const Optional<Color>& backgroundColor, > const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect, > bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock, > ScrollbarMode verticalScrollbarMode, bool verticalLock) >@@ -933,7 +933,7 @@ void Frame::createView(const IntSize& viewportSize, bool transparent, > > setView(frameView.copyRef()); > >- frameView->updateBackgroundRecursively(transparent); >+ frameView->updateBackgroundRecursively(backgroundColor); > > if (isMainFrame) > frameView->setParentVisible(true); >diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h >index 8ad13d6e1cc..7841ad562c5 100644 >--- a/Source/WebCore/page/Frame.h >+++ b/Source/WebCore/page/Frame.h >@@ -128,7 +128,7 @@ public: > WEBCORE_EXPORT void initWithSimpleHTMLDocument(const String& style, const URL&); > #endif > WEBCORE_EXPORT void setView(RefPtr<FrameView>&&); >- WEBCORE_EXPORT void createView(const IntSize&, bool transparent, >+ WEBCORE_EXPORT void createView(const IntSize&, const Optional<Color>& backgroundColor, > const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect, > bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false, > ScrollbarMode = ScrollbarAuto, bool verticalLock = false); >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index 06698156db4..98fa7e9a5eb 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -424,7 +424,10 @@ void FrameView::recalculateBaseBackgroundColor() > return; > > m_usesDarkAppearance = usingDarkAppearance; >- updateBackgroundRecursively(m_isTransparent); >+ Optional<Color> backgroundColor; >+ if (m_isTransparent) >+ backgroundColor = Color(Color::transparent); >+ updateBackgroundRecursively(backgroundColor); > } > #endif > >@@ -3011,18 +3014,18 @@ void FrameView::setBaseBackgroundColor(const Color& backgroundColor) > renderView()->compositor().rootBackgroundColorOrTransparencyChanged(); > } > >-void FrameView::updateBackgroundRecursively(bool transparent) >+void FrameView::updateBackgroundRecursively(const Optional<Color>& backgroundColor) > { > #if ENABLE(DARK_MODE_CSS) >- Color backgroundColor = transparent ? Color::transparent : RenderTheme::singleton().systemColor(CSSValueAppleSystemControlBackground, styleColorOptions()); >+ Color baseBackgroundColor = backgroundColor.valueOr(RenderTheme::singleton().systemColor(CSSValueAppleSystemControlBackground, styleColorOptions())); > #else >- Color backgroundColor = transparent ? Color::transparent : Color::white; >+ Color baseBackgroundColor = backgroundColor.valueOr(Color::white); > #endif > > for (auto* frame = m_frame.ptr(); frame; frame = frame->tree().traverseNext(m_frame.ptr())) { > if (FrameView* view = frame->view()) { >- view->setTransparent(transparent); >- view->setBaseBackgroundColor(backgroundColor); >+ view->setTransparent(!baseBackgroundColor.isVisible()); >+ view->setBaseBackgroundColor(baseBackgroundColor); > if (view->needsLayout()) > view->layoutContext().scheduleLayout(); > } >diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h >index 0c781ee62a3..1d2207d4ad3 100644 >--- a/Source/WebCore/page/FrameView.h >+++ b/Source/WebCore/page/FrameView.h >@@ -190,7 +190,7 @@ public: > > WEBCORE_EXPORT Color baseBackgroundColor() const; > WEBCORE_EXPORT void setBaseBackgroundColor(const Color&); >- WEBCORE_EXPORT void updateBackgroundRecursively(bool); >+ WEBCORE_EXPORT void updateBackgroundRecursively(const Optional<Color>& backgroundColor); > > enum ExtendedBackgroundModeFlags { > ExtendedBackgroundModeNone = 0, >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 3099971f337..6fd12504516 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -1703,7 +1703,10 @@ ExceptionOr<void> Internals::setViewIsTransparent(bool transparent) > Document* document = contextDocument(); > if (!document || !document->view()) > return Exception { InvalidAccessError }; >- document->view()->updateBackgroundRecursively(transparent); >+ Optional<Color> backgroundColor; >+ if (transparent) >+ backgroundColor = Color(Color::transparent); >+ document->view()->updateBackgroundRecursively(backgroundColor); > return { }; > } > >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 23c29f997b0..3ec5ee8a29d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,80 @@ >+2019-01-18 Philippe Normand <pnormand@igalia.com> and Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [WPE] Add API for webview background color configuration >+ https://bugs.webkit.org/show_bug.cgi?id=192305 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ > 2019-01-16 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK][WPE] Add web extensions API to whitelist access to a security origin >diff --git a/Source/WebKit/PlatformWPE.cmake b/Source/WebKit/PlatformWPE.cmake >index 1f675c44e4c..3cdefd2bed2 100644 >--- a/Source/WebKit/PlatformWPE.cmake >+++ b/Source/WebKit/PlatformWPE.cmake >@@ -97,6 +97,7 @@ set(WPE_API_INSTALLED_HEADERS > ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardList.h > ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitBackForwardListItem.h > ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitCredential.h >+ ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitColor.h > ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenu.h > ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuActions.h > ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitContextMenuItem.h >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >index 1b2ed1b0275..da2f8a527dd 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >+++ b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >@@ -65,7 +65,7 @@ void CoordinatedGraphicsScene::applyStateChanges(const Vector<CoordinatedGraphic > commitSceneState(state.nicosia); > } > >-void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, const Color& backgroundColor, bool drawsBackground, TextureMapper::PaintFlags PaintFlags) >+void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix& matrix, const FloatRect& clipRect, TextureMapper::PaintFlags PaintFlags) > { > updateSceneState(); > >@@ -78,18 +78,8 @@ void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatri > m_textureMapper->beginPainting(PaintFlags); > m_textureMapper->beginClip(TransformationMatrix(), clipRect); > >- if (drawsBackground) { >- RGBA32 rgba = makeRGBA32FromFloats(backgroundColor.red(), >- backgroundColor.green(), backgroundColor.blue(), >- backgroundColor.alpha() * opacity); >- m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), Color(rgba)); >- } else >- m_textureMapper->clearColor(m_viewBackgroundColor); >- >- if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) { >- currentRootLayer->setOpacity(opacity); >+ if (currentRootLayer->transform() != matrix) > currentRootLayer->setTransform(matrix); >- } > > currentRootLayer->paint(); > m_fpsCounter.updateFPSAndDisplay(*m_textureMapper, clipRect.location(), matrix); >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h >index d4bb58268fe..2e6b335dbbd 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h >+++ b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h >@@ -72,7 +72,7 @@ public: > virtual ~CoordinatedGraphicsScene(); > > void applyStateChanges(const Vector<WebCore::CoordinatedGraphicsState>&); >- void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&, const WebCore::Color& backgroundColor, bool drawsBackground, WebCore::TextureMapper::PaintFlags = 0); >+ void paintToCurrentGLContext(const WebCore::TransformationMatrix&, const WebCore::FloatRect&, WebCore::TextureMapper::PaintFlags = 0); > void detach(); > > // The painting thread must lock the main thread to use below two methods, because two methods access members that the main thread manages. See m_client. >@@ -82,9 +82,6 @@ public: > bool isActive() const { return m_isActive; } > void setActive(bool active) { m_isActive = active; } > >- void setViewBackgroundColor(const WebCore::Color& color) { m_viewBackgroundColor = color; } >- WebCore::Color viewBackgroundColor() const { return m_viewBackgroundColor; } >- > private: > void commitSceneState(const WebCore::CoordinatedGraphicsState::NicosiaState&); > void updateSceneState(); >@@ -113,7 +110,6 @@ private: > std::unique_ptr<WebCore::TextureMapperLayer> m_rootLayer; > > Nicosia::PlatformLayer::LayerID m_rootLayerID { 0 }; >- WebCore::Color m_viewBackgroundColor { WebCore::Color::white }; > > WebCore::TextureMapperFPSCounter m_fpsCounter; > }; >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp >index 7522f84ea8f..805f2330ccf 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp >+++ b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp >@@ -156,13 +156,6 @@ void ThreadedCompositor::setViewportSize(const IntSize& viewportSize, float scal > m_compositingRunLoop->scheduleUpdate(); > } > >-void ThreadedCompositor::setDrawsBackground(bool drawsBackground) >-{ >- LockHolder locker(m_attributes.lock); >- m_attributes.drawsBackground = drawsBackground; >- m_compositingRunLoop->scheduleUpdate(); >-} >- > void ThreadedCompositor::updateViewport() > { > m_compositingRunLoop->scheduleUpdate(); >@@ -194,8 +187,8 @@ void ThreadedCompositor::renderLayerTree() > WebCore::IntSize viewportSize; > WebCore::IntPoint scrollPosition; > float scaleFactor; >- bool drawsBackground; > bool needsResize; >+ > Vector<WebCore::CoordinatedGraphicsState> states; > > { >@@ -203,7 +196,6 @@ void ThreadedCompositor::renderLayerTree() > viewportSize = m_attributes.viewportSize; > scrollPosition = m_attributes.scrollPosition; > scaleFactor = m_attributes.scaleFactor; >- drawsBackground = m_attributes.drawsBackground; > needsResize = m_attributes.needsResize; > > states = WTFMove(m_attributes.states); >@@ -247,14 +239,11 @@ void ThreadedCompositor::renderLayerTree() > viewportTransform.scale(scaleFactor); > viewportTransform.translate(-scrollPosition.x(), -scrollPosition.y()); > >- if (!drawsBackground) { >- glClearColor(0, 0, 0, 0); >- glClear(GL_COLOR_BUFFER_BIT); >- } >+ glClearColor(0, 0, 0, 0); >+ glClear(GL_COLOR_BUFFER_BIT); > > m_scene->applyStateChanges(states); >- m_scene->paintToCurrentGLContext(viewportTransform, 1, FloatRect { FloatPoint { }, viewportSize }, >- Color::transparent, !drawsBackground, m_paintFlags); >+ m_scene->paintToCurrentGLContext(viewportTransform, FloatRect { FloatPoint { }, viewportSize }, m_paintFlags); > > m_context->swapBuffers(); > >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h >index 6d7053850da..b631fc035f6 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h >+++ b/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h >@@ -70,7 +70,6 @@ public: > void setScaleFactor(float); > void setScrollPosition(const WebCore::IntPoint&, float scale); > void setViewportSize(const WebCore::IntSize&, float scale); >- void setDrawsBackground(bool); > > void updateSceneState(const WebCore::CoordinatedGraphicsState&); > >@@ -112,9 +111,7 @@ private: > WebCore::IntSize viewportSize; > WebCore::IntPoint scrollPosition; > float scaleFactor { 1 }; >- bool drawsBackground { true }; > bool needsResize { false }; >- > Vector<WebCore::CoordinatedGraphicsState> states; > > bool clientRendersNextFrame { false }; >diff --git a/Source/WebKit/Shared/WebPageCreationParameters.cpp b/Source/WebKit/Shared/WebPageCreationParameters.cpp >index 6d07c03ad8c..43ea3f53646 100644 >--- a/Source/WebKit/Shared/WebPageCreationParameters.cpp >+++ b/Source/WebKit/Shared/WebPageCreationParameters.cpp >@@ -38,7 +38,6 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const > encoder << store; > encoder.encodeEnum(drawingAreaType); > encoder << pageGroupData; >- encoder << drawsBackground; > encoder << isEditable; > encoder << underlayColor; > encoder << useFixedLayout; >@@ -120,6 +119,7 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const > #if ENABLE(CONTENT_EXTENSIONS) > encoder << contentRuleLists; > #endif >+ encoder << backgroundColor; > } > > Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder) >@@ -138,8 +138,6 @@ Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decod > if (!pageGroupData) > return WTF::nullopt; > parameters.pageGroupData = WTFMove(*pageGroupData); >- if (!decoder.decode(parameters.drawsBackground)) >- return WTF::nullopt; > if (!decoder.decode(parameters.isEditable)) > return WTF::nullopt; > if (!decoder.decode(parameters.underlayColor)) >@@ -347,6 +345,11 @@ Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decod > return WTF::nullopt; > parameters.contentRuleLists = WTFMove(*contentRuleLists); > #endif >+ Optional<Optional<WebCore::Color>> backgroundColor; >+ decoder >> backgroundColor; >+ if (!backgroundColor) >+ return WTF::nullopt; >+ parameters.backgroundColor = WTFMove(*backgroundColor); > > return WTFMove(parameters); > } >diff --git a/Source/WebKit/Shared/WebPageCreationParameters.h b/Source/WebKit/Shared/WebPageCreationParameters.h >index b382ceedd44..2427b8c23ff 100644 >--- a/Source/WebKit/Shared/WebPageCreationParameters.h >+++ b/Source/WebKit/Shared/WebPageCreationParameters.h >@@ -73,7 +73,6 @@ struct WebPageCreationParameters { > DrawingAreaType drawingAreaType; > WebPageGroupData pageGroupData; > >- bool drawsBackground; > bool isEditable; > > WebCore::Color underlayColor; >@@ -186,6 +185,8 @@ struct WebPageCreationParameters { > #if ENABLE(CONTENT_EXTENSIONS) > Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists; > #endif >+ >+ Optional<WebCore::Color> backgroundColor; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/SourcesWPE.txt b/Source/WebKit/SourcesWPE.txt >index b74ce636cee..d4a4fd1df0f 100644 >--- a/Source/WebKit/SourcesWPE.txt >+++ b/Source/WebKit/SourcesWPE.txt >@@ -168,6 +168,7 @@ UIProcess/API/glib/WebKitWindowProperties.cpp @no-unify > UIProcess/API/wpe/CompositingManagerProxy.cpp @no-unify > UIProcess/API/wpe/PageClientImpl.cpp @no-unify > UIProcess/API/wpe/ScrollGestureController.cpp @no-unify >+UIProcess/API/wpe/WebKitColor.cpp @no-unify > UIProcess/API/wpe/WebKitScriptDialogWPE.cpp @no-unify > UIProcess/API/wpe/WebKitWebViewBackend.cpp @no-unify > UIProcess/API/wpe/WebKitWebViewWPE.cpp @no-unify >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp >index 67201d89eaa..7a8a10f5c1c 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp >@@ -3969,74 +3969,6 @@ void webkitWebViewWebProcessTerminated(WebKitWebView* webView, WebKitWebProcessT > g_signal_emit(webView, signals[WEB_PROCESS_TERMINATED], 0, reason); > } > >-#if PLATFORM(GTK) >-/** >- * webkit_web_view_set_background_color: >- * @web_view: a #WebKitWebView >- * @rgba: a #GdkRGBA >- * >- * Sets the color that will be used to draw the @web_view background before >- * the actual contents are rendered. Note that if the web page loaded in @web_view >- * specifies a background color, it will take precedence over the @rgba color. >- * By default the @web_view background color is opaque white. >- * Note that the parent window must have a RGBA visual and >- * #GtkWidget:app-paintable property set to %TRUE for backgrounds colors to work. >- * >- * <informalexample><programlisting> >- * static void browser_window_set_background_color (BrowserWindow *window, >- * const GdkRGBA *rgba) >- * { >- * WebKitWebView *web_view; >- * GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (window)); >- * GdkVisual *rgba_visual = gdk_screen_get_rgba_visual (screen); >- * >- * if (!rgba_visual) >- * return; >- * >- * gtk_widget_set_visual (GTK_WIDGET (window), rgba_visual); >- * gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); >- * >- * web_view = browser_window_get_web_view (window); >- * webkit_web_view_set_background_color (web_view, rgba); >- * } >- * </programlisting></informalexample> >- * >- * Since: 2.8 >- */ >-void webkit_web_view_set_background_color(WebKitWebView* webView, const GdkRGBA* rgba) >-{ >- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); >- g_return_if_fail(rgba); >- >- Color color(*rgba); >- auto& page = getPage(webView); >- if (page.backgroundColor() == color) >- return; >- >- page.setBackgroundColor(color); >- page.setDrawsBackground(color == Color::white); >-} >- >-/** >- * webkit_web_view_get_background_color: >- * @web_view: a #WebKitWebView >- * @rgba: (out): a #GdkRGBA to fill in with the background color >- * >- * Gets the color that is used to draw the @web_view background before >- * the actual contents are rendered. >- * For more information see also webkit_web_view_set_background_color() >- * >- * Since: 2.8 >- */ >-void webkit_web_view_get_background_color(WebKitWebView* webView, GdkRGBA* rgba) >-{ >- g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); >- g_return_if_fail(rgba); >- >- *rgba = getPage(webView).backgroundColor(); >-} >-#endif // PLATFORM(GTK) >- > /* > * webkit_web_view_is_editable: > * @web_view: a #WebKitWebView >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp >index bc821799128..7799fb81c73 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp >@@ -24,6 +24,7 @@ > #include "WebKitScriptDialogImpl.h" > #include "WebKitWebViewBasePrivate.h" > #include "WebKitWebViewPrivate.h" >+#include <WebCore/Color.h> > #include <WebCore/GtkUtilities.h> > #include <WebCore/PlatformDisplay.h> > #include <WebCore/PlatformScreen.h> >@@ -359,3 +360,65 @@ GtkWidget* webkit_web_view_new_with_user_content_manager(WebKitUserContentManage > > return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "user-content-manager", userContentManager, nullptr)); > } >+ >+/** >+ * webkit_web_view_set_background_color: >+ * @web_view: a #WebKitWebView >+ * @rgba: a #GdkRGBA >+ * >+ * Sets the color that will be used to draw the @web_view background before >+ * the actual contents are rendered. Note that if the web page loaded in @web_view >+ * specifies a background color, it will take precedence over the @rgba color. >+ * By default the @web_view background color is opaque white. >+ * Note that the parent window must have a RGBA visual and >+ * #GtkWidget:app-paintable property set to %TRUE for backgrounds colors to work. >+ * >+ * <informalexample><programlisting> >+ * static void browser_window_set_background_color (BrowserWindow *window, >+ * const GdkRGBA *rgba) >+ * { >+ * WebKitWebView *web_view; >+ * GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (window)); >+ * GdkVisual *rgba_visual = gdk_screen_get_rgba_visual (screen); >+ * >+ * if (!rgba_visual) >+ * return; >+ * >+ * gtk_widget_set_visual (GTK_WIDGET (window), rgba_visual); >+ * gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); >+ * >+ * web_view = browser_window_get_web_view (window); >+ * webkit_web_view_set_background_color (web_view, rgba); >+ * } >+ * </programlisting></informalexample> >+ * >+ * Since: 2.8 >+ */ >+void webkit_web_view_set_background_color(WebKitWebView* webView, const GdkRGBA* rgba) >+{ >+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); >+ g_return_if_fail(rgba); >+ >+ auto& page = *webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(webView)); >+ page.setBackgroundColor(WebCore::Color(*rgba)); >+} >+ >+/** >+ * webkit_web_view_get_background_color: >+ * @web_view: a #WebKitWebView >+ * @rgba: (out): a #GdkRGBA to fill in with the background color >+ * >+ * Gets the color that is used to draw the @web_view background before >+ * the actual contents are rendered. >+ * For more information see also webkit_web_view_set_background_color() >+ * >+ * Since: 2.8 >+ */ >+void webkit_web_view_get_background_color(WebKitWebView* webView, GdkRGBA* rgba) >+{ >+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); >+ g_return_if_fail(rgba); >+ >+ auto& page = *webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(webView)); >+ *rgba = page.backgroundColor().valueOr(WebCore::Color::white); >+} >diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp b/Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp >new file mode 100644 >index 00000000000..b818f95a309 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp >@@ -0,0 +1,118 @@ >+/* >+ * Copyright (C) 2019 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "WebKitColor.h" >+ >+#include "WebKitColorPrivate.h" >+ >+/** >+ * SECTION: WebKitColor >+ * @Short_description: A boxed type representing a RGBA color >+ * @Title: WebKitColor >+ * @See_also: #WebKitWebView. >+ * >+ * A WebKitColor is a boxed type representing a RGBA color. >+ * >+ * Since: 2.24 >+ */ >+ >+/** >+ * webkit_color_copy: >+ * @color: a #WebKitColor >+ * >+ * Make a copy of @color. >+ * >+ * Returns: (transfer full): A copy of passed in #WebKitColor. >+ * >+ * Since: 2.24 >+ */ >+WebKitColor* webkit_color_copy(WebKitColor* color) >+{ >+ g_return_val_if_fail(color, nullptr); >+ >+ WebKitColor* copy = static_cast<WebKitColor*>(fastZeroedMalloc(sizeof(WebKitColor))); >+ copy->red = color->red; >+ copy->green = color->green; >+ copy->blue = color->blue; >+ copy->alpha = color->alpha; >+ return copy; >+} >+ >+/** >+ * webkit_color_free: >+ * @color: a #WebKitColor >+ * >+ * Free the #WebKitColor. >+ * >+ * Since: 2.24 >+ */ >+void webkit_color_free(WebKitColor* color) >+{ >+ g_return_if_fail(color); >+ >+ fastFree(color); >+} >+ >+G_DEFINE_BOXED_TYPE(WebKitColor, webkit_color, webkit_color_copy, webkit_color_free); >+ >+const WebCore::Color webkitColorToWebCoreColor(WebKitColor* color) >+{ >+ return WebCore::Color(static_cast<float>(color->red), static_cast<float>(color->green), >+ static_cast<float>(color->blue), static_cast<float>(color->alpha)); >+} >+ >+void webkitColorFillFromWebCoreColor(const WebCore::Color& webCoreColor, WebKitColor* color) >+{ >+ RELEASE_ASSERT(webCoreColor.isValid()); >+ >+ double r, g, b, a; >+ webCoreColor.getRGBA(r, g, b, a); >+ color->red = r; >+ color->green = g; >+ color->blue = b; >+ color->alpha = a; >+} >+ >+/** >+ * webkit_color_parse: >+ * @color: a #WebKitColor to fill in >+ * @color_string: color representation as color nickname or HEX string >+ * >+ * Create a new #WebKitColor for the given @color_string >+ * representation. There are two valid representation types: standard color >+ * names (see https://htmlcolorcodes.com/color-names/ for instance) or HEX >+ * values. >+ * >+ * Returns: a #gboolean indicating if the @color was correctly filled in or not. >+ * >+ * Since: 2.24 >+ */ >+gboolean webkit_color_parse(WebKitColor* color, const gchar* colorString) >+{ >+ g_return_val_if_fail(color, FALSE); >+ g_return_val_if_fail(colorString, FALSE); >+ >+ auto webCoreColor = WebCore::Color(colorString); >+ if (!webCoreColor.isValid()) >+ return FALSE; >+ >+ webkitColorFillFromWebCoreColor(webCoreColor, color); >+ return TRUE; >+} >diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitColor.h b/Source/WebKit/UIProcess/API/wpe/WebKitColor.h >new file mode 100644 >index 00000000000..f26d0916068 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/wpe/WebKitColor.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2019 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#if !defined(__WEBKIT_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) >+#error "Only <wpe/webkit.h> can be included directly." >+#endif >+ >+#ifndef WebKitColor_h >+#define WebKitColor_h >+ >+#include <glib-object.h> >+#include <wpe/WebKitDefines.h> >+ >+G_BEGIN_DECLS >+ >+/** >+ * WebKitColor: >+ * @red: Red channel, between 0.0 and 1.0 inclusive >+ * @green: Green channel, between 0.0 and 1.0 inclusive >+ * @blue: Blue channel, between 0.0 and 1.0 inclusive >+ * @alpha: Alpha channel, between 0.0 and 1.0 inclusive >+ * >+ * A WebKitColor is a boxed type representing a RGBA color. >+ * >+ * Since: 2.24 >+ */ >+struct _WebKitColor { >+ gdouble red; >+ gdouble green; >+ gdouble blue; >+ gdouble alpha; >+}; >+ >+typedef struct _WebKitColor WebKitColor; >+ >+#define WEBKIT_TYPE_COLOR (webkit_color_get_type()) >+ >+WEBKIT_API GType >+webkit_color_get_type (void); >+ >+WEBKIT_API gboolean >+webkit_color_parse (WebKitColor *color, const gchar *color_string); >+ >+G_END_DECLS >+ >+#endif /* WebKitColor_h */ >diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h b/Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h >new file mode 100644 >index 00000000000..239a1160341 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h >@@ -0,0 +1,26 @@ >+/* >+ * Copyright (C) 2019 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+#include "Color.h" >+#include "WebKitColor.h" >+ >+void webkitColorFillFromWebCoreColor(const WebCore::Color&, WebKitColor*); >+const WebCore::Color webkitColorToWebCoreColor(WebKitColor*); >diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h b/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h >index 4102a7526d6..2a4a6204235 100644 >--- a/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h >+++ b/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h >@@ -49,6 +49,7 @@ > #include <wpe/WebKitWebContext.h> > #include <wpe/WebKitWebResource.h> > #include <wpe/WebKitWebViewBackend.h> >+#include <wpe/WebKitColor.h> > #include <wpe/WebKitWebViewSessionState.h> > #include <wpe/WebKitWindowProperties.h> > >@@ -517,6 +518,13 @@ WEBKIT_API void > webkit_web_view_remove_frame_displayed_callback (WebKitWebView *web_view, > guint id); > >+WEBKIT_API void >+webkit_web_view_set_background_color (WebKitWebView *web_view, >+ WebKitColor *color); >+WEBKIT_API void >+webkit_web_view_get_background_color (WebKitWebView *web_view, >+ WebKitColor *color); >+ > G_END_DECLS > > #endif >diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp >index a3495e852e1..9e5ce5c3896 100644 >--- a/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp >+++ b/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp >@@ -20,6 +20,7 @@ > #include "config.h" > #include "WebKitWebView.h" > >+#include "WebKitColorPrivate.h" > #include "WebKitWebViewPrivate.h" > > gboolean webkitWebViewAuthenticate(WebKitWebView*, WebKitAuthenticationRequest*) >@@ -178,3 +179,44 @@ WebKitWebView* webkit_web_view_new_with_user_content_manager(WebKitWebViewBacken > "user-content-manager", userContentManager, > nullptr)); > } >+ >+/** >+ * webkit_web_view_set_background_color: >+ * @web_view: a #WebKitWebView >+ * @backgroundColor: a #WebKitColor >+ * >+ * Sets the color that will be used to draw the @web_view background before >+ * the actual contents are rendered. Note that if the web page loaded in @web_view >+ * specifies a background color, it will take precedence over the background color. >+ * By default the @web_view background color is opaque white. >+ * >+ * Since: 2.24 >+ */ >+void webkit_web_view_set_background_color(WebKitWebView* webView, WebKitColor* backgroundColor) >+{ >+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); >+ g_return_if_fail(backgroundColor); >+ >+ auto& page = webkitWebViewGetPage(webView); >+ page.setBackgroundColor(webkitColorToWebCoreColor(backgroundColor)); >+} >+ >+/** >+ * webkit_web_view_get_background_color: >+ * @web_view: a #WebKitWebView >+ * @rgba: (out): a #WebKitColor to fill in with the background color >+ * >+ * Gets the color that is used to draw the @web_view background before the >+ * actual contents are rendered. For more information see also >+ * webkit_web_view_set_background_color(). >+ * >+ * Since: 2.24 >+ */ >+void webkit_web_view_get_background_color(WebKitWebView* webView, WebKitColor* color) >+{ >+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); >+ auto& page = webkitWebViewGetPage(webView); >+ >+ auto& webCoreColor = page.backgroundColor(); >+ webkitColorFillFromWebCoreColor(webCoreColor.valueOr(WebCore::Color::white), color); >+} >diff --git a/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt b/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt >index 6fcf61ad0f4..e62cad0b203 100644 >--- a/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt >+++ b/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt >@@ -206,6 +206,8 @@ webkit_web_view_restore_session_state > webkit_web_view_get_main_resource > webkit_web_view_add_frame_displayed_callback > webkit_web_view_remove_frame_displayed_callback >+webkit_web_view_get_background_color >+webkit_web_view_set_background_color > > <SUBSECTION WebKitJavascriptResult> > WebKitJavascriptResult >@@ -266,6 +268,16 @@ webkit_web_view_backend_new > webkit_web_view_backend_get_type > </SECTION> > >+<SECTION> >+<FILE>WebKitColor</FILE> >+WEBKIT_TYPE_COLOR >+WebKitColor >+webkit_color_parse >+ >+<SUBSECTION Private> >+webkit_color_get_type >+</SECTION> >+ > <SECTION> > <FILE>WebKitAuthenticationRequest</FILE> > WebKitAuthenticationRequest >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index b91faaf7449..f6c2530d2f9 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -424,7 +424,6 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin > , m_cpuLimit(m_configuration->cpuLimit()) > , m_backForwardList(WebBackForwardList::create(*this)) > , m_waitsForPaintAfterViewDidMoveToWindow(m_configuration->waitsForPaintAfterViewDidMoveToWindow()) >- , m_drawsBackground(m_configuration->drawsBackground()) > , m_pageID(pageID) > , m_controlledByAutomation(m_configuration->isControlledByAutomation()) > #if PLATFORM(COCOA) >@@ -443,6 +442,9 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin > { > RELEASE_LOG_IF_ALLOWED(Loading, "constructor: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); > >+ if (!m_configuration->drawsBackground()) >+ m_backgroundColor = Color(Color::transparent); >+ > m_webProcessLifetimeTracker.addObserver(m_visitedLinkStore); > m_webProcessLifetimeTracker.addObserver(m_websiteDataStore); > >@@ -1531,13 +1533,20 @@ void WebPageProxy::createInspectorTargets() > > void WebPageProxy::setDrawsBackground(bool drawsBackground) > { >- if (m_drawsBackground == drawsBackground) >- return; >+ Optional<WebCore::Color> backgroundColor; >+ if (!drawsBackground) >+ backgroundColor = Color(Color::transparent); >+ setBackgroundColor(backgroundColor); >+} > >- m_drawsBackground = drawsBackground; >+void WebPageProxy::setBackgroundColor(const Optional<WebCore::Color>& color) >+{ >+ if (m_backgroundColor == color) >+ return; > >+ m_backgroundColor = color; > if (isValid()) >- m_process->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID); >+ m_process->send(Messages::WebPage::SetBackgroundColor(color), m_pageID); > } > > void WebPageProxy::setTopContentInset(float contentInset) >@@ -6719,7 +6728,6 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc > parameters.drawingAreaType = m_drawingArea->type(); > parameters.store = preferencesStore(); > parameters.pageGroupData = m_pageGroup->data(); >- parameters.drawsBackground = m_drawsBackground; > parameters.isEditable = m_isEditable; > parameters.underlayColor = m_underlayColor; > parameters.useFixedLayout = m_useFixedLayout; >@@ -6817,6 +6825,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc > #endif > > parameters.needsFontAttributes = m_needsFontAttributes; >+ parameters.backgroundColor = m_backgroundColor; > > process.addWebUserContentControllerProxy(m_userContentController, parameters); > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 2286b35c9fb..41c65f1d577 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -512,7 +512,7 @@ public: > > bool canShowMIMEType(const String& mimeType); > >- bool drawsBackground() const { return m_drawsBackground; } >+ bool drawsBackground() const { return !m_backgroundColor || m_backgroundColor.value().isVisible(); } > void setDrawsBackground(bool); > > String currentURL() const; >@@ -755,10 +755,11 @@ public: > > #if PLATFORM(GTK) > PlatformWidget viewWidget(); >- const WebCore::Color& backgroundColor() const { return m_backgroundColor; } >- void setBackgroundColor(const WebCore::Color& color) { m_backgroundColor = color; } > #endif > >+ const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; } >+ void setBackgroundColor(const Optional<WebCore::Color>&); >+ > #if PLATFORM(WIN) > PlatformWidget viewWidget(); > #endif >@@ -2081,8 +2082,6 @@ private: > > LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess }; > >- bool m_drawsBackground { true }; >- > WebCore::Color m_underlayColor; > WebCore::Color m_pageExtendedBackgroundColor; > >@@ -2181,9 +2180,10 @@ private: > > #if PLATFORM(GTK) > String m_accessibilityPlugID; >- WebCore::Color m_backgroundColor { WebCore::Color::white }; > #endif > >+ Optional<WebCore::Color> m_backgroundColor; >+ > unsigned m_pendingLearnOrIgnoreWordMessageCount { 0 }; > > bool m_mainFrameHasCustomContentProvider { false }; >diff --git a/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp b/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp >index e111c2b3986..18294d37fe4 100644 >--- a/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp >+++ b/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp >@@ -37,10 +37,6 @@ > #include <WebCore/RefPtrCairo.h> > #include <cairo.h> > >-#if PLATFORM(GTK) >-#include <gtk/gtk.h> >-#endif >- > #if PLATFORM(GTK) && PLATFORM(X11) && defined(GDK_WINDOWING_X11) > #include <WebCore/BackingStoreBackendCairoX11.h> > #include <WebCore/PlatformDisplayX11.h> >@@ -97,24 +93,6 @@ void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& > for (const auto& updateRect : updateInfo.updateRects) { > IntRect srcRect = updateRect; > srcRect.move(-updateRectLocation.x(), -updateRectLocation.y()); >-#if PLATFORM(GTK) >- if (!m_webPageProxy.drawsBackground()) { >- const WebCore::Color color = m_webPageProxy.backgroundColor(); >- if (color.isVisible()) { >- // When the application sets the background color through m_webPageProxy.backgroundColor(), we update the surface in 2 steps. >- // 1. Fill the surface by m_webPageProxy.backgroundColor(). >- // 2. Composite webpage's bitmap which has a transparent background. >- // In step 1, we use CompositeCopy as m_webPageProxy.backgroundColor() may not be opaque. >- // On the other hand, in step 2, bitmap should be composited by CompositeSourceOver >- // because it should be blended with m_webPageProxy.backgroundColor(). >- graphicsContext.fillRect(srcRect, color); >- graphicsContext.setCompositeOperation(WebCore::CompositeSourceOver); >- bitmap->paint(graphicsContext, deviceScaleFactor(), updateRect.location(), srcRect); >- graphicsContext.setCompositeOperation(WebCore::CompositeCopy); >- continue; >- } >- } >-#endif > bitmap->paint(graphicsContext, deviceScaleFactor(), updateRect.location(), srcRect); > } > } >diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp >index ecf345f80f8..eb62d6d654f 100644 >--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp >+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp >@@ -59,26 +59,4 @@ AcceleratedBackingStore::AcceleratedBackingStore(WebPageProxy& webPage) > { > } > >-bool AcceleratedBackingStore::paint(cairo_t* cr, const IntRect& clipRect) >-{ >- if (m_webPage.drawsBackground()) >- return true; >- >- const WebCore::Color& color = m_webPage.backgroundColor(); >- if (!color.isOpaque()) { >- cairo_rectangle(cr, clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height()); >- cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); >- cairo_fill(cr); >- } >- >- if (color.isVisible()) { >- setSourceRGBAFromColor(cr, color); >- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); >- cairo_rectangle(cr, clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height()); >- cairo_fill(cr); >- } >- >- return true; >-} >- > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h >index 3de3b5dfaf4..c8ba3ff7888 100644 >--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h >+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h >@@ -45,7 +45,7 @@ public: > virtual ~AcceleratedBackingStore() = default; > > virtual void update(const LayerTreeContext&) { } >- virtual bool paint(cairo_t*, const WebCore::IntRect&); >+ virtual bool paint(cairo_t*, const WebCore::IntRect&) = 0; > > protected: > AcceleratedBackingStore(WebPageProxy&); >diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp >index 216362cb23f..a77da3afe97 100644 >--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp >+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp >@@ -93,7 +93,6 @@ bool AcceleratedBackingStoreWayland::paint(cairo_t* cr, const IntRect& clipRect) > return false; > > cairo_save(cr); >- AcceleratedBackingStore::paint(cr, clipRect); > > #if GTK_CHECK_VERSION(3, 16, 0) > if (canGdkUseGL()) { >diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp >index 27d72c1c47e..82ce8c6b65d 100644 >--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp >+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp >@@ -186,7 +186,6 @@ bool AcceleratedBackingStoreX11::paint(cairo_t* cr, const IntRect& clipRect) > return false; > > cairo_save(cr); >- AcceleratedBackingStore::paint(cr, clipRect); > > // The surface can be modified by the web process at any time, so we mark it > // as dirty to ensure we always render the updated contents as soon as possible. >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >index aacb5b9ce61..e13d5842964 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -1393,7 +1393,6 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() > WebPage* webPage = m_frame->page(); > > bool isMainFrame = m_frame->isMainFrame(); >- bool isTransparent = !webPage->drawsBackground(); > bool shouldUseFixedLayout = isMainFrame && webPage->useFixedLayout(); > bool shouldDisableScrolling = isMainFrame && !webPage->mainFrameIsScrollable(); > bool shouldHideScrollbars = shouldDisableScrolling; >@@ -1418,7 +1417,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() > bool horizontalLock = shouldHideScrollbars || webPage->alwaysShowsHorizontalScroller(); > bool verticalLock = shouldHideScrollbars || webPage->alwaysShowsVerticalScroller(); > >- m_frame->coreFrame()->createView(webPage->size(), isTransparent, >+ m_frame->coreFrame()->createView(webPage->size(), webPage->backgroundColor(), > webPage->fixedLayoutSize(), fixedVisibleContentRect, shouldUseFixedLayout, > horizontalScrollbarMode, horizontalLock, verticalScrollbarMode, verticalLock); > >diff --git a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp >index 9920465b173..f2487769c97 100644 >--- a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp >+++ b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp >@@ -93,14 +93,6 @@ void AcceleratedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& sc > m_layerTreeHost->scrollNonCompositedContents(scrollRect); > } > >-void AcceleratedDrawingArea::pageBackgroundTransparencyChanged() >-{ >- if (m_layerTreeHost) >- m_layerTreeHost->pageBackgroundTransparencyChanged(); >- else if (m_previousLayerTreeHost) >- m_previousLayerTreeHost->pageBackgroundTransparencyChanged(); >-} >- > void AcceleratedDrawingArea::setLayerTreeStateIsFrozen(bool isFrozen) > { > if (m_layerTreeStateIsFrozen == isFrozen) >diff --git a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h >index 70abe435925..a0df568f9ac 100644 >--- a/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h >@@ -43,7 +43,6 @@ protected: > void setNeedsDisplay() override; > void setNeedsDisplayInRect(const WebCore::IntRect&) override; > void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override; >- void pageBackgroundTransparencyChanged() override; > void setLayerTreeStateIsFrozen(bool) override; > bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; } > LayerTreeHost* layerTreeHost() const override { return m_layerTreeHost.get(); } >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >index 1520f520dac..93b7a2dde72 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >@@ -224,10 +224,6 @@ void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged() > m_webPage.corePage()->pageOverlayController().didChangeDeviceScaleFactor(); > } > >-void CoordinatedLayerTreeHost::pageBackgroundTransparencyChanged() >-{ >-} >- > GraphicsLayerFactory* CoordinatedLayerTreeHost::graphicsLayerFactory() > { > return &m_coordinator; >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >index 0a8bec8a398..ea97453154c 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >@@ -55,7 +55,6 @@ protected: > void sizeDidChange(const WebCore::IntSize& newSize) override; > > void deviceOrPageScaleFactorChanged() override; >- void pageBackgroundTransparencyChanged() override; > > void setVisibleContentsRect(const WebCore::FloatRect&); > void renderNextFrame(bool); >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp >index 823b7fa2ac7..100fc64a619 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp >@@ -184,17 +184,6 @@ void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged() > m_compositor->setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor()); > } > >-void ThreadedCoordinatedLayerTreeHost::pageBackgroundTransparencyChanged() >-{ >- if (m_isDiscardable) { >- m_discardableSyncActions.add(DiscardableSyncActions::UpdateBackground); >- return; >- } >- >- CoordinatedLayerTreeHost::pageBackgroundTransparencyChanged(); >- m_compositor->setDrawsBackground(m_webPage.drawsBackground()); >-} >- > void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size) > { > if (m_isDiscardable) { >@@ -286,9 +275,6 @@ void ThreadedCoordinatedLayerTreeHost::setIsDiscardable(bool discardable) > if (m_discardableSyncActions.isEmpty()) > return; > >- if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateBackground)) >- pageBackgroundTransparencyChanged(); >- > if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateSize)) { > // Size changes already sets the scale factor and updates the viewport. > sizeDidChange(m_webPage.size()); >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h >index b784681679b..22876162e69 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h >@@ -57,7 +57,6 @@ private: > void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override; > void sizeDidChange(const WebCore::IntSize&) override; > void deviceOrPageScaleFactorChanged() override; >- void pageBackgroundTransparencyChanged() override; > > void contentsSizeChanged(const WebCore::IntSize&) override; > void didChangeViewportAttributes(WebCore::ViewportAttributes&&) override; >@@ -143,8 +142,7 @@ private: > enum class DiscardableSyncActions { > UpdateSize = 1 << 1, > UpdateViewport = 1 << 2, >- UpdateScale = 1 << 3, >- UpdateBackground = 1 << 4 >+ UpdateScale = 1 << 3 > }; > > CompositorClient m_compositorClient; >diff --git a/Source/WebKit/WebProcess/WebPage/DrawingArea.h b/Source/WebKit/WebProcess/WebPage/DrawingArea.h >index f9c89174a4a..5784a4f179c 100644 >--- a/Source/WebKit/WebProcess/WebPage/DrawingArea.h >+++ b/Source/WebKit/WebProcess/WebPage/DrawingArea.h >@@ -79,7 +79,6 @@ public: > virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) = 0; > > // FIXME: These should be pure virtual. >- virtual void pageBackgroundTransparencyChanged() { } > virtual void forceRepaint() { } > virtual bool forceRepaintAsync(CallbackID) { return false; } > virtual void setLayerTreeStateIsFrozen(bool) { } >diff --git a/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp >index 6a86b002b86..089ac20bf87 100644 >--- a/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp >+++ b/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp >@@ -410,8 +410,7 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo) > updateInfo.viewSize = m_webPage.size(); > updateInfo.deviceScaleFactor = m_webPage.corePage()->deviceScaleFactor(); > >- // Always render the whole page when we don't render the background. >- IntRect bounds = m_webPage.drawsBackground() ? m_dirtyRegion.bounds() : m_webPage.bounds(); >+ IntRect bounds = m_dirtyRegion.bounds(); > ASSERT(m_webPage.bounds().contains(bounds)); > > IntSize bitmapSize = bounds.size(); >@@ -424,16 +423,11 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo) > if (!bitmap->createHandle(updateInfo.bitmapHandle)) > return; > >- Vector<IntRect> rects; >- if (m_webPage.drawsBackground()) { >- rects = m_dirtyRegion.rects(); >- >- if (shouldPaintBoundsRect(bounds, rects)) { >- rects.clear(); >- rects.append(bounds); >- } >- } else >+ Vector<IntRect> rects = m_dirtyRegion.rects(); >+ if (shouldPaintBoundsRect(bounds, rects)) { >+ rects.clear(); > rects.append(bounds); >+ } > > updateInfo.scrollRect = m_scrollRect; > updateInfo.scrollOffset = m_scrollOffset; >diff --git a/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h >index 85dd458e018..53c398299e6 100644 >--- a/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h >+++ b/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h >@@ -74,7 +74,6 @@ public: > virtual void forceRepaint() = 0; > virtual bool forceRepaintAsync(CallbackID) { return false; } > virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0; >- virtual void pageBackgroundTransparencyChanged() = 0; > > virtual void pauseRendering(); > virtual void resumeRendering(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index dd97d6eb07a..0df7b7e7b46 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -514,8 +514,6 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > > setUseFixedLayout(parameters.useFixedLayout); > >- setDrawsBackground(parameters.drawsBackground); >- > setUnderlayColor(parameters.underlayColor); > > setPaginationMode(parameters.paginationMode); >@@ -639,6 +637,8 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > #if USE(AUDIO_SESSION) > PlatformMediaSessionManager::setShouldDeactivateAudioSession(true); > #endif >+ >+ setBackgroundColor(parameters.backgroundColor); > } > > #if ENABLE(WEB_RTC) >@@ -2877,19 +2877,16 @@ void WebPage::setIndicating(bool indicating) > } > #endif > >-void WebPage::setDrawsBackground(bool drawsBackground) >+void WebPage::setBackgroundColor(const Optional<WebCore::Color>& backgroundColor) > { >- if (m_drawsBackground == drawsBackground) >+ if (m_backgroundColor == backgroundColor) > return; > >- m_drawsBackground = drawsBackground; >+ m_backgroundColor = backgroundColor; > >- if (FrameView* frameView = mainFrameView()) { >- bool isTransparent = !drawsBackground; >- frameView->updateBackgroundRecursively(isTransparent); >- } >+ if (FrameView* frameView = mainFrameView()) >+ frameView->updateBackgroundRecursively(backgroundColor); > >- m_drawingArea->pageBackgroundTransparencyChanged(); > m_drawingArea->setNeedsDisplay(); > } > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index f3b934e27da..afe01e27b27 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -500,8 +500,6 @@ public: > > void postInjectedBundleMessage(const String& messageName, const UserData&); > >- bool drawsBackground() const { return m_drawsBackground; } >- > void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; } > WebCore::Color underlayColor() const { return m_underlayColor; } > >@@ -1137,6 +1135,8 @@ public: > > void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&); > >+ const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; } >+ > private: > WebPage(uint64_t pageID, WebPageCreationParameters&&); > >@@ -1263,7 +1263,7 @@ private: > void setIndicating(bool); > #endif > >- void setDrawsBackground(bool); >+ void setBackgroundColor(const Optional<WebCore::Color>&); > > #if PLATFORM(COCOA) > void setTopContentInsetFenced(float, IPC::Attachment); >@@ -1745,7 +1745,7 @@ private: > bool m_isSuspendedUnderLock { false }; > > HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders; >- WebCore::Color m_backgroundColor { WebCore::Color::white }; >+ Optional<WebCore::Color> m_backgroundColor { WebCore::Color::white }; > > HashSet<unsigned> m_activeRenderingSuppressionTokens; > unsigned m_maximumRenderingSuppressionToken { 0 }; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 54abbaf8934..87c45a35438 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -25,7 +25,7 @@ messages -> WebPage LegacyReceiver { > SetActivityState(OptionSet<WebCore::ActivityState::Flag> activityState, WebKit::ActivityStateChangeID activityStateChangeID, Vector<WebKit::CallbackID> callbackIDs) > SetLayerHostingMode(enum:uint8_t WebKit::LayerHostingMode layerHostingMode) > >- SetDrawsBackground(bool drawsBackground) >+ SetBackgroundColor(Optional<WebCore::Color> color) > > AddConsoleMessage(uint64_t frameID, enum:uint8_t JSC::MessageSource messageSource, enum:uint8_t JSC::MessageLevel messageLevel, String message, uint64_t requestID) > SendCSPViolationReport(uint64_t frameID, URL reportURL, IPC::FormDataReference reportData) >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 3acb67f5c36..ed36ed21ac9 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-18 Philippe Normand <pnormand@igalia.com> >+ >+ [WPE] Add API for webview background color configuration >+ https://bugs.webkit.org/show_bug.cgi?id=192305 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebFrameLoaderClient.cpp: >+ (WebFrameLoaderClient::transitionToCommittedForNewPage): Create >+ FrameView with background color. >+ > 2019-01-17 Per Arne Vollan <pvollan@apple.com> > > [Win][HighDPI] Repaint glitches when scrolling. >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >index ee8198a8827..da6a576b6b1 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -984,10 +984,12 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage() > > RECT pixelRect; > view->frameRect(&pixelRect); >- bool transparent = view->transparent(); >+ Optional<Color> backgroundColor; >+ if (view->transparent()) >+ backgroundColor = Color(Color::transparent); > FloatRect logicalFrame(pixelRect); > logicalFrame.scale(1.0f / view->deviceScaleFactor()); >- core(m_webFrame)->createView(enclosingIntRect(logicalFrame).size(), transparent, /* fixedLayoutSize */ { }, /* fixedVisibleContentRect */ { }); >+ core(m_webFrame)->createView(enclosingIntRect(logicalFrame).size(), backgroundColor, /* fixedLayoutSize */ { }, /* fixedVisibleContentRect */ { }); > } > > void WebFrameLoaderClient::didSaveToPageCache() >diff --git a/Source/WebKitLegacy/win/WebFrame.cpp b/Source/WebKitLegacy/win/WebFrame.cpp >index 04b6fea3cb4..4ad3166017f 100644 >--- a/Source/WebKitLegacy/win/WebFrame.cpp >+++ b/Source/WebKitLegacy/win/WebFrame.cpp >@@ -2089,7 +2089,10 @@ void WebFrame::updateBackground() > if (!coreFrame || !coreFrame->view()) > return; > >- coreFrame->view()->updateBackgroundRecursively(webView()->transparent()); >+ Optional<Color> backgroundColor; >+ if (webView()->transparent()) >+ backgroundColor = Color(Color::transparent); >+ coreFrame->view()->updateBackgroundRecursively(backgroundColor); > } > > // IWebFrame2 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 5ae308652bf..b420ac54ddc 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-18 Philippe Normand <pnormand@igalia.com> >+ >+ [WPE] Add API for webview background color configuration >+ https://bugs.webkit.org/show_bug.cgi?id=192305 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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. >+ > 2019-01-16 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK][WPE] Add web extensions API to whitelist access to a security origin >diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp >index 62cf55db311..2d51ecc16c3 100644 >--- a/Tools/MiniBrowser/wpe/main.cpp >+++ b/Tools/MiniBrowser/wpe/main.cpp >@@ -42,6 +42,7 @@ static gboolean ignoreTLSErrors; > static const char* cookiesFile; > static const char* cookiesPolicy; > static const char* proxy; >+const char* bgColor; > > static const GOptionEntry commandLineOptions[] = > { >@@ -53,6 +54,7 @@ static const GOptionEntry commandLineOptions[] = > { "proxy", 0, 0, G_OPTION_ARG_STRING, &proxy, "Set proxy", "PROXY" }, > { "ignore-host", 0, 0, G_OPTION_ARG_STRING_ARRAY, &ignoreHosts, "Set proxy ignore hosts", "HOSTS" }, > { "ignore-tls-errors", 0, 0, G_OPTION_ARG_NONE, &ignoreTLSErrors, "Ignore TLS errors", nullptr }, >+ { "bg-color", 0, 0, G_OPTION_ARG_STRING, &bgColor, "Window background color. Default: white", "COLOR" }, > { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, nullptr, "[URL]" }, > { nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr } > }; >@@ -194,6 +196,10 @@ int main(int argc, char *argv[]) > if (ignoreTLSErrors) > webkit_web_context_set_tls_errors_policy(webContext, WEBKIT_TLS_ERRORS_POLICY_IGNORE); > >+ WebKitColor color; >+ if (bgColor && webkit_color_parse(&color, bgColor)) >+ webkit_web_view_set_background_color(webView, &color); >+ > if (uriArguments) > webkit_web_view_load_uri(webView, uriArguments[0]); > else if (!automationMode) >diff --git a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp >index 54f197b8833..d0531b49f0f 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp >@@ -1133,11 +1133,16 @@ static void testWebViewIsPlayingAudio(IsPlayingAudioWebViewTest* test, gconstpoi > g_assert_false(webkit_web_view_is_playing_audio(test->m_webView)); > } > >-#if PLATFORM(GTK) > static void testWebViewBackgroundColor(WebViewTest* test, gconstpointer) > { >+#if PLATFORM(GTK) >+#define ColorType GdkRGBA >+#elif PLATFORM(WPE) >+#define ColorType WebKitColor >+#endif >+ > // White is the default background. >- GdkRGBA rgba; >+ ColorType rgba; > webkit_web_view_get_background_color(test->m_webView, &rgba); > g_assert_cmpfloat(rgba.red, ==, 1); > g_assert_cmpfloat(rgba.green, ==, 1); >@@ -1155,10 +1160,23 @@ static void testWebViewBackgroundColor(WebViewTest* test, gconstpointer) > g_assert_cmpfloat(rgba.blue, ==, 0); > g_assert_cmpfloat(rgba.alpha, ==, 0.5); > >+#if PLATFORM(WPE) >+ ColorType color; >+ g_assert(webkit_color_parse(&color, "red")); >+ g_assert_cmpfloat(color.red, ==, 1); >+ webkit_web_view_set_background_color(test->m_webView, &color); >+ webkit_web_view_get_background_color(test->m_webView, &rgba); >+ g_assert_cmpfloat(rgba.red, ==, 1); >+ g_assert_cmpfloat(rgba.green, ==, 0); >+ g_assert_cmpfloat(rgba.blue, ==, 0); >+ g_assert_cmpfloat(rgba.alpha, ==, 1); >+#endif >+ > // The actual rendering can't be tested using unit tests, use > // MiniBrowser --bg-color="<color-value>" for manually testing this API. > } > >+#if PLATFORM(GTK) > static void testWebViewPreferredSize(WebViewTest* test, gconstpointer) > { > test->loadHtml("<html style='width: 325px; height: 615px'></html>", nullptr); >@@ -1363,8 +1381,8 @@ void beforeAll() > NotificationWebViewTest::add("WebKitWebView", "notification-initial-permission-disallowed", testWebViewNotificationInitialPermissionDisallowed); > #endif > IsPlayingAudioWebViewTest::add("WebKitWebView", "is-playing-audio", testWebViewIsPlayingAudio); >-#if PLATFORM(GTK) > WebViewTest::add("WebKitWebView", "background-color", testWebViewBackgroundColor); >+#if PLATFORM(GTK) > WebViewTest::add("WebKitWebView", "preferred-size", testWebViewPreferredSize); > #endif > WebViewTitleTest::add("WebKitWebView", "title-change", testWebViewTitleChange);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192305
:
356371
|
358458
|
358459
|
358597
|
358799
|
359005
|
359470
|
359477
|
360849
|
361048
|
361672
|
361676
|
361678