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 "nsGkAtoms.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsINode.h"
|
#include "nsINode.h"
|
||||||
|
#include "nsString.h"
|
||||||
#include "nsStyledElement.h"
|
#include "nsStyledElement.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@@ -1314,9 +1316,22 @@ class EditorDOMPointBase final {
|
|||||||
const SelfType& aDOMPoint) {
|
const SelfType& aDOMPoint) {
|
||||||
aStream << "{ mParent=" << aDOMPoint.GetContainer();
|
aStream << "{ mParent=" << aDOMPoint.GetContainer();
|
||||||
if (aDOMPoint.mParent) {
|
if (aDOMPoint.mParent) {
|
||||||
|
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
|
aStream << " (" << *aDOMPoint.mParent
|
||||||
<< ", Length()=" << aDOMPoint.mParent->Length() << ")";
|
<< ", Length()=" << aDOMPoint.mParent->Length() << ")";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
aStream << ", mChild=" << static_cast<nsIContent*>(aDOMPoint.mChild);
|
aStream << ", mChild=" << static_cast<nsIContent*>(aDOMPoint.mChild);
|
||||||
if (aDOMPoint.mChild) {
|
if (aDOMPoint.mChild) {
|
||||||
aStream << " (" << *aDOMPoint.mChild << ")";
|
aStream << " (" << *aDOMPoint.mChild << ")";
|
||||||
|
|||||||
@@ -1146,7 +1146,7 @@ Result<EditActionResult, nsresult> HTMLEditor::HandleInsertText(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pointToInsert = [&]() -> EditorDOMPoint {
|
EditorDOMPoint pointToInsert = [&]() {
|
||||||
if (InsertingTextForExtantComposition(aPurpose)) {
|
if (InsertingTextForExtantComposition(aPurpose)) {
|
||||||
auto compositionStartPoint =
|
auto compositionStartPoint =
|
||||||
GetFirstIMESelectionStartPoint<EditorDOMPoint>();
|
GetFirstIMESelectionStartPoint<EditorDOMPoint>();
|
||||||
|
|||||||
Reference in New Issue
Block a user