Make HTMLEditor::GetSelectionContainer() protected

RESOLVED FIXED in Firefox 63

Status

()

enhancement
RESOLVED FIXED
11 months ago
11 months ago

People

(Reporter: masayuki, Assigned: masayuki)

Tracking

Trunk
mozilla63
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(1 attachment)

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: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.