mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 593604. Part 5: Mark CSS gradient images as opaque when all their stops are opaque. r=dbaron,a=blocking
This commit is contained in:
parent
1afaa01821
commit
7684e2b15c
@ -1373,6 +1373,16 @@ nsStyleGradient::nsStyleGradient(void)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsStyleGradient::IsOpaque()
|
||||
{
|
||||
for (PRUint32 i = 0; i < mStops.Length(); i++) {
|
||||
if (NS_GET_A(mStops[i].mColor) < 255)
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// nsStyleImage
|
||||
//
|
||||
@ -1608,10 +1618,8 @@ nsStyleImage::IsOpaque() const
|
||||
if (!IsComplete())
|
||||
return PR_FALSE;
|
||||
|
||||
if (mType == eStyleImageType_Gradient) {
|
||||
// We could check if every stop color of the gradient is non-transparent.
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (mType == eStyleImageType_Gradient)
|
||||
return mGradient->IsOpaque();
|
||||
|
||||
if (mType == eStyleImageType_Element)
|
||||
return PR_FALSE;
|
||||
|
@ -173,6 +173,8 @@ public:
|
||||
return !(*this == aOther);
|
||||
};
|
||||
|
||||
PRBool IsOpaque();
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(nsStyleGradient)
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user