Closed Bug 1447213 Opened 2 years ago Closed 2 years ago

Get rid of EditorDOMPoint::AsRaw()

Categories

(Core :: DOM: Editor, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Currently, a lot of methods take |const EditorRawDOMPoint&| as their argument. However, some of them are called with EditorDOMPoint::AsRaw(). This is not good for performance because:
1. Needs to create temporary instance of EditorRawDOMPoint.
2. EditorRawDOMPoint::AsRaw() may be used by simple mistake.
3. Such methods may call EditorRawDOMPoint::Offset(), however, it's not copied to the original EditorDOMPoint instance.  So, callers may need to compute offset again.

So, such methods should be changed to template methods if they are not virtual method and get rid of AsRaw() methods for prevent its looks not expensive.
Comment on attachment 8960587 [details]
Bug 1447213 - Change editor methods which take |const EditorRawDOMPoint&| but called with EditorDOMPoint.AsRaw() to template methods

Oops, not enough. Needs some more explicit declaration.
https://treeherder.mozilla.org/logviewer.html#?job_id=169206719&repo=try&lineNumber=32800
Attachment #8960587 - Flags: review?(m_kato) → review-
Comment on attachment 8960587 [details]
Bug 1447213 - Change editor methods which take |const EditorRawDOMPoint&| but called with EditorDOMPoint.AsRaw() to template methods

https://reviewboard.mozilla.org/r/229336/#review235988
Attachment #8960587 - Flags: review?(m_kato) → review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e381311f2847
Change editor methods which take |const EditorRawDOMPoint&| but called with EditorDOMPoint.AsRaw() to template methods r=m_kato
https://hg.mozilla.org/mozilla-central/rev/e381311f2847
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.