Closed Bug 575052 Opened 14 years ago Closed 14 years ago

cache text offsets within hypertext accessible

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: surkov, Assigned: surkov)

References

()

Details

(Keywords: access)

Attachments

(1 file, 1 obsolete file)

      No description provided.
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → surkov.alexander
Status: NEW → ASSIGNED
Attachment #454345 - Flags: superreview?(neil)
Attachment #454345 - Flags: review?(marco.zehe)
Attachment #454345 - Flags: review?(bolterbugz)
Blocks: 565452
Blocks: 566328
Comment on attachment 454345 [details] [diff] [review]
patch

r=me for the tests and the functionality part. Great job!
Attachment #454345 - Flags: review?(marco.zehe) → review+
(In reply to comment #3)
> I've updated perf tracking table -
> https://wiki.mozilla.org/Accessibility/EventCoalescing#Performance_improvements_tracking_table
> (tested on try server build I pointed above).

Very nice.
Comment on attachment 454345 [details] [diff] [review]
patch

>+
>+  } else {
Nit: strange place for a blank line

>+  PRInt32 offset = mOffsets.SafeElementAt(index - 1, -1);
>+  if (offset != -1) {
>+    if (aInvalidateAfter) {
>+      PRInt32 count = mOffsets.Length() - index;
>+      if (count > 0)
>+        mOffsets.RemoveElementsAt(index, count);
>+    }
>+    return offset;
>+  }
Rather than using SafeElementAt, I'd prefer checking count >= 0 like this:
PRInt32 count = mOffsets.Length() - index;
if (count >= 0) {
  if (count > 0 && aInvalidateAfter)
    mOffsets.RemoveElementsAt(index, count);
  return mOffsets[index - 1];
}
This also makes things minusculely easier for the optimiser ;-)

>+  PRUint32 childCount = GetChildCount();
>+  while (mOffsets.Length() < childCount && mOffsets.Length() < index) {
index is always less than mChildren.Length() [or childCount], right? So you shouldn't have to compare against childCount.
(In reply to comment #6)
> (From update of attachment 454345 [details] [diff] [review])
> >+
> >+  } else {
> Nit: strange place for a blank line

the empty line is intended to separate visually end of if block from else block, it seems to me it's a bit more readable, I would safe this if you don't mind.

> Rather than using SafeElementAt, I'd prefer checking count >= 0 like this:
> PRInt32 count = mOffsets.Length() - index;
> if (count >= 0) {
>   if (count > 0 && aInvalidateAfter)
>     mOffsets.RemoveElementsAt(index, count);
>   return mOffsets[index - 1];
> }
> This also makes things minusculely easier for the optimiser ;-)
> 
> >+  PRUint32 childCount = GetChildCount();
> >+  while (mOffsets.Length() < childCount && mOffsets.Length() < index) {
> index is always less than mChildren.Length() [or childCount], right? So you
> shouldn't have to compare against childCount.

I like this, thank you.
Attached patch patch2Splinter Review
Neil's comments are fixed
Attachment #454345 - Attachment is obsolete: true
Attachment #455085 - Flags: superreview?(neil)
Attachment #455085 - Flags: review?(bolterbugz)
Attachment #454345 - Flags: superreview?(neil)
Attachment #454345 - Flags: review?(bolterbugz)
Attachment #455085 - Flags: superreview?(neil) → superreview+
Comment on attachment 455085 [details] [diff] [review]
patch2

r=me.

>+nsHyperTextAccessible::GetChildOffset(nsAccessible* aChild,
>+                                      PRBool 

>+  EnsureChildren();

Good.

We should probably add more tests (later).
Attachment #455085 - Flags: review?(bolterbugz) → review+
landed on 1.9.3 (2.0) - http://hg.mozilla.org/mozilla-central/rev/7456a4bfba46
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.

Attachment

General

Created:
Updated:
Size: