mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1192330 - add ia2AccessibleText::UpdateTextChangeData r=surkov
Soon we will need to be able to update the text change event data from both HandleAccEvent() and ProxyTextChangeEvent(), so separate out the logic to do that into a function.
This commit is contained in:
parent
e43b77bce9
commit
2b5f6116ed
@ -622,3 +622,18 @@ ia2AccessibleText::InitTextChangeData()
|
||||
ClearOnShutdown(&sLastTextChangeAcc);
|
||||
ClearOnShutdown(&sLastTextChangeString);
|
||||
}
|
||||
|
||||
void
|
||||
ia2AccessibleText::UpdateTextChangeData(HyperTextAccessibleWrap* aAcc,
|
||||
bool aInsert, const nsString& aStr,
|
||||
int32_t aStart, uint32_t aLen)
|
||||
{
|
||||
if (!sLastTextChangeString)
|
||||
sLastTextChangeString = new nsString();
|
||||
|
||||
sLastTextChangeAcc = aAcc;
|
||||
sLastTextChangeStart = aStart;
|
||||
sLastTextChangeEnd = aStart + aLen;
|
||||
sLastTextChangeWasInsert = aInsert;
|
||||
*sLastTextChangeString = aStr;
|
||||
}
|
||||
|
@ -115,6 +115,9 @@ public:
|
||||
/* [retval][out] */ IA2TextSegment *oldText);
|
||||
|
||||
static void InitTextChangeData();
|
||||
static void UpdateTextChangeData(HyperTextAccessibleWrap* aAcc, bool aInsert,
|
||||
const nsString& aStr, int32_t aStart,
|
||||
uint32_t aLen);
|
||||
|
||||
protected:
|
||||
static StaticRefPtr<HyperTextAccessibleWrap> sLastTextChangeAcc;
|
||||
|
@ -53,16 +53,13 @@ HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
|
||||
Accessible* accessible = aEvent->GetAccessible();
|
||||
if (accessible && accessible->IsHyperText()) {
|
||||
sLastTextChangeAcc =
|
||||
static_cast<HyperTextAccessibleWrap*>(accessible->AsHyperText());
|
||||
if (!sLastTextChangeString)
|
||||
sLastTextChangeString = new nsString();
|
||||
|
||||
AccTextChangeEvent* event = downcast_accEvent(aEvent);
|
||||
event->GetModifiedText(*sLastTextChangeString);
|
||||
sLastTextChangeStart = event->GetStartOffset();
|
||||
sLastTextChangeEnd = sLastTextChangeStart + event->GetLength();
|
||||
sLastTextChangeWasInsert = event->IsTextInserted();
|
||||
HyperTextAccessibleWrap* text =
|
||||
static_cast<HyperTextAccessibleWrap*>(accessible->AsHyperText());
|
||||
ia2AccessibleText::UpdateTextChangeData(text, event->IsTextInserted(),
|
||||
event->ModifiedText(),
|
||||
event->GetStartOffset(),
|
||||
event->GetLength());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user