Diff
Modified: trunk/LayoutTests/ChangeLog (267023 => 267024)
--- trunk/LayoutTests/ChangeLog 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/LayoutTests/ChangeLog 2020-09-14 18:26:27 UTC (rev 267024)
@@ -1,3 +1,15 @@
+2020-09-14 Simon Fraser <[email protected]>
+
+ First steps towards LFC painting in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=216466
+
+ Reviewed by Zalan Bujtas.
+
+ Now that we actually paint with LFC, some tests fail because of missing features in
+ the very basic LFC paint path. Mark these as failures for now.
+
+ * platform/mac-wk2/TestExpectations:
+
2020-09-14 Sam Weinig <[email protected]>
[WebIDL] Replace 'serializable' with '[Default] object toJSON()'
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (267023 => 267024)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-09-14 18:26:27 UTC (rev 267024)
@@ -1234,6 +1234,24 @@
[ arm64 ] fast/replaced/no-focus-ring-embed.html [ Skip ]
[ arm64 ] fast/replaced/no-focus-ring-object.html [ Skip ]
+# LFC painting is work in progress
+webkit.org/b/216471 fast/layoutformattingcontext/block-only/replaced-intrinsic-width-simple.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/empty-table-with-specified-height-quirk-simple.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/empty-table-with-specified-height-standards-simple.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/float-in-inline-context-simple.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/floats-shrinking-line-simple.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/subframe-with-display-none-html.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-cell-vertical-alignment-simple.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-border-collapse3.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-collapsed-row-border.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-collapsed-row-border2.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-multiple-sections.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-row-border.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-rowspan-with-spacing.html [ ImageOnlyFailure ]
+webkit.org/b/216471 fast/layoutformattingcontext/table-simple-thead-border-ignore.html [ ImageOnlyFailure ]
+
# rdar://66703773 (REGRESSION (20A2316-20A2348b): http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html is a constant failure)
[ arm64 ] http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html [ Skip ]
Modified: trunk/Source/WebCore/CMakeLists.txt (267023 => 267024)
--- trunk/Source/WebCore/CMakeLists.txt 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-09-14 18:26:27 UTC (rev 267024)
@@ -103,6 +103,7 @@
"${WEBCORE_DIR}/layout"
"${WEBCORE_DIR}/layout/blockformatting"
"${WEBCORE_DIR}/layout/blockformatting/tablewrapper"
+ "${WEBCORE_DIR}/layout/display"
"${WEBCORE_DIR}/layout/displaytree"
"${WEBCORE_DIR}/layout/floats"
"${WEBCORE_DIR}/layout/inlineformatting"
Modified: trunk/Source/WebCore/ChangeLog (267023 => 267024)
--- trunk/Source/WebCore/ChangeLog 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/ChangeLog 2020-09-14 18:26:27 UTC (rev 267024)
@@ -1,3 +1,79 @@
+2020-09-14 Simon Fraser <[email protected]>
+
+ First steps towards LFC painting in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=216466
+
+ Reviewed by Zalan Bujtas.
+
+ Get LFC painting in WebKit2.
+
+ Display::LayerController() is intended to be a controller object that makes layerization
+ decisions; for now, it just creates some root layers and hooks them up via attachRootGraphicsLayer().
+ It also creates a GraphicsLayerClient that paints by calling LayoutContext::paint().
+
+ Display::View is responsible for the display of an LFC-rendered document. FrameView
+ has one, and the Display::View has a Display::LayerController(). The minimal hookup points are:
+ 1. Page::doAfterUpdateRendering() tells each Display::View to prepareForDisplay().
+ This is where we'll do once-per-rendering layer updating.
+ 2. FrameView::flushCompositingStateForThisFrame() tells the Display::View() to flush
+ layers, which just passes through to Display::LayerController().
+
+ For now we just rely on the fact that Display::LayerController() calls attachRootGraphicsLayer()
+ after RenderLayerCompositor, replacing the root layer created by existing RenderLayerCompositor code.
+
+ * CMakeLists.txt:
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/LayoutState.h:
+ (WebCore::Layout::LayoutState::hasRoot const):
+ * layout/display/DisplayLayerController.cpp: Added.
+ (WebCore::Display::LayerController::RootLayerClient::RootLayerClient):
+ (WebCore::Display::LayerController::RootLayerClient::notifyFlushRequired):
+ (WebCore::Display::LayerController::RootLayerClient::paintContents):
+ (WebCore::Display::LayerController::LayerController):
+ (WebCore::Display::LayerController::prepareForDisplay):
+ (WebCore::Display::LayerController::flushLayers):
+ (WebCore::Display::LayerController::visibleRectForLayerFlushing const):
+ (WebCore::Display::LayerController::scheduleRenderingUpdate):
+ (WebCore::Display::LayerController::ensureRootLayer):
+ (WebCore::Display::LayerController::setupRootLayerHierarchy):
+ (WebCore::Display::LayerController::updateRootLayerGeometry):
+ (WebCore::Display::LayerController::attachRootLayer):
+ (WebCore::Display::LayerController::graphicsLayerFactory const):
+ * layout/display/DisplayLayerController.h: Added.
+ (WebCore::Display::LayerController::view const):
+ (WebCore::Display::LayerController::rootGraphicsLayer const):
+ (WebCore::Display::LayerController::contentLayer const):
+ * layout/display/DisplayView.cpp: Copied from Source/WebCore/layout/displaytree/DisplayPainter.h.
+ (WebCore::Display::View::View):
+ (WebCore::Display::View::~View):
+ (WebCore::Display::View::frame const):
+ (WebCore::Display::View::page const):
+ (WebCore::Display::View::layoutState const):
+ (WebCore::Display::View::prepareForDisplay):
+ (WebCore::Display::View::flushLayers):
+ * layout/display/DisplayView.h: Copied from Source/WebCore/layout/displaytree/DisplayPainter.h.
+ (WebCore::Display::View::frameView const):
+ * layout/displaytree/DisplayPainter.cpp:
+ (WebCore::Display::Painter::absoluteDisplayBox):
+ (WebCore::Display::paintSubtree):
+ (WebCore::Display::collectPaintRootsAndContentRect):
+ (WebCore::Display::absoluteDisplayBox): Deleted.
+ * layout/displaytree/DisplayPainter.h:
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::flushCompositingStateForThisFrame):
+ (WebCore::FrameView::existingDisplayView const):
+ (WebCore::FrameView::displayView):
+ * page/FrameView.h:
+ * page/Page.cpp:
+ (WebCore::Page::doAfterUpdateRendering):
+ * platform/graphics/x11/PlatformDisplayX11.h: Denote Display as being in the global namespace.
+ * platform/graphics/x11/XErrorTrapper.h:
+ (WebCore::XErrorTrapper::XErrorTrapper):
+ * platform/graphics/x11/XUniquePtr.h:
+
2020-09-14 Sam Weinig <[email protected]>
[WebIDL] Replace 'serializable' with '[Default] object toJSON()'
Modified: trunk/Source/WebCore/Headers.cmake (267023 => 267024)
--- trunk/Source/WebCore/Headers.cmake 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/Headers.cmake 2020-09-14 18:26:27 UTC (rev 267024)
@@ -693,6 +693,9 @@
layout/LayoutUnits.h
layout/MarginTypes.h
+ layout/display/DisplayLayerController.h
+ layout/display/DisplayView.h
+
layout/displaytree/DisplayBox.h
layout/displaytree/DisplayInlineContent.h
layout/displaytree/DisplayInlineRect.h
Modified: trunk/Source/WebCore/Sources.txt (267023 => 267024)
--- trunk/Source/WebCore/Sources.txt 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/Sources.txt 2020-09-14 18:26:27 UTC (rev 267024)
@@ -1432,6 +1432,8 @@
layout/blockformatting/PrecomputedBlockMarginCollapse.cpp
layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp
layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContextQuirks.cpp
+layout/display/DisplayLayerController.cpp
+layout/display/DisplayView.cpp
layout/displaytree/DisplayBox.cpp
layout/displaytree/DisplayInlineContent.cpp
layout/displaytree/DisplayPainter.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (267023 => 267024)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-09-14 18:26:27 UTC (rev 267024)
@@ -6075,6 +6075,10 @@
0FF835BF1EE354DA008B4CC7 /* DOMQuad.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMQuad.idl; sourceTree = "<group>"; };
0FF835C01EE354DA008B4CC7 /* DOMQuadInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMQuadInit.h; sourceTree = "<group>"; };
0FF835C11EE354DA008B4CC7 /* DOMQuadInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMQuadInit.idl; sourceTree = "<group>"; };
+ 0FFB4DA1250EA00E0086B952 /* DisplayLayerController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayLayerController.h; sourceTree = "<group>"; };
+ 0FFB4DA2250EA00F0086B952 /* DisplayLayerController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayLayerController.cpp; sourceTree = "<group>"; };
+ 0FFB4DA3250EA3700086B952 /* DisplayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayView.h; sourceTree = "<group>"; };
+ 0FFB4DA4250EA3700086B952 /* DisplayView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayView.cpp; sourceTree = "<group>"; };
0FFD45A7243BF257000D4BEA /* ScrollingTreeLatchingController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingTreeLatchingController.h; sourceTree = "<group>"; };
0FFD45A8243BF257000D4BEA /* ScrollingTreeLatchingController.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreeLatchingController.cpp; sourceTree = "<group>"; };
0FFD4D5E18651FA300512F6E /* AsyncScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncScrollingCoordinator.cpp; sourceTree = "<group>"; };
@@ -17418,10 +17422,22 @@
path = displaylists;
sourceTree = "<group>";
};
+ 0FFB4DA0250E9FC40086B952 /* display */ = {
+ isa = PBXGroup;
+ children = (
+ 0FFB4DA2250EA00F0086B952 /* DisplayLayerController.cpp */,
+ 0FFB4DA1250EA00E0086B952 /* DisplayLayerController.h */,
+ 0FFB4DA4250EA3700086B952 /* DisplayView.cpp */,
+ 0FFB4DA3250EA3700086B952 /* DisplayView.h */,
+ );
+ path = display;
+ sourceTree = "<group>";
+ };
115CFA66208AF720001E6991 /* layout */ = {
isa = PBXGroup;
children = (
115CFA99208BC09A001E6991 /* blockformatting */,
+ 0FFB4DA0250E9FC40086B952 /* display */,
1199FA58208E3C4C002358CC /* displaytree */,
6FCFC055212DACC2007695D2 /* floats */,
115CFA9A208BC140001E6991 /* inlineformatting */,
Modified: trunk/Source/WebCore/layout/LayoutState.h (267023 => 267024)
--- trunk/Source/WebCore/layout/LayoutState.h 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/layout/LayoutState.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -82,6 +82,7 @@
bool inLimitedQuirksMode() const { return m_quirksMode == QuirksMode::Limited; }
bool inNoQuirksMode() const { return m_quirksMode == QuirksMode::No; }
+ bool hasRoot() const { return !!m_rootContainer; }
const ContainerBox& root() const { return *m_rootContainer; }
// LFC integration only. Full LFC has proper ICB access.
Added: trunk/Source/WebCore/layout/display/DisplayLayerController.cpp (0 => 267024)
--- trunk/Source/WebCore/layout/display/DisplayLayerController.cpp (rev 0)
+++ trunk/Source/WebCore/layout/display/DisplayLayerController.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisplayLayerController.h"
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "DisplayBox.h"
+#include "DisplayPainter.h"
+#include "DisplayView.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "LayoutContext.h"
+#include "Logging.h"
+#include "Page.h"
+#include "Settings.h"
+
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+namespace Display {
+
+LayerController::RootLayerClient::RootLayerClient(LayerController& layerController)
+ : m_layerController(layerController)
+{
+}
+
+void LayerController::RootLayerClient::notifyFlushRequired(const GraphicsLayer*)
+{
+ m_layerController.scheduleRenderingUpdate();
+}
+
+void LayerController::RootLayerClient::paintContents(const GraphicsLayer* layer, GraphicsContext& context, const FloatRect& dirtyRect, GraphicsLayerPaintBehavior)
+{
+ ASSERT_UNUSED(layer, layer == m_layerController.contentLayer());
+
+ // FIXME: Temporary; once we do scrolling this root layer won't paint anything.
+ if (auto* layoutState = m_layerController.view().layoutState())
+ Layout::LayoutContext::paint(*layoutState, context, enclosingIntRect(dirtyRect));
+}
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(LayerController);
+
+LayerController::LayerController(View& view)
+ : m_view(view)
+ , m_rootLayerClient(*this)
+{
+}
+
+LayerController::~LayerController() = default;
+
+void LayerController::prepareForDisplay(const Layout::LayoutState& layoutState)
+{
+ if (!layoutState.hasRoot())
+ return;
+
+ auto& rootLayoutBox = layoutState.root();
+ if (!rootLayoutBox.firstChild())
+ return;
+
+ ASSERT(layoutState.hasDisplayBox(rootLayoutBox));
+
+ auto viewSize = layoutState.displayBoxForLayoutBox(rootLayoutBox).size();
+ auto contentSize = layoutState.displayBoxForLayoutBox(*rootLayoutBox.firstChild()).size();
+
+ // FIXME: Using the firstChild() size won't be correct until we compute overflow correctly,
+ contentSize.clampToMinimumSize(viewSize);
+
+ LOG_WITH_STREAM(FormattingContextLayout, stream << "LayerController::prepareForDisplay - viewSize " << viewSize << " contentSize " << contentSize);
+
+ ensureRootLayer(viewSize, contentSize);
+
+ // FIXME: For now, repaint the world on every update.
+ m_contentLayer->setNeedsDisplay();
+
+ auto& settings = m_view.frame().settings();
+ bool showDebugBorders = settings.showDebugBorders();
+ bool showRepaintCounter = settings.showRepaintCounter();
+ bool acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled();
+
+ m_rootLayer->setShowDebugBorder(showDebugBorders);
+ m_contentHostLayer->setShowDebugBorder(showDebugBorders);
+
+ m_contentLayer->setShowDebugBorder(showDebugBorders);
+ m_contentLayer->setShowRepaintCounter(showRepaintCounter);
+ m_contentLayer->setAcceleratesDrawing(acceleratedDrawingEnabled);
+}
+
+void LayerController::flushLayers()
+{
+ if (!m_rootLayer)
+ return;
+
+ FloatRect visibleRect = visibleRectForLayerFlushing();
+ m_rootLayer->flushCompositingState(visibleRect);
+}
+
+FloatRect LayerController::visibleRectForLayerFlushing() const
+{
+ const auto& frameView = m_view.frameView();
+ return frameView.visibleContentRect();
+}
+
+void LayerController::scheduleRenderingUpdate()
+{
+ auto page = m_view.page();
+ if (!page)
+ return;
+
+ page->scheduleRenderingUpdate();
+}
+
+void LayerController::ensureRootLayer(LayoutSize viewSize, LayoutSize contentSize)
+{
+ if (m_rootLayer) {
+ updateRootLayerGeometry(viewSize, contentSize);
+ return;
+ }
+
+ setupRootLayerHierarchy();
+ updateRootLayerGeometry(viewSize, contentSize);
+
+ attachRootLayer();
+}
+
+void LayerController::setupRootLayerHierarchy()
+{
+ // FIXME: This layer hierarchy is just enough to get topContentInset working.
+ m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), m_rootLayerClient);
+ m_rootLayer->setName("display root");
+ m_rootLayer->setPosition({ });
+ m_rootLayer->setAnchorPoint({ });
+
+ m_contentHostLayer = GraphicsLayer::create(graphicsLayerFactory(), m_rootLayerClient);
+ m_contentHostLayer->setName("content host");
+ m_contentHostLayer->setAnchorPoint({ });
+
+ m_contentLayer = GraphicsLayer::create(graphicsLayerFactory(), m_rootLayerClient);
+ m_contentLayer->setName("content");
+ m_contentLayer->setPosition({ });
+ m_contentLayer->setAnchorPoint({ });
+ m_contentLayer->setDrawsContent(true);
+
+ m_rootLayer->addChild(*m_contentHostLayer);
+ m_contentHostLayer->addChild(*m_contentLayer);
+}
+
+void LayerController::updateRootLayerGeometry(LayoutSize viewSize, LayoutSize contentSize)
+{
+ m_rootLayer->setSize(viewSize);
+
+ float topContentInset = m_view.frameView().topContentInset();
+ m_contentHostLayer->setPosition({ 0, topContentInset });
+ m_contentHostLayer->setSize(viewSize);
+
+ m_contentLayer->setSize(contentSize);
+}
+
+void LayerController::attachRootLayer()
+{
+ auto page = m_view.page();
+ if (!page)
+ return;
+
+ page->chrome().client().attachRootGraphicsLayer(m_view.frame(), rootGraphicsLayer());
+}
+
+GraphicsLayerFactory* LayerController::graphicsLayerFactory() const
+{
+ auto page = m_view.page();
+ if (!page)
+ return nullptr;
+
+ return page->chrome().client().graphicsLayerFactory();
+}
+
+} // namespace Display
+} // namespace WebCore
+
+#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)
Added: trunk/Source/WebCore/layout/display/DisplayLayerController.h (0 => 267024)
--- trunk/Source/WebCore/layout/display/DisplayLayerController.h (rev 0)
+++ trunk/Source/WebCore/layout/display/DisplayLayerController.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "DisplayRect.h"
+#include "GraphicsLayer.h"
+#include "LayoutUnits.h"
+#include <wtf/IsoMalloc.h>
+
+namespace WebCore {
+
+class GraphicsLayer;
+class GraphicsLayerFactory;
+
+namespace Layout {
+class LayoutState;
+}
+
+namespace Display {
+
+class View;
+
+// A controller object that makes layerization decisions for a display tree, for a single document.
+class LayerController {
+ WTF_MAKE_ISO_ALLOCATED(LayerController);
+public:
+ LayerController(View&);
+ ~LayerController();
+
+ void prepareForDisplay(const Layout::LayoutState&);
+ void flushLayers();
+
+ const View& view() const { return m_view; }
+
+private:
+ void ensureRootLayer(LayoutSize viewSize, LayoutSize contentSize);
+ void attachRootLayer();
+ void setupRootLayerHierarchy();
+ void updateRootLayerGeometry(LayoutSize viewSize, LayoutSize contentSize);
+ void scheduleRenderingUpdate();
+
+ GraphicsLayer* rootGraphicsLayer() const { return m_rootLayer.get(); }
+ GraphicsLayer* contentLayer() const { return m_contentLayer.get(); }
+
+ GraphicsLayerFactory* graphicsLayerFactory() const;
+
+ FloatRect visibleRectForLayerFlushing() const;
+
+ class RootLayerClient : public GraphicsLayerClient {
+ public:
+ RootLayerClient(LayerController&);
+
+ private:
+ // GraphicsLayerClient implementation
+ void notifyFlushRequired(const GraphicsLayer*) final;
+ void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect&, GraphicsLayerPaintBehavior) final;
+
+ LayerController& m_layerController;
+ };
+
+ View& m_view;
+ RootLayerClient m_rootLayerClient;
+
+ RefPtr<GraphicsLayer> m_rootLayer;
+ RefPtr<GraphicsLayer> m_contentHostLayer;
+ RefPtr<GraphicsLayer> m_contentLayer;
+};
+
+} // namespace Display
+} // namespace WebCore
+
+#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)
Copied: trunk/Source/WebCore/layout/display/DisplayView.cpp (from rev 267023, trunk/Source/WebCore/layout/displaytree/DisplayPainter.h) (0 => 267024)
--- trunk/Source/WebCore/layout/display/DisplayView.cpp (rev 0)
+++ trunk/Source/WebCore/layout/display/DisplayView.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisplayView.h"
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "FrameViewLayoutContext.h"
+#include "LayoutContext.h"
+#include "LayoutState.h"
+#include "Page.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+namespace Display {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(View);
+
+View::View(FrameView& frameView)
+ : m_frameView(frameView)
+ , m_layerController(*this)
+{
+}
+
+View::~View()
+{
+}
+
+Frame& View::frame() const
+{
+ return m_frameView.frame();
+}
+
+Page* View::page() const
+{
+ return m_frameView.frame().page();
+}
+
+const Layout::LayoutState* View::layoutState() const
+{
+ return m_frameView.layoutContext().layoutFormattingState();
+}
+
+void View::prepareForDisplay()
+{
+ auto* layoutState = this->layoutState();
+ if (!layoutState)
+ return;
+
+ m_layerController.prepareForDisplay(*layoutState);
+}
+
+void View::flushLayers()
+{
+ m_layerController.flushLayers();
+}
+
+
+
+} // namespace Display
+} // namespace WebCore
+
+#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)
Copied: trunk/Source/WebCore/layout/display/DisplayView.h (from rev 267023, trunk/Source/WebCore/layout/displaytree/DisplayPainter.h) (0 => 267024)
--- trunk/Source/WebCore/layout/display/DisplayView.h (rev 0)
+++ trunk/Source/WebCore/layout/display/DisplayView.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "DisplayLayerController.h"
+#include "DisplayRect.h"
+#include "LayoutUnits.h"
+#include <wtf/IsoMalloc.h>
+
+namespace WebCore {
+
+class Frame;
+class FrameView;
+class Page;
+
+namespace Layout {
+class LayoutState;
+class LayoutTreeContent;
+}
+
+namespace Display {
+
+// The root object which renders a display tree for a single document.
+class View {
+ WTF_MAKE_ISO_ALLOCATED(View);
+public:
+ View(FrameView&);
+ ~View();
+
+ void prepareForDisplay();
+ void flushLayers();
+
+ Page* page() const;
+ FrameView& frameView() const { return m_frameView; }
+ Frame& frame() const;
+
+ const Layout::LayoutState* layoutState() const;
+
+private:
+ FrameView& m_frameView;
+ LayerController m_layerController;
+};
+
+} // namespace Display
+} // namespace WebCore
+
+#endif // ENABLE(LAYOUT_FORMATTING_CONTEXT)
Modified: trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp (267023 => 267024)
--- trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -141,7 +141,7 @@
}
}
-static Box absoluteDisplayBox(const Layout::LayoutState& layoutState, const Layout::Box& layoutBoxToPaint)
+Box Painter::absoluteDisplayBox(const Layout::LayoutState& layoutState, const Layout::Box& layoutBoxToPaint)
{
// Should never really happen but table code is way too incomplete.
if (!layoutState.hasDisplayBox(layoutBoxToPaint))
@@ -178,7 +178,7 @@
return;
if (!layoutState.hasDisplayBox(layoutBox))
return;
- auto absoluteDisplayBox = Display::absoluteDisplayBox(layoutState, layoutBox);
+ auto absoluteDisplayBox = Painter::absoluteDisplayBox(layoutState, layoutBox);
if (!dirtyRect.intersects(snappedIntRect(absoluteDisplayBox.rect())))
return;
@@ -248,7 +248,7 @@
if (isPaintRootCandidate(layoutBox))
appendPaintRoot(layoutBox);
if (layoutState.hasDisplayBox(layoutBox))
- contentRect.uniteIfNonZero(Display::absoluteDisplayBox(layoutState, layoutBox).rect());
+ contentRect.uniteIfNonZero(Painter::absoluteDisplayBox(layoutState, layoutBox).rect());
if (!is<Layout::ContainerBox>(layoutBox) || !downcast<Layout::ContainerBox>(layoutBox).hasChild())
break;
layoutBoxList.append(downcast<Layout::ContainerBox>(layoutBox).firstChild());
Modified: trunk/Source/WebCore/layout/displaytree/DisplayPainter.h (267023 => 267024)
--- trunk/Source/WebCore/layout/displaytree/DisplayPainter.h 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/layout/displaytree/DisplayPainter.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -42,6 +42,8 @@
public:
static void paint(const Layout::LayoutState&, GraphicsContext&, const IntRect& dirtyRect);
static void paintInlineFlow(const Layout::LayoutState&, GraphicsContext&);
+
+ static Box absoluteDisplayBox(const Layout::LayoutState&, const Layout::Box&);
};
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (267023 => 267024)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -32,6 +32,7 @@
#include "FloatingContext.h"
#include "InlineFormattingContext.h"
#include "LayoutBox.h"
+#include "RuntimeEnabledFeatures.h"
#include "TextUtil.h"
namespace WebCore {
Modified: trunk/Source/WebCore/page/FrameView.cpp (267023 => 267024)
--- trunk/Source/WebCore/page/FrameView.cpp 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/page/FrameView.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -130,6 +130,7 @@
#endif
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "DisplayView.h"
#include "LayoutContext.h"
#endif
@@ -956,6 +957,14 @@
bool FrameView::flushCompositingStateForThisFrame(const Frame& rootFrameForFlush)
{
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
+ if (auto* view = existingDisplayView())
+ view->flushLayers();
+ return true;
+ }
+#endif
+
RenderView* renderView = this->renderView();
if (!renderView)
return true; // We don't want to keep trying to update layers if we have no renderer.
@@ -5340,6 +5349,20 @@
return frame().contentRenderer();
}
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+Display::View* FrameView::existingDisplayView() const
+{
+ return m_displayView.get();
+}
+
+Display::View& FrameView::displayView()
+{
+ if (!m_displayView)
+ m_displayView = makeUnique<Display::View>(*this);
+ return *m_displayView;
+}
+#endif
+
int FrameView::mapFromLayoutToCSSUnits(LayoutUnit value) const
{
return value / (frame().pageZoomFactor() * frame().frameScaleFactor());
Modified: trunk/Source/WebCore/page/FrameView.h (267023 => 267024)
--- trunk/Source/WebCore/page/FrameView.h 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/page/FrameView.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -74,6 +74,12 @@
class RenderWidget;
class ScrollingCoordinator;
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+namespace Display {
+class View;
+}
+#endif
+
enum class FrameFlattening;
Pagination::Mode paginationModeForRenderStyle(const RenderStyle&);
@@ -101,6 +107,11 @@
WEBCORE_EXPORT RenderView* renderView() const;
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ Display::View* existingDisplayView() const;
+ Display::View& displayView();
+#endif
+
int mapFromLayoutToCSSUnits(LayoutUnit) const;
LayoutUnit mapFromCSSToLayoutUnits(int) const;
@@ -842,6 +853,10 @@
const Ref<Frame> m_frame;
FrameViewLayoutContext m_layoutContext;
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ std::unique_ptr<Display::View> m_displayView;
+#endif
+
HashSet<Widget*> m_widgetsInRenderTree;
std::unique_ptr<ListHashSet<RenderEmbeddedObject*>> m_embeddedObjectsToUpdate;
std::unique_ptr<WeakHashSet<RenderElement>> m_slowRepaintObjects;
Modified: trunk/Source/WebCore/page/Page.cpp (267023 => 267024)
--- trunk/Source/WebCore/page/Page.cpp 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/page/Page.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -166,6 +166,10 @@
#include "WebGLStateTracker.h"
#endif
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "DisplayView.h"
+#endif
+
namespace WebCore {
static HashSet<Page*>& allPages()
@@ -1528,6 +1532,15 @@
// Code here should do once-per-frame work that needs to be done before painting, and requires
// layout to be up-to-date. It should not run script, trigger layout, or dirty layout.
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
+ forEachDocument([] (Document& document) {
+ if (auto* frameView = document.view())
+ frameView->displayView().prepareForDisplay();
+ });
+ }
+#endif
+
forEachDocument([] (Document& document) {
if (auto* frame = document.frame())
frame->eventHandler().updateCursorIfNeeded();
Modified: trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h (267023 => 267024)
--- trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -41,17 +41,17 @@
class PlatformDisplayX11 final : public PlatformDisplay {
public:
static std::unique_ptr<PlatformDisplay> create();
- static std::unique_ptr<PlatformDisplay> create(Display*);
+ static std::unique_ptr<PlatformDisplay> create(::Display*);
virtual ~PlatformDisplayX11();
- Display* native() const { return m_display; }
+ ::Display* native() const { return m_display; }
void* visual() const;
bool supportsXComposite() const;
bool supportsXDamage(Optional<int>& damageEventBase, Optional<int>& damageErrorBase) const;
private:
- PlatformDisplayX11(Display*, NativeDisplayOwned);
+ PlatformDisplayX11(::Display*, NativeDisplayOwned);
Type type() const override { return PlatformDisplay::Type::X11; }
@@ -59,7 +59,7 @@
void initializeEGLDisplay() override;
#endif
- Display* m_display { nullptr };
+ ::Display* m_display { nullptr };
mutable Optional<bool> m_supportsXComposite;
mutable Optional<bool> m_supportsXDamage;
mutable Optional<int> m_damageEventBase;
Modified: trunk/Source/WebCore/platform/graphics/x11/XErrorTrapper.h (267023 => 267024)
--- trunk/Source/WebCore/platform/graphics/x11/XErrorTrapper.h 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/platform/graphics/x11/XErrorTrapper.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -35,7 +35,7 @@
WTF_MAKE_NONCOPYABLE(XErrorTrapper);
public:
enum class Policy { Ignore, Warn, Crash };
- XErrorTrapper(Display*, Policy = Policy::Ignore, Vector<unsigned char>&& expectedErrors = { });
+ XErrorTrapper(::Display*, Policy = Policy::Ignore, Vector<unsigned char>&& expectedErrors = { });
~XErrorTrapper();
unsigned char errorCode() const;
@@ -43,7 +43,7 @@
private:
void errorEvent(XErrorEvent*);
- Display* m_display { nullptr };
+ ::Display* m_display { nullptr };
Policy m_policy { Policy::Ignore };
Vector<unsigned char> m_expectedErrors;
XErrorHandler m_previousErrorHandler { nullptr };
Modified: trunk/Source/WebCore/platform/graphics/x11/XUniquePtr.h (267023 => 267024)
--- trunk/Source/WebCore/platform/graphics/x11/XUniquePtr.h 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebCore/platform/graphics/x11/XUniquePtr.h 2020-09-14 18:26:27 UTC (rev 267024)
@@ -32,7 +32,7 @@
#if USE(GLX)
typedef struct __GLXcontextRec* GLXContext;
-extern "C" void glXDestroyContext(Display*, GLXContext);
+extern "C" void glXDestroyContext(::Display*, GLXContext);
#endif
namespace WebCore {
Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp (267023 => 267024)
--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp 2020-09-14 17:58:51 UTC (rev 267023)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp 2020-09-14 18:26:27 UTC (rev 267024)
@@ -47,7 +47,6 @@
#include <wtf/NeverDestroyed.h>
namespace WebKit {
-using namespace WebCore;
static Optional<int> s_damageEventBase;
static Optional<int> s_damageErrorBase;
@@ -135,7 +134,7 @@
bool AcceleratedBackingStoreX11::checkRequirements()
{
- auto& display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay());
+ auto& display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay());
return display.supportsXComposite() && display.supportsXDamage(s_damageEventBase, s_damageErrorBase);
}
@@ -161,8 +160,8 @@
if (!m_surface && !m_damage)
return;
- Display* display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
- XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
+ Display* display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native();
+ WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
if (m_damage) {
XDamageNotifier::singleton().remove(m_damage.get());
m_damage.reset();
@@ -176,10 +175,10 @@
if (m_surface && cairo_xlib_surface_get_drawable(m_surface.get()) == pixmap)
return;
- Display* display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
+ Display* display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native();
if (m_surface) {
- XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
+ WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
if (m_damage) {
XDamageNotifier::singleton().remove(m_damage.get());
m_damage.reset();
@@ -195,14 +194,14 @@
if (!drawingArea)
return;
- IntSize size = drawingArea->size();
+ WebCore::IntSize size = drawingArea->size();
float deviceScaleFactor = m_webPage.deviceScaleFactor();
size.scale(deviceScaleFactor);
- XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
- ASSERT(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native() == gdk_x11_display_get_xdisplay(gdk_display_get_default()));
+ WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
+ ASSERT(downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native() == gdk_x11_display_get_xdisplay(gdk_display_get_default()));
#if USE(GTK4)
- auto* visual = WK_XVISUAL(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()));
+ auto* visual = WK_XVISUAL(downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()));
#else
GdkVisual* gdkVisual = gdk_screen_get_rgba_visual(gdk_screen_get_default());
if (!gdkVisual)
@@ -210,7 +209,7 @@
auto* visual = GDK_VISUAL_XVISUAL(gdkVisual);
#endif
m_surface = adoptRef(cairo_xlib_surface_create(display, pixmap, visual, size.width(), size.height()));
- cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
+ WebCore::cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
m_damage = XDamageCreate(display, pixmap, XDamageReportNonEmpty);
XDamageNotifier::singleton().add(m_damage.get(), [this] {
if (m_webPage.isViewVisible())
@@ -229,7 +228,7 @@
// as dirty to ensure we always render the updated contents as soon as possible.
cairo_surface_mark_dirty(m_surface.get());
- FloatSize viewSize(gtk_widget_get_width(m_webPage.viewWidget()), gtk_widget_get_height(m_webPage.viewWidget()));
+ WebCore::FloatSize viewSize(gtk_widget_get_width(m_webPage.viewWidget()), gtk_widget_get_height(m_webPage.viewWidget()));
graphene_rect_t rect = GRAPHENE_RECT_INIT(0, 0, viewSize.width(), viewSize.height());
RefPtr<cairo_t> cr = adoptRef(gtk_snapshot_append_cairo(gtkSnapshot, &rect));
cairo_set_source_surface(cr.get(), m_surface.get(), 0, 0);
@@ -239,7 +238,7 @@
cairo_surface_flush(m_surface.get());
}
#else
-bool AcceleratedBackingStoreX11::paint(cairo_t* cr, const IntRect& clipRect)
+bool AcceleratedBackingStoreX11::paint(cairo_t* cr, const WebCore::IntRect& clipRect)
{
if (!m_surface)
return false;