Bug 1442355 - Add a getter for docshell's colormatrix. r=smaug

--HG--
extra : rebase_source : ceb177980b2da2e0efa3e78a68f9bc299386355f
This commit is contained in:
Eitan Isaacson 2018-03-05 09:51:00 +02:00
Родитель 401631cd0e
Коммит 528d0526a6
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -14528,3 +14528,26 @@ nsDocShell::SetColorMatrix(float* aMatrix, uint32_t aMatrixLen)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetColorMatrix(uint32_t* aMatrixLen, float** aMatrix)
{
NS_ENSURE_ARG_POINTER(aMatrixLen);
*aMatrixLen = 0;
NS_ENSURE_ARG_POINTER(aMatrix);
*aMatrix = nullptr;
if (mColorMatrix) {
*aMatrix = (float*)moz_xmalloc(20 * sizeof(float));
if (!*aMatrix) {
return NS_ERROR_OUT_OF_MEMORY;
}
MOZ_ASSERT(20 * sizeof(float) == sizeof(mColorMatrix->components));
*aMatrixLen = 20;
memcpy(*aMatrix, mColorMatrix->components, 20 * sizeof(float));
}
return NS_OK;
}

Просмотреть файл

@ -1186,6 +1186,9 @@ interface nsIDocShell : nsIDocShellTreeItem
void setColorMatrix([array, size_is(aMatrixLen)] in float aMatrix,
[optional] in unsigned long aMatrixLen);
void getColorMatrix([optional] out unsigned long aMatrixLen,
[array, size_is(aMatrixLen), retval] out float aMatrix);
%{C++
/**
* These methods call nsDocShell::GetHTMLEditorInternal() and