⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245716 in webkit


Ignore:
Timestamp:
May 23, 2019, 2:17:57 PM (7 years ago)
Author:
Alan Bujtas
Message:

[Hittest] Move hittesting from RenderView to Document
https://bugs.webkit.org/show_bug.cgi?id=198192
<rdar://problem/51077762>

Reviewed by Antti Koivisto.

Source/WebCore:

RenderView is not refcounted and may be destroyed in updateLayout(), so enter hit-testing from Document.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::press):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::visiblePositionForPoint const):

  • dom/Document.cpp:

(WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower):
(WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower):
(WebCore::Document::scheduleStyleRecalc):
(WebCore::Document::prepareMouseEvent):
(WebCore::Document::hitTest):

  • dom/Document.h:

(WebCore::Document::inHitTesting const):

  • dom/TreeScope.cpp:

(WebCore::TreeScope::nodeFromPoint):
(WebCore::TreeScope::elementsFromPoint):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::contains const):

  • html/HTMLPlugInElement.cpp:

(WebCore::HTMLPlugInElement::isReplacementObscured):

  • html/MediaElementSession.cpp:

(WebCore::isElementMainContentForPurposesOfAutoplay):

  • page/DragController.cpp:

(WebCore::elementUnderMouse):

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMouseDraggedEvent):
(WebCore::EventHandler::eventMayStartDrag const):
(WebCore::EventHandler::updateSelectionForMouseDrag):
(WebCore::EventHandler::hitTestResultAtPoint const):
(WebCore::EventHandler::updateCursor):
(WebCore::EventHandler::isInsideScrollbar const):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::hoverTimerFired):
(WebCore::EventHandler::handleDrag):
(WebCore::hitTestResultInFrame):

  • page/FrameViewLayoutContext.cpp:

(WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):

  • rendering/RenderView.cpp:

(WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Deleted.
(WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower): Deleted.
(): Deleted.
(WebCore::RenderView::hitTest): Deleted.

  • rendering/RenderView.h:
  • rendering/RenderWidget.cpp:

(WebCore::RenderWidget::nodeAtPoint):

  • testing/Internals.cpp:

(WebCore::Internals::nodesFromRect const):

Source/WebKit:

  • WebProcess/WebPage/ViewGestureGeometryCollector.cpp:

(WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::determinePrimarySnapshottedPlugIn):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::dynamicViewportSizeUpdate):

