зеркало из https://github.com/mozilla/pjs.git
Added box layout system.
This commit is contained in:
Родитель
4103ca4f8b
Коммит
e637847edd
|
@ -66,6 +66,9 @@ public:
|
|||
static nsIAtom* titledbutton;
|
||||
static nsIAtom* mode;
|
||||
|
||||
static nsIAtom* box;
|
||||
static nsIAtom* flex;
|
||||
|
||||
static nsIAtom* widget;
|
||||
static nsIAtom* window;
|
||||
};
|
||||
|
|
|
@ -48,6 +48,8 @@ nsIAtom* nsXULAtoms::progressmeter;
|
|||
nsIAtom* nsXULAtoms::titledbutton;
|
||||
nsIAtom* nsXULAtoms::mode;
|
||||
|
||||
nsIAtom* nsXULAtoms::box;
|
||||
nsIAtom* nsXULAtoms::flex;
|
||||
|
||||
nsIAtom* nsXULAtoms::widget;
|
||||
nsIAtom* nsXULAtoms::window;
|
||||
|
@ -91,6 +93,8 @@ void nsXULAtoms::AddrefAtoms() {
|
|||
titledbutton = NS_NewAtom("titledbutton");
|
||||
|
||||
mode = NS_NewAtom("mode");
|
||||
box = NS_NewAtom("box");
|
||||
flex = NS_NewAtom("flex");
|
||||
|
||||
widget = NS_NewAtom("widget");
|
||||
window = NS_NewAtom("window");
|
||||
|
@ -124,6 +128,10 @@ void nsXULAtoms::ReleaseAtoms() {
|
|||
NS_RELEASE(progressmeter);
|
||||
NS_RELEASE(mode);
|
||||
|
||||
NS_RELEASE(box);
|
||||
NS_RELEASE(flex);
|
||||
|
||||
|
||||
NS_RELEASE(widget);
|
||||
NS_RELEASE(window);
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
|
|
@ -70,10 +70,9 @@ NS_NewProgressMeterFrame ( nsIFrame*& aNewFrame );
|
|||
nsresult
|
||||
NS_NewTitledButtonFrame ( nsIFrame*& aNewFrame );
|
||||
|
||||
/*
|
||||
#include "nsProgressMeterFrame.h"
|
||||
#include "nsTitledButtonFrame.h"
|
||||
*/
|
||||
nsresult
|
||||
NS_NewBoxFrame ( nsIFrame*& aNewFrame );
|
||||
|
||||
#endif
|
||||
|
||||
//static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
|
@ -1298,6 +1297,7 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
(nsXULAtoms::treeindentation == tag.get()) ||
|
||||
(nsXULAtoms::toolbox == tag.get()) ||
|
||||
(nsXULAtoms::toolbar == tag.get()) ||
|
||||
(nsXULAtoms::box == tag.get()) ||
|
||||
(nsXULAtoms::progressmeter == tag.get() )) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -2246,6 +2246,14 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
|
|||
}
|
||||
// End of PROGRESS METER CONSTRUCTION logic
|
||||
|
||||
// BOX CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::box) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewBoxFrame(newFrame);
|
||||
}
|
||||
// End of BOX CONSTRUCTION logic
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton) {
|
||||
processChildren = PR_TRUE;
|
||||
|
|
|
@ -27,12 +27,17 @@ nsButtonFrameRenderer::SetNameSpace(PRInt32 aNameSpace)
|
|||
}
|
||||
|
||||
void
|
||||
nsButtonFrameRenderer::SetFrame(nsIFrame* aFrame, nsIPresContext& aPresContext)
|
||||
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
|
||||
{
|
||||
mFrame = aFrame;
|
||||
ReResolveStyles(aPresContext);
|
||||
}
|
||||
|
||||
void
|
||||
nsButtonFrameRenderer::Redraw()
|
||||
{
|
||||
mFrame->Invalidate(mOutlineRect, PR_TRUE);
|
||||
}
|
||||
|
||||
nsString
|
||||
nsButtonFrameRenderer::GetPseudoClassAttribute()
|
||||
|
@ -334,8 +339,14 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext,
|
|||
|
||||
nsRect rect;
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
{
|
||||
// because we have and outline rect we need to
|
||||
// store our bounds for redraw. We will change
|
||||
// these bounds when outline appears
|
||||
mOutlineRect = rect;
|
||||
mOutlineRect.width = 0;
|
||||
mOutlineRect.height= 0;
|
||||
|
||||
if (mOuterFocusStyle) {
|
||||
// ---------- paint the outer focus border -------------
|
||||
|
@ -360,11 +371,11 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer)
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer)
|
||||
{
|
||||
if /*(mOutlineStyle) */ (PR_FALSE) {
|
||||
if (mOutlineStyle) {
|
||||
|
||||
GetButtonOutlineRect(aRect, rect);
|
||||
GetButtonOutlineRect(aRect, mOutlineRect);
|
||||
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
|
@ -374,7 +385,7 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext,
|
|||
|
||||
aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, rect, *spacing, mOutlineStyle, 0);
|
||||
aDirtyRect, mOutlineRect, *spacing, mOutlineStyle, 0);
|
||||
|
||||
aRenderingContext.PopState(clipEmpty);
|
||||
}
|
||||
|
@ -529,10 +540,18 @@ nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding()
|
|||
return borderAndPadding;
|
||||
}
|
||||
|
||||
// gets the full size of our border with all the focus borders
|
||||
nsMargin
|
||||
nsButtonFrameRenderer::GetFullButtonBorderAndPadding()
|
||||
{
|
||||
return GetButtonOuterFocusBorderAndPadding() + GetButtonBorderAndPadding() + GetButtonInnerFocusMargin() + GetButtonInnerFocusBorderAndPadding();
|
||||
return GetAddedButtonBorderAndPadding() + GetButtonBorderAndPadding();
|
||||
}
|
||||
|
||||
// gets all the focus borders and padding that will be added to the regular border
|
||||
nsMargin
|
||||
nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
|
||||
{
|
||||
return GetButtonOuterFocusBorderAndPadding() + GetButtonInnerFocusMargin() + GetButtonInnerFocusBorderAndPadding();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
const nsRect& aRect);
|
||||
|
||||
virtual void SetNameSpace(PRInt32 aNameSpace);
|
||||
virtual void SetFrame(nsIFrame* aFrame, nsIPresContext& aPresContext);
|
||||
virtual void SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext);
|
||||
|
||||
virtual void SetActive(PRBool aActive, PRBool notify);
|
||||
virtual void SetHover(PRBool aHover, PRBool notify);
|
||||
|
@ -82,12 +82,13 @@ public:
|
|||
virtual void GetButtonRect(const nsRect& aRect, nsRect& aResult);
|
||||
virtual void GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult);
|
||||
virtual void GetButtonContentRect(const nsRect& aRect, nsRect& aResult);
|
||||
virtual nsMargin GetButtonOuterFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonBorderAndPadding();
|
||||
virtual nsMargin GetButtonInnerFocusMargin();
|
||||
virtual nsMargin GetButtonInnerFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonOutlineBorderAndPadding();
|
||||
virtual nsMargin GetFullButtonBorderAndPadding();
|
||||
virtual nsMargin GetButtonOuterFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonBorderAndPadding();
|
||||
virtual nsMargin GetButtonInnerFocusMargin();
|
||||
virtual nsMargin GetButtonInnerFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonOutlineBorderAndPadding();
|
||||
virtual nsMargin GetFullButtonBorderAndPadding();
|
||||
virtual nsMargin GetAddedButtonBorderAndPadding();
|
||||
|
||||
virtual void ReResolveStyles(nsIPresContext& aPresContext);
|
||||
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
nsMargin& aBorderPadding);
|
||||
|
||||
virtual void Redraw();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -118,7 +120,9 @@ private:
|
|||
nsCOMPtr<nsIStyleContext> mOutlineStyle;
|
||||
|
||||
PRInt32 mNameSpace;
|
||||
nsIFrame* mFrame;
|
||||
nsFrame* mFrame;
|
||||
|
||||
nsRect mOutlineRect;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -27,12 +27,17 @@ nsButtonFrameRenderer::SetNameSpace(PRInt32 aNameSpace)
|
|||
}
|
||||
|
||||
void
|
||||
nsButtonFrameRenderer::SetFrame(nsIFrame* aFrame, nsIPresContext& aPresContext)
|
||||
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
|
||||
{
|
||||
mFrame = aFrame;
|
||||
ReResolveStyles(aPresContext);
|
||||
}
|
||||
|
||||
void
|
||||
nsButtonFrameRenderer::Redraw()
|
||||
{
|
||||
mFrame->Invalidate(mOutlineRect, PR_TRUE);
|
||||
}
|
||||
|
||||
nsString
|
||||
nsButtonFrameRenderer::GetPseudoClassAttribute()
|
||||
|
@ -334,8 +339,14 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext,
|
|||
|
||||
nsRect rect;
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer)
|
||||
{
|
||||
// because we have and outline rect we need to
|
||||
// store our bounds for redraw. We will change
|
||||
// these bounds when outline appears
|
||||
mOutlineRect = rect;
|
||||
mOutlineRect.width = 0;
|
||||
mOutlineRect.height= 0;
|
||||
|
||||
if (mOuterFocusStyle) {
|
||||
// ---------- paint the outer focus border -------------
|
||||
|
@ -360,11 +371,11 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer)
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer)
|
||||
{
|
||||
if /*(mOutlineStyle) */ (PR_FALSE) {
|
||||
if (mOutlineStyle) {
|
||||
|
||||
GetButtonOutlineRect(aRect, rect);
|
||||
GetButtonOutlineRect(aRect, mOutlineRect);
|
||||
|
||||
const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing);
|
||||
|
||||
|
@ -374,7 +385,7 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext,
|
|||
|
||||
aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, rect, *spacing, mOutlineStyle, 0);
|
||||
aDirtyRect, mOutlineRect, *spacing, mOutlineStyle, 0);
|
||||
|
||||
aRenderingContext.PopState(clipEmpty);
|
||||
}
|
||||
|
@ -529,10 +540,18 @@ nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding()
|
|||
return borderAndPadding;
|
||||
}
|
||||
|
||||
// gets the full size of our border with all the focus borders
|
||||
nsMargin
|
||||
nsButtonFrameRenderer::GetFullButtonBorderAndPadding()
|
||||
{
|
||||
return GetButtonOuterFocusBorderAndPadding() + GetButtonBorderAndPadding() + GetButtonInnerFocusMargin() + GetButtonInnerFocusBorderAndPadding();
|
||||
return GetAddedButtonBorderAndPadding() + GetButtonBorderAndPadding();
|
||||
}
|
||||
|
||||
// gets all the focus borders and padding that will be added to the regular border
|
||||
nsMargin
|
||||
nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
|
||||
{
|
||||
return GetButtonOuterFocusBorderAndPadding() + GetButtonInnerFocusMargin() + GetButtonInnerFocusBorderAndPadding();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
const nsRect& aRect);
|
||||
|
||||
virtual void SetNameSpace(PRInt32 aNameSpace);
|
||||
virtual void SetFrame(nsIFrame* aFrame, nsIPresContext& aPresContext);
|
||||
virtual void SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext);
|
||||
|
||||
virtual void SetActive(PRBool aActive, PRBool notify);
|
||||
virtual void SetHover(PRBool aHover, PRBool notify);
|
||||
|
@ -82,12 +82,13 @@ public:
|
|||
virtual void GetButtonRect(const nsRect& aRect, nsRect& aResult);
|
||||
virtual void GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult);
|
||||
virtual void GetButtonContentRect(const nsRect& aRect, nsRect& aResult);
|
||||
virtual nsMargin GetButtonOuterFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonBorderAndPadding();
|
||||
virtual nsMargin GetButtonInnerFocusMargin();
|
||||
virtual nsMargin GetButtonInnerFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonOutlineBorderAndPadding();
|
||||
virtual nsMargin GetFullButtonBorderAndPadding();
|
||||
virtual nsMargin GetButtonOuterFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonBorderAndPadding();
|
||||
virtual nsMargin GetButtonInnerFocusMargin();
|
||||
virtual nsMargin GetButtonInnerFocusBorderAndPadding();
|
||||
virtual nsMargin GetButtonOutlineBorderAndPadding();
|
||||
virtual nsMargin GetFullButtonBorderAndPadding();
|
||||
virtual nsMargin GetAddedButtonBorderAndPadding();
|
||||
|
||||
virtual void ReResolveStyles(nsIPresContext& aPresContext);
|
||||
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
nsMargin& aBorderPadding);
|
||||
|
||||
virtual void Redraw();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -118,7 +120,9 @@ private:
|
|||
nsCOMPtr<nsIStyleContext> mOutlineStyle;
|
||||
|
||||
PRInt32 mNameSpace;
|
||||
nsIFrame* mFrame;
|
||||
nsFrame* mFrame;
|
||||
|
||||
nsRect mOutlineRect;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -70,10 +70,9 @@ NS_NewProgressMeterFrame ( nsIFrame*& aNewFrame );
|
|||
nsresult
|
||||
NS_NewTitledButtonFrame ( nsIFrame*& aNewFrame );
|
||||
|
||||
/*
|
||||
#include "nsProgressMeterFrame.h"
|
||||
#include "nsTitledButtonFrame.h"
|
||||
*/
|
||||
nsresult
|
||||
NS_NewBoxFrame ( nsIFrame*& aNewFrame );
|
||||
|
||||
#endif
|
||||
|
||||
//static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
|
@ -1298,6 +1297,7 @@ nsCSSFrameConstructor::TableIsValidCellContent(nsIPresContext* aPresContext,
|
|||
(nsXULAtoms::treeindentation == tag.get()) ||
|
||||
(nsXULAtoms::toolbox == tag.get()) ||
|
||||
(nsXULAtoms::toolbar == tag.get()) ||
|
||||
(nsXULAtoms::box == tag.get()) ||
|
||||
(nsXULAtoms::progressmeter == tag.get() )) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -2246,6 +2246,14 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresContext* aPresContext,
|
|||
}
|
||||
// End of PROGRESS METER CONSTRUCTION logic
|
||||
|
||||
// BOX CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::box) {
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
rv = NS_NewBoxFrame(newFrame);
|
||||
}
|
||||
// End of BOX CONSTRUCTION logic
|
||||
|
||||
// TITLED BUTTON CONSTRUCTION
|
||||
else if (aTag == nsXULAtoms::titledbutton) {
|
||||
processChildren = PR_TRUE;
|
||||
|
|
|
@ -35,7 +35,8 @@ LOCAL_INCLUDES = \
|
|||
|
||||
# Note the sophisticated alphabetical ordering :-|
|
||||
CPPSRCS = \
|
||||
nsProgressMeterFrame.cpp \
|
||||
nsBoxFrame.cpp \
|
||||
nsProgressMeterFrame.cpp \
|
||||
nsTitledButtonFrame.cpp \
|
||||
nsToolbarFrame.cpp \
|
||||
nsToolboxFrame.cpp \
|
||||
|
|
|
@ -24,6 +24,7 @@ REQUIRES=xpcom raptor pref
|
|||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPPSRCS= \
|
||||
nsBoxFrame.cpp \
|
||||
nsProgressMeterFrame.cpp \
|
||||
nsTitledButtonFrame.cpp \
|
||||
nsToolboxFrame.cpp \
|
||||
|
@ -34,6 +35,7 @@ CPPSRCS= \
|
|||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsBoxFrame.obj \
|
||||
.\$(OBJDIR)\nsProgressMeterFrame.obj \
|
||||
.\$(OBJDIR)\nsTitledButtonFrame.obj \
|
||||
.\$(OBJDIR)\nsToolboxFrame.obj \
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Eric D Vaughan
|
||||
This class lays out its children either vertically or horizontally
|
||||
|
||||
**/
|
||||
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
class nsBoxDataSpring;
|
||||
|
||||
class nsBoxFrame : public nsHTMLContainerFrame
|
||||
{
|
||||
public:
|
||||
|
||||
friend nsresult NS_NewBoxFrame(nsIFrame*& aNewFrame);
|
||||
|
||||
NS_IMETHOD FlowChildAt(nsIFrame* frame,
|
||||
nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus,
|
||||
const nsSize& size);
|
||||
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* asPrevInFlow);
|
||||
|
||||
NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRInt32 aParentChange,
|
||||
nsStyleChangeList* aChangeList,
|
||||
PRInt32* aLocalChange) ;
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint);
|
||||
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus& aEventStatus);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
virtual PRIntn GetSkipSides() const { return 0; }
|
||||
|
||||
nsBoxFrame();
|
||||
|
||||
virtual void Stretch(nsBoxDataSpring* springs, PRInt32 nSprings, nscoord& size);
|
||||
|
||||
private:
|
||||
|
||||
PRBool mHorizontal;
|
||||
|
||||
}; // class nsBoxFrame
|
||||
|
|
@ -601,10 +601,7 @@ nsProgressMeterFrame :: Reflow ( nsIPresContext& aPresContext,
|
|||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
|
||||
ReResolveStyleContext(&aPresContext, mStyleContext, NS_STYLE_HINT_REFLOW, nsnull, nsnull);
|
||||
|
||||
{
|
||||
if (mUndetermined)
|
||||
gStripeAnimator->AddFrame(this);
|
||||
else
|
||||
|
|
|
@ -193,11 +193,7 @@ nsTitledButtonFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
mNeedsLayout = PR_TRUE;
|
||||
UpdateAttributes(*aPresContext);
|
||||
|
||||
// redraw
|
||||
nsRect frameRect;
|
||||
GetRect(frameRect);
|
||||
nsRect rect(0,0,frameRect.width, frameRect.height);
|
||||
Invalidate(rect, PR_TRUE);
|
||||
mRenderer.Redraw();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -800,18 +796,28 @@ nsTitledButtonFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
|
||||
nsRect minSize(0,0,mMinSize.width, mMinSize.height);
|
||||
|
||||
// we need to factory or focus stuff into our computed size.
|
||||
nscoord computedWidth = aReflowState.computedWidth;
|
||||
nscoord computedHeight = aReflowState.computedHeight;
|
||||
|
||||
|
||||
nsMargin added = mRenderer.GetAddedButtonBorderAndPadding();
|
||||
|
||||
computedWidth -= (added.left + added.right);
|
||||
computedHeight -= (added.top + added.bottom);
|
||||
|
||||
// if the width is set
|
||||
if (fixedWidthContent)
|
||||
if (aReflowState.computedWidth >= minSize.width)
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
if (computedWidth >= minSize.width)
|
||||
aDesiredSize.width = computedWidth;
|
||||
else
|
||||
aDesiredSize.width = minSize.width;
|
||||
aDesiredSize.width = minSize.width;
|
||||
|
||||
|
||||
// if the height is set
|
||||
if (fixedHeightContent)
|
||||
if (aReflowState.computedWidth >= minSize.height)
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
if (computedHeight >= minSize.height)
|
||||
aDesiredSize.height = computedHeight;
|
||||
else
|
||||
aDesiredSize.height = minSize.height;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ nsIAtom* nsXULAtoms::progressmeter;
|
|||
nsIAtom* nsXULAtoms::titledbutton;
|
||||
nsIAtom* nsXULAtoms::mode;
|
||||
|
||||
nsIAtom* nsXULAtoms::box;
|
||||
nsIAtom* nsXULAtoms::flex;
|
||||
|
||||
nsIAtom* nsXULAtoms::widget;
|
||||
nsIAtom* nsXULAtoms::window;
|
||||
|
@ -91,6 +93,8 @@ void nsXULAtoms::AddrefAtoms() {
|
|||
titledbutton = NS_NewAtom("titledbutton");
|
||||
|
||||
mode = NS_NewAtom("mode");
|
||||
box = NS_NewAtom("box");
|
||||
flex = NS_NewAtom("flex");
|
||||
|
||||
widget = NS_NewAtom("widget");
|
||||
window = NS_NewAtom("window");
|
||||
|
@ -124,6 +128,10 @@ void nsXULAtoms::ReleaseAtoms() {
|
|||
NS_RELEASE(progressmeter);
|
||||
NS_RELEASE(mode);
|
||||
|
||||
NS_RELEASE(box);
|
||||
NS_RELEASE(flex);
|
||||
|
||||
|
||||
NS_RELEASE(widget);
|
||||
NS_RELEASE(window);
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
|
|
@ -66,6 +66,9 @@ public:
|
|||
static nsIAtom* titledbutton;
|
||||
static nsIAtom* mode;
|
||||
|
||||
static nsIAtom* box;
|
||||
static nsIAtom* flex;
|
||||
|
||||
static nsIAtom* widget;
|
||||
static nsIAtom* window;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче