diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 84242e26d9f..e7782b628b1 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -33,8 +33,9 @@ #include "nsINameSpaceManager.h" #include "nsHTMLAtoms.h" #include "nsXULAtoms.h" +#include "nsIReflowCommand.h" - +#define CONSTANT (float)0.001; // // NS_NewToolbarFrame // @@ -70,7 +71,7 @@ nsBoxFrame::Init(nsIPresContext& aPresContext, mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value); if (value.EqualsIgnoreCase("vertical")) mHorizontal = PR_FALSE; - else + else if (value.EqualsIgnoreCase("horizontal")) mHorizontal = PR_TRUE; return rv; @@ -112,6 +113,8 @@ public: nscoord calculatedSize; PRBool sizeValid; + PRBool wasFlowed; + void init() { @@ -121,6 +124,7 @@ public: maxSize = NS_INTRINSICSIZE; calculatedSize = 0; sizeValid = PR_FALSE; + wasFlowed = PR_FALSE; } }; @@ -249,6 +253,30 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, } else availableSize.height = aReflowState.availableHeight; + nsMargin inset(0,0,0,0); + GetInset(inset); + + if (NS_INTRINSICSIZE != availableSize.width) + availableSize.width -= (inset.left + inset.right); + + if (NS_INTRINSICSIZE != availableSize.height) + availableSize.height -= (inset.top + inset.bottom); + + + // Until I can handle incremental reflow correctly (or at all), I need to at + // least make sure that I don't be a bad citizen. This will certainly betray my + // complete lack of understanding of the reflow code, but I think I need to + // make sure that I advance to the next reflow command to make everything down + // the line matches up. + if ( aReflowState.reason == eReflowReason_Incremental ) { + nsIFrame* target; + aReflowState.reflowCommand->GetTarget(target); + if (this != target) { + // ignore the next reflow command and proceed as normal... + nsIFrame* ignore; + aReflowState.reflowCommand->GetNext(ignore); + } + } // ------ first pass build springs ------- @@ -324,10 +352,36 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, flexSize.width = NS_INTRINSICSIZE; else flexSize.height = NS_INTRINSICSIZE; + + // get the content + nsCOMPtr content; + childFrame->GetContent(getter_AddRefs(content)); - if (wunit != eStyleUnit_Coord || hunit != eStyleUnit_Coord) + PRInt32 error; + nsString value; + + // get the spring constant + if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value)) + { + value.Trim("%"); + float percent = value.ToFloat(&error); + springs[count].springConstant = percent; + } + + if (mHorizontal) { + if (wunit == eStyleUnit_Percent) + springs[count].springConstant = position->mWidth.GetPercentValue(); + } else { + if (hunit == eStyleUnit_Percent) + springs[count].springConstant = position->mHeight.GetPercentValue(); + } + + // only flow if fixed and width or height was not set + if (springs[count].springConstant == 0.0 && (wunit != eStyleUnit_Coord || hunit != eStyleUnit_Coord)) { + springs[count].wasFlowed = PR_TRUE; FlowChildAt(childFrame,aPresContext, desiredSize, aReflowState, aStatus, flexSize); - + } + if (desiredSize.height > maxDesiredSize.height) maxDesiredSize.height = desiredSize.height; @@ -352,28 +406,6 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, springs[count].preferredSize = desiredSize.height; - // get the content - nsCOMPtr content; - childFrame->GetContent(getter_AddRefs(content)); - - PRInt32 error; - nsString value; - - // get the spring constant - if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value)) - { - value.Trim("%"); - float percent = value.ToFloat(&error); - springs[count].springConstant = percent; - } - - if (mHorizontal) { - if (wunit == eStyleUnit_Percent) - springs[count].springConstant = position->mWidth.GetPercentValue(); - } else { - if (hunit == eStyleUnit_Percent) - springs[count].springConstant = position->mHeight.GetPercentValue(); - } rv = childFrame->GetNextSibling(&childFrame); NS_ASSERTION(rv == NS_OK,"failed to get next child"); @@ -427,50 +459,55 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, else size.height = springs[count].calculatedSize; - // flow child - FlowChildAt(childFrame,aPresContext, desiredSize, aReflowState, aStatus, size); - - // if its height greater than the max. Set the max to this height and set a flag - // saying we will need to do another pass. But keep going there - // may be another child that is bigger - if (mHorizontal) { - if (availableSize.height == NS_INTRINSICSIZE || desiredSize.height > availableSize.height) { - availableSize.height = desiredSize.height; - changedHeight = PR_TRUE; - } + nsRect r(0,0,0,0); + childFrame->GetRect(r); - // if we are wider than we anticipated then - // then this child can't get smaller then the size returned - // so set its minSize to be the desired and restretch. Then - // just start over because the springs are all messed up - // anyway. + if (springs[count].wasFlowed == PR_FALSE || (size.width != r.width || size.height!=r.height)) { + + // flow child + FlowChildAt(childFrame,aPresContext, desiredSize, aReflowState, aStatus, size); + + // if its height greater than the max. Set the max to this height and set a flag + // saying we will need to do another pass. But keep going there + // may be another child that is bigger + if (mHorizontal) { + if (availableSize.height == NS_INTRINSICSIZE || desiredSize.height > availableSize.height) { + availableSize.height = desiredSize.height; + changedHeight = PR_TRUE; + } + + // if we are wider than we anticipated then + // then this child can't get smaller then the size returned + // so set its minSize to be the desired and restretch. Then + // just start over because the springs are all messed up + // anyway. - if (desiredSize.width > size.width) { - springs[count].preferredSize = desiredSize.width; - springs[count].minSize = desiredSize.width; - Stretch(springs, totalCount, availableSize.width); - changedHeight = PR_TRUE; - break; - } + if (desiredSize.width > size.width) { + springs[count].preferredSize = desiredSize.width; + springs[count].minSize = desiredSize.width; + Stretch(springs, totalCount, availableSize.width); + changedHeight = PR_TRUE; + break; + } - } else { - if (availableSize.width == NS_INTRINSICSIZE || desiredSize.width > availableSize.width) { - availableSize.width = desiredSize.width; - changedHeight = PR_TRUE; - } + } else { + if (availableSize.width == NS_INTRINSICSIZE || desiredSize.width > availableSize.width) { + availableSize.width = desiredSize.width; + changedHeight = PR_TRUE; + } - if (desiredSize.height > size.height) { - springs[count].preferredSize = desiredSize.height; - springs[count].minSize = desiredSize.height; - Stretch(springs, totalCount, availableSize.height); - changedHeight = PR_TRUE; - break; - } + if (desiredSize.height > size.height) { + springs[count].preferredSize = desiredSize.height; + springs[count].minSize = desiredSize.height; + Stretch(springs, totalCount, availableSize.height); + changedHeight = PR_TRUE; + break; + } + } } - nsresult rv = childFrame->GetNextSibling(&childFrame); NS_ASSERTION(rv == NS_OK,"failed to get next child"); count++; @@ -487,8 +524,8 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, } while (PR_TRUE == changedHeight); // ---- 3th pass. Layout --- - nscoord x = borderPadding.left; - nscoord y = borderPadding.top; + nscoord x = borderPadding.left + inset.left; + nscoord y = borderPadding.top + inset.top; nscoord width = 0; nscoord height = 0; @@ -504,10 +541,10 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, if (mHorizontal) { x += margin.left; - y = borderPadding.top + margin.top; + y = borderPadding.top + inset.top + margin.top; } else { y += margin.top; - x = borderPadding.left + margin.left; + x = borderPadding.left + inset.left + margin.left; } nsRect rect; @@ -559,6 +596,11 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, if (height > aDesiredSize.height) aDesiredSize.height = height; + if (NS_INTRINSICSIZE != availableSize.width) + availableSize.width += (inset.left + inset.right); + + if (NS_INTRINSICSIZE != availableSize.height) + availableSize.height += (inset.top + inset.bottom); aDesiredSize.width += borderPadding.left + borderPadding.right; aDesiredSize.height += borderPadding.top + borderPadding.bottom; @@ -570,7 +612,10 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } - +void +nsBoxFrame::GetInset(nsMargin& margin) +{ +} void nsBoxFrame::Stretch(nsBoxDataSpring* springs, PRInt32 nSprings, nscoord& size) @@ -583,9 +628,12 @@ nsBoxFrame::Stretch(nsBoxDataSpring* springs, PRInt32 nSprings, nscoord& size) for (i=0; i childContent; + mContent->ChildAt(0, *getter_AddRefs(childContent)); + + nsIFrame* childFrame = mFrames.FirstChild(); + + while ( childContent ) { + // first determine if the current content node matches the current frame. Make sure we don't + // walk off the end of the frame list when we still have content nodes. + nsCOMPtr currentFrameContent; + if ( childFrame ) + childFrame->GetContent(getter_AddRefs(currentFrameContent)); + + // if not hidden continue otherwise add a collapsed grippy + if ( childFrame && currentFrameContent && childContent == currentFrameContent ) { + childFrame->GetNextSibling(&childFrame); + } else { + collapsedGrippies++; + } + + contentCounter++; + mContent->ChildAt(contentCounter, *getter_AddRefs(childContent)); + } + + // -----set the bottom margin to be the sum of those colapsed bars--- + // set left to be the width of the grippy + mInset = nsMargin(0,0,0,0); + + if (IsHorizontal()) { + mInset.top = grippyWidth; + mInset.right = collapsedGrippyHeight*collapsedGrippies; + } else { + mInset.left = grippyWidth; + mInset.bottom = collapsedGrippyHeight*collapsedGrippies; + } + + // -----flow things----- + nsresult result = nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); + + // -----set all the grippy locations----- + mNumToolbars = 0; + childFrame = mFrames.FirstChild(); + while (nsnull != childFrame) + { + // get the childs rect and figure out the grippy size + nsRect rect(0,0,0,0); + childFrame->GetRect(rect); + + nsCOMPtr childContent; + childFrame->GetContent ( getter_AddRefs(childContent) ); + nsRect grippyRect(rect); + + if (IsHorizontal()) { + grippyRect.y = 0; + grippyRect.height = grippyWidth; + } else { + grippyRect.x = 0; + grippyRect.width = grippyWidth; + } + + mGrippies[mNumToolbars].SetProperties ( grippyRect, childContent, PR_FALSE ); + + nsresult rv = childFrame->GetNextSibling(&childFrame); + NS_ASSERTION(rv == NS_OK,"failed to get next child"); + mNumToolbars++; + } + + return result; +} // Reflow + +void +nsToolboxFrame::GetInset(nsMargin& margin) +{ + margin = mInset; +} // // GetFrameForPoint diff --git a/layout/xul/base/src/nsToolboxFrame.h b/layout/xul/base/src/nsToolboxFrame.h index fb1176b2cdf..8a79321666a 100644 --- a/layout/xul/base/src/nsToolboxFrame.h +++ b/layout/xul/base/src/nsToolboxFrame.h @@ -36,14 +36,18 @@ // http://www.mozilla.org/xpfe/DMWSpecNew.html // +#ifndef nsToolBoxFrame_h___ +#define nsToolBoxFrame_h___ + #include "nsHTMLContainerFrame.h" #include "nsIStyleContext.h" #include "nsIContent.h" #include "nsXULAtoms.h" #include "nsCOMPtr.h" +#include "nsBoxFrame.h" -class nsToolboxFrame : public nsHTMLContainerFrame +class nsToolboxFrame : public nsBoxFrame { public: friend nsresult NS_NewToolboxFrame(nsIFrame*& aNewFrame); @@ -100,8 +104,6 @@ protected: nsToolboxFrame(); virtual ~nsToolboxFrame(); - PRIntn GetSkipSides() const; - virtual void UpdateStyles(nsIPresContext* aPresContext); void RefreshStyleContext(nsIPresContext* aPresContext, @@ -125,6 +127,9 @@ protected: nsCOMPtr mGrippyNormalStyle; nsCOMPtr mGrippyRolloverStyle; + nsMargin mInset; + virtual void GetInset(nsMargin& margin); + unsigned long mSumOfToolbarHeights; TabInfo mGrippies[10]; //*** make this a list or something!!!!!! unsigned short mNumToolbars; @@ -139,3 +144,5 @@ protected: nsToolboxFrame& operator= ( const nsToolboxFrame& aFrame ) ; // DO NOT IMPLEMENT }; // class nsToolboxFrame + +#endif diff --git a/xpfe/browser/src/navigator.xul b/xpfe/browser/src/navigator.xul index 168079d3c1b..c3da7e27486 100644 --- a/xpfe/browser/src/navigator.xul +++ b/xpfe/browser/src/navigator.xul @@ -3,55 +3,9 @@ - - - - #header { - position: fixed; - width: 100%; - top: 0; - right: 0; - bottom: auto; - left: 0; - } - #main { - position: fixed; - width: auto; - height: auto; - right: 0; - bottom: 40px; - left: 0; - overflow: auto; - padding: 2px .5em; - border: solid 0px black; - } - - #footer_bar { - position: fixed; - width: 100%; - height: 20px; - top: auto; - right: 0; - bottom: 0; - left: 0; - margin-top: auto; - } - - #footer { - position: fixed; - width: 100%; - height: 20px; - top: auto; - right: 0; - bottom: 0; - left: 0; - margin-top: auto; - } - - + onload="Startup()" title="Mozilla"> function Startup() @@ -158,16 +112,15 @@ function BrowserEditBookmarks() { - var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("ToolkitCore"); + var prefsCore = XPAppCoresManager.Find("PrefsCore"); + if (!PrefsCore) { + PrefsCore = new ToolkitCore(); + if (PrefsCore) { + toolkitCore.Init("PrefsCore"); } } - if (toolkitCore) { - toolkitCore.ShowWindow("resource:/res/rdf/bookmarks.xul", - window); + if (PrefsCore) { + PrefsCore.ShowWindow(window); } } @@ -313,15 +266,16 @@ function DoPreferences() { - var prefsCore = XPAppCoresManager.Find("PrefsCore"); - if (!prefsCore) { - prefsCore = new PrefsCore(); - if (prefsCore) { - prefsCore.Init("PrefsCore"); + var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); + if (!toolkitCore) { + toolkitCore = new ToolkitCore(); + if (toolkitCore) { + toolkitCore.Init("ToolkitCore"); } } - if (prefsCore) { - prefsCore.ShowWindow(window); + if (toolkitCore) { + toolkitCore.ShowWindow("resource:/res/samples/PrefsWindow.html", + window); } } @@ -556,14 +510,9 @@ - - - - - - - - + + + @@ -582,44 +531,71 @@ onclick="window.frames[0].stop()"> - - - + + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + - - + + + + var bindCount = 0; function onStatus() { var status = document.getElementById("Browser:Status"); @@ -627,7 +603,7 @@ var text = status.getAttribute("text"); var statusText = document.getElementById("statusText"); if ( statusText ) { - statusText.childNodes[0].nodeValue = text; + statusText.setAttribute( "value", text ); } /* if ( bindCount == 0 ) { @@ -643,35 +619,21 @@ dump("Can't find status broadcaster!\n"); } } + function onSecurity() { var security = document.getElementById("Browser:Security"); - var indicator = document.getElementById("statusbar-indicator"); - var style = indicator.getAttribute("style"); - // Strip off current display/width setting. - style = style.replace( /display[^;]*;/, "" ); - style = style.replace( /width[^;]*;/, "" ); + var indicator = document.getElementById("security-box"); + var icon = document.getElementById("security-button"); + if ( security.getAttribute("secure") == "true" ) { - // Set indicator to display:normal; - style = style + "display:normal;width:120px;"; - color = "border-top-color:yellow;" + indicator.setAttribute("class","secure"); + icon.setAttribute("class","secure"); } else { - // Set indicator to display:none; - style = style + "display:none;width:0%;"; - color = "border-top-color:rgb(192,192,192);" + indicator.setAttribute("class","insecure"); + icon.setAttribute("class","insecure"); } - indicator.setAttribute("style",style); - - var meter = document.getElementById("statusbar-meter"); - var text = document.getElementById("statusbar-text"); - style = meter.getAttribute("style"); - style = style.replace( /border-top-color[^;];/, "" ); - style = style + color; - meter.setAttribute("style",style); - style = text.getAttribute("style"); - style = style.replace( /border-top-color[^;];/, "" ); - style = style + color; - text.setAttribute("style",style); } + function securityOn() { var security = document.getElementById("Browser:Security"); if ( security.getAttribute("secure") == "false" ) { @@ -713,7 +675,7 @@ // Turn off progress meter. var meter = document.getElementById("Browser:LoadingProgress"); var status = document.getElementById("Browser:Status"); - status.setAttribute("text","Document: Done"); + status.setAttribute("value","Document: Done"); meter.setAttribute("value","0"); meter.setAttribute("mode","normal"); } @@ -732,7 +694,7 @@ if ( mode == "normal" ) { var status = document.getElementById("Browser:Status"); if ( status ) { - status.setAttribute("text","Document: Done"); + status.setAttribute("value","Document: Done"); } } } @@ -748,6 +710,8 @@ } + + @@ -755,90 +719,53 @@ - - - - - - - - - - - - [Notification Component] - - - - - - - - - - - - - - - - Document: Done - - - -Build ID: 00000000 - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xpfe/browser/src/xul.css b/xpfe/browser/src/xul.css index 6979f8f7653..2e4fae11175 100644 --- a/xpfe/browser/src/xul.css +++ b/xpfe/browser/src/xul.css @@ -31,18 +31,6 @@ toolbar { min-height: 20px; } -toolbar#taskbar { - display:block; - background-color: #666699; - border-bottom: solid #333366 1px; - border-top: solid #9999AA 1px; - border-left: solid #9999AA 1px; - border-right: solid #333366 1px; - font: 10pt sans-serif; - min-height: 16px; - color: white; -} - toolbar[collapsed="true"] { display:none; } @@ -52,6 +40,7 @@ toolbar[hidden="true"] { toolbox { background-color:darkgray; + display: block; } :toolbox-normal { @@ -80,20 +69,6 @@ window { display: block; } -titledbutton#Throbber -{ - list-style-image:url("resource:/res/throbber/anims00.gif"); -} - - -titledbutton#Throbber[busy="true"] { - list-style-image:url("resource:/res/throbber/throbbingN.gif"); -} - -titledbutton:button-focus { - border: none; -} - broadcaster { display: none; } @@ -124,9 +99,12 @@ progressmeter { color: #BBBBCC; } - titledbutton { display: inline; +} + +toolbar titledbutton { + display: inline; color:black; padding: 2px; @@ -135,16 +113,63 @@ titledbutton { font: 2.5mm sans-serif; } -toolbar#taskbar titledbutton{ - color:#CCCCFF; -} - -titledbutton[pseudoclass~="hover"] { +toolbar [pseudoclass~="hover"] { border: 1px outset white; color:blue; //text-decoration:underline; padding: 1px; } + +toolbar titledbutton[pseudoclass~="hover"]:-moz-outline { + border : 1px solid black; +} + +toolbar titledbutton[pseudoclass~="active"] { + + text-decoration:none; + border: 1px inset; + + padding-left: 2px; + padding-right: 0px; + padding-top: 2px; + padding-bottom: 0px; +} + +toolbar titledbutton[pseudoclass~="active"]:-moz-outline { + border : 1px solid black; +} + +toolbar titledbutton[disabled] { + opacity: 0.5; +} + +/**** Please put all browser specific style here eventually it will be moved + out to another .css file like navigator.xul +****/ + +titledbutton#Throbber +{ + list-style-image:url("resource:/res/throbber/anims00.gif"); +} + +titledbutton#Throbber[busy="true"] { + list-style-image:url("resource:/res/throbber/throbbingN.gif"); +} + +toolbar#taskbar titledbutton{ + color:#CCCCFF; +} + +toolbar#taskbar titledbutton[pseudoclass~="active"] { + + text-decoration:none; + border: 1px inset; + + padding-left: 2px; + padding-right: 0px; + padding-top: 2px; + padding-bottom: 0px; +} toolbar#taskbar titledbutton[pseudoclass~="hover"] { border: 1px outset #666699; @@ -152,53 +177,37 @@ toolbar#taskbar titledbutton[pseudoclass~="hover"] { //text-decoration:underline; padding: 1px; } - -titledbutton[pseudoclass~="hover"]:-moz-outline { - border : 1px solid black; -} - -titledbutton[pseudoclass~="active"] { - text-decoration:none; - border: 1px inset; - - padding-left: 2px; - padding-right: 0px; - padding-top: 2px; - padding-bottom: 0px; +toolbar#taskbar { + display:block; + background-color: #666699; + border-bottom: solid #333366 1px; + border-top: solid #9999AA 1px; + border-left: solid #9999AA 1px; + border-right: solid #333366 1px; + font: 10pt sans-serif; + min-height: 16px; + color: white; } -toolbar#taskbar titledbutton[pseudoclass~="active"] { - text-decoration:none; - border: 1px inset; - - padding-left: 2px; - padding-right: 0px; - padding-top: 2px; - padding-bottom: 0px; +box[class=insecure] { + margin-top: 2px; + border-top: 0px; } -titledbutton[pseudoclass~="active"]:-moz-outline { - border : 1px solid black; -} - -titledbutton:-moz-focus-inner { +box[class=secure] { + border-top: 2px solid yellow; + margin-top: 0px; } -titledbutton:-moz-focus-outer { +box#status-bar titledbutton { + font: 2.5mm sans-serif; } -titledbutton[pseudoclass~="focus"] { +titledbutton[class=secure] { + background-color: yellow; } -titledbutton[pseudoclass~="focus"]:-moz-focus-inner { +titledbutton[class=insecure] { } - -titledbutton[pseudoclass~="focus"]:-moz-focus-outer { -} - -titledbutton[disabled] { - opacity: 0.5; -} -