Closed
Bug 570710
Opened 14 years ago
Closed 14 years ago
avoid extra traversal of children array during text event creation
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
People
(Reporter: surkov, Assigned: surkov)
References
()
Details
(Keywords: access)
Attachments
(1 file)
(deleted),
patch
|
davidb
:
review+
MarcoZ
:
review+
|
Details | Diff | Splinter Review |
GetText() in nsAccTextChangeEvent constructor makes us to traverse children array for second time.
Assignee | ||
Comment 1•14 years ago
|
||
try-server build is expected
Attachment #449859 -
Flags: review?(marco.zehe)
Attachment #449859 -
Flags: review?(bolterbugz)
Comment 2•14 years ago
|
||
Comment on attachment 449859 [details] [diff] [review]
patch
> nsAccTextChangeEvent::
> nsAccTextChangeEvent(nsIAccessible *aAccessible,
>- PRInt32 aStart, PRUint32 aLength, PRBool aIsInserted,
>+ PRInt32 aStart, PRUint32 aLength,
>+ nsAString& aModifiedText, PRBool aIsInserted,
> PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput) :
> nsAccEvent(aIsInserted ? nsIAccessibleEvent::EVENT_TEXT_INSERTED : nsIAccessibleEvent::EVENT_TEXT_REMOVED,
> aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes),
>- mStart(aStart), mLength(aLength), mIsInserted(aIsInserted)
>+ mStart(aStart), mLength(aLength), mIsInserted(aIsInserted),
>+ mModifiedText(aModifiedText)
> {
>-#ifdef XP_WIN
>- nsCOMPtr<nsIAccessibleText> textAccessible = do_QueryInterface(aAccessible);
>- NS_ASSERTION(textAccessible, "Should not be firing test change event for non-text accessible!!!");
>- if (textAccessible) {
>- textAccessible->GetText(aStart, aStart + aLength, mModifiedText);
>- }
>-#endif
> }
>
I don't understand this change. It makes Linux and Mac less performant right?
Comment 3•14 years ago
|
||
Comment on attachment 449859 [details] [diff] [review]
patch
r=me with one nit:
>+ // Expose imaginary embedded object character if the accessible hans't
"has no" instead of the mistyped "hasn't".
Thanks for also preparing the tests for the other bug! r=me stands unless try-server build reveals errors.
Attachment #449859 -
Flags: review?(marco.zehe) → review+
Assignee | ||
Comment 4•14 years ago
|
||
(In reply to comment #2)
> I don't understand this change. It makes Linux and Mac less performant right?
Absolutely. But it must be worth sacrifice.
Assignee | ||
Updated•14 years ago
|
Summary: avoid extra array traversal during text event creation → avoid extra traversal of children array during text event creation
Comment 5•14 years ago
|
||
(In reply to comment #0)
> GetText() in nsAccTextChangeEvent constructor makes us to traverse children
> array for second time.
I'm not familiar with how this happens. Can you explain?
Assignee | ||
Comment 6•14 years ago
|
||
Assignee | ||
Comment 7•14 years ago
|
||
(In reply to comment #5)
> (In reply to comment #0)
> > GetText() in nsAccTextChangeEvent constructor makes us to traverse children
> > array for second time.
>
> I'm not familiar with how this happens. Can you explain?
GetText() finds children by offsets iterating through array and get text from them.
Comment 8•14 years ago
|
||
Comment on attachment 449859 [details] [diff] [review]
patch
r=me thanks!
> nsresult
> nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
> {
>+ // Return text representation of not text accessible within hypertext
Please change "not text" to "non-text".
>+++ b/accessible/src/html/nsHyperTextAccessible.cpp
>@@ -426,16 +426,17 @@ nsHyperTextAccessible::GetPosAndText(PRI
> // Embedded object, append marker
> // XXX Append \n for <br>'s
> if (startOffset >= 1) {
> -- startOffset;
> }
> else {
> if (endOffset > 0) {
> if (aText) {
>+ // XXX: should use nsIAccessible::AppendTextTo.
Bug filed?
(The testing design worries me a bit in terms of making this a bit harder to debug oranges etc. but ok)
I tested trunk with and without your patch. There was of course no impact without a11y, and with a11y, as expected, your changes cut the processing time in half. Nice.
http://people.mozilla.com/~dbolter/perf/textchangeevents.html
Attachment #449859 -
Flags: review?(bolterbugz) → review+
Comment 9•14 years ago
|
||
Average numbers
without patch: 10 113
with patch: 10 54
Assignee | ||
Comment 10•14 years ago
|
||
(In reply to comment #8)
> >+ // XXX: should use nsIAccessible::AppendTextTo.
>
> Bug filed?
We have couple bugs about text problems, all of them should end in rethinking GetPosAndText and relatives. This should be a part of it.
Assignee | ||
Comment 11•14 years ago
|
||
landed on 1.9.3 - http://hg.mozilla.org/mozilla-central/rev/c8f859ac1b6c
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•