Location:
trunk/Source
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r245715 r245716  
     12019-05-23  Zalan Bujtas  <zalan@apple.com>
     2
     3        [Hittest] Move hittesting from RenderView to Document
     4        https://bugs.webkit.org/show_bug.cgi?id=198192
     5        <rdar://problem/51077762>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        RenderView is not refcounted and may be destroyed in updateLayout(), so enter hit-testing from Document.
     10
     11        * accessibility/AccessibilityObject.cpp:
     12        (WebCore::AccessibilityObject::press):
     13        * accessibility/AccessibilityRenderObject.cpp:
     14        (WebCore::AccessibilityRenderObject::visiblePositionForPoint const):
     15        * dom/Document.cpp:
     16        (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower):
     17        (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower):
     18        (WebCore::Document::scheduleStyleRecalc):
     19        (WebCore::Document::prepareMouseEvent):
     20        (WebCore::Document::hitTest):
     21        * dom/Document.h:
     22        (WebCore::Document::inHitTesting const):
     23        * dom/TreeScope.cpp:
     24        (WebCore::TreeScope::nodeFromPoint):
     25        (WebCore::TreeScope::elementsFromPoint):
     26        * editing/FrameSelection.cpp:
     27        (WebCore::FrameSelection::contains const):
     28        * html/HTMLPlugInElement.cpp:
     29        (WebCore::HTMLPlugInElement::isReplacementObscured):
     30        * html/MediaElementSession.cpp:
     31        (WebCore::isElementMainContentForPurposesOfAutoplay):
     32        * page/DragController.cpp:
     33        (WebCore::elementUnderMouse):
     34        * page/EventHandler.cpp:
     35        (WebCore::EventHandler::handleMouseDraggedEvent):
     36        (WebCore::EventHandler::eventMayStartDrag const):
     37        (WebCore::EventHandler::updateSelectionForMouseDrag):
     38        (WebCore::EventHandler::hitTestResultAtPoint const):
     39        (WebCore::EventHandler::updateCursor):
     40        (WebCore::EventHandler::isInsideScrollbar const):
     41        (WebCore::EventHandler::handleWheelEvent):
     42        (WebCore::EventHandler::hoverTimerFired):
     43        (WebCore::EventHandler::handleDrag):
     44        (WebCore::hitTestResultInFrame):
     45        * page/FrameViewLayoutContext.cpp:
     46        (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
     47        * rendering/RenderView.cpp:
     48        (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Deleted.
     49        (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower): Deleted.
     50        (): Deleted.
     51        (WebCore::RenderView::hitTest): Deleted.
     52        * rendering/RenderView.h:
     53        * rendering/RenderWidget.cpp:
     54        (WebCore::RenderWidget::nodeAtPoint):
     55        * testing/Internals.cpp:
     56        (WebCore::Internals::nodesFromRect const):
     57
    1582019-05-23  Youenn Fablet  <youenn@apple.com>
    259
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r245565 r245716  
    10721072        HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AccessibilityHitTest);
    10731073        HitTestResult hitTestResult(clickPoint());
    1074         document->renderView()->hitTest(request, hitTestResult);
     1074        document->hitTest(request, hitTestResult);
    10751075        if (auto* innerNode = hitTestResult.innerNode()) {
    10761076            if (auto* shadowHost = innerNode->shadowHost())
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r245565 r245716  
    22122212                               HitTestRequest::Active);
    22132213        HitTestResult result(ourpoint);
    2214         renderView->hitTest(request, result);
     2214        renderView->document().hitTest(request, result);
    22152215        innerNode = result.innerNode();
    22162216        if (!innerNode)
  • trunk/Source/WebCore/dom/Document.cpp

    r245712 r245716  
    184184#include "ScriptState.h"
    185185#include "ScriptedAnimationController.h"
     186#include "ScrollbarTheme.h"
    186187#include "ScrollingCoordinator.h"
    187188#include "SecurityOrigin.h"
     
    332333static const Seconds maxIntervalForUserGestureForwardingAfterMediaFinishesPlaying { 1_s };
    333334
     335struct FrameFlatteningLayoutDisallower {
     336    FrameFlatteningLayoutDisallower(FrameView& frameView)
     337        : m_frameView(frameView)
     338        , m_disallowLayout(frameView.effectiveFrameFlattening() != FrameFlattening::Disabled)
     339    {
     340        if (m_disallowLayout)
     341            m_frameView.startDisallowingLayout();
     342    }
     343
     344    ~FrameFlatteningLayoutDisallower()
     345    {
     346        if (m_disallowLayout)
     347            m_frameView.endDisallowingLayout();
     348    }
     349
     350private:
     351    FrameView& m_frameView;
     352    bool m_disallowLayout { false };
     353};
     354
    334355// DOM Level 2 says (letters added):
    335356//
     
    17871808void Document::scheduleStyleRecalc()
    17881809{
    1789     ASSERT(!m_renderView || !m_renderView->inHitTesting());
     1810    ASSERT(!m_renderView || !inHitTesting());
    17901811
    17911812    if (m_styleRecalcTimer.isActive() || pageCacheState() != NotInPageCache)
     
    37053726
    37063727    HitTestResult result(documentPoint);
    3707     renderView()->hitTest(request, result);
     3728    hitTest(request, result);
    37083729
    37093730    if (!request.readOnly())
     
    80158036}
    80168037
     8038bool Document::hitTest(const HitTestRequest& request, HitTestResult& result)
     8039{
     8040    return hitTest(request, result.hitTestLocation(), result);
     8041}
     8042
     8043bool Document::hitTest(const HitTestRequest& request, const HitTestLocation& location, HitTestResult& result)
     8044{
     8045    Ref<Document> protectedThis(*this);
     8046    updateLayout();
     8047    if (!renderView())
     8048        return false;
     8049
     8050#if !ASSERT_DISABLED
     8051    SetForScope<bool> hitTestRestorer { m_inHitTesting, true };
     8052#endif
     8053
     8054    auto& frameView = renderView()->frameView();
     8055    Ref<FrameView> protector(frameView);
     8056
     8057    FrameFlatteningLayoutDisallower disallower(frameView);
     8058
     8059    bool resultLayer = renderView()->layer()->hitTest(request, location, result);
     8060
     8061    // ScrollView scrollbars are not the same as RenderLayer scrollbars tested by RenderLayer::hitTestOverflowControls,
     8062    // so we need to test ScrollView scrollbars separately here. In case of using overlay scrollbars, the layer hit test
     8063    // will always work so we need to check the ScrollView scrollbars in that case too.
     8064    if (!resultLayer || ScrollbarTheme::theme().usesOverlayScrollbars()) {
     8065        // FIXME: Consider if this test should be done unconditionally.
     8066        if (request.allowsFrameScrollbars()) {
     8067            IntPoint windowPoint = frameView.contentsToWindow(location.roundedPoint());
     8068            if (auto* frameScrollbar = frameView.scrollbarAtPoint(windowPoint)) {
     8069                result.setScrollbar(frameScrollbar);
     8070                return true;
     8071            }
     8072        }
     8073    }
     8074    return resultLayer;
     8075}
     8076
    80178077ElementIdentifier Document::identifierForElement(Element& element)
    80188078{
  • trunk/Source/WebCore/dom/Document.h

    r245467 r245716  
    139139class HTMLPictureElement;
    140140class HTMLScriptElement;
     141class HitTestLocation;
    141142class HitTestRequest;
    142143class HitTestResult;
     
    15251526    void frameWasDisconnectedFromOwner();
    15261527
     1528    WEBCORE_EXPORT bool hitTest(const HitTestRequest&, HitTestResult&);
     1529    bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
     1530#if !ASSERT_DISABLED
     1531    bool inHitTesting() const { return m_inHitTesting; }
     1532#endif
     1533
    15271534protected:
    15281535    enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     
    20012008    bool m_areDeviceMotionAndOrientationUpdatesSuspended { false };
    20022009    bool m_userDidInteractWithPage { false };
     2010#if !ASSERT_DISABLED
     2011    bool m_inHitTesting { false };
     2012#endif
    20032013
    20042014#if ENABLE(TELEPHONE_NUMBER_DETECTION)
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r245320 r245716  
    357357
    358358    HitTestResult result(absolutePoint.value());
    359     documentScope().renderView()->hitTest(HitTestRequest(), result);
    360 
     359    documentScope().hitTest(HitTestRequest(), result);
    361360    if (localPoint)
    362361        *localPoint = result.localPoint();
    363 
    364362    return result.innerNode();
    365363}
     
    404402        | HitTestRequest::IncludeAllElementsUnderPoint);
    405403    HitTestResult result(absolutePoint.value());
    406     documentScope().renderView()->hitTest(request, result);
     404    documentScope().hitTest(request, result);
    407405
    408406    Node* lastNode = nullptr;
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r239971 r245716  
    18801880        return false;
    18811881   
    1882     RenderView* renderView = m_frame->contentRenderer();
    1883     if (!renderView)
     1882    auto* document = m_frame->document();
     1883    if (!document)
    18841884        return false;
    18851885   
    18861886    HitTestResult result(point);
    1887     renderView->hitTest(HitTestRequest(), result);
     1887    document->hitTest(HitTestRequest(), result);
    18881888    Node* innerNode = result.innerNode();
    18891889    if (!innerNode || !innerNode->renderer())
  • trunk/Source/WebCore/html/HTMLPlugInElement.cpp

    r242920 r245716  
    474474    ASSERT(!renderView->needsLayout());
    475475    ASSERT(!renderView->document().needsStyleRecalc());
    476     bool hit = renderView->hitTest(request, location, result);
     476    bool hit = topDocument->hitTest(request, location, result);
    477477    if (!hit || result.innerNode() != &pluginRenderer.frameOwnerElement())
    478478        return true;
    479479
    480480    location = LayoutPoint(x, y);
    481     hit = renderView->hitTest(request, location, result);
     481    hit = topDocument->hitTest(request, location, result);
    482482    if (!hit || result.innerNode() != &pluginRenderer.frameOwnerElement())
    483483        return true;
    484484
    485485    location = LayoutPoint(x + width, y);
    486     hit = renderView->hitTest(request, location, result);
     486    hit = topDocument->hitTest(request, location, result);
    487487    if (!hit || result.innerNode() != &pluginRenderer.frameOwnerElement())
    488488        return true;
    489489
    490490    location = LayoutPoint(x + width, y + height);
    491     hit = renderView->hitTest(request, location, result);
     491    hit = topDocument->hitTest(request, location, result);
    492492    if (!hit || result.innerNode() != &pluginRenderer.frameOwnerElement())
    493493        return true;
    494494
    495495    location = LayoutPoint(x, y + height);
    496     hit = renderView->hitTest(request, location, result);
     496    hit = topDocument->hitTest(request, location, result);
    497497    if (!hit || result.innerNode() != &pluginRenderer.frameOwnerElement())
    498498        return true;
  • trunk/Source/WebCore/html/MediaElementSession.cpp

    r245467 r245716  
    855855        return true;
    856856
    857     RenderView& mainRenderView = *mainFrame.view()->renderView();
    858 
    859857    // Hit test the area of the main frame where the element appears, to determine if the element is being obscured.
    860858    IntRect rectRelativeToView = element.clientRect();
     
    865863
    866864    // Elements which are obscured by other elements cannot be main content.
    867     mainRenderView.hitTest(request, result);
     865    if (!mainFrame.document())
     866        return false;
     867    mainFrame.document()->hitTest(request, result);
    868868    result.setToNonUserAgentShadowAncestor();
    869869    RefPtr<Element> hitElement = result.targetElement();
  • trunk/Source/WebCore/page/DragController.cpp

    r244056 r245716  
    367367
    368368    HitTestResult result(point);
    369     documentUnderMouse->renderView()->hitTest(HitTestRequest(), result);
     369    documentUnderMouse->hitTest(HitTestRequest(), result);
    370370
    371371    auto* node = result.innerNode();
  • trunk/Source/WebCore/page/EventHandler.cpp

    r245062 r245716  
    901901    if (m_selectionInitiationState != ExtendedSelection) {
    902902        HitTestResult result(m_mouseDownPos);
    903         m_frame.document()->renderView()->hitTest(HitTestRequest(), result);
     903        m_frame.document()->hitTest(HitTestRequest(), result);
    904904
    905905        updateSelectionForMouseDrag(result);
     
    914914    // that its logic needs to stay in sync with handleMouseMoveEvent() and the way we setMouseDownMayStartDrag
    915915    // in handleMousePressEvent
    916     RenderView* renderView = m_frame.contentRenderer();
    917     if (!renderView)
     916    auto* document = m_frame.document();
     917    if (!document)
    918918        return false;
    919919
     
    934934    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowUserAgentShadowContent);
    935935    HitTestResult result(view->windowToContents(event.position()));
    936     renderView->hitTest(request, result);
     936    document->hitTest(request, result);
    937937    DragState state;
    938938    Element* targetElement = result.targetElement();
     
    948948    if (!view)
    949949        return;
    950     RenderView* renderView = m_frame.contentRenderer();
    951     if (!renderView)
     950    auto* document = m_frame.document();
     951    if (!document)
    952952        return;
    953953
    954954    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::Move | HitTestRequest::DisallowUserAgentShadowContent);
    955955    HitTestResult result(view->windowToContents(m_lastKnownMousePosition));
    956     renderView->hitTest(request, result);
     956    document->hitTest(request, result);
    957957    updateSelectionForMouseDrag(result);
    958958}
     
    11991199
    12001200    HitTestResult result(point, nonNegativePaddingHeight, nonNegativePaddingWidth, nonNegativePaddingHeight, nonNegativePaddingWidth);
    1201     RenderView* renderView = m_frame.contentRenderer();
    1202     if (!renderView)
     1201    auto* document = m_frame.document();
     1202    if (!document)
    12031203        return result;
    12041204
    12051205    // hitTestResultAtPoint is specifically used to hitTest into all frames, thus it always allows child frame content.
    12061206    HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent);
    1207     renderView->hitTest(request, result);
     1207    document->hitTest(request, result);
    12081208    if (!request.readOnly())
    12091209        m_frame.document()->updateHoverActiveState(request, result.targetElement());
     
    14011401        return;
    14021402
    1403     RenderView* renderView = view->renderView();
    1404     if (!renderView)
     1403    auto* document = m_frame.document();
     1404    if (!document)
    14051405        return;
    14061406
     
    14161416    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowFrameScrollbars);
    14171417    HitTestResult result(view->windowToContents(m_lastKnownMousePosition));
    1418     renderView->hitTest(request, result);
     1418    document->hitTest(request, result);
    14191419
    14201420    updateCursor(*view, result, shiftKey);
     
    26652665bool EventHandler::isInsideScrollbar(const IntPoint& windowPoint) const
    26662666{
    2667     if (RenderView* renderView = m_frame.contentRenderer()) {
     2667    if (auto* document = m_frame.document()) {
    26682668        HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowUserAgentShadowContent);
    26692669        HitTestResult result(windowPoint);
    2670         renderView->hitTest(request, result);
     2670        document->hitTest(request, result);
    26712671        return result.scrollbar();
    26722672    }
     
    27842784bool EventHandler::handleWheelEvent(const PlatformWheelEvent& event)
    27852785{
    2786     RenderView* renderView = m_frame.contentRenderer();
    2787     if (!renderView)
     2786    auto* document = m_frame.document();
     2787    if (!document)
    27882788        return false;
    27892789
     
    28072807    HitTestRequest request;
    28082808    HitTestResult result(view->windowToContents(event.position()));
    2809     renderView->hitTest(request, result);
     2809    document->hitTest(request, result);
    28102810
    28112811    RefPtr<Element> element = result.targetElement();
     
    31193119    Ref<Frame> protectedFrame(m_frame);
    31203120
    3121     if (RenderView* renderView = m_frame.contentRenderer()) {
     3121    if (auto* document = m_frame.document()) {
    31223122        if (FrameView* view = m_frame.view()) {
    31233123            HitTestRequest request(HitTestRequest::Move | HitTestRequest::DisallowUserAgentShadowContent);
    31243124            HitTestResult result(view->windowToContents(m_lastKnownMousePosition));
    3125             renderView->hitTest(request, result);
    3126             m_frame.document()->updateHoverActiveState(request, result.targetElement());
     3125            document->hitTest(request, result);
     3126            document->updateHoverActiveState(request, result.targetElement());
    31273127        }
    31283128    }
     
    36833683        HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowUserAgentShadowContent);
    36843684        HitTestResult result(m_mouseDownPos);
    3685         m_frame.contentRenderer()->hitTest(request, result);
     3685        m_frame.document()->hitTest(request, result);
    36863686        if (m_frame.page())
    36873687            dragState().source = m_frame.page()->dragController().draggableElement(&m_frame, result.targetElement(), m_mouseDownPos, dragState());
     
    40584058            return result;
    40594059    }
    4060     frame->contentRenderer()->hitTest(HitTestRequest(hitType), result);
     4060    frame->document()->hitTest(HitTestRequest(hitType), result);
    40614061    return result;
    40624062}
  • trunk/Source/WebCore/page/FrameViewLayoutContext.cpp

    r244682 r245716  
    322322
    323323    if (auto* renderView = this->renderView()) {
    324         ASSERT(!renderView->inHitTesting());
     324        ASSERT(!frame().document()->inHitTesting());
    325325        renderView->setNeedsLayout();
    326326        scheduleLayout();
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r245543 r245716  
    5050#include "RenderTreeBuilder.h"
    5151#include "RenderWidget.h"
    52 #include "ScrollbarTheme.h"
    5352#include "Settings.h"
    5453#include "StyleInheritedData.h"
     
    6261WTF_MAKE_ISO_ALLOCATED_IMPL(RenderView);
    6362
    64 struct FrameFlatteningLayoutDisallower {
    65     FrameFlatteningLayoutDisallower(FrameView& frameView)
    66         : m_frameView(frameView)
    67         , m_disallowLayout(frameView.effectiveFrameFlattening() != FrameFlattening::Disabled)
    68     {
    69         if (m_disallowLayout)
    70             m_frameView.startDisallowingLayout();
    71     }
    72 
    73     ~FrameFlatteningLayoutDisallower()
    74     {
    75         if (m_disallowLayout)
    76             m_frameView.endDisallowingLayout();
    77     }
    78 
    79 private:
    80     FrameView& m_frameView;
    81     bool m_disallowLayout { false };
    82 };
    83 
    8463RenderView::RenderView(Document& document, RenderStyle&& style)
    8564    : RenderBlockFlow(document, WTFMove(style))
     
    136115    }
    137116    m_renderersNeedingLazyRepaint.clear();
    138 }
    139 
    140 bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result)
    141 {
    142     return hitTest(request, result.hitTestLocation(), result);
    143 }
    144 
    145 bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& location, HitTestResult& result)
    146 {
    147     document().updateLayout();
    148    
    149 #if !ASSERT_DISABLED
    150     SetForScope<bool> hitTestRestorer { m_inHitTesting, true };
    151 #endif
    152 
    153     FrameFlatteningLayoutDisallower disallower(frameView());
    154 
    155     bool resultLayer = layer()->hitTest(request, location, result);
    156 
    157     // ScrollView scrollbars are not the same as RenderLayer scrollbars tested by RenderLayer::hitTestOverflowControls,
    158     // so we need to test ScrollView scrollbars separately here. In case of using overlay scrollbars, the layer hit test
    159     // will always work so we need to check the ScrollView scrollbars in that case too.
    160     if (!resultLayer || ScrollbarTheme::theme().usesOverlayScrollbars()) {
    161         // FIXME: Consider if this test should be done unconditionally.
    162         if (request.allowsFrameScrollbars()) {
    163             IntPoint windowPoint = frameView().contentsToWindow(location.roundedPoint());
    164             if (Scrollbar* frameScrollbar = frameView().scrollbarAtPoint(windowPoint)) {
    165                 result.setScrollbar(frameScrollbar);
    166                 return true;
    167             }
    168         }
    169     }
    170 
    171     return resultLayer;
    172117}
    173118
  • trunk/Source/WebCore/rendering/RenderView.h

    r242936 r245716  
    4343    RenderView(Document&, RenderStyle&&);
    4444    virtual ~RenderView();
    45 
    46     WEBCORE_EXPORT bool hitTest(const HitTestRequest&, HitTestResult&);
    47     bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
    4845
    4946    const char* renderName() const override { return "RenderView"; }
     
    195192#endif
    196193
    197 #if !ASSERT_DISABLED
    198     bool inHitTesting() const { return m_inHitTesting; }
    199 #endif
    200 
    201194protected:
    202195    void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override;
     
    254247    bool m_usesFirstLineRules { false };
    255248    bool m_usesFirstLetterRules { false };
    256 #if !ASSERT_DISABLED
    257     bool m_inHitTesting { false };
    258 #endif
    259249
    260250    HashMap<RenderElement*, Vector<CachedImage*>> m_renderersWithPausedImageAnimation;
  • trunk/Source/WebCore/rendering/RenderWidget.cpp

    r237266 r245716  
    365365    if (request.allowsChildFrameContent() && is<FrameView>(widget()) && downcast<FrameView>(*widget()).renderView()) {
    366366        FrameView& childFrameView = downcast<FrameView>(*widget());
    367         RenderView& childRoot = *childFrameView.renderView();
    368367
    369368        LayoutPoint adjustedLocation = accumulatedOffset + location();
     
    373372        HitTestResult childFrameResult(newHitTestLocation);
    374373
    375         bool isInsideChildFrame = childRoot.hitTest(newHitTestRequest, newHitTestLocation, childFrameResult);
     374        auto* document = childFrameView.frame().document();
     375        if (!document)
     376            return false;
     377        bool isInsideChildFrame = document->hitTest(newHitTestRequest, newHitTestLocation, childFrameResult);
    376378
    377379        if (request.resultIsElementList())
  • trunk/Source/WebCore/testing/Internals.cpp

    r245508 r245716  
    21012101
    21022102    HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPadding);
    2103     renderView->hitTest(request, result);
     2103    document.hitTest(request, result);
    21042104    const HitTestResult::NodeSet& nodeSet = result.listBasedTestResult();
    21052105    Vector<Ref<Node>> matches;
  • trunk/Source/WebKit/ChangeLog

    r245715 r245716  
     12019-05-23  Zalan Bujtas  <zalan@apple.com>
     2
     3        [Hittest] Move hittesting from RenderView to Document
     4        https://bugs.webkit.org/show_bug.cgi?id=198192
     5        <rdar://problem/51077762>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
     10        (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
     11        * WebProcess/WebPage/WebPage.cpp:
     12        (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
     13        * WebProcess/WebPage/ios/WebPageIOS.mm:
     14        (WebKit::WebPage::dynamicViewportSizeUpdate):
     15
    1162019-05-23  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp

    r241224 r245716  
    116116    HitTestResult hitTestResult = HitTestResult(originInContentsSpace);
    117117
    118     m_webPage.mainFrameView()->renderView()->hitTest(HitTestRequest(), hitTestResult);
     118    m_webPage.mainFrame()->document()->hitTest(HitTestRequest(), hitTestResult);
    119119    Node* node = hitTestResult.innerNode();
    120120    if (!node) {
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r245679 r245716  
    59255925            HitTestResult hitTestResult(plugInRectRelativeToTopDocument.center());
    59265926
    5927             if (!mainFrameView->renderView())
     5927            if (!mainFrame() || !mainFrame()->document())
    59285928                return;
    5929             mainFrameView->renderView()->hitTest(request, hitTestResult);
     5929            mainFrame()->document()->hitTest(request, hitTestResult);
    59305930
    59315931            RefPtr<Element> element = hitTestResult.targetElement();
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r245679 r245716  
    29862986        HitTestResult hitTestResult = HitTestResult(unobscuredContentRectCenter);
    29872987
    2988         if (RenderView* mainFrameRenderView = frameView.renderView())
    2989             mainFrameRenderView->hitTest(HitTestRequest(), hitTestResult);
     2988        if (auto* document = frameView.frame().document())
     2989            document->hitTest(HitTestRequest(), hitTestResult);
    29902990
    29912991        if (Node* node = hitTestResult.innerNode()) {
Note: See TracChangeset for help on using the changeset viewer.