Bug 1297963 - Part 2: Add URLValueData comparison functions that work OMT. r=emilio

MozReview-Commit-ID: IfTsuOJ0iXI
This commit is contained in:
Cameron McCormack 2016-08-29 18:17:26 +08:00
Родитель d3c7ea79a6
Коммит 0b8daf1a8b
2 изменённых файлов: 30 добавлений и 0 удалений

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

@ -2678,6 +2678,23 @@ css::URLValueData::URIEquals(const URLValueData& aOther) const
mLocalURLFlag == aOther.mLocalURLFlag;
}
bool
css::URLValueData::DefinitelyEqualURIs(const URLValueData& aOther) const
{
return mBaseURI == aOther.mBaseURI &&
(mString == aOther.mString ||
NS_strcmp(nsCSSValue::GetBufferValue(mString),
nsCSSValue::GetBufferValue(aOther.mString)));
}
bool
css::URLValueData::DefinitelyEqualURIsAndPrincipal(
const URLValueData& aOther) const
{
return mOriginPrincipal == aOther.mOriginPrincipal &&
DefinitelyEqualURIs(aOther);
}
nsIURI*
css::URLValueData::GetURI() const
{

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

@ -122,6 +122,19 @@ struct URLValueData
// false in that case).
bool MaybeUnresolvedURIEquals(const URLValueData& aOther) const;
// Returns true iff we know for sure, by comparing the mBaseURI pointer,
// the specified url() value mString, and the mLocalURLFlag, that these
// two URLValueData objects represent the same computed url() value.
//
// Doesn't look at mReferrer or mOriginPrincipal.
//
// Safe to call from any thread.
bool DefinitelyEqualURIs(const URLValueData& aOther) const;
// Smae as DefinitelyEqualURIs but additionally compares the nsIPrincipal
// pointers of the two URLValueData objects.
bool DefinitelyEqualURIsAndPrincipal(const URLValueData& aOther) const;
nsIURI* GetURI() const;
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;