mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1698786: part 7) Add more MOZ_LOG
ging to mozInlineSpellWordUtil
. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D109277
This commit is contained in:
parent
9e4f5f9c4a
commit
58f319b15f
@ -209,6 +209,10 @@ nsresult mozInlineSpellWordUtil::SetPositionAndEnd(nsINode* aPositionNode,
|
||||
int32_t aPositionOffset,
|
||||
nsINode* aEndNode,
|
||||
int32_t aEndOffset) {
|
||||
MOZ_LOG(sInlineSpellWordUtilLog, LogLevel::Debug,
|
||||
("%s: pos=(%p, %i), end=(%p, %i)", __FUNCTION__, aPositionNode,
|
||||
aPositionOffset, aEndNode, aEndOffset));
|
||||
|
||||
MOZ_ASSERT(aPositionNode, "Null begin node?");
|
||||
MOZ_ASSERT(aEndNode, "Null end node?");
|
||||
|
||||
@ -757,6 +761,8 @@ void mozInlineSpellWordUtil::NormalizeWord(nsAString& aWord) {
|
||||
}
|
||||
|
||||
void mozInlineSpellWordUtil::BuildSoftText() {
|
||||
MOZ_LOG(sInlineSpellWordUtilLog, LogLevel::Debug, ("%s", __FUNCTION__));
|
||||
|
||||
// First we have to work backwards from mSoftStart to find a text node
|
||||
// containing a DOM word separator, a non-inline-element
|
||||
// boundary, or the hard start node. That's where we'll start building the
|
||||
@ -1012,8 +1018,31 @@ NodeOffset mozInlineSpellWordUtil::MapSoftTextOffsetToDOMPosition(
|
||||
return NodeOffset(nullptr, -1);
|
||||
}
|
||||
|
||||
// static
|
||||
void mozInlineSpellWordUtil::ToString(const DOMMapHint aHint,
|
||||
nsACString& aResult) {
|
||||
switch (aHint) {
|
||||
case HINT_BEGIN:
|
||||
aResult.AssignLiteral("begin");
|
||||
break;
|
||||
case HINT_END:
|
||||
aResult.AssignLiteral("end");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mozInlineSpellWordUtil::FindRealWordContaining(
|
||||
int32_t aSoftTextOffset, DOMMapHint aHint, bool aSearchForward) const {
|
||||
if (MOZ_LOG_TEST(sInlineSpellWordUtilLog, LogLevel::Debug)) {
|
||||
nsAutoCString hint;
|
||||
mozInlineSpellWordUtil::ToString(aHint, hint);
|
||||
|
||||
MOZ_LOG(
|
||||
sInlineSpellWordUtilLog, LogLevel::Debug,
|
||||
("%s: offset=%i, hint=%s, searchForward=%i.", __FUNCTION__,
|
||||
aSoftTextOffset, hint.get(), static_cast<int32_t>(aSearchForward)));
|
||||
}
|
||||
|
||||
NS_ASSERTION(mSoftTextValid,
|
||||
"Soft text must be valid if we're to map out of it");
|
||||
if (!mSoftTextValid) return -1;
|
||||
|
@ -186,6 +186,9 @@ class MOZ_STACK_CLASS mozInlineSpellWordUtil {
|
||||
enum DOMMapHint { HINT_BEGIN, HINT_END };
|
||||
NodeOffset MapSoftTextOffsetToDOMPosition(int32_t aSoftTextOffset,
|
||||
DOMMapHint aHint);
|
||||
|
||||
static void ToString(DOMMapHint aHint, nsACString& aResult);
|
||||
|
||||
// Finds the index of the real word containing aSoftTextOffset, or -1 if none
|
||||
// If it's exactly between two words, then if aHint is HINT_BEGIN, return the
|
||||
// later word (favouring the assumption that it's the BEGINning of a word),
|
||||
|
Loading…
Reference in New Issue
Block a user