r=vidur@netscape.com Performance. Added NS_FRAME_HAS_VIEW frame state flag

so we can quickly tell whether the frame has an associated view


git-svn-id: svn://10.0.0.236/trunk@59586 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
troy%netscape.com
2000-02-03 00:51:37 +00:00
parent 7bc9fb3895
commit 05e293d03e
4 changed files with 42 additions and 22 deletions

View File

@@ -168,6 +168,9 @@ typedef PRUint32 nsFrameState;
// If this bit is set, the frame has dirty children.
#define NS_FRAME_HAS_DIRTY_CHILDREN 0x00001000
// If this bit is set, the frame has an associated view
#define NS_FRAME_HAS_VIEW 0x00002000
// The low 16 bits of the frame state word are reserved by this API.
#define NS_FRAME_RESERVED 0x0000FFFF

View File

@@ -1406,18 +1406,22 @@ NS_IMETHODIMP nsFrame::GetView(nsIPresContext* aPresContext, nsIView** aView) co
// Initialize OUT parameter
*aView = nsnull;
// Check for a property on the frame
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
// Check the frame state bit and see if the frame has a view
if (mState & NS_FRAME_HAS_VIEW) {
// Check for a property on the frame
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (frameManager) {
void* value;
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::viewProperty, 0, &value);
*aView = (nsIView*)value;
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::viewProperty, 0, &value);
*aView = (nsIView*)value;
NS_ASSERTION(value != 0, "frame state bit was set but frame has no view");
}
}
}
@@ -1442,6 +1446,9 @@ NS_IMETHODIMP nsFrame::SetView(nsIPresContext* aPresContext, nsIView* aView)
aView, nsnull);
}
}
// Set the frame state bit that says the frame has a view
mState |= NS_FRAME_HAS_VIEW;
}
return NS_OK;

View File

@@ -168,6 +168,9 @@ typedef PRUint32 nsFrameState;
// If this bit is set, the frame has dirty children.
#define NS_FRAME_HAS_DIRTY_CHILDREN 0x00001000
// If this bit is set, the frame has an associated view
#define NS_FRAME_HAS_VIEW 0x00002000
// The low 16 bits of the frame state word are reserved by this API.
#define NS_FRAME_RESERVED 0x0000FFFF

View File

@@ -1406,18 +1406,22 @@ NS_IMETHODIMP nsFrame::GetView(nsIPresContext* aPresContext, nsIView** aView) co
// Initialize OUT parameter
*aView = nsnull;
// Check for a property on the frame
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
// Check the frame state bit and see if the frame has a view
if (mState & NS_FRAME_HAS_VIEW) {
// Check for a property on the frame
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (frameManager) {
void* value;
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::viewProperty, 0, &value);
*aView = (nsIView*)value;
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::viewProperty, 0, &value);
*aView = (nsIView*)value;
NS_ASSERTION(value != 0, "frame state bit was set but frame has no view");
}
}
}
@@ -1442,6 +1446,9 @@ NS_IMETHODIMP nsFrame::SetView(nsIPresContext* aPresContext, nsIView* aView)
aView, nsnull);
}
}
// Set the frame state bit that says the frame has a view
mState |= NS_FRAME_HAS_VIEW;
}
return NS_OK;