icecat: add release icecat-140.10.1-1gnu1 for ecne

This commit is contained in:
Ark74 2026-05-04 16:58:41 -06:00
parent a5f93cb214
commit ff85d7c623
1256 changed files with 63469 additions and 24141 deletions

View file

@ -1487,7 +1487,7 @@ nsresult nsFrameSelection::TakeFocus(nsIContent& aNewFocus,
}
case FocusMode::kExtendSelection: {
// Now update the range list:
nsINode* inclusiveTableCellAncestor =
nsCOMPtr<nsINode> inclusiveTableCellAncestor =
GetClosestInclusiveTableCellAncestor(&aNewFocus);
if (mTableSelection.mClosestInclusiveTableCellAncestor &&
inclusiveTableCellAncestor &&
@ -1641,8 +1641,7 @@ void nsFrameSelection::AddHighlightSelection(
}
}
void nsFrameSelection::RepaintHighlightSelection(
nsAtom* aHighlightName) {
void nsFrameSelection::RepaintHighlightSelection(nsAtom* aHighlightName) {
if (auto iter =
std::find_if(mHighlightSelections.begin(), mHighlightSelections.end(),
[&aHighlightName](auto const& aElm) {
@ -1817,76 +1816,84 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
SelectionIntoView aSelectionIntoView) {
MOZ_ASSERT(aFrame);
if (MOZ_UNLIKELY(!IsAvailable())) {
return NS_OK;
}
// expected behavior for PageMove is to scroll AND move the caret
// and remain relative position of the caret in view. see Bug 4302.
// find out where the caret is.
// we should know mDesiredCaretPos.mValue value of nsFrameSelection, but I
// haven't seen that behavior in other windows applications yet.
MOZ_DIAGNOSTIC_ASSERT(GetSelection(mozilla::SelectionType::eNormal));
const OwningNonNull<Selection> selection = NormalSelection();
// Get the scroll container frame. If aFrame is not scrollable, this is
// nullptr.
ScrollContainerFrame* scrollContainerFrame = aFrame->GetScrollTargetFrame();
// Get the scrolled frame. If aFrame is not scrollable, this is aFrame
// itself.
nsIFrame* scrolledFrame =
scrollContainerFrame ? scrollContainerFrame->GetScrolledFrame() : aFrame;
if (!scrolledFrame) {
return NS_OK;
}
const AutoWeakFrame scrollContainerFrameWeak(scrollContainerFrame);
// find out where the caret is.
// we should know mDesiredCaretPos.mValue value of nsFrameSelection, but I
// havent seen that behavior in other windows applications yet.
RefPtr<Selection> selection = &NormalSelection();
if (!selection) {
return NS_OK;
}
nsRect caretPos;
nsIFrame* caretFrame = nsCaret::GetGeometry(selection, &caretPos);
if (!caretFrame) {
return NS_OK;
}
// If the scrolled frame is outside of current selection limiter,
// we need to scroll the frame but keep moving selection in the limiter.
nsIFrame* frameToClick = scrolledFrame;
if (!NodeIsInLimiters(scrolledFrame->GetContent())) {
frameToClick = GetFrameToPageSelect();
if (NS_WARN_IF(!frameToClick)) {
return NS_OK;
bool scrolledFrameIsInLimiter = true;
const auto offsets = [&]()
MOZ_NEVER_INLINE_DEBUG -> nsIFrame::ContentOffsets {
// Get the scrolled frame. If aFrame is not scrollable, this is aFrame
// itself.
nsIFrame* scrolledFrame = scrollContainerFrame
? scrollContainerFrame->GetScrolledFrame()
: aFrame;
if (MOZ_UNLIKELY(!scrolledFrame)) {
return {};
}
}
if (scrollContainerFrame) {
// 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
// called later because caret may not fully visible. E.g., if
// clicking line will be visible only half height with scrolling
// the frame, ScrollSelectionIntoView additionally scrolls to show
// the caret entirely.
if (aForward) {
caretPos.y += scrollContainerFrame->GetPageScrollAmount().height;
nsRect caretPos;
nsIFrame* caretFrame = nsCaret::GetGeometry(selection, &caretPos);
if (MOZ_UNLIKELY(!caretFrame)) {
return {};
}
// If the scrolled frame is outside of current selection limiter,
// we need to scroll the frame but keep moving selection in the limiter.
nsIFrame* frameToClick = scrolledFrame;
if (!NodeIsInLimiters(scrolledFrame->GetContent())) {
frameToClick = GetFrameToPageSelect();
scrolledFrameIsInLimiter = scrolledFrame == frameToClick;
if (NS_WARN_IF(!frameToClick)) {
return {};
}
}
if (scrollContainerFrame) {
// 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
// called later because caret may not fully visible. E.g., if
// clicking line will be visible only half height with scrolling
// the frame, ScrollSelectionIntoView additionally scrolls to show
// the caret entirely.
if (aForward) {
caretPos.y += scrollContainerFrame->GetPageScrollAmount().height;
} else {
caretPos.y -= scrollContainerFrame->GetPageScrollAmount().height;
}
} else {
caretPos.y -= scrollContainerFrame->GetPageScrollAmount().height;
// Otherwise, adjust pseudo-click position with the frame size.
if (aForward) {
caretPos.y += frameToClick->GetSize().height;
} else {
caretPos.y -= frameToClick->GetSize().height;
}
}
} else {
// Otherwise, adjust pseudo-click position with the frame size.
if (aForward) {
caretPos.y += frameToClick->GetSize().height;
} else {
caretPos.y -= frameToClick->GetSize().height;
}
}
caretPos += caretFrame->GetOffsetTo(frameToClick);
caretPos += caretFrame->GetOffsetTo(frameToClick);
// get a content at desired location
nsPoint desiredPoint;
desiredPoint.x = caretPos.x;
desiredPoint.y = caretPos.y + caretPos.height / 2;
nsIFrame::ContentOffsets offsets =
frameToClick->GetContentOffsetsFromPoint(desiredPoint);
if (!offsets.content) {
// get a content at desired location
nsPoint desiredPoint;
desiredPoint.x = caretPos.x;
desiredPoint.y = caretPos.y + caretPos.height / 2;
return frameToClick->GetContentOffsetsFromPoint(desiredPoint);
}();
if (MOZ_UNLIKELY(!offsets.content)) {
// XXX Do we need to handle ScrollSelectionIntoView in this case?
return NS_OK;
}
@ -1896,7 +1903,7 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
{
// We don't want any script to run until we check whether selection is
// modified by HandleClick.
SelectionBatcher ensureNoSelectionChangeNotifications(selection,
SelectionBatcher ensureNoSelectionChangeNotifications(selection.ref(),
__FUNCTION__);
RangeBoundary oldAnchor = selection->AnchorRef();
@ -1916,7 +1923,7 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
aSelectionIntoView == SelectionIntoView::IfChanged && !selectionChanged);
// Then, scroll the given frame one page.
if (scrollContainerFrame) {
if (scrollContainerFrameWeak.IsAlive()) {
// 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,
@ -1925,9 +1932,10 @@ nsresult nsFrameSelection::PageMove(bool aForward, bool aExtend,
// case, ScrollSelectionIntoView would scroll to show caret instead of
// page scroll of an element outside selection limiter.
ScrollMode scrollMode = doScrollSelectionIntoView && !selectionChanged &&
scrolledFrame != frameToClick
!scrolledFrameIsInLimiter
? ScrollMode::Instant
: ScrollMode::Smooth;
MOZ_ASSERT(scrollContainerFrameWeak.GetFrame() == scrollContainerFrame);
scrollContainerFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
ScrollUnit::PAGES, scrollMode);
}