Title: [259333] trunk/Source
Revision
259333
Author
[email protected]
Date
2020-03-31 19:29:56 -0700 (Tue, 31 Mar 2020)

Log Message

Add type traits for ScrollableArea, and other cleanup
https://bugs.webkit.org/show_bug.cgi?id=209838

Reviewed by Chris Dumez.

Source/WebCore:

Make it possible to use type casts on ScrollableArea so that EventHandler code can stop
passing around so many different types.

Because ScrollView inherits from both Widget and ScrollableArea, expand out its SPECIALIZE_TYPE_TRAITS macros.

Mark RenderLayer and RenderListBox ScrollableArea overrides as final.

* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::platformPrepareForWheelEvents): Null-check page and return early.
* platform/ScrollView.h:
(isType):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::isScrollView const):
(WebCore::ScrollableArea::isRenderLayer const):
(WebCore::ScrollableArea::isListBox const):
(WebCore::ScrollableArea::isPDFPlugin const):
* rendering/RenderLayer.h:
(isType):
* rendering/RenderListBox.h:
(isType):

Source/WebCore/../WebKit:

Because PDFPlugin inherits from both Plugin and ScrollableArea, expand out its SPECIALIZE_TYPE_TRAITS macros
and change the macros to use the isFoo() pattern.

* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.h:
(isType):
* WebProcess/Plugins/Plugin.h:
(WebKit::Plugin::isPluginProxy const):
(WebKit::Plugin::isNetscapePlugin const):
(WebKit::Plugin::isPDFPlugin const):
* WebProcess/Plugins/PluginProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259332 => 259333)


--- trunk/Source/WebCore/ChangeLog	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebCore/ChangeLog	2020-04-01 02:29:56 UTC (rev 259333)
@@ -1,3 +1,31 @@
+2020-03-31  Simon Fraser  <[email protected]>
+
+        Add type traits for ScrollableArea, and other cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=209838
+
+        Reviewed by Chris Dumez.
+
+        Make it possible to use type casts on ScrollableArea so that EventHandler code can stop
+        passing around so many different types.
+
+        Because ScrollView inherits from both Widget and ScrollableArea, expand out its SPECIALIZE_TYPE_TRAITS macros.
+
+        Mark RenderLayer and RenderListBox ScrollableArea overrides as final.
+
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::platformPrepareForWheelEvents): Null-check page and return early.
+        * platform/ScrollView.h:
+        (isType):
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::isScrollView const):
+        (WebCore::ScrollableArea::isRenderLayer const):
+        (WebCore::ScrollableArea::isListBox const):
+        (WebCore::ScrollableArea::isPDFPlugin const):
+        * rendering/RenderLayer.h:
+        (isType):
+        * rendering/RenderListBox.h:
+        (isType):
+
 2020-03-31  Kate Cheney  <[email protected]>
 
         Requests for messageHandlers() in the DOMWindow should be ignored for non-app-bound navigations

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (259332 => 259333)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-04-01 02:29:56 UTC (rev 259333)
@@ -950,8 +950,12 @@
 {
     clearOrScheduleClearingLatchedStateIfNeeded(wheelEvent);
 
-    FrameView* view = m_frame.view();
+    auto* page = m_frame.page();
+    if (!page)
+        return;
 
+    auto* view = m_frame.view();
+
     if (!view)
         scrollableContainer = wheelEventTarget;
     else {
@@ -971,13 +975,12 @@
         }
     }
 
-    Page* page = m_frame.page();
-    if (scrollableArea && page && page->isMonitoringWheelEvents())
+    if (scrollableArea && page->isMonitoringWheelEvents())
         scrollableArea->scrollAnimator().setWheelEventTestMonitor(page->wheelEventTestMonitor());
 
