зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1609662: part 15) Rename some methods in `Selection`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60256 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9f2d95176c
Коммит
eed3b8d8ab
|
@ -1361,8 +1361,7 @@ nsresult Selection::GetPrimaryOrCaretFrameForNodeOffset(nsIContent* aContent,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Selection::SelectFramesForContent(nsIContent* aContent,
|
void Selection::SelectFramesOf(nsIContent* aContent, bool aSelected) const {
|
||||||
bool aSelected) const {
|
|
||||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
return;
|
return;
|
||||||
|
@ -1378,14 +1377,13 @@ void Selection::SelectFramesForContent(nsIContent* aContent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// select all content children of aContent
|
nsresult Selection::SelectFramesOfInclusiveDescendantsOfContent(
|
||||||
nsresult Selection::SelectAllFramesForContent(
|
|
||||||
PostContentIterator& aPostOrderIter, nsIContent* aContent,
|
PostContentIterator& aPostOrderIter, nsIContent* aContent,
|
||||||
bool aSelected) const {
|
bool aSelected) const {
|
||||||
// If aContent doesn't have children, we should avoid to use the content
|
// If aContent doesn't have children, we should avoid to use the content
|
||||||
// iterator for performance reason.
|
// iterator for performance reason.
|
||||||
if (!aContent->HasChildren()) {
|
if (!aContent->HasChildren()) {
|
||||||
SelectFramesForContent(aContent, aSelected);
|
SelectFramesOf(aContent, aSelected);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,7 +1395,7 @@ nsresult Selection::SelectAllFramesForContent(
|
||||||
nsINode* node = aPostOrderIter.GetCurrentNode();
|
nsINode* node = aPostOrderIter.GetCurrentNode();
|
||||||
MOZ_ASSERT(node);
|
MOZ_ASSERT(node);
|
||||||
nsIContent* innercontent = node->IsContent() ? node->AsContent() : nullptr;
|
nsIContent* innercontent = node->IsContent() ? node->AsContent() : nullptr;
|
||||||
SelectFramesForContent(innercontent, aSelected);
|
SelectFramesOf(innercontent, aSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1488,7 +1486,7 @@ nsresult Selection::SelectFrames(nsPresContext* aPresContext, nsRange* aRange,
|
||||||
if (aRange->Collapsed() ||
|
if (aRange->Collapsed() ||
|
||||||
(startNode == endNode && !startNode->HasChildren())) {
|
(startNode == endNode && !startNode->HasChildren())) {
|
||||||
if (!isFirstContentTextNode) {
|
if (!isFirstContentTextNode) {
|
||||||
SelectFramesForContent(startContent, aSelect);
|
SelectFramesOf(startContent, aSelect);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1504,7 +1502,8 @@ nsresult Selection::SelectFrames(nsPresContext* aPresContext, nsRange* aRange,
|
||||||
nsINode* node = subtreeIter.GetCurrentNode();
|
nsINode* node = subtreeIter.GetCurrentNode();
|
||||||
MOZ_ASSERT(node);
|
MOZ_ASSERT(node);
|
||||||
nsIContent* content = node->IsContent() ? node->AsContent() : nullptr;
|
nsIContent* content = node->IsContent() ? node->AsContent() : nullptr;
|
||||||
SelectAllFramesForContent(postOrderIter, content, aSelect);
|
SelectFramesOfInclusiveDescendantsOfContent(postOrderIter, content,
|
||||||
|
aSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We must now do the last one if it is not the same as the first
|
// We must now do the last one if it is not the same as the first
|
||||||
|
|
|
@ -707,10 +707,15 @@ class Selection final : public nsSupportsWeakReference,
|
||||||
* nothing.
|
* nothing.
|
||||||
*/
|
*/
|
||||||
void SetAnchorFocusRange(int32_t aIndex);
|
void SetAnchorFocusRange(int32_t aIndex);
|
||||||
void SelectFramesForContent(nsIContent* aContent, bool aSelected) const;
|
void SelectFramesOf(nsIContent* aContent, bool aSelected) const;
|
||||||
nsresult SelectAllFramesForContent(PostContentIterator& aPostOrderIter,
|
|
||||||
nsIContent* aContent,
|
/**
|
||||||
bool aSelected) const;
|
* https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant.
|
||||||
|
*/
|
||||||
|
nsresult SelectFramesOfInclusiveDescendantsOfContent(
|
||||||
|
PostContentIterator& aPostOrderIter, nsIContent* aContent,
|
||||||
|
bool aSelected) const;
|
||||||
|
|
||||||
nsresult SelectFrames(nsPresContext* aPresContext, nsRange* aRange,
|
nsresult SelectFrames(nsPresContext* aPresContext, nsRange* aRange,
|
||||||
bool aSelect);
|
bool aSelect);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче