mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Bug 370379: Create views less frequently. Stops creating views for -moz-hidden-unscrollable, opacity, fixed backgrounds, and scrollbars, plus removes some unneeded methods from views and view managers. r+sr=roc.
This commit is contained in:
parent
2809a36959
commit
4862938c93
@ -61,7 +61,6 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -88,7 +88,6 @@
|
||||
|
||||
#include "nsContentCID.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -2690,16 +2690,6 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
||||
|
||||
vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
|
||||
|
||||
// Since nsHTMLContainerFrame::CreateViewForFrame might have created
|
||||
// the view before we knew about the child with the fixed background
|
||||
// attachment (root or BODY) or the stylesheet specifying that
|
||||
// attachment, set the BitBlt flag here as well.
|
||||
if (canvasColor.mBackgroundAttachment == NS_STYLE_BG_ATTACHMENT_FIXED) {
|
||||
nsIView *view = aForFrame->GetView();
|
||||
if (view)
|
||||
vm->SetViewBitBltEnabled(view, PR_FALSE);
|
||||
}
|
||||
|
||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, canvasColor,
|
||||
aBorder, aPadding, aUsePrintSettings, aBGClipRect);
|
||||
|
@ -59,7 +59,6 @@
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
@ -542,11 +542,13 @@ nsDisplayBackground::IsVaryingRelativeToFrame(nsDisplayListBuilder* aBuilder,
|
||||
if (!bg->HasFixedBackground())
|
||||
return PR_FALSE;
|
||||
|
||||
// aAncestorFrame is an ancestor of this frame ... if it's in our document
|
||||
// then we'll be moving relative to the viewport, so we will change our
|
||||
// display. If it's in some ancestor document then we won't be moving
|
||||
// relative to the viewport so we won't change our display.
|
||||
for (nsIFrame* f = mFrame->GetParent(); f; f = f->GetParent()) {
|
||||
// aAncestorFrame is the frame that is going to be moved.
|
||||
// Check if mFrame is equal to aAncestorFrame or aAncestorFrame is an
|
||||
// ancestor of mFrame in the same document. If this is true, mFrame
|
||||
// will move relative to its viewport, which means this display item will
|
||||
// change when it is moved. If they are in different documents, we do not
|
||||
// want to return true because mFrame won't move relative to its viewport.
|
||||
for (nsIFrame* f = mFrame; f; f = f->GetParent()) {
|
||||
if (f == aAncestorFrame)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
//#define FCF_NOISY
|
||||
|
@ -457,33 +457,6 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext,
|
||||
!display->mAppearance && bg->mBackgroundClip == NS_STYLE_BG_CLIP_BORDER &&
|
||||
!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);
|
||||
@ -623,8 +596,6 @@ SyncFrameViewGeometryDependentProperties(nsPresContext* aPresContext,
|
||||
// Remove clipping of child views.
|
||||
vm->SetViewChildClipRegion(aView, nsnull);
|
||||
}
|
||||
|
||||
vm->SetViewContentTransparency(aView, viewHasTransparentContent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -671,27 +642,6 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::SyncFrameViewAfterSizeChange(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsIView* aView,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
NS_ASSERTION(!aStyleContext || aFrame->GetStyleContext() == aStyleContext,
|
||||
"Wrong style context for frame?");
|
||||
|
||||
if (!aView) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsnull == aStyleContext) {
|
||||
aStyleContext = aFrame->GetStyleContext();
|
||||
}
|
||||
|
||||
SyncFrameViewGeometryDependentProperties(aPresContext, aFrame, aStyleContext, aView, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::SyncFrameViewProperties(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
@ -711,11 +661,6 @@ nsContainerFrame::SyncFrameViewProperties(nsPresContext* aPresContext,
|
||||
if (nsnull == aStyleContext) {
|
||||
aStyleContext = aFrame->GetStyleContext();
|
||||
}
|
||||
|
||||
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
|
||||
|
||||
// Set the view's opacity
|
||||
vm->SetViewOpacity(aView, display->mOpacity);
|
||||
|
||||
// Make sure visibility is correct
|
||||
if (0 == (aFlags & NS_FRAME_NO_VISIBILITY)) {
|
||||
@ -748,7 +693,7 @@ nsContainerFrame::SyncFrameViewProperties(nsPresContext* aPresContext,
|
||||
|
||||
// See if the frame is being relatively positioned or absolutely
|
||||
// positioned
|
||||
PRBool isPositioned = display->IsPositioned();
|
||||
PRBool isPositioned = aStyleContext->GetStyleDisplay()->IsPositioned();
|
||||
|
||||
PRInt32 zIndex = 0;
|
||||
PRBool autoZIndex = PR_FALSE;
|
||||
@ -777,48 +722,9 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
|
||||
if (aFrame->NeedsView()) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsStyleContext* sc = aFrame->GetStyleContext();
|
||||
const nsStyleDisplay* display = sc->GetStyleDisplay();
|
||||
if (display->mOpacity != 1.0f) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// See if the frame has a fixed background attachment
|
||||
const nsStyleBackground *color;
|
||||
PRBool isCanvas;
|
||||
PRBool hasBackground =
|
||||
nsCSSRendering::FindBackground(aFrame->GetPresContext(),
|
||||
aFrame, &color, &isCanvas);
|
||||
if (hasBackground && color->HasFixedBackground()) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
|
||||
if (aFrame->GetStyleContext()->GetStyleDisplay()->IsPositioned()) {
|
||||
return PR_TRUE;
|
||||
} else if (display->IsAbsolutelyPositioned()) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (sc->GetPseudoType() == nsCSSAnonBoxes::scrolledContent) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// See if the frame is block-level and has 'overflow' set to
|
||||
// '-moz-hidden-unscrollable'. If so, then we need to give it a view
|
||||
// so clipping of any child views works correctly. Note that if it's
|
||||
// floated it is also block-level, but we can't trust that the style
|
||||
// context 'display' value is set correctly.
|
||||
if ((display->IsBlockLevel() || display->IsFloating()) &&
|
||||
(display->mOverflowX == NS_STYLE_OVERFLOW_CLIP)) {
|
||||
// XXX Check for the frame being a block frame and only force a view
|
||||
// in that case, because adding a view for box frames seems to cause
|
||||
// problems for XUL...
|
||||
nsIAtom* frameType = aFrame->GetType();
|
||||
if ((frameType == nsGkAtoms::blockFrame) ||
|
||||
(frameType == nsGkAtoms::areaFrame)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
|
@ -108,16 +108,6 @@ public:
|
||||
const nsRect* aCombinedArea,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
// Sets view attributes from the frame style that depend on the view's size
|
||||
// (clip, transparency). This needs to be called if you change the size of
|
||||
// a view and the view's frame could have clipping set on it.
|
||||
// @param aStyleContext can be null, in which case the frame's style context is used
|
||||
static void SyncFrameViewAfterSizeChange(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsIView* aView,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
// Sets the view's attributes from the frame style.
|
||||
// - opacity
|
||||
// - visibility
|
||||
|
@ -1448,8 +1448,8 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const
|
||||
result = presContext->GetViewportOverflowOverride();
|
||||
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainer();
|
||||
if (container) {
|
||||
nsCOMPtr<nsIScrollable> scrollable = do_QueryInterface(container);
|
||||
nsCOMPtr<nsIScrollable> scrollable = do_QueryInterface(container);
|
||||
if (scrollable) {
|
||||
HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_X,
|
||||
result.mHorizontal);
|
||||
HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_Y,
|
||||
|
@ -3363,12 +3363,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
if (view) {
|
||||
mWidget = view->GetWidget();
|
||||
PRBool fTransparent = PR_FALSE;
|
||||
mInstance->GetValue(nsPluginInstanceVariable_TransparentBool,
|
||||
(void *)&fTransparent);
|
||||
|
||||
view->GetViewManager()->SetViewContentTransparency(view,
|
||||
fTransparent);
|
||||
}
|
||||
|
||||
if (PR_TRUE == windowless) {
|
||||
|
@ -700,8 +700,6 @@ nsSimplePageSequenceFrame::PrintNextPage()
|
||||
|
||||
PR_PL(("SeqFr::Paint -> %p PageNo: %d View: %p", pf, mPageNum, view));
|
||||
|
||||
vm->SetViewContentTransparency(view, PR_FALSE);
|
||||
|
||||
vm->Display(view, 0, 0, clipRect);
|
||||
|
||||
if (mSelectionHeight > -1 && selectionY < mSelectionHeight) {
|
||||
|
@ -44,11 +44,7 @@
|
||||
#include "nsViewportFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsDisplayList.h"
|
||||
|
||||
nsIFrame*
|
||||
|
@ -1157,10 +1157,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
||||
|| mDisplay != aOther.mDisplay
|
||||
|| (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE)
|
||||
|| mOverflowX != aOther.mOverflowX
|
||||
|| mOverflowY != aOther.mOverflowY
|
||||
// might need to create a view to handle change from 1.0 to partial opacity
|
||||
|| (mOpacity != aOther.mOpacity
|
||||
&& ((mOpacity < 1.0) != (aOther.mOpacity < 1.0))))
|
||||
|| mOverflowY != aOther.mOverflowY)
|
||||
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
|
||||
|
||||
if (mFloats != aOther.mFloats)
|
||||
@ -1177,7 +1174,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|
||||
if (mClipFlags != aOther.mClipFlags
|
||||
|| mClip != aOther.mClip
|
||||
|| mOpacity != aOther.mOpacity)
|
||||
NS_UpdateHint(hint, nsChangeHint_SyncFrameView);
|
||||
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
@ -1862,39 +1862,11 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
PRBool aForce)
|
||||
{
|
||||
NS_ASSERTION(aForce, "We only get called to force view creation now");
|
||||
// If we don't yet have a view, see if we need a view
|
||||
if (!aFrame->HasView()) {
|
||||
PRInt32 zIndex = 0;
|
||||
PRBool autoZIndex = PR_FALSE;
|
||||
PRBool fixedBackgroundAttachment = PR_FALSE;
|
||||
|
||||
const nsStyleBackground* bg;
|
||||
PRBool isCanvas;
|
||||
PRBool hasBG =
|
||||
nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas);
|
||||
const nsStyleDisplay* disp = aStyleContext->GetStyleDisplay();
|
||||
|
||||
if (disp->mOpacity != 1.0f) {
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("nsBoxFrame::CreateViewForFrame: frame=%p opacity=%g",
|
||||
aFrame, disp->mOpacity));
|
||||
aForce = PR_TRUE;
|
||||
}
|
||||
|
||||
// See if the frame has a fixed background attachment
|
||||
if (hasBG && bg->HasFixedBackground()) {
|
||||
aForce = PR_TRUE;
|
||||
fixedBackgroundAttachment = PR_TRUE;
|
||||
}
|
||||
|
||||
// See if the frame is a scrolled frame
|
||||
if (!aForce) {
|
||||
if (aStyleContext->GetPseudoType() == nsCSSAnonBoxes::scrolledContent) {
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("nsBoxFrame::CreateViewForFrame: scrolled frame=%p", aFrame));
|
||||
aForce = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (aForce) {
|
||||
// Create a view
|
||||
@ -1908,12 +1880,6 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
|
||||
// Create a view
|
||||
nsIView *view = viewManager->CreateView(aFrame->GetRect(), parentView);
|
||||
if (view) {
|
||||
// If the frame has a fixed background attachment, then indicate that the
|
||||
// view's contents should be repainted and not bitblt'd
|
||||
if (fixedBackgroundAttachment) {
|
||||
viewManager->SetViewBitBltEnabled(view, PR_FALSE);
|
||||
}
|
||||
|
||||
// Insert the view into the view hierarchy. If the parent view is a
|
||||
// scrolling view we need to do this differently
|
||||
nsIScrollableView* scrollingView = parentView->ToScrollableView();
|
||||
@ -1924,55 +1890,6 @@ nsBoxFrame::CreateViewForFrame(nsPresContext* aPresContext,
|
||||
// XXX put view last in document order until we can do better
|
||||
viewManager->InsertChild(parentView, view, nsnull, PR_TRUE);
|
||||
}
|
||||
|
||||
// See if the view should be hidden
|
||||
PRBool viewIsVisible = PR_TRUE;
|
||||
PRBool viewHasTransparentContent =
|
||||
!isCanvas &&
|
||||
(!hasBG ||
|
||||
(bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
|
||||
|
||||
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
|
||||
if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) {
|
||||
viewIsVisible = PR_FALSE;
|
||||
}
|
||||
else if (NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible) {
|
||||
// If it has a widget, hide the view because the widget can't deal with it
|
||||
if (view->HasWidget()) {
|
||||
viewIsVisible = PR_FALSE;
|
||||
}
|
||||
else {
|
||||
// If it's a container element, then leave the view visible, but
|
||||
// mark it as having transparent content. The reason we need to
|
||||
// do this is that child elements can override their parent's
|
||||
// hidden visibility and be visible anyway.
|
||||
//
|
||||
// Because this function is called before processing the content
|
||||
// object's child elements, we can't tell if it's a leaf by looking
|
||||
// at whether the frame has any child frames
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
|
||||
if (content && content->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
// The view needs to be visible, but marked as having transparent
|
||||
// content
|
||||
viewHasTransparentContent = PR_TRUE;
|
||||
} else {
|
||||
// Go ahead and hide the view
|
||||
viewIsVisible = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (viewIsVisible) {
|
||||
if (viewHasTransparentContent) {
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
}
|
||||
|
||||
} else {
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
}
|
||||
|
||||
viewManager->SetViewOpacity(view, disp->mOpacity);
|
||||
}
|
||||
|
||||
// Remember our view
|
||||
|
@ -190,11 +190,6 @@ nsMenuPopupFrame::Init(nsIContent* aContent,
|
||||
// about that constraint.
|
||||
viewManager->SetViewFloating(ourView, PR_TRUE);
|
||||
|
||||
// XXX Hack. Change our transparency to be non-transparent
|
||||
// until the bug related to update of transparency on show/hide
|
||||
// is fixed.
|
||||
viewManager->SetViewContentTransparency(ourView, PR_FALSE);
|
||||
|
||||
// XXX make sure we are hidden (shouldn't this be done automatically?)
|
||||
viewManager->SetViewVisibility(ourView, nsViewVisibility_kHide);
|
||||
if (!ourView->HasWidget()) {
|
||||
|
@ -76,10 +76,6 @@ nsScrollbarFrame::Init(nsIContent* aContent,
|
||||
{
|
||||
nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
|
||||
CreateViewForFrame(GetPresContext(), this, GetStyleContext(), PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
view->GetViewManager()->SetViewContentTransparency(view, PR_TRUE);
|
||||
|
||||
// We want to be a reflow root since we use reflows to move the
|
||||
// slider. Any reflow inside the scrollbar frame will be a reflow to
|
||||
// move the slider and will thus not change anything outside of the
|
||||
|
@ -125,8 +125,6 @@ nsSliderFrame::Init(nsIContent* aContent,
|
||||
}
|
||||
|
||||
CreateViewForFrame(GetPresContext(), this, GetStyleContext(), PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
view->GetViewManager()->SetViewContentTransparency(view, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -362,9 +362,6 @@ nsSplitterFrame::Init(nsIContent* aContent,
|
||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
|
||||
if (!realTimeDrag) {
|
||||
// currently this only works on win32 and mac
|
||||
static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
||||
|
@ -213,8 +213,4 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollableView, NS_ISCROLLABLEVIEW_IID)
|
||||
//for this view, it can always be scrolled via a blit
|
||||
#define NS_SCROLL_PROPERTY_ALWAYS_BLIT 0x0001
|
||||
|
||||
//regardless of the transparency or opacity settings
|
||||
//for this view, it can never be scrolled via a blit
|
||||
#define NS_SCROLL_PROPERTY_NEVER_BLIT 0x0002
|
||||
|
||||
#endif
|
||||
|
@ -58,9 +58,10 @@ enum nsViewVisibility {
|
||||
};
|
||||
|
||||
// IID for the nsIView interface
|
||||
// 6610ae89-3909-422f-a227-ede67b97bcd1
|
||||
#define NS_IVIEW_IID \
|
||||
{ 0x658f72ee, 0x32ef, 0x4e93, \
|
||||
{ 0xb8, 0x4e, 0x5f, 0x0f, 0x8f, 0x77, 0xe4, 0x22 } }
|
||||
{ 0x6610ae89, 0x3909, 0x422f, \
|
||||
{ 0xa2, 0x27, 0xed, 0xe6, 0x7b, 0x97, 0xbc, 0xd1 } }
|
||||
|
||||
// Public view flags are defined in this file
|
||||
#define NS_VIEW_FLAGS_PUBLIC 0x00FF
|
||||
@ -70,13 +71,6 @@ enum nsViewVisibility {
|
||||
|
||||
// Public view flags
|
||||
|
||||
// The view is transparent
|
||||
#define NS_VIEW_FLAG_TRANSPARENT 0x0001
|
||||
|
||||
// The view is always painted onto a background consisting
|
||||
// of a uniform field of opaque pixels.
|
||||
#define NS_VIEW_FLAG_UNIFORM_BACKGROUND 0x0002
|
||||
|
||||
// Indicates that the view is using auto z-indexing
|
||||
#define NS_VIEW_FLAG_AUTO_ZINDEX 0x0004
|
||||
|
||||
@ -244,43 +238,6 @@ public:
|
||||
*/
|
||||
nsIView* GetNextSibling() const { return NS_REINTERPRET_CAST(nsIView*, mNextSibling); }
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. Called to get the opacity of a view.
|
||||
* A value of 0.0 means completely transparent. A value of 1.0 means
|
||||
* completely opaque.
|
||||
* @result view's opacity value
|
||||
*/
|
||||
float GetOpacity() const { return mOpacity; }
|
||||
|
||||
/**
|
||||
* Used to ask a view if it has any areas within its bounding box
|
||||
* that are transparent. This is not the same as opacity - opacity can
|
||||
* be set externally, transparency is a quality of the view itself.
|
||||
* @result Returns PR_TRUE if there are transparent areas, PR_FALSE otherwise.
|
||||
*/
|
||||
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. 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) {
|
||||
mVFlags |= NS_VIEW_FLAG_UNIFORM_BACKGROUND;
|
||||
} else {
|
||||
mVFlags &= ~NS_VIEW_FLAG_UNIFORM_BACKGROUND;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool HasUniformBackground() {
|
||||
return mVFlags & NS_VIEW_FLAG_UNIFORM_BACKGROUND;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view's link to client owned data.
|
||||
* @param aData - data to associate with view. nsnull to disassociate
|
||||
|
@ -62,10 +62,10 @@ enum nsRectVisibility {
|
||||
nsRectVisibility_kZeroAreaRect
|
||||
};
|
||||
|
||||
|
||||
// 88946f17-d4a7-410f-bb42-cc71dcd0a330
|
||||
#define NS_IVIEWMANAGER_IID \
|
||||
{ 0xd9af8f22, 0xc64d, 0x4036, \
|
||||
{ 0x9e, 0x8b, 0x69, 0x5a, 0x63, 0x69, 0x3f, 0xd3 } }
|
||||
{ 0x88946f17, 0xd4a7, 0x410f, \
|
||||
{ 0xbb, 0x42, 0xcc, 0x71, 0xdc, 0xd0, 0xa3, 0x30 } }
|
||||
|
||||
class nsIViewManager : public nsISupports
|
||||
{
|
||||
@ -193,27 +193,12 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GrabMouseEvents(nsIView *aView, PRBool& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Used to grab/capture all keyboard events for a specific view,
|
||||
* irrespective of the cursor position at which the
|
||||
* event occurred.
|
||||
* @param aView view to capture keyboard events
|
||||
* @result event handling status
|
||||
*/
|
||||
NS_IMETHOD GrabKeyEvents(nsIView *aView, PRBool& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the current view, if any, that's capturing mouse events.
|
||||
* @result view that is capturing mouse events or nsnull
|
||||
*/
|
||||
NS_IMETHOD GetMouseEventGrabber(nsIView *&aView) = 0;
|
||||
|
||||
/**
|
||||
* Get the current view, if any, that's capturing keyboard events.
|
||||
* @result view that is capturing keyboard events or nsnull
|
||||
*/
|
||||
NS_IMETHOD GetKeyEventGrabber(nsIView *&aView) = 0;
|
||||
|
||||
/**
|
||||
* Given a parent view, insert another view as its child.
|
||||
* aSibling and aAbove control the "document order" for the insertion.
|
||||
@ -336,31 +321,11 @@ public:
|
||||
*/
|
||||
NS_IMETHOD SetViewFloating(nsIView *aView, PRBool aFloatingView) = 0;
|
||||
|
||||
/**
|
||||
* Set whether the view can be bitblitted during scrolling.
|
||||
*/
|
||||
NS_IMETHOD SetViewBitBltEnabled(nsIView *aView, PRBool aEnable) = 0;
|
||||
|
||||
/**
|
||||
* Set whether the view's children should be searched during event processing.
|
||||
*/
|
||||
NS_IMETHOD SetViewCheckChildEvents(nsIView *aView, PRBool aEnable) = 0;
|
||||
|
||||
/**
|
||||
* Used set the transparency status of the content in a view. see
|
||||
* nsIView.HasTransparency().
|
||||
* @param aTransparent PR_TRUE if there are transparent areas, PR_FALSE otherwise.
|
||||
*/
|
||||
NS_IMETHOD SetViewContentTransparency(nsIView *aView, PRBool aTransparent) = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
||||
* A value of 0.0 means completely transparent. A value of 1.0 means
|
||||
* completely opaque.
|
||||
* @param opacity new opacity value
|
||||
*/
|
||||
NS_IMETHOD SetViewOpacity(nsIView *aView, float aOpacity) = 0;
|
||||
|
||||
/**
|
||||
* Set the view observer associated with this manager
|
||||
* @param aObserver - new observer
|
||||
|
@ -541,9 +541,7 @@ void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsPoin
|
||||
} else {
|
||||
PRUint32 scrolledViewFlags = aScrolledView->GetViewFlags();
|
||||
|
||||
if ((mScrollProperties & NS_SCROLL_PROPERTY_NEVER_BLIT) ||
|
||||
(scrolledViewFlags & NS_VIEW_FLAG_DONT_BITBLT) ||
|
||||
(!(mScrollProperties & NS_SCROLL_PROPERTY_ALWAYS_BLIT) &&
|
||||
if ((!(mScrollProperties & NS_SCROLL_PROPERTY_ALWAYS_BLIT) &&
|
||||
!mViewManager->CanScrollWithBitBlt(aScrolledView, aTwipsDelta, &updateRegion))) {
|
||||
canBitBlit = PR_FALSE;
|
||||
}
|
||||
|
@ -183,8 +183,7 @@ nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
|
||||
// a promise that the view will paint all its pixels opaquely. Views
|
||||
// should make this promise explicitly by calling
|
||||
// SetViewContentTransparency.
|
||||
mVFlags = NS_VIEW_FLAG_TRANSPARENT;
|
||||
mOpacity = 1.0f;
|
||||
mVFlags = 0;
|
||||
mViewManager = aViewManager;
|
||||
mChildRemoved = PR_FALSE;
|
||||
mDirtyRegion = nsnull;
|
||||
@ -566,22 +565,6 @@ void nsView::RemoveChild(nsView *child)
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView::SetOpacity(float opacity)
|
||||
{
|
||||
mOpacity = opacity;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView::SetContentTransparency(PRBool aTransparent)
|
||||
{
|
||||
if (aTransparent == PR_TRUE)
|
||||
mVFlags |= NS_VIEW_FLAG_TRANSPARENT;
|
||||
else
|
||||
mVFlags &= ~NS_VIEW_FLAG_TRANSPARENT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Native widgets ultimately just can't deal with the awesome power of
|
||||
// CSS2 z-index. However, we set the z-index on the widget anyway
|
||||
// because in many simple common cases the widgets do end up in the
|
||||
@ -799,8 +782,8 @@ void nsIView::List(FILE* out, PRInt32 aIndent) const
|
||||
if (v->GetZParent()) {
|
||||
fprintf(out, " zparent=%p", (void*)v->GetZParent());
|
||||
}
|
||||
fprintf(out, " z=%d vis=%d opc=%1.3f tran=%d clientData=%p <\n",
|
||||
mZIndex, mVis, mOpacity, IsTransparent(), mClientData);
|
||||
fprintf(out, " z=%d vis=%d clientData=%p <\n",
|
||||
mZIndex, mVis, mClientData);
|
||||
for (nsView* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
|
||||
NS_ASSERTION(kid->GetParent() == this, "incorrect parent");
|
||||
kid->List(out, aIndent + 1);
|
||||
|
@ -65,10 +65,6 @@ class nsZPlaceholderView;
|
||||
// by its children or just handle the events itself
|
||||
#define NS_VIEW_FLAG_DONT_CHECK_CHILDREN 0x0200
|
||||
|
||||
// indicates that the view should not be bitblt'd when moved
|
||||
// or scrolled and instead must be repainted
|
||||
#define NS_VIEW_FLAG_DONT_BITBLT 0x0400
|
||||
|
||||
// set if this view is clipping its normal descendants
|
||||
// to its bounds. When this flag is set, child views
|
||||
// bounds need not be inside this view's bounds.
|
||||
@ -176,19 +172,6 @@ public:
|
||||
* @result PR_TRUE if the view floats, PR_FALSE otherwise.
|
||||
*/
|
||||
NS_IMETHOD SetFloating(PRBool aFloatingView);
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
||||
* A value of 0.0 means completely transparent. A value of 1.0 means
|
||||
* completely opaque.
|
||||
* @param opacity new opacity value
|
||||
*/
|
||||
NS_IMETHOD SetOpacity(float opacity);
|
||||
/**
|
||||
* Used set the transparency status of the content in a view. see
|
||||
* HasTransparency().
|
||||
* @param aTransparent PR_TRUE if there are transparent areas, PR_FALSE otherwise.
|
||||
*/
|
||||
NS_IMETHOD SetContentTransparency(PRBool aTransparent);
|
||||
/**
|
||||
* Set the widget associated with this view.
|
||||
* @param aWidget widget to associate with view. It is an error
|
||||
|
@ -289,7 +289,6 @@ NS_IMETHODIMP nsViewManager::Init(nsIDeviceContext* aContext)
|
||||
mRefreshEnabled = PR_TRUE;
|
||||
|
||||
mMouseGrabber = nsnull;
|
||||
mKeyGrabber = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1508,7 +1507,6 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
||||
if (aEvent->message == NS_DEACTIVATE) {
|
||||
PRBool result;
|
||||
GrabMouseEvents(nsnull, result);
|
||||
mKeyGrabber = nsnull;
|
||||
}
|
||||
|
||||
//Find the view whose coordinates system we're in.
|
||||
@ -1532,12 +1530,6 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
||||
capturedEvent = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent)) {
|
||||
if (mKeyGrabber) {
|
||||
view = mKeyGrabber;
|
||||
capturedEvent = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull != view) {
|
||||
PRInt32 p2a = mContext->AppUnitsPerDevPixel();
|
||||
@ -1682,25 +1674,12 @@ NS_IMETHODIMP nsViewManager::GrabMouseEvents(nsIView *aView, PRBool &aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::GrabKeyEvents(nsIView *aView, PRBool &aResult)
|
||||
{
|
||||
mKeyGrabber = NS_STATIC_CAST(nsView*, aView);
|
||||
aResult = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::GetMouseEventGrabber(nsIView *&aView)
|
||||
{
|
||||
aView = GetMouseEventGrabber();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::GetKeyEventGrabber(nsIView *&aView)
|
||||
{
|
||||
aView = mKeyGrabber;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Recursively reparent widgets if necessary
|
||||
|
||||
void nsViewManager::ReparentChildWidgets(nsIView* aView, nsIWidget *aNewWidget)
|
||||
@ -2056,21 +2035,6 @@ PRBool nsViewManager::CanScrollWithBitBlt(nsView* aView, nsPoint aDelta,
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetViewBitBltEnabled(nsIView *aView, PRBool aEnable)
|
||||
{
|
||||
nsView* view = NS_STATIC_CAST(nsView*, aView);
|
||||
|
||||
NS_ASSERTION(!(nsnull == view), "no view");
|
||||
|
||||
if (aEnable) {
|
||||
view->SetViewFlags(view->GetViewFlags() & ~NS_VIEW_FLAG_DONT_BITBLT);
|
||||
} else {
|
||||
view->SetViewFlags(view->GetViewFlags() | NS_VIEW_FLAG_DONT_BITBLT);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetViewCheckChildEvents(nsIView *aView, PRBool aEnable)
|
||||
{
|
||||
nsView* view = NS_STATIC_CAST(nsView*, aView);
|
||||
@ -2200,37 +2164,6 @@ NS_IMETHODIMP nsViewManager::SetViewZIndex(nsIView *aView, PRBool aAutoZIndex, P
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetViewContentTransparency(nsIView *aView, PRBool aTransparent)
|
||||
{
|
||||
nsView* view = NS_STATIC_CAST(nsView*, aView);
|
||||
|
||||
if (view->IsTransparent() != aTransparent) {
|
||||
view->SetContentTransparency(aTransparent);
|
||||
|
||||
if (IsViewInserted(view)) {
|
||||
UpdateView(view, NS_VMREFRESH_NO_SYNC);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetViewOpacity(nsIView *aView, float aOpacity)
|
||||
{
|
||||
nsView* view = NS_STATIC_CAST(nsView*, aView);
|
||||
|
||||
if (view->GetOpacity() != aOpacity)
|
||||
{
|
||||
view->SetOpacity(aOpacity);
|
||||
|
||||
if (IsViewInserted(view)) {
|
||||
UpdateView(view, NS_VMREFRESH_NO_SYNC);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::SetViewObserver(nsIViewObserver *aObserver)
|
||||
{
|
||||
mObserver = aObserver;
|
||||
|
@ -180,10 +180,8 @@ public:
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent, nsEventStatus* aStatus);
|
||||
|
||||
NS_IMETHOD GrabMouseEvents(nsIView *aView, PRBool &aResult);
|
||||
NS_IMETHOD GrabKeyEvents(nsIView *aView, PRBool &aresult);
|
||||
|
||||
NS_IMETHOD GetMouseEventGrabber(nsIView *&aView);
|
||||
NS_IMETHOD GetKeyEventGrabber(nsIView *&aView);
|
||||
|
||||
NS_IMETHOD InsertChild(nsIView *parent, nsIView *child, nsIView *sibling,
|
||||
PRBool above);
|
||||
@ -204,8 +202,6 @@ public:
|
||||
|
||||
NS_IMETHOD SetViewChildClipRegion(nsIView *aView, const nsRegion *aRegion);
|
||||
|
||||
NS_IMETHOD SetViewBitBltEnabled(nsIView *aView, PRBool aEnable);
|
||||
|
||||
NS_IMETHOD SetViewCheckChildEvents(nsIView *aView, PRBool aEnable);
|
||||
|
||||
NS_IMETHOD SetViewFloating(nsIView *aView, PRBool aFloating);
|
||||
@ -213,8 +209,6 @@ public:
|
||||
NS_IMETHOD SetViewVisibility(nsIView *aView, nsViewVisibility aVisible);
|
||||
|
||||
NS_IMETHOD SetViewZIndex(nsIView *aView, PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost=PR_FALSE);
|
||||
NS_IMETHOD SetViewContentTransparency(nsIView *aView, PRBool aTransparent);
|
||||
NS_IMETHOD SetViewOpacity(nsIView *aView, float aOpacity);
|
||||
|
||||
NS_IMETHOD SetViewObserver(nsIViewObserver *aObserver);
|
||||
NS_IMETHOD GetViewObserver(nsIViewObserver *&aObserver);
|
||||
@ -416,7 +410,6 @@ public: // NOT in nsIViewManager, so private to the view module
|
||||
nsView* GetMouseEventGrabber() const {
|
||||
return RootViewManager()->mMouseGrabber;
|
||||
}
|
||||
nsView* GetKeyEventGrabber() const { return mKeyGrabber; }
|
||||
nsViewManager* RootViewManager() const { return mRootViewManager; }
|
||||
PRBool IsRootVM() const { return this == RootViewManager(); }
|
||||
|
||||
@ -482,7 +475,6 @@ public: // NOT in nsIViewManager, so private to the view module
|
||||
private:
|
||||
nsIDeviceContext *mContext;
|
||||
nsIViewObserver *mObserver;
|
||||
nsView *mKeyGrabber;
|
||||
nsIScrollableView *mRootScrollable;
|
||||
nscolor mDefaultBackgroundColor;
|
||||
nsPoint mMouseLocation; // device units, relative to mRootView
|
||||
|
Loading…
x
Reference in New Issue
Block a user