diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/DrawingArea.h')
-rw-r--r-- | Source/WebKit2/WebProcess/WebPage/DrawingArea.h | 113 |
1 files changed, 78 insertions, 35 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h index adf7c5cc8..c3d682711 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h @@ -23,48 +23,54 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DrawingArea_h -#define DrawingArea_h +#pragma once #include "DrawingAreaInfo.h" #include "LayerTreeContext.h" +#include "MessageReceiver.h" +#include <WebCore/ActivityState.h> #include <WebCore/FloatRect.h> #include <WebCore/IntRect.h> -#include <WebCore/ViewState.h> +#include <WebCore/LayerFlushThrottleState.h> +#include <WebCore/LayoutMilestones.h> +#include <WebCore/PlatformScreen.h> #include <functional> #include <wtf/Forward.h> #include <wtf/Noncopyable.h> +#include <wtf/TypeCasts.h> +#include <wtf/Vector.h> namespace IPC { class Connection; -class MessageDecoder; +class Decoder; } namespace WebCore { +class DisplayRefreshMonitor; +class Frame; class FrameView; class GraphicsLayer; class GraphicsLayerFactory; +class MachSendRight; +struct ViewportAttributes; } namespace WebKit { struct ColorSpaceData; class LayerTreeHost; -class PageOverlay; class WebPage; struct WebPageCreationParameters; struct WebPreferencesStore; -class DrawingArea { +class DrawingArea : public IPC::MessageReceiver { WTF_MAKE_NONCOPYABLE(DrawingArea); public: - static std::unique_ptr<DrawingArea> create(WebPage*, const WebPageCreationParameters&); + static std::unique_ptr<DrawingArea> create(WebPage&, const WebPageCreationParameters&); virtual ~DrawingArea(); DrawingAreaType type() const { return m_type; } - - void didReceiveDrawingAreaMessage(IPC::Connection*, IPC::MessageDecoder&); virtual void setNeedsDisplay() = 0; virtual void setNeedsDisplayInRect(const WebCore::IntRect&) = 0; @@ -78,71 +84,108 @@ public: virtual bool layerTreeStateIsFrozen() const { return false; } virtual LayerTreeHost* layerTreeHost() const { return 0; } - virtual void didInstallPageOverlay(PageOverlay*) { } - virtual void didUninstallPageOverlay(PageOverlay*) { } - virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&) { } - virtual void setPageOverlayOpacity(PageOverlay*, float) { } - virtual void clearPageOverlay(PageOverlay*) { } - virtual void setPaintingEnabled(bool) { } virtual void updatePreferences(const WebPreferencesStore&) { } virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) { } -#if PLATFORM(MAC) - virtual void setExposedRect(const WebCore::FloatRect&) = 0; - virtual WebCore::FloatRect exposedRect() const = 0; - virtual void setCustomFixedPositionRect(const WebCore::FloatRect&) = 0; +#if PLATFORM(COCOA) + virtual void setViewExposedRect(std::optional<WebCore::FloatRect>) = 0; + virtual std::optional<WebCore::FloatRect> viewExposedRect() const = 0; + + virtual void acceleratedAnimationDidStart(uint64_t /*layerID*/, const String& /*key*/, double /*startTime*/) { } + virtual void acceleratedAnimationDidEnd(uint64_t /*layerID*/, const String& /*key*/) { } + virtual void addFence(const WebCore::MachSendRight&) { } +#endif +#if PLATFORM(IOS) + virtual WebCore::FloatRect exposedContentRect() const = 0; + virtual void setExposedContentRect(const WebCore::FloatRect&) = 0; #endif virtual void mainFrameScrollabilityChanged(bool) { } virtual bool supportsAsyncScrolling() { return false; } - virtual void didChangeScrollOffsetForAnyFrame() { } - virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) { return false; } -#if USE(ACCELERATED_COMPOSITING) - virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; } + virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return nullptr; } virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0; virtual void scheduleCompositingLayerFlush() = 0; -#endif + virtual void scheduleCompositingLayerFlushImmediately() = 0; -#if USE(COORDINATED_GRAPHICS) - virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection*, IPC::MessageDecoder&) = 0; +#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) + virtual RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID); #endif virtual void dispatchAfterEnsuringUpdatedScrollPosition(std::function<void ()>); - virtual void viewStateDidChange(WebCore::ViewState::Flags) { } + virtual void activityStateDidChange(WebCore::ActivityState::Flags, bool /* wantsDidUpdateActivityState */, const Vector<uint64_t>& /* callbackIDs */) { } virtual void setLayerHostingMode(LayerHostingMode) { } + virtual bool markLayersVolatileImmediatelyIfPossible() { return true; } + + virtual bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) { return false; } + + virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) { } + + virtual void setShouldScaleViewToFitDocument(bool) { } + + virtual bool dispatchDidReachLayoutMilestone(WebCore::LayoutMilestones) { return false; } + +#if PLATFORM(COCOA) + // Used by TiledCoreAnimationDrawingArea. + virtual void updateGeometry(const WebCore::IntSize& viewSize, const WebCore::IntSize& layerPosition, bool flushSynchronously, const WebCore::MachSendRight& fencePort) { } +#endif + + virtual void layerHostDidFlushLayers() { }; + +#if USE(COORDINATED_GRAPHICS_THREADED) + virtual void didChangeViewportAttributes(WebCore::ViewportAttributes&&) = 0; +#endif + +#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER) + virtual void deviceOrPageScaleFactorChanged() = 0; +#endif + protected: - DrawingArea(DrawingAreaType, WebPage*); + DrawingArea(DrawingAreaType, WebPage&); DrawingAreaType m_type; - WebPage* m_webPage; + WebPage& m_webPage; + +#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) + uint64_t m_nativeSurfaceHandleForCompositing { 0 }; +#endif private: + // IPC::MessageReceiver. + void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; + void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; + // Message handlers. // FIXME: These should be pure virtual. virtual void updateBackingStoreState(uint64_t /*backingStoreStateID*/, bool /*respondImmediately*/, float /*deviceScaleFactor*/, const WebCore::IntSize& /*size*/, const WebCore::IntSize& /*scrollOffset*/) { } virtual void didUpdate() { } -#if PLATFORM(MAC) +#if PLATFORM(COCOA) // Used by TiledCoreAnimationDrawingArea. - virtual void updateGeometry(const WebCore::IntSize& viewSize, const WebCore::IntSize& layerPosition) { } virtual void setDeviceScaleFactor(float) { } virtual void setColorSpace(const ColorSpaceData&) { } virtual void adjustTransientZoom(double scale, WebCore::FloatPoint origin) { } virtual void commitTransientZoom(double scale, WebCore::FloatPoint origin) { } + + virtual void addTransactionCallbackID(uint64_t callbackID) { ASSERT_NOT_REACHED(); } #endif -}; -#define DRAWING_AREA_TYPE_CASTS(ToValueTypeName, predicate) \ - TYPE_CASTS_BASE(ToValueTypeName, DrawingArea, value, value->predicate, value.predicate) +#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) + virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0; + virtual void destroyNativeSurfaceHandleForCompositing(bool&) = 0; +#endif +}; } // namespace WebKit -#endif // DrawingArea_h +#define SPECIALIZE_TYPE_TRAITS_DRAWING_AREA(ToValueTypeName, AreaType) \ +SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::ToValueTypeName) \ + static bool isType(const WebKit::DrawingArea& area) { return area.type() == WebKit::AreaType; } \ +SPECIALIZE_TYPE_TRAITS_END() |