From f2186c6cc2b359a0982c8c0988261c6f1425101d Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 3 Feb 2011 01:02:48 +0800 Subject: [PATCH] Bug 630841 - update text offsets when remove child from hypertext accessible, r=surkov, a=final --- accessible/src/html/nsHyperTextAccessible.cpp | 11 +++++++++++ accessible/src/html/nsHyperTextAccessible.h | 1 + 2 files changed, 12 insertions(+) diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index ec07b613d3b..1e664f666b5 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -2093,6 +2093,17 @@ nsHyperTextAccessible::InvalidateChildren() nsAccessibleWrap::InvalidateChildren(); } +PRBool +nsHyperTextAccessible::RemoveChild(nsAccessible* aAccessible) +{ + PRInt32 childIndex = aAccessible->GetIndexInParent(); + PRInt32 count = mOffsets.Length() - childIndex; + if (count > 0) + mOffsets.RemoveElementsAt(childIndex, count); + + return nsAccessible::RemoveChild(aAccessible); +} + //////////////////////////////////////////////////////////////////////////////// // nsHyperTextAccessible public static diff --git a/accessible/src/html/nsHyperTextAccessible.h b/accessible/src/html/nsHyperTextAccessible.h index 804ff0cc6fd..81ac7fefe7c 100644 --- a/accessible/src/html/nsHyperTextAccessible.h +++ b/accessible/src/html/nsHyperTextAccessible.h @@ -90,6 +90,7 @@ public: virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState); virtual void InvalidateChildren(); + virtual PRBool RemoveChild(nsAccessible* aAccessible); // nsHyperTextAccessible (static helper method)