Closed Bug 585255 Opened 14 years ago Closed 13 years ago

Remove nsTreeWalker usage from nsFocusManager

Categories

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

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla6

People

(Reporter: craig.topper, Assigned: craig.topper)

Details

Attachments

(1 file, 4 obsolete files)

nsFocusManager uses nsTreeWalker to locate next and previous nsIContents. This is overkill now that there are fast node traversal methods supported by nsINode. It should use GetNextNode and a new method to get the previous nsIContent.

Patch coming soon.
Attached patch Patch (obsolete) — Splinter Review
I've added an GetPreviousContent method to nsIContent. I can move it to nsINode if that is preferred, but since it only knows how to return nsIContent* I think you need to be in an nsIContent to even bother wanting to find a previous content. (My knowledge of nsINode vs nsIContent is very bad.)

Not entirely sure how to test this. Is focus stuff covered by one of the test systems? I did run the built browser and made sure it still seemed to move forwards and backwards correctly.
Attachment #463996 - Flags: review?(jonas)
For what it's worth, the behavior of that function wrt aRoot doesn't match the documentation.  Also, there's no problem using nsContentUtils methods in nsGenericElement; they just couldn't be used in nsINode....
Oops I was going to fix that and forgot. I'll post a new patch later today.
Attached patch Fixes for bz's comments (obsolete) — Splinter Review
Attachment #463996 - Attachment is obsolete: true
Attachment #464305 - Flags: review?(jonas)
Attachment #463996 - Flags: review?(jonas)
I think we want

nsIContent* nsIContent::GetPreviousContent

to be changed into

nsIContent* nsINode::GetPreviousContent

i.e. moved to the nsINode interface. We probably also want to keep it inlined such that it can be called from anywhere. This means that you won't be able to call nsContentUtils::ContentIsDescendantOf but unfortunately have to duplicate and inline it :( It's somewhat more ok though since it's DEBUG only.
If we want to inline it, the right way to do it is to put the decl in nsINode and the impl at the bottom of nsIContent.h.
Attached patch Moved GetPreviousNode to nsINode (obsolete) — Splinter Review
Attachment #464305 - Attachment is obsolete: true
Attachment #464710 - Flags: review?(jonas)
Attachment #464305 - Flags: review?(jonas)
Comment on attachment 464710 [details] [diff] [review]
Moved GetPreviousNode to nsINode

Yay! Pretty!
Attachment #464710 - Flags: review?(jonas) → review+
Jonas, should I ask for 2.0 approval or wait til we branch?
I'd say that we should wait. There's not much value for users here, just value for our continued ease of working with this code, so doesn't give us much to put in FF4.
I don't want to land this tonight as the tree is in a crazy state. I'll try to remember to land this tomorrow, otherwise please remind me.
Attachment #464710 - Attachment is obsolete: true
Attachment #525323 - Attachment is obsolete: true
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/af860093a19a
Status: NEW → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: