Diff
Modified: trunk/Source/WebCore/ChangeLog (242081 => 242082)
--- trunk/Source/WebCore/ChangeLog 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebCore/ChangeLog 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1,3 +1,23 @@
+2019-02-26 Philippe Normand <[email protected]> and Carlos Garcia Campos <[email protected]>
+
+ [WPE] Add API for webview background color configuration
+ https://bugs.webkit.org/show_bug.cgi?id=192305
+
+ 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.
+
2019-02-25 Yongjun Zhang <[email protected]>
scalableNativeWebpageParameters() is not preserved on new page navigation.
Modified: trunk/Source/WebCore/page/Frame.cpp (242081 => 242082)
--- trunk/Source/WebCore/page/Frame.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebCore/page/Frame.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -934,7 +934,7 @@
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)
@@ -965,7 +965,7 @@
setView(frameView.copyRef());
- frameView->updateBackgroundRecursively(transparent);
+ frameView->updateBackgroundRecursively(backgroundColor);
if (isMainFrame)
frameView->setParentVisible(true);
Modified: trunk/Source/WebCore/page/Frame.h (242081 => 242082)
--- trunk/Source/WebCore/page/Frame.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebCore/page/Frame.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -129,7 +129,7 @@
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);
Modified: trunk/Source/WebCore/page/FrameView.cpp (242081 => 242082)
--- trunk/Source/WebCore/page/FrameView.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebCore/page/FrameView.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -398,7 +398,10 @@
return;
m_usesDarkAppearance = usingDarkAppearance;
- updateBackgroundRecursively(m_isTransparent);
+ Optional<Color> backgroundColor;
+ if (m_isTransparent)
+ backgroundColor = Color(Color::transparent);
+ updateBackgroundRecursively(backgroundColor);
}
#endif
@@ -2993,18 +2996,18 @@
setNeedsCompositingConfigurationUpdate();
}
-void FrameView::updateBackgroundRecursively(bool transparent)
+void FrameView::updateBackgroundRecursively(const Optional<Color>& backgroundColor)
{
#if ENABLE(DARK_MODE_CSS) && PLATFORM(MAC)
- 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();
}
Modified: trunk/Source/WebCore/page/FrameView.h (242081 => 242082)
--- trunk/Source/WebCore/page/FrameView.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebCore/page/FrameView.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -192,7 +192,7 @@
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,
Modified: trunk/Source/WebCore/testing/Internals.cpp (242081 => 242082)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1714,7 +1714,10 @@
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 { };
}
Modified: trunk/Source/WebKit/ChangeLog (242081 => 242082)
--- trunk/Source/WebKit/ChangeLog 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/ChangeLog 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1,3 +1,80 @@
+2019-02-26 Philippe Normand <[email protected]> and Carlos Garcia Campos <[email protected]>
+
+ [WPE] Add API for webview background color configuration
+ https://bugs.webkit.org/show_bug.cgi?id=192305
+
+ 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.
+
2019-02-25 Yongjun Zhang <[email protected]>
scalableNativeWebpageParameters() is not preserved on new page navigation.
Modified: trunk/Source/WebKit/PlatformWPE.cmake (242081 => 242082)
--- trunk/Source/WebKit/PlatformWPE.cmake 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/PlatformWPE.cmake 2019-02-26 09:55:42 UTC (rev 242082)
@@ -96,6 +96,7 @@
${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
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (242081 => 242082)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -65,7 +65,7 @@
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 @@
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), true);
- } 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);
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h (242081 => 242082)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -72,7 +72,7 @@
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 @@
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 @@
std::unique_ptr<WebCore::TextureMapperLayer> m_rootLayer;
Nicosia::PlatformLayer::LayerID m_rootLayerID { 0 };
- WebCore::Color m_viewBackgroundColor { WebCore::Color::white };
WebCore::TextureMapperFPSCounter m_fpsCounter;
};
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (242081 => 242082)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -156,13 +156,6 @@
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 @@
WebCore::IntSize viewportSize;
WebCore::IntPoint scrollPosition;
float scaleFactor;
- bool drawsBackground;
bool needsResize;
+
Vector<WebCore::CoordinatedGraphicsState> states;
{
@@ -203,7 +196,6 @@
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 @@
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();
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (242081 => 242082)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -70,7 +70,6 @@
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 @@
WebCore::IntSize viewportSize;
WebCore::IntPoint scrollPosition;
float scaleFactor { 1 };
- bool drawsBackground { true };
bool needsResize { false };
-
Vector<WebCore::CoordinatedGraphicsState> states;
bool clientRendersNextFrame { false };
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (242081 => 242082)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -39,7 +39,6 @@
encoder.encodeEnum(drawingAreaType);
encoder << drawingAreaIdentifier;
encoder << pageGroupData;
- encoder << drawsBackground;
encoder << isEditable;
encoder << underlayColor;
encoder << useFixedLayout;
@@ -126,6 +125,7 @@
#if ENABLE(CONTENT_EXTENSIONS)
encoder << contentRuleLists;
#endif
+ encoder << backgroundColor;
}
Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder)
@@ -149,8 +149,6 @@
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))
@@ -368,6 +366,12 @@
parameters.contentRuleLists = WTFMove(*contentRuleLists);
#endif
+ Optional<Optional<WebCore::Color>> backgroundColor;
+ decoder >> backgroundColor;
+ if (!backgroundColor)
+ return WTF::nullopt;
+ parameters.backgroundColor = WTFMove(*backgroundColor);
+
return WTFMove(parameters);
}
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (242081 => 242082)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -74,7 +74,6 @@
DrawingAreaIdentifier drawingAreaIdentifier;
WebPageGroupData pageGroupData;
- bool drawsBackground;
bool isEditable;
WebCore::Color underlayColor;
@@ -194,6 +193,8 @@
#if ENABLE(CONTENT_EXTENSIONS)
Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists;
#endif
+
+ Optional<WebCore::Color> backgroundColor;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/SourcesWPE.txt (242081 => 242082)
--- trunk/Source/WebKit/SourcesWPE.txt 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/SourcesWPE.txt 2019-02-26 09:55:42 UTC (rev 242082)
@@ -172,6 +172,7 @@
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
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-02-26 09:55:42 UTC (rev 242082)
@@ -687,7 +687,8 @@
_page = [_contentView page];
[self _dispatchSetDeviceOrientation:deviceOrientation()];
- _page->setDrawsBackground(self.opaque);
+ if (!self.opaque)
+ _page->setBackgroundColor(WebCore::Color(WebCore::Color::transparent));
[_contentView layer].anchorPoint = CGPointZero;
[_contentView setFrame:bounds];
@@ -2502,7 +2503,10 @@
if (!_page)
return;
- _page->setDrawsBackground(opaque);
+ Optional<WebCore::Color> backgroundColor;
+ if (!opaque)
+ backgroundColor = WebCore::Color(WebCore::Color::transparent);
+ _page->setBackgroundColor(backgroundColor);
[self _updateScrollViewBackground];
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -3988,74 +3988,6 @@
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
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -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>
@@ -361,3 +362,65 @@
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);
+}
Added: trunk/Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp (0 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -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;
+}
Added: trunk/Source/WebKit/UIProcess/API/wpe/WebKitColor.h (0 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitColor.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitColor.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -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 */
Added: trunk/Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h (0 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitColorPrivate.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -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*);
Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -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_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
Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -20,6 +20,7 @@
#include "config.h"
#include "WebKitWebView.h"
+#include "WebKitColorPrivate.h"
#include "WebKitWebViewPrivate.h"
gboolean webkitWebViewAuthenticate(WebKitWebView*, WebKitAuthenticationRequest*)
@@ -178,3 +179,44 @@
"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);
+}
Modified: trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt 2019-02-26 09:55:42 UTC (rev 242082)
@@ -247,6 +247,8 @@
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
@@ -308,6 +310,16 @@
</SECTION>
<SECTION>
+<FILE>WebKitColor</FILE>
+WEBKIT_TYPE_COLOR
+WebKitColor
+webkit_color_parse
+
+<SUBSECTION Private>
+webkit_color_get_type
+</SECTION>
+
+<SECTION>
<FILE>WebKitAuthenticationRequest</FILE>
WebKitAuthenticationRequest
WebKitAuthenticationScheme
Modified: trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml 2019-02-26 09:55:42 UTC (rev 242082)
@@ -55,6 +55,7 @@
<xi:include href=""
<xi:include href=""
<xi:include href=""
+ <xi:include href=""
</chapter>
<chapter>
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1454,7 +1454,10 @@
void WebViewImpl::setDrawsBackground(bool drawsBackground)
{
- m_page->setDrawsBackground(drawsBackground);
+ Optional<WebCore::Color> backgroundColor;
+ if (!drawsBackground)
+ backgroundColor = WebCore::Color(WebCore::Color::transparent);
+ m_page->setBackgroundColor(backgroundColor);
// Make sure updateLayer gets called on the web view.
[m_view setNeedsDisplay:YES];
@@ -1462,7 +1465,8 @@
bool WebViewImpl::drawsBackground() const
{
- return m_page->drawsBackground();
+ auto& backgroundColor = m_page->backgroundColor();
+ return !backgroundColor || backgroundColor.value().isVisible();
}
void WebViewImpl::setBackgroundColor(NSColor *backgroundColor)
@@ -1486,7 +1490,7 @@
bool WebViewImpl::isOpaque() const
{
- return m_page->drawsBackground();
+ return drawsBackground();
}
void WebViewImpl::setShouldSuppressFirstResponderChanges(bool shouldSuppress)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -429,7 +429,6 @@
, 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)
@@ -448,6 +447,9 @@
{
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);
@@ -1559,15 +1561,14 @@
m_inspectorController->createInspectorTarget(pageTargetId, Inspector::InspectorTargetType::Page);
}
-void WebPageProxy::setDrawsBackground(bool drawsBackground)
+void WebPageProxy::setBackgroundColor(const Optional<Color>& color)
{
- if (m_drawsBackground == drawsBackground)
+ if (m_backgroundColor == color)
return;
- m_drawsBackground = drawsBackground;
-
+ 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)
@@ -6863,7 +6864,6 @@
parameters.drawingAreaIdentifier = drawingArea.identifier();
parameters.store = preferencesStore();
parameters.pageGroupData = m_pageGroup->data();
- parameters.drawsBackground = m_drawsBackground;
parameters.isEditable = m_isEditable;
parameters.underlayColor = m_underlayColor;
parameters.useFixedLayout = m_useFixedLayout;
@@ -6967,6 +6967,7 @@
#endif
parameters.needsFontAttributes = m_needsFontAttributes;
+ parameters.backgroundColor = m_backgroundColor;
process.addWebUserContentControllerProxy(m_userContentController, parameters);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -521,9 +521,6 @@
bool canShowMIMEType(const String& mimeType);
- bool drawsBackground() const { return m_drawsBackground; }
- void setDrawsBackground(bool);
-
String currentURL() const;
float topContentInset() const { return m_topContentInset; }
@@ -766,11 +763,12 @@
#if PLATFORM(GTK)
PlatformWidget viewWidget();
- const WebCore::Color& backgroundColor() const { return m_backgroundColor; }
- void setBackgroundColor(const WebCore::Color& color) { m_backgroundColor = color; }
bool makeGLContextCurrent();
#endif
+ const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
+ void setBackgroundColor(const Optional<WebCore::Color>&);
+
#if PLATFORM(WIN)
PlatformWidget viewWidget();
#endif
@@ -2120,8 +2118,6 @@
LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess };
- bool m_drawsBackground { true };
-
WebCore::Color m_underlayColor;
WebCore::Color m_pageExtendedBackgroundColor;
@@ -2220,9 +2216,10 @@
#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 };
Modified: trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -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 @@
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);
}
}
Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -59,26 +59,4 @@
{
}
-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
Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -45,7 +45,7 @@
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;
virtual bool makeContextCurrent() { return false; }
protected:
Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -110,7 +110,6 @@
return false;
cairo_save(cr);
- AcceleratedBackingStore::paint(cr, clipRect);
#if GTK_CHECK_VERSION(3, 16, 0)
if (m_gdkGLContext) {
Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -186,7 +186,6 @@
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.
Modified: trunk/Source/WebKit/UIProcess/win/WebView.cpp (242081 => 242082)
--- trunk/Source/WebKit/UIProcess/win/WebView.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/UIProcess/win/WebView.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -451,7 +451,8 @@
static void drawPageBackground(HDC dc, const WebPageProxy* page, const RECT& rect)
{
- if (!page->drawsBackground())
+ auto& backgroundColor = page->backgroundColor();
+ if (!backgroundColor || backgroundColor.value().isVisible())
return;
::FillRect(dc, &rect, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1));
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1409,7 +1409,6 @@
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;
@@ -1434,7 +1433,7 @@
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);
Modified: trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -93,14 +93,6 @@
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)
Modified: trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -43,7 +43,6 @@
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(); }
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -224,10 +224,6 @@
m_webPage.corePage()->pageOverlayController().didChangeDeviceScaleFactor();
}
-void CoordinatedLayerTreeHost::pageBackgroundTransparencyChanged()
-{
-}
-
GraphicsLayerFactory* CoordinatedLayerTreeHost::graphicsLayerFactory()
{
return &m_coordinator;
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -55,7 +55,6 @@
void sizeDidChange(const WebCore::IntSize& newSize) override;
void deviceOrPageScaleFactorChanged() override;
- void pageBackgroundTransparencyChanged() override;
void setVisibleContentsRect(const WebCore::FloatRect&);
void renderNextFrame(bool);
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -184,17 +184,6 @@
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 @@
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());
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -57,7 +57,6 @@
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 @@
enum class DiscardableSyncActions {
UpdateSize = 1 << 1,
UpdateViewport = 1 << 2,
- UpdateScale = 1 << 3,
- UpdateBackground = 1 << 4
+ UpdateScale = 1 << 3
};
CompositorClient m_compositorClient;
Modified: trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -81,7 +81,6 @@
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) { }
Modified: trunk/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -410,8 +410,7 @@
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 @@
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;
Modified: trunk/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -74,7 +74,6 @@
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();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -520,8 +520,6 @@
setUseFixedLayout(parameters.useFixedLayout);
- setDrawsBackground(parameters.drawsBackground);
-
setUnderlayColor(parameters.underlayColor);
setPaginationMode(parameters.paginationMode);
@@ -648,6 +646,8 @@
#if USE(AUDIO_SESSION)
PlatformMediaSessionManager::setShouldDeactivateAudioSession(true);
#endif
+
+ setBackgroundColor(parameters.backgroundColor);
}
#if ENABLE(WEB_RTC)
@@ -2918,19 +2918,16 @@
}
#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();
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-02-26 09:55:42 UTC (rev 242082)
@@ -501,8 +501,6 @@
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; }
@@ -1149,6 +1147,8 @@
bool requestDOMPasteAccess();
WebCore::IntRect rectForElementAtInteractionLocation() const;
+ const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
+
private:
WebPage(uint64_t pageID, WebPageCreationParameters&&);
@@ -1285,7 +1285,7 @@
void setIndicating(bool);
#endif
- void setDrawsBackground(bool);
+ void setBackgroundColor(const Optional<WebCore::Color>&);
#if PLATFORM(COCOA)
void setTopContentInsetFenced(float, IPC::Attachment);
@@ -1784,7 +1784,7 @@
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 };
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (242081 => 242082)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-02-26 09:55:42 UTC (rev 242082)
@@ -25,7 +25,7 @@
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)
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (242081 => 242082)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1,3 +1,14 @@
+2019-02-26 Philippe Normand <[email protected]>
+
+ [WPE] Add API for webview background color configuration
+ https://bugs.webkit.org/show_bug.cgi?id=192305
+
+ Reviewed by Michael Catanzaro.
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::transitionToCommittedForNewPage): Create
+ FrameView with background color.
+
2019-02-20 Darin Adler <[email protected]>
Finish removing String::format
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (242081 => 242082)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -985,10 +985,12 @@
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()
Modified: trunk/Source/WebKitLegacy/win/WebFrame.cpp (242081 => 242082)
--- trunk/Source/WebKitLegacy/win/WebFrame.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Source/WebKitLegacy/win/WebFrame.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -2089,7 +2089,10 @@
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
Modified: trunk/Tools/ChangeLog (242081 => 242082)
--- trunk/Tools/ChangeLog 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Tools/ChangeLog 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1,3 +1,17 @@
+2019-02-26 Philippe Normand <[email protected]>
+
+ [WPE] Add API for webview background color configuration
+ https://bugs.webkit.org/show_bug.cgi?id=192305
+
+ 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.
+
2019-02-25 Yongjun Zhang <[email protected]>
scalableNativeWebpageParameters() is not preserved on new page navigation.
Modified: trunk/Tools/MiniBrowser/wpe/main.cpp (242081 => 242082)
--- trunk/Tools/MiniBrowser/wpe/main.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Tools/MiniBrowser/wpe/main.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -43,6 +43,7 @@
static const char* cookiesFile;
static const char* cookiesPolicy;
static const char* proxy;
+const char* bgColor;
static const GOptionEntry commandLineOptions[] =
{
@@ -55,6 +56,7 @@
{ "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 },
{ "content-filter", 0, 0, G_OPTION_ARG_FILENAME, &contentFilter, "JSON with content filtering rules", "FILE" },
+ { "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 }
};
@@ -254,6 +256,10 @@
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) {
GFile* file = g_file_new_for_commandline_arg(uriArguments[0]);
char* url = ""
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp (242081 => 242082)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp 2019-02-26 08:50:48 UTC (rev 242081)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp 2019-02-26 09:55:42 UTC (rev 242082)
@@ -1133,11 +1133,16 @@
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 @@
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 @@
NotificationWebViewTest::add("WebKitWebView", "notification-initial-permission-disallowed", testWebViewNotificationInitialPermissionDisallowed);
#endif
IsPlayingAudioWebViewTest::add("WebKitWebView", "is-playing-audio", testWebViewIsPlayingAudio);
+ WebViewTest::add("WebKitWebView", "background-color", testWebViewBackgroundColor);
#if PLATFORM(GTK)
- WebViewTest::add("WebKitWebView", "background-color", testWebViewBackgroundColor);
WebViewTest::add("WebKitWebView", "preferred-size", testWebViewPreferredSize);
#endif
WebViewTitleTest::add("WebKitWebView", "title-change", testWebViewTitleChange);