Bug 1627175 - part 29: Get rid of `EditorBase::GetNextElementOrTextInBlock()` and `EditorBase::GetPreviousElementOrTextInBlock()` r=m_kato

Depends on D113232

Differential Revision: https://phabricator.services.mozilla.com/D113233
This commit is contained in:
Masayuki Nakano 2021-04-27 11:17:40 +00:00
Родитель 4a928f25f7
Коммит 3f701eb0f4
3 изменённых файлов: 14 добавлений и 25 удалений

Просмотреть файл

@ -1732,11 +1732,6 @@ class EditorBase : public nsIEditor,
nsIContent* GetPreviousNodeInBlock(const EditorRawDOMPoint& aPoint) const { nsIContent* GetPreviousNodeInBlock(const EditorRawDOMPoint& aPoint) const {
return GetPreviousContent(aPoint, {WalkTreeOption::StopAtBlockBoundary}); return GetPreviousContent(aPoint, {WalkTreeOption::StopAtBlockBoundary});
} }
nsIContent* GetPreviousElementOrTextInBlock(
const EditorRawDOMPoint& aPoint) const {
return GetPreviousContent(aPoint, {WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary});
}
nsIContent* GetPreviousEditableNodeInBlock( nsIContent* GetPreviousEditableNodeInBlock(
const EditorRawDOMPoint& aPoint) const { const EditorRawDOMPoint& aPoint) const {
return GetPreviousContent(aPoint, {WalkTreeOption::IgnoreNonEditableNode, return GetPreviousContent(aPoint, {WalkTreeOption::IgnoreNonEditableNode,
@ -1748,10 +1743,6 @@ class EditorBase : public nsIEditor,
nsIContent* GetPreviousNodeInBlock(const nsINode& aNode) const { nsIContent* GetPreviousNodeInBlock(const nsINode& aNode) const {
return GetPreviousContent(aNode, {WalkTreeOption::StopAtBlockBoundary}); return GetPreviousContent(aNode, {WalkTreeOption::StopAtBlockBoundary});
} }
nsIContent* GetPreviousElementOrTextInBlock(const nsINode& aNode) const {
return GetPreviousContent(aNode, {WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary});
}
nsIContent* GetPreviousEditableNodeInBlock(const nsINode& aNode) const { nsIContent* GetPreviousEditableNodeInBlock(const nsINode& aNode) const {
return GetPreviousContent(aNode, {WalkTreeOption::IgnoreNonEditableNode, return GetPreviousContent(aNode, {WalkTreeOption::IgnoreNonEditableNode,
WalkTreeOption::StopAtBlockBoundary}); WalkTreeOption::StopAtBlockBoundary});
@ -1794,12 +1785,6 @@ class EditorBase : public nsIEditor,
return GetNextContent(aPoint, {WalkTreeOption::StopAtBlockBoundary}); return GetNextContent(aPoint, {WalkTreeOption::StopAtBlockBoundary});
} }
template <typename PT, typename CT> template <typename PT, typename CT>
nsIContent* GetNextElementOrTextInBlock(
const EditorDOMPointBase<PT, CT>& aPoint) const {
return GetNextContent(aPoint, {WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary});
}
template <typename PT, typename CT>
nsIContent* GetNextEditableNodeInBlock( nsIContent* GetNextEditableNodeInBlock(
const EditorDOMPointBase<PT, CT>& aPoint) const { const EditorDOMPointBase<PT, CT>& aPoint) const {
return GetNextContent(aPoint, {WalkTreeOption::IgnoreNonEditableNode, return GetNextContent(aPoint, {WalkTreeOption::IgnoreNonEditableNode,
@ -1811,10 +1796,6 @@ class EditorBase : public nsIEditor,
nsIContent* GetNextNodeInBlock(const nsINode& aNode) const { nsIContent* GetNextNodeInBlock(const nsINode& aNode) const {
return GetNextContent(aNode, {WalkTreeOption::StopAtBlockBoundary}); return GetNextContent(aNode, {WalkTreeOption::StopAtBlockBoundary});
} }
nsIContent* GetNextElementOrTextInBlock(const nsINode& aNode) const {
return GetNextContent(aNode, {WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary});
}
nsIContent* GetNextEditableNodeInBlock(const nsINode& aNode) const { nsIContent* GetNextEditableNodeInBlock(const nsINode& aNode) const {
return GetNextContent(aNode, {WalkTreeOption::IgnoreNonEditableNode, return GetNextContent(aNode, {WalkTreeOption::IgnoreNonEditableNode,
WalkTreeOption::StopAtBlockBoundary}); WalkTreeOption::StopAtBlockBoundary});

Просмотреть файл

@ -5005,7 +5005,9 @@ nsIContent* HTMLEditor::GetPreviousHTMLElementOrTextInternal(
return nullptr; return nullptr;
} }
return aNoBlockCrossing return aNoBlockCrossing
? GetPreviousElementOrTextInBlock(aNode) ? GetPreviousContent(aNode,
{WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary})
: GetPreviousContent(aNode, : GetPreviousContent(aNode,
{WalkTreeOption::IgnoreDataNodeExceptText}); {WalkTreeOption::IgnoreDataNodeExceptText});
} }
@ -5017,7 +5019,9 @@ nsIContent* HTMLEditor::GetPreviousHTMLElementOrTextInternal(
return nullptr; return nullptr;
} }
return aNoBlockCrossing return aNoBlockCrossing
? GetPreviousElementOrTextInBlock(aPoint) ? GetPreviousContent(aPoint,
{WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary})
: GetPreviousContent(aPoint, : GetPreviousContent(aPoint,
{WalkTreeOption::IgnoreDataNodeExceptText}); {WalkTreeOption::IgnoreDataNodeExceptText});
} }
@ -5047,7 +5051,8 @@ nsIContent* HTMLEditor::GetNextHTMLElementOrTextInternal(
return nullptr; return nullptr;
} }
return aNoBlockCrossing return aNoBlockCrossing
? GetNextElementOrTextInBlock(aNode) ? GetNextContent(aNode, {WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary})
: GetNextContent(aNode, : GetNextContent(aNode,
{WalkTreeOption::IgnoreDataNodeExceptText}); {WalkTreeOption::IgnoreDataNodeExceptText});
} }
@ -5059,7 +5064,8 @@ nsIContent* HTMLEditor::GetNextHTMLElementOrTextInternal(
return nullptr; return nullptr;
} }
return aNoBlockCrossing return aNoBlockCrossing
? GetNextElementOrTextInBlock(aPoint) ? GetNextContent(aPoint, {WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary})
: GetNextContent(aPoint, : GetNextContent(aPoint,
{WalkTreeOption::IgnoreDataNodeExceptText}); {WalkTreeOption::IgnoreDataNodeExceptText});
} }

Просмотреть файл

@ -4415,8 +4415,10 @@ nsresult HTMLEditor::AutoDeleteRangesHandler::AutoBlockElementsJoiner::
atStart.IsEndOfContainer() && range.StartRef().GetChild() && atStart.IsEndOfContainer() && range.StartRef().GetChild() &&
range.StartRef().GetChild()->IsHTMLElement(nsGkAtoms::br) && range.StartRef().GetChild()->IsHTMLElement(nsGkAtoms::br) &&
!aHTMLEditor.IsVisibleBRElement(range.StartRef().GetChild()) !aHTMLEditor.IsVisibleBRElement(range.StartRef().GetChild())
? aHTMLEditor.GetNextElementOrTextInBlock( ? aHTMLEditor.GetNextContent(
*atStart.ContainerAsContent()) *atStart.ContainerAsContent(),
{WalkTreeOption::IgnoreDataNodeExceptText,
WalkTreeOption::StopAtBlockBoundary})
: nullptr; : nullptr;
if (!nextContent || nextContent != range.StartRef().GetChild()) { if (!nextContent || nextContent != range.StartRef().GetChild()) {
noNeedToChangeStart = true; noNeedToChangeStart = true;