This commit is contained in:
evaughan%netscape.com 2000-09-14 23:02:26 +00:00
parent 279ba5b1e5
commit bb9a09703e
3 changed files with 50 additions and 4 deletions

View File

@ -53,6 +53,10 @@
#include "nsBoxToBlockAdaptor.h"
#include "nsILineIterator.h"
#include "nsIFontMetrics.h"
#include "nsHTMLContainerFrame.h"
#include "nsWidgetsCID.h"
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
//#define DEBUG_REFLOW
//#define DEBUG_GROW
@ -127,9 +131,46 @@ nsBoxToBlockAdaptor::nsBoxToBlockAdaptor(nsIPresShell* aPresShell, nsIFrame* aFr
mOverflow.width = 0;
mOverflow.height = 0;
mIncludeOverflow = PR_TRUE;
mPresShell = aPresShell;
NeedsRecalc();
}
NS_IMETHODIMP
nsBoxToBlockAdaptor::SetParentBox(nsIBox* aParent)
{
nsresult rv = nsBox::SetParentBox(aParent);
nsIBox* parent = aParent;
if (parent) {
PRBool needsWidget = PR_FALSE;
parent->ChildrenMustHaveWidgets(needsWidget);
if (needsWidget) {
nsCOMPtr<nsIPresContext> context;
mPresShell->GetPresContext(getter_AddRefs(context));
nsIView* view = nsnull;
mFrame->GetView(context, &view);
if (!view) {
nsCOMPtr<nsIStyleContext> style;
mFrame->GetStyleContext(getter_AddRefs(style));
nsHTMLContainerFrame::CreateViewForFrame(context,mFrame,style,nsnull,PR_TRUE);
mFrame->GetView(context, &view);
}
nsIWidget* widget;
view->GetWidget(widget);
if (!widget)
view->CreateWidget(kWidgetCID);
}
}
return rv;
}
PRBool
nsBoxToBlockAdaptor::HasStyleChange()
{
@ -687,6 +728,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
if (needsReflow) {
Redraw(aState);
redrawAfterReflow = PR_TRUE;
//printf("Redrawing!!!/n");
}
} break;

View File

@ -47,6 +47,7 @@ public:
NS_IMETHOD SetIncludeOverflow(PRBool aInclude);
NS_IMETHOD GetOverflow(nsSize& aOverflow);
NS_IMETHOD NeedsRecalc();
NS_IMETHOD SetParentBox(nsIBox* aParent);
NS_IMETHOD Recycle(nsIPresShell* aPresShell);
@ -94,6 +95,7 @@ protected:
PRBool mSizeSet;
nsSize mOverflow;
PRBool mIncludeOverflow;
nsCOMPtr<nsIPresShell> mPresShell;
};
#endif

View File

@ -322,11 +322,13 @@ nsDeckFrame::Paint(nsIPresContext* aPresContext,
// only paint the seleced box
nsIBox* box = GetSelectedBox();
nsIFrame* frame = nsnull;
box->GetFrame(&frame);
if (box) {
nsIFrame* frame = nsnull;
box->GetFrame(&frame);
if (frame != nsnull)
PaintChild(aPresContext, aRenderingContext, aDirtyRect, frame, aWhichLayer);
if (frame != nsnull)
PaintChild(aPresContext, aRenderingContext, aDirtyRect, frame, aWhichLayer);
}
return NS_OK;