зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1639074 - Don't call `EditorDOMPoint::GetPreviousSiblingOfChild()` if the container is not a container element r=m_kato
For warning the potential of callers' bug, `GetPreviousSiblingOfChild()` outputs warning into the console when its container is not a container element, e.g., it's odd trying to get previous sibling of child if the container is a text node. Therefore, this patch makes the new caller, `WSRunScanner::GetPreviousEditableCharPoint()`, check `CanContainerHaveChildren()` before calling it. Differential Revision: https://phabricator.services.mozilla.com/D75888
This commit is contained in:
Родитель
9577e42b6f
Коммит
a97bc5aea1
|
@ -1316,7 +1316,8 @@ EditorDOMPointInText WSRunScanner::GetInclusiveNextEditableCharPoint(
|
|||
}
|
||||
|
||||
EditorRawDOMPoint point;
|
||||
if (nsIContent* child = aPoint.GetChild()) {
|
||||
if (nsIContent* child =
|
||||
aPoint.CanContainerHaveChildren() ? aPoint.GetChild() : nullptr) {
|
||||
nsIContent* leafContent = child->HasChildren()
|
||||
? HTMLEditUtils::GetFirstLeafChild(
|
||||
*child, ChildBlockBoundary::Ignore)
|
||||
|
@ -1380,7 +1381,9 @@ EditorDOMPointInText WSRunScanner::GetPreviousEditableCharPoint(
|
|||
}
|
||||
|
||||
EditorRawDOMPoint point;
|
||||
if (nsIContent* previousChild = aPoint.GetPreviousSiblingOfChild()) {
|
||||
if (nsIContent* previousChild = aPoint.CanContainerHaveChildren()
|
||||
? aPoint.GetPreviousSiblingOfChild()
|
||||
: nullptr) {
|
||||
nsIContent* leafContent =
|
||||
previousChild->HasChildren()
|
||||
? HTMLEditUtils::GetLastLeafChild(*previousChild,
|
||||
|
|
Загрузка…
Ссылка в новой задаче