PRBool hasOverflowClip = isBlockLevel && (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP);
PRBool hasOverflowClip = isBlockLevel && (display->mOverflow == NS_STYLE_OVERFLOW_CLIP);
SyncFrameViewGeometryDependentProperties(nsPresContext*  aPresContext,                                         nsIFrame*        aFrame,                                         nsStyleContext*  aStyleContext,                                         nsIView*         aView,                                         PRUint32         aFlags){  nsIViewManager* vm = aView->GetViewManager();  PRBool isCanvas;  const nsStyleBackground* bg;  PRBool hasBG =    nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas);  // background-attachment: fixed is not really geometry dependent, but  // we set it here because it's cheap to do so  PRBool fixedBackground = hasBG &&    NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment;  // If the frame has a fixed background attachment, then indicate that the  // view's contents should be repainted and not bitblt'd  vm->SetViewBitBltEnabled(aView, !fixedBackground);  // If the frame has a solid background color, 'background-clip:border',  // and it's a kind of frame that paints its background, and rounded borders aren't  // clipping the background, then it's opaque.  PRBool  viewHasTransparentContent =    !(hasBG && !(bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&      bg->mBackgroundClip == NS_STYLE_BG_CLIP_BORDER &&      aFrame->CanPaintBackground() &&      !HasNonZeroBorderRadius(aStyleContext));  PRBool drawnOnUniformField = PR_FALSE;  if (aStyleContext->GetPseudoType() == nsCSSAnonBoxes::scrolledContent) {    // If the nsGfxScrollFrame draws a solid unclipped background    // color, and nothing else, then tell the view system that we're    // drawn on a uniform field. Note that it's OK if the background    // is clipped to the padding area, since the scrollport is within    // the borders.    nsIFrame* scrollFrame = aFrame->GetParent();    while (scrollFrame->GetStyleContext()->GetPseudoType()           == nsCSSAnonBoxes::scrolledContent) {      scrollFrame = scrollFrame->GetParent();    }    PRBool scrollFrameIsCanvas;    const nsStyleBackground* scrollFrameBG;    PRBool scrollFrameHasBG =      nsCSSRendering::FindBackground(aPresContext, scrollFrame, &scrollFrameBG,                                     &scrollFrameIsCanvas);    const nsStyleDisplay* bgDisplay = scrollFrame->GetStyleDisplay();    drawnOnUniformField = scrollFrameHasBG &&      !(scrollFrameBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) &&      (scrollFrameBG->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) &&      !HasNonZeroBorderRadius(scrollFrame->GetStyleContext()) &&      !(bgDisplay->IsAbsolutelyPositioned()        && (bgDisplay->mClipFlags & NS_STYLE_CLIP_RECT));  }  aView->SetHasUniformBackground(drawnOnUniformField);  if (isCanvas) {    nsIView* rootView;    vm->GetRootView(rootView);    nsIView* rootParent = rootView->GetParent();    if (!rootParent) {      // We're the root of a view manager hierarchy. We will have to      // paint something. NOTE: this can be overridden below.      viewHasTransparentContent = PR_FALSE;    }    nsIDocument *doc = aPresContext->PresShell()->GetDocument();    if (doc) {      nsIContent *rootElem = doc->GetRootContent();      if (!doc->GetParentDocument() &&          rootElem && rootElem->IsContentOfType(nsIContent::eXUL)) {        // we're XUL at the root of the document hierarchy. Try to make our        // window translucent.        // don't proceed unless this is the root view        // (sometimes the non-root-view is a canvas)        if (aView->HasWidget() && aView == rootView) {          viewHasTransparentContent = hasBG && (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);          aView->GetWidget()->SetWindowTranslucency(viewHasTransparentContent);        }      }    }  }  // XXX we should also set widget transparency for XUL popups  const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();  nsFrameState kidState = aFrame->GetStateBits();    if (!viewHasTransparentContent) {    // If we're showing the view but the frame is hidden, then the view is transparent    const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();    if ((nsViewVisibility_kShow == aView->GetVisibility()         && NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible)        || (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflowX            && (kidState & NS_FRAME_OUTSIDE_CHILDREN) != 0)) {      viewHasTransparentContent = PR_TRUE;    }  }  // If the frame has visible content that overflows the content area, then we  // need the view marked as having transparent content  // There are two types of clipping:  // - 'clip' which only applies to absolutely positioned elements, and is  //    relative to the element's border edge. 'clip' applies to the entire  //    element  // - 'overflow-clip' which only applies to block-level elements and replaced  //   elements that have 'overflow' set to 'hidden'. 'overflow-clip' is relative  //   to the content area and applies to content only (not border or background).  //   Note that out-of-flow frames like floated or absolutely positioned frames  //   are block-level, but we can't rely on the 'display' value being set correctly  //   in the style context...  PRBool isBlockLevel = display->IsBlockLevel() || (kidState & NS_FRAME_OUT_OF_FLOW);  PRBool hasClip = display->IsAbsolutelyPositioned() && (display->mClipFlags & NS_STYLE_CLIP_RECT);  PRBool hasOverflowClip = isBlockLevel && (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP);  if (hasClip || hasOverflowClip) {    nsSize frameSize = aFrame->GetSize();    nsRect  clipRect;    if (hasClip) {      // Start with the 'auto' values and then factor in user specified values      clipRect.SetRect(0, 0, frameSize.width, frameSize.height);      if (display->mClipFlags & NS_STYLE_CLIP_RECT) {        if (0 == (NS_STYLE_CLIP_TOP_AUTO & display->mClipFlags)) {          clipRect.y = display->mClip.y;        }        if (0 == (NS_STYLE_CLIP_LEFT_AUTO & display->mClipFlags)) {          clipRect.x = display->mClip.x;        }        if (0 == (NS_STYLE_CLIP_RIGHT_AUTO & display->mClipFlags)) {          clipRect.width = display->mClip.width;        }        if (0 == (NS_STYLE_CLIP_BOTTOM_AUTO & display->mClipFlags)) {          clipRect.height = display->mClip.height;        }      }    }    if (hasOverflowClip) {      const nsStyleBorder* borderStyle = aStyleContext->GetStyleBorder();      const nsStylePadding* paddingStyle = aStyleContext->GetStylePadding();      nsMargin border, padding;      // XXX We don't support the 'overflow-clip' property yet so just use the      // content area (which is the default value) as the clip shape      nsRect overflowClipRect(0, 0, frameSize.width, frameSize.height);      borderStyle->GetBorder(border);      overflowClipRect.Deflate(border);      // XXX We need to handle percentage padding      if (paddingStyle->GetPadding(padding)) {        overflowClipRect.Deflate(padding);      }      if (hasClip) {        // If both 'clip' and 'overflow-clip' apply then use the intersection        // of the two        clipRect.IntersectRect(clipRect, overflowClipRect);      } else {        clipRect = overflowClipRect;      }    }      nsRect newSize = aView->GetBounds();    newSize -= aView->GetPosition();    // If part of the view is being clipped out, then mark it transparent    if (clipRect.y > newSize.y        || clipRect.x > newSize.x        || clipRect.XMost() < newSize.XMost()        || clipRect.YMost() < newSize.YMost()) {      viewHasTransparentContent = PR_TRUE;    }    // Set clipping of child views.    nsRegion region(clipRect);    vm->SetViewChildClipRegion(aView, &region);  } else {    // Remove clipping of child views.    vm->SetViewChildClipRegion(aView, nsnull);  }  vm->SetViewContentTransparency(aView, viewHasTransparentContent);}