Skip to content

Commit

Permalink
Web Inspector: Can't scroll overflow: scroll containers if a remote…
Browse files Browse the repository at this point in the history
… inspector highlight is visible

rdar://124554999
https://bugs.webkit.org/show_bug.cgi?id=273599

Reviewed by Patrick Angle.

The method InspectorOverlay::update should be called to update the
overlay's position e.g. when a scroll event happens and elements move.
That function is exposed to the public by the
InspectorInstrumentation::didScroll static method, where objects
without direct access to the inspector overlay use it.

The static method is called in Chrome::scroll, but that path is only
visited when scrolling happens in the root <html> element. If the root
can't scroll but instead it's some deeper element being scrolled, we
should also find a way to call the static method to position the
overlay.

This commit gives that duty to LocalFrameView::didChangeScrollOffset
because that method is called when any element scrolls inside the frame.

* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::didChangeScrollOffset):
   - When any element is scrolled, update the inspector overlay's
     position.

* Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
(-[WKInspectorHighlightView initWithFrame:]):
   - Prevent the inspector overlay from blocking tap events into
     deeper scrollable elements.

Canonical link: https://commits.webkit.org/278614@main
  • Loading branch information
the-chenergy authored and rcaliman-apple committed May 10, 2024
1 parent a2a16a6 commit 43ec0e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/WebCore/page/LocalFrameView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2807,8 +2807,11 @@ void LocalFrameView::setViewportConstrainedObjectsNeedLayout()

void LocalFrameView::didChangeScrollOffset()
{
if (auto* page = m_frame->page())
if (auto* page = m_frame->page()) {
page->pageOverlayController().didScrollFrame(m_frame.get());
InspectorInstrumentation::didScroll(*page);
}

m_frame->loader().client().didChangeScrollOffset();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ - (instancetype)initWithFrame:(CGRect)frame
return nil;
_layers = adoptNS([[NSMutableArray alloc] init]);
self.opaque = NO;
self.userInteractionEnabled = NO;
return self;
}

Expand Down

0 comments on commit 43ec0e8

Please sign in to comment.