fixes for:

60058
43825
53885
45856
40612

-r ben -sr hyatt
This commit is contained in:
evaughan%netscape.com 2001-01-11 01:56:27 +00:00
parent 14b74a767a
commit 4fe0954556
9 changed files with 140 additions and 61 deletions

View File

@ -2244,6 +2244,7 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox,
nsSize minSize (0, 0);
nsSize maxSize (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
nscoord flexSize = 0;
nscoord ascentSize = 0;
nsIBox::AddCSSPrefSize(state, child, prefSizeCSS);
@ -2255,12 +2256,14 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox,
child->GetMinSize(state, minSize);
child->GetMaxSize(state, maxSize);
child->GetFlex(state, flexSize);
child->GetAscent(state, ascentSize);
char min[100];
char pref[100];
char max[100];
char calc[100];
char flex[100];
char ascent[100];
nsSize actualSize;
GetFrameSizeWithMargin(child, actualSize);
@ -2271,14 +2274,16 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox,
GetValue(aPresContext, maxSize, maxSizeCSS, max);
GetValue(aPresContext, actualSize, actualSizeCSS, calc);
GetValue(aPresContext, flexSize, flexCSS, flex);
GetValue(aPresContext, ascentSize, NS_INTRINSICSIZE, ascent);
printf("min%s, pref%s, max%s, actual%s, flex=%s\n\n",
printf("min%s, pref%s, max%s, actual%s, flex=%s, ascent=%s\n\n",
min,
pref,
max,
calc,
flex
flex,
ascent
);
return NS_OK;

View File

@ -250,11 +250,13 @@ nsDeckFrame::IndexChanged(nsIPresContext* aPresContext)
// hide the currently showing box
nsIBox* currentBox = GetBoxAt(mIndex);
HideBox(aPresContext, currentBox);
if (currentBox) // only hide if it exists
HideBox(aPresContext, currentBox);
// show the new box
nsIBox* newBox = GetBoxAt(index);
ShowBox(aPresContext, newBox);
if (newBox) // only show if it exists
ShowBox(aPresContext, newBox);
mIndex = index;
}

View File

@ -540,7 +540,10 @@ nsMonumentLayout::GetOtherMonuments(nsIBox* aBox, nsBoxSizeList** aList)
nsCOMPtr<nsIMonument> parent;
nsCOMPtr<nsIBox> parentBox;
GetParentMonument(aBox, parentBox, getter_AddRefs(parent));
return parent->GetOtherMonumentsAt(parentBox, 0, aList, this);
if (parent)
return parent->GetOtherMonumentsAt(parentBox, 0, aList, this);
else
return NS_OK;
}
/**
@ -590,7 +593,9 @@ nsMonumentLayout::GetOtherMonumentsAt(nsIBox* aBox, PRInt32 aIndexOfObelisk, nsB
nsCOMPtr<nsIBox> parentBox;
GetParentMonument(aBox, parentBox, getter_AddRefs(parent));
parent->GetOtherMonumentsAt(parentBox, aIndexOfObelisk, aList, this);
if (parent)
parent->GetOtherMonumentsAt(parentBox, aIndexOfObelisk, aList, this);
return NS_OK;
}
@ -600,7 +605,9 @@ nsMonumentLayout::GetOtherTemple(nsIBox* aBox, nsTempleLayout** aTemple, nsIBox*
nsCOMPtr<nsIMonument> parent;
nsCOMPtr<nsIBox> parentBox;
GetParentMonument(aBox, parentBox, getter_AddRefs(parent));
parent->GetOtherTemple(parentBox, aTemple, aTempleBox, this);
if(parent)
parent->GetOtherTemple(parentBox, aTemple, aTempleBox, this);
return NS_OK;
}

View File

@ -373,7 +373,8 @@ nsObeliskLayout::ComputeChildSizes(nsIBox* aBox,
aBox->GetParentBox(&aBox);
}
NS_ERROR("Not in GRID!!!");
// Not in GRID!!! do the default.
nsSprocketLayout::ComputeChildSizes(aBox, aState, aGivenSize, aBoxSizes, aComputedBoxSizes);
}
void

View File

@ -122,6 +122,51 @@ nsSliderFrame::Init(nsIPresContext* aPresContext,
return rv;
}
NS_IMETHODIMP
nsSliderFrame::RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame)
{
nsresult rv = nsBoxFrame::RemoveFrame(aPresContext, aPresShell, aListName, aOldFrame);
PRInt32 start = GetChildCount();
if (start == 0)
RemoveListener();
return rv;
}
NS_IMETHODIMP
nsSliderFrame::InsertFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
PRInt32 start = GetChildCount();
nsresult rv = nsBoxFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
if (start == 0)
AddListener();
return rv;
}
NS_IMETHODIMP
nsSliderFrame::AppendFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
// if we have no children and on was added then make sure we add the
// listener
PRInt32 start = GetChildCount();
nsresult rv = nsBoxFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
if (start == 0)
AddListener();
return rv;
}
PRInt32
nsSliderFrame::GetCurrentPosition(nsIContent* content)
{
@ -233,43 +278,52 @@ nsSliderFrame::Paint(nsIPresContext* aPresContext,
nsIBox* thumb;
GetChildBox(&thumb);
NS_ASSERTION(thumb,"Slider does not have a thumb!!!!");
if (thumb) {
nsRect thumbRect;
thumb->GetBounds(thumbRect);
nsMargin m;
thumb->GetMargin(m);
thumbRect.Inflate(m);
nsRect thumbRect;
thumb->GetBounds(thumbRect);
nsMargin m;
thumb->GetMargin(m);
thumbRect.Inflate(m);
nsRect crect;
GetClientRect(crect);
nsRect crect;
GetClientRect(crect);
if (crect.width < thumbRect.width || crect.height < thumbRect.height)
{
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->IsVisibleOrCollapsed()) {
const nsStyleColor* myColor = (const nsStyleColor*)
mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
mStyleContext->GetStyleData(eStyleStruct_Spacing);
nsRect rect(0, 0, mRect.width, mRect.height);
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *myColor, *mySpacing, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *mySpacing, mStyleContext, 0);
if (crect.width < thumbRect.width || crect.height < thumbRect.height)
{
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->IsVisibleOrCollapsed()) {
const nsStyleColor* myColor = (const nsStyleColor*)
mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
mStyleContext->GetStyleData(eStyleStruct_Spacing);
nsRect rect(0, 0, mRect.width, mRect.height);
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *myColor, *mySpacing, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *mySpacing, mStyleContext, 0);
}
}
return NS_OK;
}
return NS_OK;
}
return nsBoxFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
}
NS_IMETHODIMP
nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
{
// get the thumb should be our only child
nsIBox* thumbBox = nsnull;
GetChildBox(&thumbBox);
if (!thumbBox) {
SyncLayout(aState);
return NS_OK;
}
EnsureOrient();
if (mState & NS_STATE_DEBUG_WAS_SET) {
@ -289,12 +343,6 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
GetContentOf(scrollbarBox, getter_AddRefs(scrollbar));
PRBool isHorizontal = IsHorizontal();
// get the thumb should be our only child
nsIBox* thumbBox = nsnull;
GetChildBox(&thumbBox);
NS_ASSERTION(thumbBox,"Slider does not have a thumb!!!!");
// get the thumb's pref size
nsSize thumbSize(0,0);
thumbBox->GetPrefSize(aState, thumbSize);
@ -334,7 +382,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
nscoord flex = 0;
thumbBox->GetFlex(aState, flex);
if (flex > 0)
{
nscoord thumbsize = NSToCoordRound(ourmaxpos * mRatio);
@ -346,7 +394,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
thumbSize.width = thumbsize;
else
thumbSize.height = thumbsize;
} else {
ourmaxpos -= thumbcoord;
mRatio = float(ourmaxpos)/float(maxpos);
@ -360,7 +408,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
// set the thumbs y coord to be the current pos * the ratio.
nscoord pos = nscoord(float(curpos)*mRatio);
nsRect thumbRect(clientRect.x, clientRect.y, thumbSize.width, thumbSize.height);
if (isHorizontal)
thumbRect.x += pos;
else
@ -370,6 +418,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
thumbBox->GetBounds(oldThumbRect);
LayoutChildAt(aState, thumbBox, thumbRect);
SyncLayout(aState);
if (DEBUG_SLIDER) {
@ -952,12 +1001,14 @@ nsSliderFrame::AddListener()
}
nsIFrame* thumbFrame = mFrames.FirstChild();
nsCOMPtr<nsIContent> content;
thumbFrame->GetContent(getter_AddRefs(content));
if (thumbFrame) {
nsCOMPtr<nsIContent> content;
thumbFrame->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
reciever->AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
reciever->AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
}
}
void

View File

@ -110,6 +110,7 @@ public:
NS_IMETHOD_(void) Notify(nsITimer *timer);
}; // class nsSliderFrame
class nsSliderFrame : public nsBoxFrame
@ -131,6 +132,24 @@ public:
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
// nsIFrame overrides
/** nsIFrame **/
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aFrameList);
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD Paint(nsIPresContext* aPresContext,

View File

@ -70,11 +70,6 @@
</handlers>
</binding>
<binding id="slider">
<content>
<xul:button align="horizontal"/>
</content>
</binding>
</bindings>

View File

@ -494,6 +494,7 @@ colorpicker[type="button"] {
slider
{
-moz-binding: url("chrome://global/content/xulBindings.xml#slider");
-moz-user-focus : ignore;
-moz-user-select : none;
}

View File

@ -17,26 +17,24 @@
</content>
</binding>
<binding id="slider">
<content>
<xul:thumb inherits="align,src" flex="1"/>
</content>
</binding>
<binding id="scrollbar">
<content>
<xul:scrollbarbutton type="decrement">
<xul:image inherits="src"/>
</xul:scrollbarbutton>
<xul:slider flex="1" inherits="curpos,maxpos,pageincrement,increment">
<xul:thumb inherits="align,src" flex="1"/>
</xul:slider>
<xul:slider flex="1" inherits="curpos,maxpos,pageincrement,increment"/>
<xul:scrollbarbutton type="increment">
<xul:image inherits="src"/>
</xul:scrollbarbutton>
</content>
</binding>
<binding id="slider">
<content>
<xul:button align="horizontal"/>
</content>
</binding>
<binding id="tab">
<content>
<xul:image inherits="src" class="tab-left"/>