Bug 1296477 - Part 1: stylo: Use ServoBundledURI everywhere else, fix from_ffi to handle the error case; r=heycam

MozReview-Commit-ID: DHNKLm3y5Gv

--HG--
extra : rebase_source : c5780ddc22169d9c908559c2eb94ca827d481e0b
This commit is contained in:
Manish Goregaokar 2017-03-12 21:08:29 -07:00
Родитель 4199502ccd
Коммит 471d940ebc
2 изменённых файлов: 16 добавлений и 40 удалений

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

@ -863,39 +863,30 @@ Gecko_SetGradientImageValue(nsStyleImage* aImage, nsStyleGradient* aGradient)
static already_AddRefed<nsStyleImageRequest>
CreateStyleImageRequest(nsStyleImageRequest::Mode aModeFlags,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
ServoBundledURI aURI)
{
MOZ_ASSERT(aURLString);
MOZ_ASSERT(aBaseURI);
MOZ_ASSERT(aReferrer);
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT(aURI.mURLString);
MOZ_ASSERT(aURI.mBaseURI);
MOZ_ASSERT(aURI.mReferrer);
MOZ_ASSERT(aURI.mPrincipal);
nsString url;
nsDependentCSubstring urlString(reinterpret_cast<const char*>(aURLString),
aURLStringLength);
nsDependentCSubstring urlString(reinterpret_cast<const char*>(aURI.mURLString),
aURI.mURLStringLength);
AppendUTF8toUTF16(urlString, url);
RefPtr<nsStringBuffer> urlBuffer = nsCSSValue::BufferFromString(url);
RefPtr<nsStyleImageRequest> req =
new nsStyleImageRequest(aModeFlags, urlBuffer, do_AddRef(aBaseURI),
do_AddRef(aReferrer), do_AddRef(aPrincipal));
new nsStyleImageRequest(aModeFlags, urlBuffer, do_AddRef(aURI.mBaseURI),
do_AddRef(aURI.mReferrer), do_AddRef(aURI.mPrincipal));
return req.forget();
}
void
Gecko_SetUrlImageValue(nsStyleImage* aImage,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
Gecko_SetUrlImageValue(nsStyleImage* aImage, ServoBundledURI aURI)
{
RefPtr<nsStyleImageRequest> req =
CreateStyleImageRequest(nsStyleImageRequest::Mode::Track,
aURLString, aURLStringLength,
aBaseURI, aReferrer, aPrincipal);
CreateStyleImageRequest(nsStyleImageRequest::Mode::Track, aURI);
aImage->SetImageRequest(req.forget());
}
@ -916,16 +907,10 @@ Gecko_SetCursorArrayLength(nsStyleUserInterface* aStyleUI, size_t aLen)
}
void
Gecko_SetCursorImage(nsCursorImage* aCursor,
const uint8_t* aURLString, uint32_t aURLStringLength,
ThreadSafeURIHolder* aBaseURI,
ThreadSafeURIHolder* aReferrer,
ThreadSafePrincipalHolder* aPrincipal)
Gecko_SetCursorImage(nsCursorImage* aCursor, ServoBundledURI aURI)
{
aCursor->mImage =
CreateStyleImageRequest(nsStyleImageRequest::Mode::Discard,
aURLString, aURLStringLength,
aBaseURI, aReferrer, aPrincipal);
CreateStyleImageRequest(nsStyleImageRequest::Mode::Discard, aURI);
}
void
@ -978,9 +963,7 @@ Gecko_SetListStyleImage(nsStyleList* aList,
ServoBundledURI aURI)
{
aList->mListStyleImage =
CreateStyleImageRequest(nsStyleImageRequest::Mode(0),
aURI.mURLString, aURI.mURLStringLength,
aURI.mBaseURI, aURI.mReferrer, aURI.mPrincipal);
CreateStyleImageRequest(nsStyleImageRequest::Mode(0), aURI);
}
void

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

@ -223,11 +223,7 @@ void Gecko_CopyListStyleTypeFrom(nsStyleList* dst, const nsStyleList* src);
void Gecko_SetNullImageValue(nsStyleImage* image);
void Gecko_SetGradientImageValue(nsStyleImage* image, nsStyleGradient* gradient);
void Gecko_SetUrlImageValue(nsStyleImage* image,
const uint8_t* url_bytes,
uint32_t url_length,
ThreadSafeURIHolder* base_uri,
ThreadSafeURIHolder* referrer,
ThreadSafePrincipalHolder* principal);
ServoBundledURI uri);
void Gecko_CopyImageValueFrom(nsStyleImage* image, const nsStyleImage* other);
nsStyleGradient* Gecko_CreateGradient(uint8_t shape,
@ -245,10 +241,7 @@ void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
// cursor style.
void Gecko_SetCursorArrayLength(nsStyleUserInterface* ui, size_t len);
void Gecko_SetCursorImage(nsCursorImage* cursor,
const uint8_t* string_bytes, uint32_t string_length,
ThreadSafeURIHolder* base_uri,
ThreadSafeURIHolder* referrer,
ThreadSafePrincipalHolder* principal);
ServoBundledURI uri);
void Gecko_CopyCursorArrayFrom(nsStyleUserInterface* dest,
const nsStyleUserInterface* src);