Bug 1964011 - part 3: Make operator<< overload for EditorDOMPointeBase export a few characters of container iif the container is a Text r=m_kato
This helps to distinguish which the instance points a `Text`. Depends on D248369 Differential Revision: https://phabricator.services.mozilla.com/D248370
This commit is contained in:
committed by
masayuki@d-toybox.com
parent
8dd9d35fa1
commit
487ff798cd
@@ -23,8 +23,10 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStyledElement.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
|
||||
namespace mozilla {
|
||||
@@ -1314,8 +1316,21 @@ class EditorDOMPointBase final {
|
||||
const SelfType& aDOMPoint) {
|
||||
aStream << "{ mParent=" << aDOMPoint.GetContainer();
|
||||
if (aDOMPoint.mParent) {
|
||||
aStream << " (" << *aDOMPoint.mParent
|
||||
<< ", Length()=" << aDOMPoint.mParent->Length() << ")";
|
||||
const auto* parentAsText = dom::Text::FromNode(aDOMPoint.mParent);
|
||||
if (parentAsText && parentAsText->TextDataLength()) {
|
||||
nsAutoString data;
|
||||
parentAsText->AppendTextTo(data);
|
||||
aStream << " (" << *parentAsText << ", (begins with=\""
|
||||
<< NS_ConvertUTF16toUTF8(
|
||||
Substring(
|
||||
data,
|
||||
std::min(static_cast<uint32_t>(data.Length()), 5u)))
|
||||
.get()
|
||||
<< "\"), Length()=" << parentAsText->TextDataLength() << ")";
|
||||
} else {
|
||||
aStream << " (" << *aDOMPoint.mParent
|
||||
<< ", Length()=" << aDOMPoint.mParent->Length() << ")";
|
||||
}
|
||||
}
|
||||
aStream << ", mChild=" << static_cast<nsIContent*>(aDOMPoint.mChild);
|
||||
if (aDOMPoint.mChild) {
|
||||
|
||||
@@ -1146,7 +1146,7 @@ Result<EditActionResult, nsresult> HTMLEditor::HandleInsertText(
|
||||
}
|
||||
}
|
||||
|
||||
auto pointToInsert = [&]() -> EditorDOMPoint {
|
||||
EditorDOMPoint pointToInsert = [&]() {
|
||||
if (InsertingTextForExtantComposition(aPurpose)) {
|
||||
auto compositionStartPoint =
|
||||
GetFirstIMESelectionStartPoint<EditorDOMPoint>();
|
||||
|
||||
Reference in New Issue
Block a user