Closed Bug 1368387 Opened 3 years ago Closed 3 years ago

Remove nsIDOMText usages from Editor

Categories

(Core :: DOM: Editor, enhancement)

55 Branch
enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: m_kato, Assigned: m_kato)

Details

Attachments

(1 file)

Also, mozilla::TextEditRules::CollapseSelectionToTrailingBRIfNeeded can improve performance since it uses nsIDOMNode.
Comment on attachment 8872238 [details]
Bug 1368387 - Remove nsIDOMText usages from Editor.

https://reviewboard.mozilla.org/r/143722/#review147416

::: editor/libeditor/HTMLEditRules.cpp:6466
(Diff revision 1)
>        if (!sibling || !mHTMLEditor || !mHTMLEditor->IsVisBreak(sibling) ||
>            TextEditUtils::HasMozAttr(GetAsDOMNode(sibling))) {
>          NS_ENSURE_STATE(mHTMLEditor);
>          newBRneeded = true;
>        }
> -    } else if (aOffset == (int32_t)strLength) {
> +    } else if (aOffset == (int32_t)node->Length()) {

nit: I'd like you to use static_cast<int32_t>(node->Length()) here (but okay to do it in a new bug).

::: editor/libeditor/TextEditRules.cpp:460
(Diff revision 1)
> -  uint32_t length;
> -  rv = nodeAsText->GetLength(&length);
> -  NS_ENSURE_SUCCESS(rv, rv);
> -
>    // nothing to do if we're not at the end of the text node
> -  if (selOffset != int32_t(length)) {
> +  if (selOffset != int32_t(selNode->Length())) {

Same, but up to you.
Attachment #8872238 - Flags: review?(masayuki) → review+
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/29d7c9080594
Remove nsIDOMText usages from Editor. r=masayuki
https://hg.mozilla.org/mozilla-central/rev/29d7c9080594
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.