Bug 1310463 - Part 3: Add FFI functions for setting list-style-image. r=xidorn

MozReview-Commit-ID: LNK4UbfMfRk
---
 layout/style/ServoBindings.cpp | 60 +++++++++++++++++++++++++++++++++---------
 layout/style/ServoBindings.h   |  9 +++++++
 2 files changed, 57 insertions(+), 12 deletions(-)
This commit is contained in:
Cameron McCormack 2016-10-20 08:53:45 +08:00
Родитель 17f39f6df6
Коммит 5948e5280e
2 изменённых файлов: 57 добавлений и 12 удалений

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

@ -734,14 +734,13 @@ Gecko_SetGradientImageValue(nsStyleImage* aImage, nsStyleGradient* aGradient)
aImage->SetGradientData(aGradient);
}
void
Gecko_SetUrlImageValue(nsStyleImage* aImage,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
static already_AddRefed<nsStyleImageRequest>
CreateStyleImageRequest(nsStyleImageRequest::Mode aModeFlags,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
{
MOZ_ASSERT(aImage);
MOZ_ASSERT(aURLString);
MOZ_ASSERT(aBaseURI);
MOZ_ASSERT(aReferrer);
@ -754,12 +753,23 @@ Gecko_SetUrlImageValue(nsStyleImage* aImage,
RefPtr<nsStringBuffer> urlBuffer = nsCSSValue::BufferFromString(url);
RefPtr<nsStyleImageRequest> req =
new nsStyleImageRequest(nsStyleImageRequest::Mode::Track |
new nsStyleImageRequest(aModeFlags, urlBuffer, do_AddRef(aBaseURI),
do_AddRef(aReferrer), do_AddRef(aPrincipal));
return req.forget();
}
void
Gecko_SetUrlImageValue(nsStyleImage* aImage,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
{
RefPtr<nsStyleImageRequest> req =
CreateStyleImageRequest(nsStyleImageRequest::Mode::Track |
nsStyleImageRequest::Mode::Lock,
urlBuffer,
do_AddRef(aBaseURI),
do_AddRef(aReferrer),
do_AddRef(aPrincipal));
aURLString, aURLStringLength,
aBaseURI, aReferrer, aPrincipal);
aImage->SetImageRequest(req.forget());
}
@ -804,6 +814,32 @@ Gecko_CreateGradient(uint8_t aShape,
return result;
}
void
Gecko_SetListStyleImageNone(nsStyleList* aList)
{
aList->mListStyleImage = nullptr;
}
void
Gecko_SetListStyleImage(nsStyleList* aList,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
{
aList->mListStyleImage =
CreateStyleImageRequest(nsStyleImageRequest::Mode::Track |
nsStyleImageRequest::Mode::Lock,
aURLString, aURLStringLength,
aBaseURI, aReferrer, aPrincipal);
}
void
Gecko_CopyListStyleImageFrom(nsStyleList* aList, const nsStyleList* aSource)
{
aList->mListStyleImage = aSource->mListStyleImage;
}
void
Gecko_EnsureTArrayCapacity(void* aArray, size_t aCapacity, size_t aElemSize)
{

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

@ -267,6 +267,15 @@ nsStyleGradient* Gecko_CreateGradient(uint8_t shape,
bool legacy_syntax,
uint32_t stops);
// list-style-image style.
void Gecko_SetListStyleImageNone(nsStyleList* style_struct);
void Gecko_SetListStyleImage(nsStyleList* style_struct,
const uint8_t* string_bytes, uint32_t string_length,
ThreadSafeURIHolder* base_uri,
ThreadSafeURIHolder* referrer,
ThreadSafePrincipalHolder* principal);
void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
// Display style.
void Gecko_SetMozBinding(nsStyleDisplay* style_struct,
const uint8_t* string_bytes, uint32_t string_length,