Backed out 5 changesets (bug 1926483) for causing failures at WSRunScanner.h. CLOSED TREE
Backed out changeset fa4c36cef1c5 (bug 1926483) Backed out changeset 24bdcd7af3e0 (bug 1926483) Backed out changeset 1df51ca968f8 (bug 1926483) Backed out changeset 7aceecb585e4 (bug 1926483) Backed out changeset 41b040b374a2 (bug 1926483)
This commit is contained in:
@@ -1194,7 +1194,7 @@ nsresult HTMLEditor::MaybeCollapseSelectionAtFirstEditableNode(
|
||||
// the visible character.
|
||||
const WSScanResult scanResultInTextNode =
|
||||
WSRunScanner::ScanInclusiveNextVisibleNodeOrBlockBoundary(
|
||||
WSRunScanner::Scan::EditableNodes, EditorRawDOMPoint(text, 0),
|
||||
editingHost, EditorRawDOMPoint(text, 0),
|
||||
BlockInlineCheck::UseComputedDisplayStyle);
|
||||
if ((scanResultInTextNode.InVisibleOrCollapsibleCharacters() ||
|
||||
scanResultInTextNode.ReachedPreformattedLineBreak()) &&
|
||||
@@ -2244,16 +2244,12 @@ nsresult HTMLEditor::InsertElementAtSelectionAsAction(
|
||||
if (!SelectionRef().GetAnchorNode()) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (NS_WARN_IF(!SelectionRef().GetAnchorNode()->IsInclusiveDescendantOf(
|
||||
editingHost))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
EditorRawDOMPoint atAnchor(SelectionRef().AnchorRef());
|
||||
// Adjust position based on the node we are going to insert.
|
||||
EditorDOMPoint pointToInsert =
|
||||
HTMLEditUtils::GetBetterInsertionPointFor<EditorDOMPoint>(*aElement,
|
||||
atAnchor);
|
||||
HTMLEditUtils::GetBetterInsertionPointFor<EditorDOMPoint>(
|
||||
*aElement, atAnchor, *editingHost);
|
||||
if (!pointToInsert.IsSet()) {
|
||||
NS_WARNING("HTMLEditUtils::GetBetterInsertionPointFor() failed");
|
||||
return NS_ERROR_FAILURE;
|
||||
@@ -2295,7 +2291,8 @@ nsresult HTMLEditor::InsertElementAtSelectionAsAction(
|
||||
if (MOZ_LIKELY(aElement->IsInComposedDoc())) {
|
||||
const auto afterElement = EditorDOMPoint::After(*aElement);
|
||||
if (MOZ_LIKELY(afterElement.IsInContentNode())) {
|
||||
nsresult rv = EnsureNoFollowingUnnecessaryLineBreak(afterElement);
|
||||
nsresult rv =
|
||||
EnsureNoFollowingUnnecessaryLineBreak(afterElement, *editingHost);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING(
|
||||
"HTMLEditor::EnsureNoFollowingUnnecessaryLineBreak() failed");
|
||||
@@ -4518,7 +4515,8 @@ Result<CreateLineBreakResult, nsresult> HTMLEditor::InsertLineBreak(
|
||||
}
|
||||
|
||||
nsresult HTMLEditor::EnsureNoFollowingUnnecessaryLineBreak(
|
||||
const EditorDOMPoint& aNextOrAfterModifiedPoint) {
|
||||
const EditorDOMPoint& aNextOrAfterModifiedPoint,
|
||||
const Element& aEditingHost) {
|
||||
MOZ_ASSERT(aNextOrAfterModifiedPoint.IsInContentNode());
|
||||
|
||||
// If the point is in a mailcite in plaintext mail composer (it is a <span>
|
||||
@@ -4546,7 +4544,7 @@ nsresult HTMLEditor::EnsureNoFollowingUnnecessaryLineBreak(
|
||||
|
||||
const Maybe<EditorLineBreak> unnecessaryLineBreak =
|
||||
HTMLEditUtils::GetFollowingUnnecessaryLineBreak<EditorLineBreak>(
|
||||
aNextOrAfterModifiedPoint);
|
||||
aNextOrAfterModifiedPoint, aEditingHost);
|
||||
if (MOZ_LIKELY(unnecessaryLineBreak.isNothing())) {
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -7845,7 +7843,7 @@ nsresult HTMLEditor::OnModifyDocument(const DocumentModifiedEvent& aRunner) {
|
||||
}
|
||||
const WSScanResult nextThing =
|
||||
WSRunScanner::ScanInclusiveNextVisibleNodeOrBlockBoundary(
|
||||
WSRunScanner::Scan::EditableNodes,
|
||||
editingHost,
|
||||
atCollapsibleWhiteSpace.AfterContainer<EditorRawDOMPoint>(),
|
||||
BlockInlineCheck::UseComputedDisplayStyle);
|
||||
if (!nextThing.ReachedBlockBoundary()) {
|
||||
@@ -7907,18 +7905,21 @@ void HTMLEditor::DocumentModifiedEvent::MaybeAppendNewInvisibleWhiteSpace(
|
||||
!aContentWillBeRemoved->IsHTMLElement(nsGkAtoms::br)) {
|
||||
return;
|
||||
}
|
||||
const Element* const editingHost =
|
||||
const_cast<nsIContent*>(aContentWillBeRemoved)->GetEditingHost();
|
||||
if (MOZ_UNLIKELY(!editingHost)) {
|
||||
return;
|
||||
}
|
||||
const WSScanResult nextThing =
|
||||
WSRunScanner::ScanInclusiveNextVisibleNodeOrBlockBoundary(
|
||||
WSRunScanner::Scan::EditableNodes,
|
||||
EditorRawDOMPoint::After(*aContentWillBeRemoved),
|
||||
editingHost, EditorRawDOMPoint::After(*aContentWillBeRemoved),
|
||||
BlockInlineCheck::UseComputedDisplayStyle);
|
||||
if (!nextThing.ReachedBlockBoundary()) {
|
||||
return;
|
||||
}
|
||||
const WSScanResult previousThing =
|
||||
WSRunScanner::ScanPreviousVisibleNodeOrBlockBoundary(
|
||||
WSRunScanner::Scan::EditableNodes,
|
||||
EditorRawDOMPoint(aContentWillBeRemoved),
|
||||
editingHost, EditorRawDOMPoint(aContentWillBeRemoved),
|
||||
BlockInlineCheck::UseComputedDisplayOutsideStyle);
|
||||
if (!previousThing.ContentIsText() || !previousThing.IsContentEditable()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user