-    ScrollLatchingState* latchingState = page ? page->latchingState() : nullptr;
+    auto* latchingState = page->latchingState();
     if (wheelEvent.shouldConsiderLatching()) {
-        if (scrollableContainer && scrollableArea && page) {
+        if (scrollableContainer && scrollableArea) {
             bool startingAtScrollLimit = scrolledToEdgeInDominantDirection(*scrollableContainer, *scrollableArea.get(), wheelEvent.deltaX(), wheelEvent.deltaY());
             if (!startingAtScrollLimit) {
                 auto latchingState = WTF::makeUnique<ScrollLatchingState>();

Modified: trunk/Source/WebCore/platform/ScrollView.h (259332 => 259333)


--- trunk/Source/WebCore/platform/ScrollView.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebCore/platform/ScrollView.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -545,4 +545,7 @@
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_WIDGET(ScrollView, isScrollView())
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ScrollView)
+    static bool isType(const WebCore::Widget& widget) { return widget.isScrollView(); }
+    static bool isType(const WebCore::ScrollableArea& area) { return area.isScrollView(); }
+SPECIALIZE_TYPE_TRAITS_END()

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (259332 => 259333)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -48,7 +48,6 @@
 // scrollOffset() is the value used by scrollbars (min is 0,0), and should never have negative components.
 typedef IntPoint ScrollOffset;
 
-
 inline int offsetForOrientation(ScrollOffset offset, ScrollbarOrientation orientation)
 {
     switch (orientation) {
@@ -59,9 +58,13 @@
     return 0;
 }
 
-
 class ScrollableArea : public CanMakeWeakPtr<ScrollableArea> {
 public:
+    virtual bool isScrollView() const { return false; }
+    virtual bool isRenderLayer() const { return false; }
+    virtual bool isListBox() const { return false; }
+    virtual bool isPDFPlugin() const { return false; }
+
     ScrollBehaviorStatus currentScrollBehaviorStatus() { return static_cast<ScrollBehaviorStatus>(m_currentScrollBehaviorStatus); }
     void setScrollBehaviorStatus(ScrollBehaviorStatus status) { m_currentScrollBehaviorStatus = static_cast<unsigned>(status); }
 
@@ -412,4 +415,3 @@
 };
 
 } // namespace WebCore
-

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (259332 => 259333)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -433,9 +433,9 @@
 
     LayoutRect rect() const { return LayoutRect(location(), size()); }
 
-    IntSize visibleSize() const override;
-    IntSize contentsSize() const override;
-    IntSize reachableTotalContentsSize() const override;
+    IntSize visibleSize() const final;
+    IntSize contentsSize() const final;
+    IntSize reachableTotalContentsSize() const final;
 
     int scrollWidth() const;
     int scrollHeight() const;
@@ -445,7 +445,7 @@
     // Scrolling methods for layers that can scroll their overflow.
     void scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea = nullptr);
 
-    bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) override;
+    bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) final;
 
     WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped);
     WEBCORE_EXPORT void scrollToOffsetWithAnimation(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped);
@@ -464,7 +464,7 @@
     // Returns the nearest enclosing layer that is scrollable.
     RenderLayer* enclosingScrollableLayer(IncludeSelfOrNot, CrossFrameBoundaries) const;
 
-    void availableContentSizeChanged(AvailableSizeChangeReason) override;
+    void availableContentSizeChanged(AvailableSizeChangeReason) final;
 
     enum AutoscrollStatus { NotInProgress, InProgress };
     // "absoluteRect" is in scaled document coordinates.
@@ -483,21 +483,21 @@
     bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
     bool hasVerticalScrollbar() const { return verticalScrollbar(); }
 
-    bool horizontalScrollbarHiddenByStyle() const override;
-    bool verticalScrollbarHiddenByStyle() const override;
+    bool horizontalScrollbarHiddenByStyle() const final;
+    bool verticalScrollbarHiddenByStyle() const final;
 
     // ScrollableArea overrides
-    ScrollPosition scrollPosition() const override { return m_scrollPosition; }
+    ScrollPosition scrollPosition() const final { return m_scrollPosition; }
 
-    Scrollbar* horizontalScrollbar() const override { return m_hBar.get(); }
-    Scrollbar* verticalScrollbar() const override { return m_vBar.get(); }
-    ScrollableArea* enclosingScrollableArea() const override;
+    Scrollbar* horizontalScrollbar() const final { return m_hBar.get(); }
+    Scrollbar* verticalScrollbar() const final { return m_vBar.get(); }
+    ScrollableArea* enclosingScrollableArea() const final;
 
-    bool isScrollableOrRubberbandable() override;
-    bool hasScrollableOrRubberbandableAncestor() override;
+    bool isScrollableOrRubberbandable() final;
+    bool hasScrollableOrRubberbandableAncestor() final;
     bool useDarkAppearance() const final;
 #if ENABLE(CSS_SCROLL_SNAP)
-    void updateSnapOffsets() override;
+    void updateSnapOffsets() final;
 #endif
 
     bool requiresScrollPositionReconciliation() const { return m_requiresScrollPositionReconciliation; }
@@ -505,12 +505,12 @@
 
 #if PLATFORM(IOS_FAMILY)
 #if ENABLE(IOS_TOUCH_EVENTS)
-    bool handleTouchEvent(const PlatformTouchEvent&) override;
+    bool handleTouchEvent(const PlatformTouchEvent&) final;
 #endif
     
