New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hold the Scroll to the Text Fragment until a user scroll happens. #4371
Hold the Scroll to the Text Fragment until a user scroll happens. #4371
Conversation
EWS run on previous version of this PR (hash 8325577) |
8325577
to
62c50f1
Compare
EWS run on previous version of this PR (hash 62c50f1) |
Source/WebCore/page/FrameView.cpp
Outdated
@@ -2321,6 +2322,19 @@ void FrameView::maintainScrollPositionAtAnchor(ContainerNode* anchorNode) | |||
scrollToAnchor(); | |||
} | |||
|
|||
void FrameView::maintainScrollPositionAtRange(SimpleRange* range) | |||
{ | |||
UNUSED_PARAM(range); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of this, since you clearly use it.
Source/WebCore/page/FrameView.cpp
Outdated
m_pendingTextFragmentIndicatorRange.reset(); | ||
m_pendingTextFragmentIndicatorText = String(); | ||
m_delayedTextFragmentIndicatorTimer.stop(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
Source/WebCore/page/FrameView.cpp
Outdated
@@ -3531,6 +3547,30 @@ void FrameView::scrollToAnchor() | |||
cancelScheduledScrolls(); | |||
} | |||
|
|||
void FrameView::scrollToRange() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a super vague name. Can we call it "scrollToTextFragment"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(or scrollToTextFragmentRange, or something)
Source/WebCore/page/FrameView.h
Outdated
@@ -472,6 +472,7 @@ class FrameView final : public ScrollView { | |||
|
|||
bool scrollToFragment(const URL&); | |||
void maintainScrollPositionAtAnchor(ContainerNode*); | |||
void maintainScrollPositionAtRange(SimpleRange*); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto here, not just "range" but more importantly "text fragment"
Source/WebCore/page/FrameView.h
Outdated
@@ -911,6 +913,7 @@ class FrameView final : public ScrollView { | |||
RefPtr<Node> m_nodeToDraw; | |||
std::optional<SimpleRange> m_pendingTextFragmentIndicatorRange; | |||
String m_pendingTextFragmentIndicatorText; | |||
bool m_doNotResetFragmentTimer { false }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't just about the timer. It's "should incoming scrolling cancel maintaining scroll-to-text-fragment position". Try to make a better name. It's hard to compress down.
62c50f1
to
a33c32b
Compare
EWS run on previous version of this PR (hash a33c32b) |
Source/WebCore/page/FrameView.cpp
Outdated
@@ -2321,6 +2322,18 @@ void FrameView::maintainScrollPositionAtAnchor(ContainerNode* anchorNode) | |||
scrollToAnchor(); | |||
} | |||
|
|||
void FrameView::maintainScrollPositionAtScrollToTextFragmentRange(SimpleRange* range) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't this take a reference?
Source/WebCore/page/FrameView.cpp
Outdated
{ | ||
LOG(Scrolling, "FrameView::maintainScrollPositionAtScrollToTextFragmentRange at %p", range); | ||
|
||
m_pendingTextFragmentIndicatorRange = *range; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since clearly it must be nonnull
Source/WebCore/page/FrameView.cpp
Outdated
@@ -2509,6 +2521,8 @@ void FrameView::textFragmentIndicatorTimerFired() | |||
|
|||
void FrameView::cancelScheduledTextFragmentIndicatorTimer() | |||
{ | |||
if (m_skipScrollResetofScrollToTextFragementRange) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your camel casing fell apart in the middle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also your spelling of fragment
Source/WebCore/page/FrameView.cpp
Outdated
ASSERT(frame().document()); | ||
Ref document = *frame().document(); | ||
|
||
SetForScope doNotResetFragmentTimer(m_skipScrollResetofScrollToTextFragementRange, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The local name should be fixed up too
a33c32b
to
7efddec
Compare
https://bugs.webkit.org/show_bug.cgi?id=245207 rdar://99668200 Reviewed by Tim Horton. For each layout that comes in until the user scrolls we need to reset the scroll to keep the fragment in the middle of the page. Otherwise, more content can come in the scroll the fragment off the page, which can be very confusing to the user. * Source/WebCore/page/FrameView.cpp: (WebCore::FrameView::reset): (WebCore::FrameView::scrollToFragment): (WebCore::FrameView::maintainScrollPositionAtRange): (WebCore::FrameView::textFragmentIndicatorTimerFired): (WebCore::FrameView::cancelScheduledTextFragmentIndicatorTimer): (WebCore::FrameView::scrollToRange): (WebCore::FrameView::performPostLayoutTasks): * Source/WebCore/page/FrameView.h: Canonical link: https://commits.webkit.org/254507@main
7efddec
to
4dc689b
Compare
Committed 254507@main (4dc689b): https://commits.webkit.org/254507@main Reviewed commits have been landed. Closing PR #4371 and removing active labels. |
4dc689b
7efddec
π macπ mac-debugπ§ͺ ios-wk2π mac-AS-debugπ§ͺ api-macπ§ͺ mac-wk1π§ͺ mac-wk2π§ͺ mac-AS-debug-wk2π§ͺ mac-wk2-stress