зеркало из https://github.com/mozilla/gecko-dev.git
bug 619002 - use text-remove / text-insert signals r=davidb, fer
This commit is contained in:
Родитель
f6c4f47b40
Коммит
159859c23d
|
@ -41,8 +41,6 @@
|
|||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsMaiInterfaceText.h"
|
||||
|
||||
PRBool nsAccessNodeWrap::gHaveNewTextSignals = PR_FALSE;
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
@ -72,7 +70,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
|
|||
void nsAccessNodeWrap::InitAccessibility()
|
||||
{
|
||||
nsAccessNode::InitXPAccessibility();
|
||||
gHaveNewTextSignals = g_signal_lookup("text-insert", ATK_TYPE_TEXT);
|
||||
}
|
||||
|
||||
void nsAccessNodeWrap::ShutdownAccessibility()
|
||||
|
|
|
@ -55,12 +55,6 @@ public: // construction, destruction
|
|||
static void InitAccessibility();
|
||||
static void ShutdownAccessibility();
|
||||
|
||||
/*
|
||||
* do we have text-remove and text-insert signals if not we need to use
|
||||
* text-changed see nsAccessibleWrap::FireAtkTextChangedEvent() and
|
||||
* bug 619002
|
||||
*/
|
||||
static PRBool gHaveNewTextSignals;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
#include "nsMaiInterfaceDocument.h"
|
||||
#include "nsMaiInterfaceImage.h"
|
||||
|
||||
nsAccessibleWrap::EAvailableAtkSignals nsAccessibleWrap::gAvailableAtkSignals =
|
||||
eUnknown;
|
||||
|
||||
//defined in nsApplicationAccessibleWrap.cpp
|
||||
extern "C" GType g_atk_hyperlink_impl_type;
|
||||
|
||||
|
@ -1368,14 +1371,11 @@ nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
|||
PRBool isFromUserInput = aEvent->IsFromUserInput();
|
||||
char* signal_name = nsnull;
|
||||
|
||||
if (gHaveNewTextSignals) {
|
||||
nsAutoString text;
|
||||
event->GetModifiedText(text);
|
||||
signal_name = g_strconcat(isInserted ? "text-insert" : "text-remove",
|
||||
isFromUserInput ? "" : "::system", NULL);
|
||||
g_signal_emit_by_name(aObject, signal_name, start, length,
|
||||
NS_ConvertUTF16toUTF8(text).get());
|
||||
} else {
|
||||
if (gAvailableAtkSignals == eUnknown)
|
||||
gAvailableAtkSignals = g_signal_lookup("text-insert", ATK_TYPE_TEXT) ?
|
||||
eHaveNewAtkTextSignals : eNoNewAtkSignals;
|
||||
|
||||
if (gAvailableAtkSignals == eNoNewAtkSignals) {
|
||||
// XXX remove this code and the gHaveNewTextSignals check when we can
|
||||
// stop supporting old atk since it doesn't really work anyway
|
||||
// see bug 619002
|
||||
|
@ -1383,6 +1383,13 @@ nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
|||
"text_changed::delete",
|
||||
isFromUserInput ? "" : kNonUserInputEvent, NULL);
|
||||
g_signal_emit_by_name(aObject, signal_name, start, length);
|
||||
} else {
|
||||
nsAutoString text;
|
||||
event->GetModifiedText(text);
|
||||
signal_name = g_strconcat(isInserted ? "text-insert" : "text-remove",
|
||||
isFromUserInput ? "" : "::system", NULL);
|
||||
g_signal_emit_by_name(aObject, signal_name, start, length,
|
||||
NS_ConvertUTF16toUTF8(text).get());
|
||||
}
|
||||
|
||||
g_free(signal_name);
|
||||
|
|
|
@ -127,6 +127,20 @@ protected:
|
|||
AtkObject *mAtkObject;
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
* do we have text-remove and text-insert signals if not we need to use
|
||||
* text-changed see nsAccessibleWrap::FireAtkTextChangedEvent() and
|
||||
* bug 619002
|
||||
*/
|
||||
enum EAvailableAtkSignals {
|
||||
eUnknown,
|
||||
eHaveNewAtkTextSignals,
|
||||
eNoNewAtkSignals
|
||||
};
|
||||
|
||||
static EAvailableAtkSignals gAvailableAtkSignals;
|
||||
|
||||
PRUint16 CreateMaiInterfaces(void);
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче