Unify box and frame trees by moving nsIBox methods onto nsIFrame. XUL-box frames can call the superclass nsBox implementation, all other frames get the nsFrame implementation of the box methods, which acts like nsBoxToBlockAdaptor used to. Bug 258513, r+sr=roc.

This commit is contained in:
bryner@brianryner.com
2004-09-28 18:37:50 +00:00
parent 226691d7f7
commit f447d12b9e
73 changed files with 3590 additions and 3643 deletions

View File

@@ -113,6 +113,7 @@
#include "nsScrollPortFrame.h"
#include "nsXULAtoms.h"
#include "nsBoxFrame.h"
#include "nsIBoxLayout.h"
#ifdef MOZ_ENABLE_CAIRO
#include "nsCanvasFrame.h"
#endif
@@ -5817,11 +5818,9 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
nsRefPtr<nsStyleContext> contentStyle = aContentStyle;
if (!gfxScrollFrame) {
nsCOMPtr<nsIBox> box = do_QueryInterface(aParentFrame);
// Build a XULScrollFrame when the parent is a box, because XULScrollFrames
// do box layout well. Otherwise build an HTMLScrollFrame.
if (box) {
if (aParentFrame->IsBoxFrame()) {
NS_NewXULScrollFrame(aPresShell, &gfxScrollFrame, aIsRoot);
} else {
NS_NewHTMLScrollFrame(aPresShell, &gfxScrollFrame, aIsRoot);
@@ -9816,12 +9815,9 @@ nsCSSFrameConstructor::StyleChangeReflow(nsPresContext* aPresContext,
#endif
// Is it a box? If so we can coelesce.
nsresult rv;
nsIBox *box;
rv = CallQueryInterface(aFrame, &box);
if (NS_SUCCEEDED(rv) && box) {
if (aFrame->IsBoxFrame()) {
nsBoxLayoutState state(aPresContext);
box->MarkStyleChange(state);
aFrame->MarkStyleChange(state);
}
else {
// If the frame is part of a split block-in-inline hierarchy, then
@@ -9833,10 +9829,10 @@ nsCSSFrameConstructor::StyleChangeReflow(nsPresContext* aPresContext,
// Target a style-change reflow at the frame.
nsHTMLReflowCommand *reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
eReflowType_StyleChanged,
nsnull,
aAttribute);
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
eReflowType_StyleChanged,
nsnull,
aAttribute);
if (NS_SUCCEEDED(rv))
aPresContext->PresShell()->AppendReflowCommand(reflowCmd);