Closed Bug 624977 Opened 14 years ago Closed 14 years ago

Optimize nsXulTreeAccessible selectedItems()

Categories

(Core :: Disability Access APIs, defect)

x86_64
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b10

People

(Reporter: tbsaunde, Assigned: tbsaunde)

References

Details

Attachments

(2 files, 1 obsolete file)

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre Build Identifier: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre selectedITems() in nsXulTreeAccessible was iterating over all the rows of a xul tree when finding the list of selected items instead we use getRangeCount() and getRangeAt() from xul tree selection Reproducible: Couldn't Reproduce
Attached patch a patch implementing this (obsolete) — Splinter Review
Attachment #503082 - Flags: review?
Component: Disability Access → Disability Access APIs
Product: Firefox → Core
Comment on attachment 503082 [details] [diff] [review] a patch implementing this nsITreeSelection::GetRangeAt is not optimal for us - http://mxr.mozilla.org/mozilla-central/source/layout/xul/base/src/tree/src/nsTreeSelection.cpp#584, but that is much better than we have now - traverse through all tree items and look each item through all ranges. I'd suggest to file followup bug to change nsITreeSelection what can be done after Firefox 4. >+ PRInt32 selectionGroups, curGroup; >+ selection->GetRangeCount(&selectionGroups); >+ for (curGroup = 0; curGroup < selectionGroups; curGroup++) { >+ PRInt32 curRow, firstRow, lastRow; >+ selection->GetRangeAt(curGroup, &firstRow, &lastRow); >+ for (curRow = firstRow; curRow <= lastRow; curRow++) { >+ nsIAccessible* item = GetTreeItemAccessible(curRow); > if (item) > selectedItems->AppendElement(item, PR_FALSE); > } > } I'd define variables where they are used, initialize them and change their names, also please use spaces (not tabs) like >+ PRInt32 rangeCount = 0; >+ selection->GetRangeCount(&rangeCount); >+ for (PRint32 rangeIdx = 0; rangeIdx < rangeCount; rangeIdx++) { >+ PRInt32 firstRowIdx = 0, lastRowIdx = -1; > selection->GetRangeAt(rangeIdx, &firstRowIdx, &lastRowIdx); >+ for (PRInt32 rowIdx = firstRowIdx; rowIdx <= lastRowIdx; rowIdx++) { >+ nsIAccessible* item = GetTreeItemAccessible(rowIdx); > if (item) > selectedItems->AppendElement(item, PR_FALSE); > } > } please update the patch and rerequest the review
Attachment #503082 - Flags: review?
Attachment #503082 - Flags: review?(surkov.alexander)
Assignee: nobody → trev.saunders
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
updated patch
Attachment #503101 - Flags: review?(surkov.alexander)
Comment on attachment 503101 [details] [diff] [review] updated patch basedon Surkov's comments r=me, requesting an approval, that should be good perf improvement
Attachment #503101 - Flags: review?(surkov.alexander)
Attachment #503101 - Flags: review+
Attachment #503101 - Flags: approval2.0?
Flags: in-testsuite?
Attachment #503082 - Attachment is obsolete: true
Attachment #503082 - Flags: review?(surkov.alexander)
QA Contact: disability.access → accessibility-apis
Comment on attachment 503101 [details] [diff] [review] updated patch basedon Surkov's comments a=me as long as we get a clean try server run, and please confirm that we have sufficient test coverage. (Nice one Trevor!)
Attachment #503101 - Flags: approval2.0? → approval2.0+
Trevor to confirm test coverage you can purposely introduce various bugs and run our test suite to check for failures. If nothing fails we'll need to write tests.
Nice and green on tryserver.
(In reply to comment #7) > Nice and green on tryserver. Unfortunately it's not covered by mochitest. I'll add some mochitests since it sounds like mochitest suite fails when Orca is running and as consequence Trevor can't do that.
Summary: improve nsXulTreeAccessible selectedItems() → Optimize nsXulTreeAccessible selectedItems()
Attached patch mochitestSplinter Review
Attachment #504370 - Flags: review?(marco.zehe)
Severity: enhancement → normal
Comment on attachment 504370 [details] [diff] [review] mochitest r=me, nicely done, thanks!
Attachment #504370 - Flags: review?(marco.zehe) → review+
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b10
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: