Closed Bug 1483144 Opened 5 years ago Closed 5 years ago

Make HTMLEditor::GetSelectionContainer() protected

Categories

(Core :: DOM: Editor, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

HTMLEditor::GetSelectionContainer() is a public method, but it's not used by outer classes. So, we can make it a protected member.
HTMLEditor::GetSelectionContainer() is a public method, but it's not used by
outer classes. So, we can make it a protected member.

Additionally, this patch cleans up the method.

  - Renames to GetSelectionContainerElement() for making clearer what will be
    returned.
  - Makes it const.
  - Makes it take Selection reference since most callers already have Selection.
  - Makes it use RangeBoundary to access start point and end point of range since nsRange::StartOffset() and nsRange::EndOffset() may be slow.
  - Makes it not use GetSelectedElement() since it requires unnecessary additional cost and the condition to call it means it uses only the first path in GetSelectedElement() which just returns start node of the range.
  - Makes it output warning when it returns nullptr since it reaches nullptr only when illegal cases, e.g., Selection is in orphan node.
Comment on attachment 9001461 [details]
Bug 1483144 - Make HTMLEditor::GetSelectionContainer() protected

Makoto Kato [:m_kato] has approved the revision.
Attachment #9001461 - Flags: review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/a28cf4300f12
Make HTMLEditor::GetSelectionContainer() protected r=m_kato
https://hg.mozilla.org/mozilla-central/rev/a28cf4300f12
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.