Closed
Bug 1481292
Opened 7 years ago
Closed 7 years ago
Investigate if ContentEventHandler could stop using GetChildAt_Deprecated
Categories
(Core :: DOM: UI Events & Focus Handling, enhancement, P3)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
FIXED
mozilla63
| Tracking | Status | |
|---|---|---|
| firefox63 | --- | fixed |
People
(Reporter: smaug, Assigned: masayuki)
Details
Attachments
(2 files)
GetChildAt_Deprecated will be slow soon.
| Assignee | ||
Comment 1•7 years ago
|
||
By which bug? And what should be used instead?
Flags: needinfo?(bugs)
| Reporter | ||
Comment 2•7 years ago
|
||
Bug 651120.
Basically one should try to use nsINode::GetFirstChild / GetNextSibling / GetPreviousSibling when possible, and or if there is RangeBoundary around, it has its methods.
Flags: needinfo?(bugs)
| Assignee | ||
Comment 3•7 years ago
|
||
Thank you.
> Basically one should try to use nsINode::GetFirstChild / GetNextSibling / GetPreviousSibling when possible
It may be difficult to decide how many times to call GetFirstChild and GetNextSibling is faster than calling GetChildAt_Deprecated...
> or if there is RangeBoundary around, it has its methods
https://searchfox.org/mozilla-central/rev/51268dcbdff0f6f4a5cff7986df0f616efc5bcfd/dom/base/RangeBoundary.h#211
Anyway, RangeBoundary (and EditoDOMPoint which is another implementation of RangeBoundary) uses GetChildAt_Deprecated. Is it okay or will it updated with new API or something?
| Assignee | ||
Comment 4•7 years ago
|
||
EditorDOMPoint's reference is here:
https://searchfox.org/mozilla-central/rev/51268dcbdff0f6f4a5cff7986df0f616efc5bcfd/editor/libeditor/EditorDOMPoint.h#788
I guess that editor accesses this path a lot...
| Assignee | ||
Comment 5•7 years ago
|
||
GetChildAt_Deprecated is used in 4 places:
1. https://searchfox.org/mozilla-central/rev/51268dcbdff0f6f4a5cff7986df0f616efc5bcfd/dom/events/ContentEventHandler.cpp#1590
2. https://searchfox.org/mozilla-central/rev/51268dcbdff0f6f4a5cff7986df0f616efc5bcfd/dom/events/ContentEventHandler.cpp#1597
Looks like ContentEventHandler::GetNodePositionHavingFlatText() is dead code now. So, perhaps, we can remove all overloads of ContentEventHandler::GetNodePositionHavingFlatText().
3. https://searchfox.org/mozilla-central/rev/51268dcbdff0f6f4a5cff7986df0f616efc5bcfd/dom/events/ContentEventHandler.cpp#1697
Must be replaced with RangeBoundary.
4. https://searchfox.org/mozilla-central/rev/51268dcbdff0f6f4a5cff7986df0f616efc5bcfd/dom/events/ContentEventHandler.cpp#3039
Same.
I'll create a patch.
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Updated•7 years ago
|
Priority: -- → P3
| Reporter | ||
Comment 6•7 years ago
|
||
Great, thanks.
If the methods in nsINode or RangeBoundary can't be used, there is also the option to use nsINode::ChildNodes(), though that does use more memory. But at least the index is cached there.
| Reporter | ||
Comment 7•7 years ago
|
||
And RangeBounday does and will use the deprecated method, but usually it works without it.
| Assignee | ||
Comment 8•7 years ago
|
||
| Assignee | ||
Comment 9•7 years ago
|
||
ContentEventHandler::GetNodePositionHavingFlatText() is not used by anybody.
So, we should just get rid of it.
| Assignee | ||
Comment 10•7 years ago
|
||
ContentEventHandler::GetLastFrameInRangeForTextRect() and
ContentEventHandler::AdjustCollapsedRangeMaybeIntoTextNode() use
nsINode::GetChildAt_Deprecated() directly. They use this method when they
treat start or end of a range. So, we can make them use RangeBoundary instead.
Comment 11•7 years ago
|
||
Comment on attachment 8998147 [details]
Bug 1481292 - part 1: Get rid of ContentEventHandler::GetNodePositionHavingFlatText() because of unused
Olli Pettay [:smaug] has approved the revision.
https://phabricator.services.mozilla.com/D2842
Attachment #8998147 -
Flags: review+
Comment 12•7 years ago
|
||
Comment on attachment 8998148 [details]
Bug 1481292 - part 2: Make ContentEventHandler::GetLastFrameInRangeForTextRect() and ContentEventHandler::AdjustCollapsedRangeMaybeIntoTextNode() use RangeBoundary when they treat start or end of range
Olli Pettay [:smaug] has approved the revision.
https://phabricator.services.mozilla.com/D2843
Attachment #8998148 -
Flags: review+
Comment 13•7 years ago
|
||
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/43373390fa8d
part 1: Get rid of ContentEventHandler::GetNodePositionHavingFlatText() because of unused r=smaug
Comment 14•7 years ago
|
||
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/fcf0193311b0
part 2: Make ContentEventHandler::GetLastFrameInRangeForTextRect() and ContentEventHandler::AdjustCollapsedRangeMaybeIntoTextNode() use RangeBoundary when they treat start or end of range r=smaug
Comment 15•7 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/43373390fa8d
https://hg.mozilla.org/mozilla-central/rev/fcf0193311b0
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•