icecat: add release icecat-140.7.0-1gnu1 for ecne
This commit is contained in:
parent
7d0f5dab3b
commit
30225f2e73
156 changed files with 9131 additions and 4525 deletions
|
|
@ -1214,7 +1214,8 @@ class MOZ_STACK_CLASS HTMLEditor::AutoDeleteRangesHandler final {
|
|||
*/
|
||||
[[nodiscard]] Result<CaretPoint, nsresult> GetNewCaretPosition(
|
||||
const HTMLEditor& aHTMLEditor,
|
||||
nsIEditor::EDirection aDirectionAndAmount) const;
|
||||
nsIEditor::EDirection aDirectionAndAmount,
|
||||
const Element& aEditingHost) const;
|
||||
|
||||
RefPtr<Element> mEmptyInclusiveAncestorBlockElement;
|
||||
}; // HTMLEditor::AutoDeleteRangesHandler::AutoEmptyBlockAncestorDeleter
|
||||
|
|
@ -8375,7 +8376,8 @@ HTMLEditor::AutoDeleteRangesHandler::AutoEmptyBlockAncestorDeleter::
|
|||
Result<CaretPoint, nsresult> HTMLEditor::AutoDeleteRangesHandler::
|
||||
AutoEmptyBlockAncestorDeleter::GetNewCaretPosition(
|
||||
const HTMLEditor& aHTMLEditor,
|
||||
nsIEditor::EDirection aDirectionAndAmount) const {
|
||||
nsIEditor::EDirection aDirectionAndAmount,
|
||||
const Element& aEditingHost) const {
|
||||
MOZ_ASSERT(mEmptyInclusiveAncestorBlockElement);
|
||||
MOZ_ASSERT(mEmptyInclusiveAncestorBlockElement->GetParentElement());
|
||||
MOZ_ASSERT(aHTMLEditor.IsEditActionDataAvailable());
|
||||
|
|
@ -8386,12 +8388,23 @@ Result<CaretPoint, nsresult> HTMLEditor::AutoDeleteRangesHandler::
|
|||
case nsIEditor::eToEndOfLine: {
|
||||
// Collapse Selection to next node of after empty block element
|
||||
// if there is. Otherwise, to just after the empty block.
|
||||
auto afterEmptyBlock(
|
||||
EditorDOMPoint::After(mEmptyInclusiveAncestorBlockElement));
|
||||
MOZ_ASSERT(afterEmptyBlock.IsSet());
|
||||
if (nsIContent* nextContentOfEmptyBlock = HTMLEditUtils::GetNextContent(
|
||||
afterEmptyBlock, {}, BlockInlineCheck::Unused,
|
||||
aHTMLEditor.ComputeEditingHost())) {
|
||||
nsIContent* const nextContentOfEmptyBlock = [&]() -> nsIContent* {
|
||||
for (EditorRawDOMPoint scanStartPoint =
|
||||
EditorRawDOMPoint::After(mEmptyInclusiveAncestorBlockElement);
|
||||
scanStartPoint.IsInContentNode();) {
|
||||
nsIContent* const nextContent = HTMLEditUtils::GetNextContent(
|
||||
scanStartPoint, {}, BlockInlineCheck::Unused, &aEditingHost);
|
||||
// Let's ignore invisible `Text`.
|
||||
if (nextContent && nextContent->IsText() &&
|
||||
!HTMLEditUtils::IsVisibleTextNode(*nextContent->AsText())) {
|
||||
scanStartPoint = EditorRawDOMPoint::After(*nextContent);
|
||||
continue;
|
||||
}
|
||||
return nextContent;
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
if (nextContentOfEmptyBlock) {
|
||||
EditorDOMPoint pt = HTMLEditUtils::GetGoodCaretPointFor<EditorDOMPoint>(
|
||||
*nextContentOfEmptyBlock, aDirectionAndAmount);
|
||||
if (!pt.IsSet()) {
|
||||
|
|
@ -8400,6 +8413,8 @@ Result<CaretPoint, nsresult> HTMLEditor::AutoDeleteRangesHandler::
|
|||
}
|
||||
return CaretPoint(std::move(pt));
|
||||
}
|
||||
EditorDOMPoint afterEmptyBlock =
|
||||
EditorDOMPoint::After(mEmptyInclusiveAncestorBlockElement);
|
||||
if (NS_WARN_IF(!afterEmptyBlock.IsSet())) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
|
@ -8409,20 +8424,43 @@ Result<CaretPoint, nsresult> HTMLEditor::AutoDeleteRangesHandler::
|
|||
case nsIEditor::ePreviousWord:
|
||||
case nsIEditor::eToBeginningOfLine: {
|
||||
// Collapse Selection to previous editable node of the empty block
|
||||
// if there is. Otherwise, to after the empty block.
|
||||
EditorRawDOMPoint atEmptyBlock(mEmptyInclusiveAncestorBlockElement);
|
||||
if (nsIContent* previousContentOfEmptyBlock =
|
||||
HTMLEditUtils::GetPreviousContent(
|
||||
atEmptyBlock, {WalkTreeOption::IgnoreNonEditableNode},
|
||||
BlockInlineCheck::Unused, aHTMLEditor.ComputeEditingHost())) {
|
||||
EditorDOMPoint pt = HTMLEditUtils::GetGoodCaretPointFor<EditorDOMPoint>(
|
||||
*previousContentOfEmptyBlock, aDirectionAndAmount);
|
||||
if (!pt.IsSet()) {
|
||||
// if there is.
|
||||
nsIContent* const previousContentOfEmptyBlock = [&]() -> nsIContent* {
|
||||
for (EditorRawDOMPoint scanStartPoint =
|
||||
EditorRawDOMPoint(mEmptyInclusiveAncestorBlockElement);
|
||||
scanStartPoint.IsInContentNode();) {
|
||||
nsIContent* const previousContent = HTMLEditUtils::GetPreviousContent(
|
||||
scanStartPoint, {WalkTreeOption::IgnoreNonEditableNode},
|
||||
BlockInlineCheck::Unused, &aEditingHost);
|
||||
// Let's ignore invisible `Text`.
|
||||
if (previousContent && previousContent->IsText() &&
|
||||
!HTMLEditUtils::IsVisibleTextNode(*previousContent->AsText())) {
|
||||
scanStartPoint = EditorRawDOMPoint(previousContent, 0u);
|
||||
continue;
|
||||
}
|
||||
return previousContent;
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
if (previousContentOfEmptyBlock) {
|
||||
const EditorRawDOMPoint atEndOfPreviousContent =
|
||||
HTMLEditUtils::GetGoodCaretPointFor<EditorRawDOMPoint>(
|
||||
*previousContentOfEmptyBlock, aDirectionAndAmount);
|
||||
if (!atEndOfPreviousContent.IsSet()) {
|
||||
NS_WARNING("HTMLEditUtils::GetGoodCaretPointFor() failed");
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
return CaretPoint(std::move(pt));
|
||||
// If the previous content is between a preceding line break and the
|
||||
// block boundary of current empty block, let's move caret to the line
|
||||
// break if there is no visible things between them.
|
||||
const Maybe<EditorRawLineBreak> precedingLineBreak =
|
||||
HTMLEditUtils::GetLineBreakBeforeBlockBoundaryIfPointIsBetweenThem<
|
||||
EditorRawLineBreak>(atEndOfPreviousContent, aEditingHost);
|
||||
return precedingLineBreak.isSome()
|
||||
? CaretPoint(precedingLineBreak->To<EditorDOMPoint>())
|
||||
: CaretPoint(atEndOfPreviousContent.To<EditorDOMPoint>());
|
||||
}
|
||||
// Otherwise, let's put caret next to the deleting block.
|
||||
auto afterEmptyBlock =
|
||||
EditorDOMPoint::After(*mEmptyInclusiveAncestorBlockElement);
|
||||
if (NS_WARN_IF(!afterEmptyBlock.IsSet())) {
|
||||
|
|
@ -8492,7 +8530,7 @@ HTMLEditor::AutoDeleteRangesHandler::AutoEmptyBlockAncestorDeleter::Run(
|
|||
: EditorDOMPoint());
|
||||
}
|
||||
Result<CaretPoint, nsresult> caretPointOrError =
|
||||
GetNewCaretPosition(aHTMLEditor, aDirectionAndAmount);
|
||||
GetNewCaretPosition(aHTMLEditor, aDirectionAndAmount, aEditingHost);
|
||||
NS_WARNING_ASSERTION(
|
||||
caretPointOrError.isOk(),
|
||||
"AutoEmptyBlockAncestorDeleter::GetNewCaretPosition() failed");
|
||||
|
|
@ -8523,6 +8561,7 @@ HTMLEditor::AutoDeleteRangesHandler::AutoEmptyBlockAncestorDeleter::Run(
|
|||
NS_WARNING("EditorBase::DeleteNodeWithTransaction() failed");
|
||||
return Err(rv);
|
||||
}
|
||||
trackPointToPutCaret.FlushAndStopTracking();
|
||||
} else {
|
||||
Result<CaretPoint, nsresult> caretPointOrError =
|
||||
WhiteSpaceVisibilityKeeper::DeleteContentNodeAndJoinTextNodesAroundIt(
|
||||
|
|
@ -8534,11 +8573,11 @@ HTMLEditor::AutoDeleteRangesHandler::AutoEmptyBlockAncestorDeleter::Run(
|
|||
"DeleteContentNodeAndJoinTextNodesAroundIt() failed");
|
||||
return caretPointOrError.propagateErr();
|
||||
}
|
||||
trackPointToPutCaret.FlushAndStopTracking();
|
||||
caretPointOrError.unwrap().MoveCaretPointTo(
|
||||
pointToPutCaret, {SuggestCaret::OnlyIfHasSuggestion});
|
||||
}
|
||||
trackEmptyBlockPoint.FlushAndStopTracking();
|
||||
trackPointToPutCaret.FlushAndStopTracking();
|
||||
if (NS_WARN_IF(!atEmptyInclusiveAncestorBlockElement
|
||||
.IsInContentNodeAndValidInComposedDoc()) ||
|
||||
NS_WARN_IF(pointToPutCaret.IsSet() &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue