Bug 130078. Reverting fix because of regressions. We'll have to come back to this again :-(.
This commit is contained in:
@@ -2795,20 +2795,21 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
if (canvasColor.mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
||||||
nsIView* rootView;
|
nsIView* rootView;
|
||||||
vm->GetRootView(rootView);
|
vm->GetRootView(rootView);
|
||||||
PRBool useDefaultBackgroundColor = rootView->IsUsingDefaultBackgroundColor();
|
if (!rootView->GetParent()) {
|
||||||
if (!rootView->GetParent() && rootView->HasWidget()) {
|
PRBool widgetIsTranslucent = PR_FALSE;
|
||||||
PRBool widgetIsTranslucent;
|
|
||||||
|
if (rootView->HasWidget()) {
|
||||||
rootView->GetWidget()->GetWindowTranslucency(widgetIsTranslucent);
|
rootView->GetWidget()->GetWindowTranslucency(widgetIsTranslucent);
|
||||||
useDefaultBackgroundColor = !widgetIsTranslucent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useDefaultBackgroundColor) {
|
if (!widgetIsTranslucent) {
|
||||||
// Ensure that we always paint a color for the root (in case there's
|
// Ensure that we always paint a color for the root (in case there's
|
||||||
// no background at all or a partly transparent image).
|
// no background at all or a partly transparent image).
|
||||||
canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
canvasColor.mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||||
canvasColor.mBackgroundColor = aPresContext->DefaultBackgroundColor();
|
canvasColor.mBackgroundColor = aPresContext->DefaultBackgroundColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
|
vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
|
||||||
|
|
||||||
|
|||||||
@@ -502,23 +502,14 @@ nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
|
|||||||
|
|
||||||
PRBool isCanvas;
|
PRBool isCanvas;
|
||||||
const nsStyleBackground* bg;
|
const nsStyleBackground* bg;
|
||||||
nsPresContext* presContext = mFrame->GetPresContext();
|
|
||||||
PRBool hasBG =
|
PRBool hasBG =
|
||||||
nsCSSRendering::FindBackground(presContext, mFrame, &bg, &isCanvas);
|
nsCSSRendering::FindBackground(mFrame->GetPresContext(), mFrame, &bg, &isCanvas);
|
||||||
if (!hasBG)
|
if (!hasBG || (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) ||
|
||||||
|
bg->mBackgroundClip != NS_STYLE_BG_CLIP_BORDER ||
|
||||||
|
HasNonZeroSide(mFrame->GetStyleBorder()->mBorderRadius) ||
|
||||||
|
NS_GET_A(bg->mBackgroundColor) < 255)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
PRBool isTranslucentColor = NS_GET_A(bg->mBackgroundColor) < 255 ||
|
return PR_TRUE;
|
||||||
(bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
|
||||||
if (isCanvas) {
|
|
||||||
nsIView* rootView;
|
|
||||||
presContext->GetViewManager()->GetRootView(rootView);
|
|
||||||
if (rootView->IsUsingDefaultBackgroundColor()) {
|
|
||||||
isTranslucentColor = NS_GET_A(presContext->DefaultBackgroundColor()) < 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return !isTranslucentColor &&
|
|
||||||
bg->mBackgroundClip == NS_STYLE_BG_CLIP_BORDER &&
|
|
||||||
!HasNonZeroSide(mFrame->GetStyleBorder()->mBorderRadius);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
|||||||
@@ -2331,29 +2331,45 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||||||
tbounds.y = 0;
|
tbounds.y = 0;
|
||||||
|
|
||||||
// Create a child window of the parent that is our "root view/window"
|
// Create a child window of the parent that is our "root view/window"
|
||||||
|
// if aParentWidget has a view, we'll hook our view manager up to its view tree
|
||||||
nsIView* containerView = nsView::GetViewFor(aParentWidget);
|
nsIView* containerView = nsView::GetViewFor(aParentWidget);
|
||||||
|
|
||||||
|
if (containerView) {
|
||||||
|
// see if the containerView has already been hooked into a foreign view manager hierarchy
|
||||||
|
// if it has, then we have to hook into the hierarchy too otherwise bad things will happen.
|
||||||
|
nsIViewManager* containerVM = containerView->GetViewManager();
|
||||||
|
nsIView* pView = containerView;
|
||||||
|
do {
|
||||||
|
pView = pView->GetParent();
|
||||||
|
} while (pView && pView->GetViewManager() == containerVM);
|
||||||
|
|
||||||
|
if (!pView) {
|
||||||
|
// OK, so the container is not already hooked up into a foreign view manager hierarchy.
|
||||||
|
// That means we can choose not to hook ourselves up.
|
||||||
|
//
|
||||||
|
// If the parent container is a chrome shell then we won't hook into its view
|
||||||
|
// tree. This will improve performance a little bit (especially given scrolling/painting perf bugs)
|
||||||
|
// but is really just for peace of mind. This check can be removed if we want to support fancy
|
||||||
|
// chrome effects like transparent controls floating over content, transparent Web browsers, and
|
||||||
|
// things like that, and the perf bugs are fixed.
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> container(do_QueryReferent(mContainer));
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> parentContainer;
|
||||||
|
PRInt32 itemType;
|
||||||
|
if (nsnull == container
|
||||||
|
|| NS_FAILED(container->GetParent(getter_AddRefs(parentContainer)))
|
||||||
|
|| nsnull == parentContainer
|
||||||
|
|| NS_FAILED(parentContainer->GetItemType(&itemType))
|
||||||
|
|| itemType != nsIDocShellTreeItem::typeContent) {
|
||||||
|
containerView = nsnull;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create a view
|
// Create a view
|
||||||
nsIView* view = mViewManager->CreateView(tbounds, containerView);
|
nsIView* view = mViewManager->CreateView(tbounds, containerView);
|
||||||
if (!view)
|
if (!view)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
if (containerView) {
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> container(do_QueryReferent(mContainer));
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parentContainer;
|
|
||||||
PRInt32 itemType;
|
|
||||||
PRInt32 parentItemType;
|
|
||||||
if (container
|
|
||||||
&& NS_SUCCEEDED(container->GetItemType(&itemType))
|
|
||||||
&& itemType == nsIDocShellTreeItem::typeContent
|
|
||||||
&& NS_SUCCEEDED(container->GetParent(getter_AddRefs(parentContainer)))
|
|
||||||
&& parentContainer
|
|
||||||
&& NS_SUCCEEDED(parentContainer->GetItemType(&parentItemType))
|
|
||||||
&& parentItemType != nsIDocShellTreeItem::typeContent) {
|
|
||||||
view->SetUseDefaultBackgroundColor(PR_TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||||
// establish a parent/child widget relationship
|
// establish a parent/child widget relationship
|
||||||
|
|||||||
@@ -90,8 +90,6 @@ enum nsViewVisibility {
|
|||||||
// is z-index:auto also
|
// is z-index:auto also
|
||||||
#define NS_VIEW_FLAG_TOPMOST 0x0010
|
#define NS_VIEW_FLAG_TOPMOST 0x0010
|
||||||
|
|
||||||
#define NS_VIEW_FLAG_USE_DEFAULT_BACKGROUND 0x0020
|
|
||||||
|
|
||||||
struct nsViewZIndex {
|
struct nsViewZIndex {
|
||||||
PRBool mIsAuto;
|
PRBool mIsAuto;
|
||||||
PRInt32 mZIndex;
|
PRInt32 mZIndex;
|
||||||
@@ -285,18 +283,6 @@ public:
|
|||||||
return mVFlags & NS_VIEW_FLAG_UNIFORM_BACKGROUND;
|
return mVFlags & NS_VIEW_FLAG_UNIFORM_BACKGROUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUseDefaultBackgroundColor(PRBool aUseDefault) {
|
|
||||||
if (aUseDefault) {
|
|
||||||
mVFlags |= NS_VIEW_FLAG_USE_DEFAULT_BACKGROUND;
|
|
||||||
} else {
|
|
||||||
mVFlags &= ~NS_VIEW_FLAG_USE_DEFAULT_BACKGROUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool IsUsingDefaultBackgroundColor() {
|
|
||||||
return mVFlags & NS_VIEW_FLAG_USE_DEFAULT_BACKGROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the view's link to client owned data.
|
* Set the view's link to client owned data.
|
||||||
* @param aData - data to associate with view. nsnull to disassociate
|
* @param aData - data to associate with view. nsnull to disassociate
|
||||||
|
|||||||
Reference in New Issue
Block a user