Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout

Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
This commit is contained in:
Sebastian Hengst
2024-05-29 11:22:52 +02:00
parent 18041c50bb
commit bf4dfe53f8
120 changed files with 2450 additions and 2262 deletions

View File

@@ -19,7 +19,6 @@
#include "mozilla/IntegerRange.h"
#include "mozilla/Logging.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/StaticAnalysisFunctions.h"
#include "mozilla/StaticPrefs_bidi.h"
@@ -39,6 +38,7 @@
#include "nsTArray.h"
#include "nsTableWrapperFrame.h"
#include "nsTableCellFrame.h"
#include "nsIScrollableFrame.h"
#include "nsCCUncollectableMarker.h"
#include "nsTextFragment.h"
#include <algorithm>
@@ -1650,7 +1650,7 @@ nsIFrame* nsFrameSelection::GetFrameToPageSelect() const {
return nullptr;
}
} else {
rootFrameToSelect = mPresShell->GetRootScrollContainerFrame();
rootFrameToSelect = mPresShell->GetRootScrollFrame();
if (NS_WARN_IF(!rootFrameToSelect)) {
return nullptr;
}
@@ -1662,16 +1662,16 @@ nsIFrame* nsFrameSelection::GetFrameToPageSelect() const {
// parent under the root frame.
for (nsIFrame* frame = contentToSelect->GetPrimaryFrame();
frame && frame != rootFrameToSelect; frame = frame->GetParent()) {
ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(frame);
if (!scrollContainerFrame) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(frame);
if (!scrollableFrame) {
continue;
}
ScrollStyles scrollStyles = scrollContainerFrame->GetScrollStyles();
ScrollStyles scrollStyles = scrollableFrame->GetScrollStyles();
if (scrollStyles.mVertical == StyleOverflow::Hidden) {
continue;
}
layers::ScrollDirections directions =
scrollContainerFrame->GetAvailableScrollingDirections();
scrollableFrame->GetAvailableScrollingDirections();
if (directions.contains(layers::ScrollDirection::eVertical)) {
// If there is sub scrollable frame, let's use its page size to select.
return frame;
@@ -1693,13 +1693,12 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
// expected behavior for PageMove is to scroll AND move the caret
// and remain relative position of the caret in view. see Bug 4302.
// Get the scroll container frame. If aFrame is not scrollable, this is
// nullptr.
ScrollContainerFrame* scrollContainerFrame = aFrame->GetScrollTargetFrame();
// Get the scrollable frame. If aFrame is not scrollable, this is nullptr.
nsIScrollableFrame* scrollableFrame = aFrame->GetScrollTargetFrame();
// Get the scrolled frame. If aFrame is not scrollable, this is aFrame
// itself.
nsIFrame* scrolledFrame =
scrollContainerFrame ? scrollContainerFrame->GetScrolledFrame() : aFrame;
scrollableFrame ? scrollableFrame->GetScrolledFrame() : aFrame;
if (!scrolledFrame) {
return NS_OK;
}
@@ -1728,7 +1727,7 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
}
}
if (scrollContainerFrame) {
if (scrollableFrame) {
// If there is a scrollable frame, adjust pseudo-click position with page
// scroll amount.
// XXX This may scroll more than one page if ScrollSelectionIntoView is
@@ -1737,9 +1736,9 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
// the frame, ScrollSelectionIntoView additionally scrolls to show
// the caret entirely.
if (aForward) {
caretPos.y += scrollContainerFrame->GetPageScrollAmount().height;
caretPos.y += scrollableFrame->GetPageScrollAmount().height;
} else {
caretPos.y -= scrollContainerFrame->GetPageScrollAmount().height;
caretPos.y -= scrollableFrame->GetPageScrollAmount().height;
}
} else {
// Otherwise, adjust pseudo-click position with the frame size.
@@ -1789,10 +1788,10 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
aSelectionIntoView == SelectionIntoView::IfChanged && !selectionChanged);
// Then, scroll the given frame one page.
if (scrollContainerFrame) {
if (scrollableFrame) {
// If we'll call ScrollSelectionIntoView later and selection wasn't
// changed and we scroll outside of selection limiter, we shouldn't use
// smooth scroll here because ScrollContainerFrame uses normal runnable,
// smooth scroll here because nsIScrollableFrame uses normal runnable,
// but ScrollSelectionIntoView uses early runner and it cancels the
// pending smooth scroll. Therefore, if we used smooth scroll in such
// case, ScrollSelectionIntoView would scroll to show caret instead of
@@ -1801,8 +1800,8 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
scrolledFrame != frameToClick
? ScrollMode::Instant
: ScrollMode::Smooth;
scrollContainerFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
ScrollUnit::PAGES, scrollMode);
scrollableFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
ScrollUnit::PAGES, scrollMode);
}
// Finally, scroll selection into view if requested.