Bug 231585. A view can only be treated as having a uniform background if that background is not translucent. r+sr=dbaron,a=choffman

git-svn-id: svn://10.0.0.236/trunk@154562 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu 2004-04-07 01:03:51 +00:00
parent 13991df348
commit c67ff884e5
2 changed files with 18 additions and 4 deletions

View File

@ -278,9 +278,13 @@ public:
PRBool IsTransparent() const { return (mVFlags & NS_VIEW_FLAG_TRANSPARENT) != 0; }
/**
* Indicate that this view is always painted onto a uniform field of pixels. Thus,
* even if the view is transparent, it may still be bitblit scrollable because
* the background that shines through does not vary with position.
* Indicate that this view is always painted onto a uniform field of
* pixels. Thus, even if the view is transparent, it may still be
* bitblit scrollable because the background that shines through
* does not vary with position. Caller must ensure that the pixel
* field belongs to the same element as this view or some ancestor
* element, so that if the pixel field is in some opacity group, then
* this view is also in the opacity group (or some subgroup).
*/
void SetHasUniformBackground(PRBool aUniform) {
if (aUniform) {

View File

@ -3653,7 +3653,17 @@ void nsViewManager::OptimizeDisplayList(const nsVoidArray* aDisplayList, const n
// a view is opaque if it is neither transparent nor transluscent
if (!(element->mFlags & (VIEW_TRANSPARENT | VIEW_TRANSLUCENT))
|| (element->mView->HasUniformBackground() && aTreatUniformAsOpaque)) {
// also, treat it as opaque if it's drawn onto a uniform background
// and we're doing scrolling analysis; if the background is uniform,
// we don't care what's under it. But the background might be translucent
// because of some enclosing opacity group, in which case we do care
// what's under it. Unfortunately we don't know exactly where the
// background comes from ... it may not even have a view ... but
// the side condition on SetHasUniformBackground ensures that
// if the background is translucent, then this view is also marked
// translucent.
|| (element->mView->HasUniformBackground() && aTreatUniformAsOpaque
&& !(element->mFlags & VIEW_TRANSLUCENT))) {
aOpaqueRegion.Or(aOpaqueRegion, element->mBounds);
}
}