Closed Bug 379366 Opened 19 years ago Closed 19 years ago

reimplement IAccessibleText::newText and oldText

Categories

(Core :: Disability Access APIs, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: surkov, Assigned: surkov)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 5 obsolete files)

from bug 378038: (From update of attachment 263365 [details] [diff] [review]) Please file a follow-up bug to greatly reduce the footprint of keeping track of oldText/newText etc. Don't use member variables, just keep track of the last 12 text changes or something like that. When a request for oldText or newText comes in, find that object in the circular array and get the data for it there. Comment #33 [reply] Aaron Leventhal 2007-05-01 09:58:34 PDT Of course, you'll have to throw out older oldText/newText info when newer text changes occur on the same object. But, you would have that problem if using member variables anyway.
Actually I'm not sure whether we should bother storing more than 1 previous event. After all, if 2 events occur on the same text object, it's impossible to know which event the AT wants the info for, right? We'll have to assume the last one in that case. Therefore, we'll never be able to guarantee correct info for anything mor than the last event. That's part of the design of IA2, and there's nothing we can do about it. The results may not be gauranteed except for in-process clients, which ensures they can get the info before another event is fired on the same object. So no circular array is necessary. Just keep a few globals to track the last change (or perhaps the last removal/oldText and last insertion/newText). I'm not sure if this limitation in how many events we can return is a problem or not. It might not be.
Attached patch patch (obsolete) — — Splinter Review
to store accessible event itself in static variable
Attachment #263560 - Flags: review?(aaronleventhal)
Comment on attachment 263560 [details] [diff] [review] patch Ben, is there a crash in xulrunner from bug 378038?
Attachment #263560 - Flags: review?(bent.mozilla)
Thanks for the quick patch! I'll test this tomorrow morning and post back here.
bsmedberg, is it ok to have a static nsCOMPtr? Or should he manually AddRef/Release a simple interface pointer?
(In reply to comment #5) > bsmedberg, is it ok to have a static nsCOMPtr? Or should he manually > AddRef/Release a simple interface pointer? > It shoudn't be a problem, for example http://lxr.mozilla.org/mozilla/source/widget/src/gtk/nsWidget.h#410
Comment on attachment 263560 [details] [diff] [review] patch >-nsString nsHyperTextAccessibleWrap::sText; >-PRInt32 nsHyperTextAccessibleWrap::sOffset = 0; >-PRUint32 nsHyperTextAccessibleWrap::sLength = 0; >-PRBool nsHyperTextAccessibleWrap::sIsInserted = PR_FALSE; >+static nsCOMPtr<nsIAccessibleTextChangeEvent> sTextEvent; Having read the comments in bug 370838 I have to disappoint you that you can't have a static nsCOMPtr either. However you can use a raw pointer and manage refcounts yourself.
Yes, static COMPtrs are a problem, from what I've heard. However, I somehow missed the fact that you were already using static. I must not have noticed that changed in the last patches. So, are any more changes even necessary?
BTW, you can use nsAccessNode::ShutdownXPAccessibility() to do any destruction of static strings or nsCOMPtrs at the right time.
Comment on attachment 263560 [details] [diff] [review] patch Given those comments I'll wait for your next patch.
Attachment #263560 - Flags: review?(bent.mozilla)
Attachment #263560 - Flags: review?(aaronleventhal) → review-
Attached patch patch2 (obsolete) — — Splinter Review
Attachment #263560 - Attachment is obsolete: true
Attachment #263727 - Flags: review?(aaronleventhal)
(In reply to comment #8) > Yes, static COMPtrs are a problem, from what I've heard. > > However, I somehow missed the fact that you were already using static. I must > not have noticed that changed in the last patches. > > So, are any more changes even necessary? > I thought probably it's more fine to keep a bit longer existing accessible event object instead to have additional several members to keep its info.
Status: NEW → ASSIGNED
Comment on attachment 263727 [details] [diff] [review] patch2 Don't we need to check if the accessible for the gTextAccessible == the hyper text we're asking for the modified text from? If the last event occurs on Node A, and I ask for the modified text on Node B, I should get some kind of error. Maybe there is a COM equivalent to this: /* Returned when an operation can't complete due to an unavailable resource */ 199 #define NS_ERROR_NOT_AVAILABLE ((nsresult) 0x80040111L) Or, I think it's possible to return a NULL BSTR as opposed to an emoty string.
Comment on attachment 263727 [details] [diff] [review] patch2 Clearing request until I hear an answer.
Attachment #263727 - Flags: review?(aaronleventhal)
Attached patch patch3 (obsolete) — — Splinter Review
something like this?
Attachment #263727 - Attachment is obsolete: true
Attachment #263981 - Flags: review?(aaronleventhal)
Here is a clear case where a couple of extra { } would make it more readable: if (NS_SUCCEEDED(rv)) { if (instancePtr) gTextEvent = do_QueryInterface(aEvent); (NS_STATIC_CAST(IUnknown*, instancePtr))->Release(); } Also, can rv ever be a failure code when instancePtr is non-null, or can rv be a success code when instancePtr is null? I think you also need to check if (gTextAccessible == this), and return if it isn't. Otherwise you might return a change string for an accessible it didn't occur on. if ((aGetInsertedText && isInserted) || (!aGetInsertedText && !isInserted)) {
Attachment #263981 - Flags: review?(aaronleventhal)
Attached patch patch4 (obsolete) — — Splinter Review
Attachment #263981 - Attachment is obsolete: true
Attachment #264076 - Flags: review?(aaronleventhal)
Attachment #264076 - Flags: review?(aaronleventhal) → review+
Attachment #264076 - Flags: superreview?(neil)
Attachment #264076 - Flags: review?(bent.mozilla)
Comment on attachment 264076 [details] [diff] [review] patch4 Our XULRunner builds no longer crash with this patch. Thank you!
Attachment #264076 - Flags: review?(bent.mozilla) → review+
(In reply to comment #18) > (From update of attachment 264076 [details] [diff] [review]) > Our XULRunner builds no longer crash with this patch. Thank you! > Nice to hear, thank you for the review.
Comment on attachment 264076 [details] [diff] [review] patch4 Well, I'm still not 100% happy, so don't be surprised if someone else crashes in ~nsCOMPtr.
Attachment #264076 - Flags: superreview?(neil) → superreview+
Attached patch patch5 (obsolete) — — Splinter Review
Is it closer to 100% happiness? :)
Attachment #264076 - Attachment is obsolete: true
Attachment #264599 - Flags: superreview?(neil)
Comment on attachment 264599 [details] [diff] [review] patch5 Closer, yes :-) >+nsIAccessibleTextChangeEvent *nsAccessNodeWrap::gTextEvent; = nsnull; please >+ if (gTextEvent) >+ gTextEvent->Release(); >+ gTextEvent = nsnull; NS_IF_RELEASE(gTextEvent); (and similarly later) > >-nsString nsHyperTextAccessibleWrap::sText; >-PRInt32 nsHyperTextAccessibleWrap::sOffset = 0; >-PRUint32 nsHyperTextAccessibleWrap::sLength = 0; >-PRBool nsHyperTextAccessibleWrap::sIsInserted = PR_FALSE; >+ > Only one blank line needed ;-)
Attachment #264599 - Flags: superreview?(neil) → superreview+
Attached patch patch6 — — Splinter Review
for checking in
Attachment #264599 - Attachment is obsolete: true
Comment on attachment 264604 [details] [diff] [review] patch6 checked in
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: