зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1640553 part 2: Include row/column header cell ids in the payload for AccessibleHandler. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D76666
This commit is contained in:
Родитель
61ed1074ea
Коммит
fe12e1e987
|
@ -353,6 +353,54 @@ void HandlerProvider::BuildDynamicIA2Data(DynamicIA2Data* aOutIA2Data) {
|
|||
if (FAILED(hr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Because the same headers can apply to many cells, include the ids of
|
||||
// header cells, rather than the actual objects. Otherwise, we might
|
||||
// end up marshaling the same objects (and their payloads) many times.
|
||||
IUnknown** headers = nullptr;
|
||||
hr = cell->get_rowHeaderCells(&headers, &aOutIA2Data->mNRowHeaderCells);
|
||||
if (FAILED(hr)) {
|
||||
return;
|
||||
}
|
||||
if (aOutIA2Data->mNRowHeaderCells > 0) {
|
||||
// We use midl_user_allocate rather than CoTaskMemAlloc because this
|
||||
// struct is being marshaled by RPC, not COM.
|
||||
aOutIA2Data->mRowHeaderCellIds = static_cast<long*>(
|
||||
::midl_user_allocate(sizeof(long) * aOutIA2Data->mNRowHeaderCells));
|
||||
for (long i = 0; i < aOutIA2Data->mNRowHeaderCells; ++i) {
|
||||
RefPtr<IAccessible2> headerAcc;
|
||||
hr = headers[i]->QueryInterface(IID_IAccessible2,
|
||||
getter_AddRefs(headerAcc));
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
headers[i]->Release();
|
||||
hr = headerAcc->get_uniqueID(&aOutIA2Data->mRowHeaderCellIds[i]);
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
}
|
||||
}
|
||||
::CoTaskMemFree(headers);
|
||||
|
||||
hr = cell->get_columnHeaderCells(&headers,
|
||||
&aOutIA2Data->mNColumnHeaderCells);
|
||||
if (FAILED(hr)) {
|
||||
return;
|
||||
}
|
||||
if (aOutIA2Data->mNColumnHeaderCells > 0) {
|
||||
// We use midl_user_allocate rather than CoTaskMemAlloc because this
|
||||
// struct is being marshaled by RPC, not COM.
|
||||
aOutIA2Data->mColumnHeaderCellIds =
|
||||
static_cast<long*>(::midl_user_allocate(
|
||||
sizeof(long) * aOutIA2Data->mNColumnHeaderCells));
|
||||
for (long i = 0; i < aOutIA2Data->mNColumnHeaderCells; ++i) {
|
||||
RefPtr<IAccessible2> headerAcc;
|
||||
hr = headers[i]->QueryInterface(IID_IAccessible2,
|
||||
getter_AddRefs(headerAcc));
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
headers[i]->Release();
|
||||
hr = headerAcc->get_uniqueID(&aOutIA2Data->mColumnHeaderCellIds[i]);
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
}
|
||||
}
|
||||
::CoTaskMemFree(headers);
|
||||
}
|
||||
|
||||
// NB: get_uniqueID should be the final property retrieved in this method,
|
||||
|
|
|
@ -55,6 +55,10 @@ typedef struct _DynamicIA2Data
|
|||
long mRowExtent;
|
||||
long mColumnExtent;
|
||||
boolean mCellIsSelected;
|
||||
long mNRowHeaderCells;
|
||||
[size_is(mNRowHeaderCells)] long* mRowHeaderCellIds;
|
||||
long mNColumnHeaderCells;
|
||||
[size_is(mNColumnHeaderCells)] long* mColumnHeaderCellIds;
|
||||
// From IAccessible2
|
||||
long mUniqueId;
|
||||
} DynamicIA2Data;
|
||||
|
|
|
@ -66,6 +66,12 @@ inline void CleanupDynamicIA2Data(DynamicIA2Data& aData) {
|
|||
if (aData.mIA2Locale.variant) {
|
||||
::SysFreeString(aData.mIA2Locale.variant);
|
||||
}
|
||||
if (aData.mRowHeaderCellIds) {
|
||||
::midl_user_free(aData.mRowHeaderCellIds);
|
||||
}
|
||||
if (aData.mColumnHeaderCellIds) {
|
||||
::midl_user_free(aData.mColumnHeaderCellIds);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
|
|
Загрузка…
Ссылка в новой задаче