-    void didStartScroll() override;
-    void didEndScroll() override;
-    void didUpdateScroll() override;
+    void didStartScroll() final;
+    void didEndScroll() final;
+    void didUpdateScroll() final;
 #endif
 
     // Returns true when the layer could do touch scrolling, but doesn't look at whether there is actually scrollable overflow.
@@ -857,12 +857,12 @@
     RenderLayerBacking* ensureBacking();
     void clearBacking(bool layerBeingDestroyed = false);
 
-    GraphicsLayer* layerForHorizontalScrollbar() const override;
-    GraphicsLayer* layerForVerticalScrollbar() const override;
-    GraphicsLayer* layerForScrollCorner() const override;
+    GraphicsLayer* layerForHorizontalScrollbar() const final;
+    GraphicsLayer* layerForVerticalScrollbar() const final;
+    GraphicsLayer* layerForScrollCorner() const final;
 
-    bool usesCompositedScrolling() const override;
-    bool usesAsyncScrolling() const override;
+    bool usesCompositedScrolling() const final;
+    bool usesAsyncScrolling() const final;
 
     bool hasCompositedScrollingAncestor() const { return m_hasCompositedScrollingAncestor; }
     void setHasCompositedScrollingAncestor(bool hasCompositedScrollingAncestor) { m_hasCompositedScrollingAncestor = hasCompositedScrollingAncestor; }
@@ -1106,31 +1106,32 @@
     bool shouldBeSelfPaintingLayer() const;
 
     // ScrollableArea interface
-    void invalidateScrollbarRect(Scrollbar&, const IntRect&) override;
-    void invalidateScrollCornerRect(const IntRect&) override;
-    bool isActive() const override;
-    bool isScrollCornerVisible() const override;
-    IntRect scrollCornerRect() const override;
-    IntRect convertFromScrollbarToContainingView(const Scrollbar&, const IntRect&) const override;
-    IntRect convertFromContainingViewToScrollbar(const Scrollbar&, const IntRect&) const override;
-    IntPoint convertFromScrollbarToContainingView(const Scrollbar&, const IntPoint&) const override;
-    IntPoint convertFromContainingViewToScrollbar(const Scrollbar&, const IntPoint&) const override;
-    void setScrollOffset(const ScrollOffset&) override;
-    ScrollingNodeID scrollingNodeID() const override;
+    bool isRenderLayer() const final { return true; }
+    void invalidateScrollbarRect(Scrollbar&, const IntRect&) final;
+    void invalidateScrollCornerRect(const IntRect&) final;
+    bool isActive() const final;
+    bool isScrollCornerVisible() const final;
+    IntRect scrollCornerRect() const final;
+    IntRect convertFromScrollbarToContainingView(const Scrollbar&, const IntRect&) const final;
+    IntRect convertFromContainingViewToScrollbar(const Scrollbar&, const IntRect&) const final;
+    IntPoint convertFromScrollbarToContainingView(const Scrollbar&, const IntPoint&) const final;
+    IntPoint convertFromContainingViewToScrollbar(const Scrollbar&, const IntPoint&) const final;
+    void setScrollOffset(const ScrollOffset&) final;
+    ScrollingNodeID scrollingNodeID() const final;
 
-    IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
-    IntSize overhangAmount() const override;
-    IntPoint lastKnownMousePosition() const override;
-    bool isHandlingWheelEvent() const override;
-    bool shouldSuspendScrollAnimations() const override;
-    IntRect scrollableAreaBoundingBox(bool* isInsideFixed = nullptr) const override;
-    bool isRubberBandInProgress() const override;
-    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const override;
+    IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const final;
+    IntSize overhangAmount() const final;
+    IntPoint lastKnownMousePosition() const final;
+    bool isHandlingWheelEvent() const final;
+    bool shouldSuspendScrollAnimations() const final;
+    IntRect scrollableAreaBoundingBox(bool* isInsideFixed = nullptr) const final;
+    bool isRubberBandInProgress() const final;
+    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const final;
 #if ENABLE(CSS_SCROLL_SNAP)
-    bool isScrollSnapInProgress() const override;
+    bool isScrollSnapInProgress() const final;
 #endif
-    bool usesMockScrollAnimator() const override;
-    void logMockScrollAnimatorMessage(const String&) const override;
+    bool usesMockScrollAnimator() const final;
+    void logMockScrollAnimatorMessage(const String&) const final;
 
 #if ENABLE(IOS_TOUCH_EVENTS)
     void registerAsTouchEventListenerForScrolling();
@@ -1426,3 +1427,7 @@
 void showPaintOrderTree(const WebCore::RenderLayer*);
 void showLayerTree(const WebCore::RenderObject*);
 #endif
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::RenderLayer)
+    static bool isType(const WebCore::ScrollableArea& area) { return area.isRenderLayer(); }
+SPECIALIZE_TYPE_TRAITS_END()

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (259332 => 259333)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -62,10 +62,10 @@
 
     bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override;
 
-    bool scrolledToTop() const override;
-    bool scrolledToBottom() const override;
-    bool scrolledToLeft() const override;
-    bool scrolledToRight() const override;
+    bool scrolledToTop() const final;
+    bool scrolledToBottom() const final;
+    bool scrolledToLeft() const final;
+    bool scrolledToRight() const final;
 
 private:
     void willBeDestroyed() override;
@@ -112,35 +112,35 @@
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
 
     // ScrollableArea interface.
-    void setScrollOffset(const ScrollOffset&) override;
+    void setScrollOffset(const ScrollOffset&) final;
 
-    ScrollPosition scrollPosition() const override;
-    ScrollPosition minimumScrollPosition() const override;
-    ScrollPosition maximumScrollPosition() const override;
+    ScrollPosition scrollPosition() const final;
+    ScrollPosition minimumScrollPosition() const final;
+    ScrollPosition maximumScrollPosition() const final;
 
-    void invalidateScrollbarRect(Scrollbar&, const IntRect&) override;
-    bool isActive() const override;
-    bool isScrollCornerVisible() const override { return false; } // We don't support resize on list boxes yet. If we did these would have to change.
-    IntRect scrollCornerRect() const override { return IntRect(); }
-    void invalidateScrollCornerRect(const IntRect&) override { }
-    IntRect convertFromScrollbarToContainingView(const Scrollbar&, const IntRect&) const override;
-    IntRect convertFromContainingViewToScrollbar(const Scrollbar&, const IntRect&) const override;
-    IntPoint convertFromScrollbarToContainingView(const Scrollbar&, const IntPoint&) const override;
-    IntPoint convertFromContainingViewToScrollbar(const Scrollbar&, const IntPoint&) const override;
-    Scrollbar* verticalScrollbar() const override { return m_vBar.get(); }
-    IntSize contentsSize() const override;
-    IntSize visibleSize() const override { return IntSize(width(), height()); }
-    IntPoint lastKnownMousePosition() const override;
-    bool isHandlingWheelEvent() const override;
-    bool shouldSuspendScrollAnimations() const override;
-    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const override;
+    void invalidateScrollbarRect(Scrollbar&, const IntRect&) final;
+    bool isActive() const final;
+    bool isScrollCornerVisible() const final { return false; } // We don't support resize on list boxes yet. If we did these would have to change.
+    IntRect scrollCornerRect() const final { return IntRect(); }
+    void invalidateScrollCornerRect(const IntRect&) final { }
+    IntRect convertFromScrollbarToContainingView(const Scrollbar&, const IntRect&) const final;
+    IntRect convertFromContainingViewToScrollbar(const Scrollbar&, const IntRect&) const final;
+    IntPoint convertFromScrollbarToContainingView(const Scrollbar&, const IntPoint&) const final;
+    IntPoint convertFromContainingViewToScrollbar(const Scrollbar&, const IntPoint&) const final;
+    Scrollbar* verticalScrollbar() const final { return m_vBar.get(); }
+    IntSize contentsSize() const final;
+    IntSize visibleSize() const final { return IntSize(width(), height()); }
+    IntPoint lastKnownMousePosition() const final;
+    bool isHandlingWheelEvent() const final;
+    bool shouldSuspendScrollAnimations() const final;
+    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const final;
 
-    ScrollableArea* enclosingScrollableArea() const override;
-    bool isScrollableOrRubberbandable() override;
-    bool hasScrollableOrRubberbandableAncestor() override;
-    IntRect scrollableAreaBoundingBox(bool* = nullptr) const override;
-    bool usesMockScrollAnimator() const override;
-    void logMockScrollAnimatorMessage(const String&) const override;
+    ScrollableArea* enclosingScrollableArea() const final;
+    bool isScrollableOrRubberbandable() final;
+    bool hasScrollableOrRubberbandableAncestor() final;
+    IntRect scrollableAreaBoundingBox(bool* = nullptr) const final;
+    bool usesMockScrollAnimator() const final;
+    void logMockScrollAnimatorMessage(const String&) const final;
 
     // NOTE: This should only be called by the overridden setScrollOffset from ScrollableArea.
     void scrollTo(int newOffset);
@@ -187,4 +187,7 @@
 
 } // namepace WebCore
 
-SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderListBox, isListBox())
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::RenderListBox)
+    static bool isType(const WebCore::RenderObject& widget) { return widget.isListBox(); }
+    static bool isType(const WebCore::ScrollableArea& area) { return area.isListBox(); }
+SPECIALIZE_TYPE_TRAITS_END()

Modified: trunk/Source/WebKit/ChangeLog (259332 => 259333)


--- trunk/Source/WebKit/ChangeLog	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebKit/ChangeLog	2020-04-01 02:29:56 UTC (rev 259333)
@@ -1,3 +1,22 @@
+2020-03-31  Simon Fraser  <[email protected]>
+
+        Add type traits for ScrollableArea, and other cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=209838
+
+        Reviewed by Chris Dumez.
+
+        Because PDFPlugin inherits from both Plugin and ScrollableArea, expand out its SPECIALIZE_TYPE_TRAITS macros
+        and change the macros to use the isFoo() pattern.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        (isType):
+        * WebProcess/Plugins/Plugin.h:
+        (WebKit::Plugin::isPluginProxy const):
+        (WebKit::Plugin::isNetscapePlugin const):
+        (WebKit::Plugin::isPDFPlugin const):
+        * WebProcess/Plugins/PluginProxy.h:
+
 2020-03-31  Wenson Hsieh  <[email protected]>
 
         Datalist option's label not used

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.h (259332 => 259333)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -378,6 +378,6 @@
 
 } // namespace WebKit
 
-SPECIALIZE_TYPE_TRAITS_PLUGIN(NetscapePlugin, NetscapePluginType)
+SPECIALIZE_TYPE_TRAITS_PLUGIN(NetscapePlugin, isNetscapePlugin())
 
 #endif // ENABLE(NETSCAPE_PLUGIN_API)

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h (259332 => 259333)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -219,6 +219,7 @@
     bool shouldAlwaysAutoStart() const final { return true; }
 
     // ScrollableArea functions.
+    bool isPDFPlugin() const final { return true; }
     WebCore::IntRect scrollCornerRect() const final;
     WebCore::ScrollableArea* enclosingScrollableArea() const final;
     bool isScrollableOrRubberbandable() final { return true; }
@@ -402,6 +403,9 @@
 
 } // namespace WebKit
 
-SPECIALIZE_TYPE_TRAITS_PLUGIN(PDFPlugin, PDFPluginType)
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::PDFPlugin)
+    static bool isType(const WebKit::Plugin& plugin) { return plugin.isPDFPlugin(); }
+    static bool isType(const WebCore::ScrollableArea& area) { return area.isPDFPlugin(); }
+SPECIALIZE_TYPE_TRAITS_END()
 
 #endif // ENABLE(PDFKIT_PLUGIN)

Modified: trunk/Source/WebKit/WebProcess/Plugins/Plugin.h (259332 => 259333)


--- trunk/Source/WebKit/WebProcess/Plugins/Plugin.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebKit/WebProcess/Plugins/Plugin.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -114,8 +114,11 @@
 
     PluginType type() const { return m_type; }
 
+    bool isPluginProxy() const { return m_type == PluginProxyType; }
+    bool isNetscapePlugin() const { return m_type == NetscapePluginType; }
+    bool isPDFPlugin() const { return m_type == PDFPluginType; }
+
 private:
-
     // Initializes the plug-in. If the plug-in fails to initialize this should return false.
     // This is only called by the other initialize overload so it can be made private.
     virtual bool initialize(const Parameters&) = 0;
@@ -319,7 +322,7 @@
     
 } // namespace WebKit
 
-#define SPECIALIZE_TYPE_TRAITS_PLUGIN(ToValueTypeName, SpecificPluginType) \
+#define SPECIALIZE_TYPE_TRAITS_PLUGIN(ToValueTypeName, predicate) \
 SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::ToValueTypeName) \
-static bool isType(const WebKit::Plugin& plugin) { return plugin.type() == WebKit::SpecificPluginType; } \
+static bool isType(const WebKit::Plugin& plugin) { return plugin.predicate; } \
 SPECIALIZE_TYPE_TRAITS_END()

Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.h (259332 => 259333)


--- trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.h	2020-04-01 02:06:50 UTC (rev 259332)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginProxy.h	2020-04-01 02:29:56 UTC (rev 259333)
@@ -232,7 +232,7 @@
 
 } // namespace WebKit
 
-SPECIALIZE_TYPE_TRAITS_PLUGIN(PluginProxy, PluginProxyType)
+SPECIALIZE_TYPE_TRAITS_PLUGIN(PluginProxy, isPluginProxy())
 
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to