Closed Bug 484159 Opened 15 years ago Closed 2 years ago

Optimize nsContentUtils::ContentIsDescendantOf

Categories

(Core :: DOM: Core & HTML, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
if aPossibleDescendant is in doc, but aPossibleAncestor isn't, or vise-versa,
aPossibleAncestor can't be ancestor of aPossibleDescendant.

The method shows up occasionally in some profiles.
Attachment #368225 - Flags: superreview?(jonas)
Attachment #368225 - Flags: review?(jonas)
Comment on attachment 368225 [details] [diff] [review]
patch

Hard to say if this actually is an improvement or not in the general case. Depends on how often we call this with out-of-doc nodes.

Did you have a reason to go for this specific optimization?

I wonder if we should inline the function as well. Or instead.

r/sr=me either way.
Attachment #368225 - Flags: superreview?(jonas)
Attachment #368225 - Flags: superreview+
Attachment #368225 - Flags: review?(jonas)
Attachment #368225 - Flags: review+
(In reply to comment #1) 
> Did you have a reason to go for this specific optimization?
If the DOM is very deep and we add a new child to it.
Though if that's the only case that benefits from this optimization, you could put that check in the caller instead?
Attachment #368225 - Attachment is obsolete: true
Comment on attachment 368225 [details] [diff] [review]
patch

For some reason this causes assertions in nsRange when closing the browser.
(In reply to comment #5)
> For some reason this causes assertions in nsRange when closing the browser.
The reason is native anonymous content which is still marked to be in document, 
even though their parent isn't. This happens when destroying input element.
Hmm.  Doesn't that unbind the native anon content?
Component: DOM → DOM: Core & HTML

There is no nsContentUtils::ContentIsDescendantOf anymore and similar code has been optimized elsewhere in the past few years.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: