Reimplemented navigator.xul on top of the new box layout system.

This commit is contained in:
evaughan%netscape.com 1999-03-30 04:05:49 +00:00
Родитель 6bd0495c76
Коммит 39fe1e8a11
8 изменённых файлов: 459 добавлений и 369 удалений

Просмотреть файл

@ -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 -------
@ -325,8 +353,34 @@ nsBoxFrame::Reflow(nsIPresContext& aPresContext,
else
flexSize.height = NS_INTRINSICSIZE;
if (wunit != eStyleUnit_Coord || hunit != eStyleUnit_Coord)
// get the content
nsCOMPtr<nsIContent> 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();
}
// 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<nsIContent> 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);
nsRect r(0,0,0,0);
childFrame->GetRect(r);
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;
}
} 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 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;
}
} 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;
}
}
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<nSprings; i++) {
nsBoxDataSpring& spring = springs[i];
spring.sizeValid = PR_FALSE;
if (spring.preferredSize < spring.minSize)
spring.preferredSize = spring.minSize;
if (spring.springConstant == 0.0)
{
spring.springConstant = (float)0.001;
spring.springConstant = CONSTANT;
spring.maxSize = spring.preferredSize;
spring.minSize = spring.preferredSize;
}

Просмотреть файл

@ -24,6 +24,9 @@
**/
#ifndef nsBoxFrame_h___
#define nsBoxFrame_h___
#include "nsHTMLContainerFrame.h"
class nsBoxDataSpring;
@ -75,7 +78,10 @@ public:
nsEventStatus& aEventStatus);
PRBool IsHorizontal() const { return mHorizontal; }
protected:
nsBoxFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
@ -83,13 +89,18 @@ protected:
virtual PRIntn GetSkipSides() const { return 0; }
nsBoxFrame();
virtual void GetInset(nsMargin& margin);
virtual void Stretch(nsBoxDataSpring* springs, PRInt32 nSprings, nscoord& size);
PRBool mHorizontal;
private:
PRBool mHorizontal;
}; // class nsBoxFrame
#endif

Просмотреть файл

@ -24,6 +24,9 @@
// See documentation in associated header file
//
#ifndef nsToolbarFrame_h___
#define nsToolbarFrame_h___
#include "nsToolbarFrame.h"
#include "nsIStyleContext.h"
#include "nsCSSRendering.h"
@ -112,7 +115,7 @@ nsToolbarFrame :: Paint ( nsIPresContext& aPresContext,
#endif
return nsBlockFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer );
return nsBoxFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer );
} // Paint
@ -128,7 +131,8 @@ nsToolbarFrame :: Reflow ( nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
return nsBlockFrame::Reflow ( aPresContext, aDesiredSize, aReflowState, aStatus );
return nsBoxFrame::Reflow ( aPresContext, aDesiredSize, aReflowState, aStatus );
} // Reflow
#endif

Просмотреть файл

@ -36,9 +36,9 @@
//
#include "nsBlockFrame.h"
#include "nsBoxFrame.h"
class nsToolbarFrame : public nsBlockFrame
class nsToolbarFrame : public nsBoxFrame
{
public:
friend nsresult NS_NewToolbarFrame(nsIFrame*& aNewFrame);

Просмотреть файл

@ -88,6 +88,8 @@ nsToolboxFrame :: nsToolboxFrame ( )
kHiddenAtom(dont_AddRef( NS_NewAtom("hidden")))
{
//*** anything?
// we start off vertical
mHorizontal = PR_FALSE;
}
@ -137,7 +139,7 @@ nsToolboxFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyle
PRInt32* aLocalChange)
{
// this re-resolves |mStyleContext|, so it may change
nsresult rv = nsHTMLContainerFrame::ReResolveStyleContext(aPresContext, aParentContext,
nsresult rv = nsBoxFrame::ReResolveStyleContext(aPresContext, aParentContext,
aParentChange, aChangeList, aLocalChange);
if (NS_FAILED(rv)) {
return rv;
@ -158,7 +160,7 @@ nsToolboxFrame::Init(nsIPresContext& aPresContext,
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow)
{
nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
UpdateStyles(&aPresContext);
return rv;
}
@ -187,7 +189,7 @@ nsToolboxFrame :: Paint ( nsIPresContext& aPresContext,
nsFramePaintLayer aWhichLayer)
{
// take care of bg painting, borders and children
nsresult retVal = nsHTMLContainerFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer );
nsresult retVal = nsBoxFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer );
// now draw what makes us special
DrawGrippies ( aPresContext, aRenderingContext );
@ -247,20 +249,6 @@ nsToolboxFrame :: DrawGrippy ( nsIPresContext& aPresContext, nsIRenderingContex
} // DrawGrippy
//
// GetSkipSides
//
// ***What does this do???
//
PRIntn
nsToolboxFrame :: GetSkipSides() const
{
return 0;
} // GetSkipSides
//
// Reflow
//
@ -274,12 +262,14 @@ nsToolboxFrame :: GetSkipSides() const
// the toolbox for a "expando area" in which the grippies that represent the
// collapsed toolbars reside.
//
/*
NS_IMETHODIMP
nsToolboxFrame :: Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
// Pink you had code here to get you inital pseudo elements. Unfortunately it kind of
// messes up boxes. So I put it in the right place. Now the elements are initally
// loaded in the Init method. -EDV
@ -517,7 +507,101 @@ nsToolboxFrame :: Reflow(nsIPresContext& aPresContext,
return NS_OK;
} // Reflow
*/
NS_IMETHODIMP
nsToolboxFrame :: Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
// compute amount (in twips) each toolbar will be offset from the right because of
// the grippy
float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t);
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
nscoord grippyWidth = kGrippyWidthInPixels * onePixel; // remember to leave room for the grippy on the right
nscoord collapsedGrippyHeight = kCollapsedGrippyHeightInPixels * onePixel;
// ----see how many collased bars there are ----
int collapsedGrippies=0;
// Get the first child of the toolbox content node and the first child frame of the toolbox
unsigned int contentCounter = 0;
nsCOMPtr<nsIContent> 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<nsIContent> 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<nsIContent> 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

Просмотреть файл

@ -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<nsIStyleContext> mGrippyNormalStyle;
nsCOMPtr<nsIStyleContext> 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

Просмотреть файл

@ -3,55 +3,9 @@
<!DOCTYPE window>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
<window style="width: 100%; height: 100%" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Startup()"
title="Mozilla">
<html:style>
#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;
}
</html:style>
onload="Startup()" title="Mozilla">
<html:script>
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 @@
</menubar>
<html:div id="header">
<toolbox>
<toolbar id="mainbar">
<html:table width="100%" cellpadding=0 cellspacing=0><html:tr>
<html:td valign="middle" width="160">
<box align="vertical" style="width: 100%; height:100%">
<toolbox>
<toolbar type="toolbar">
<titledbutton src="resource:/res/toolbar/TB_Back.gif" align="bottom" value="Back" onclick="BrowserBack()">
<observes element="canGoBack" attribute="disabled"/>
</titledbutton>
@ -582,44 +531,71 @@
onclick="window.frames[0].stop()">
<observes element="canStop" attribute="disabled"/>
</titledbutton>
</html:td>
<html:td valign="middle">
<html:input id="urlbar" style="width: 100%" type="text"
<box align="vertical" flex="100%">
<spring flex="100%"/>
<html:input id="urlbar" type="text" style="min-width: 100px; min-height: 25px"
onkeyup="if (event.which == 13) { BrowserLoadURL(); }"/>
</html:td>
<html:td width="80" valign="middle">
<spring flex="100%"/>
</box>
<titledbutton src="resource:/res/toolbar/TB_Print.gif" align="bottom" value="Print"
onclick="">
<observes element="canPrint" attribute="disabled"/>
</titledbutton>
<titledbutton id="Throbber" style="list-style-image:url(resource:/res/throbber/anims00.gif);" onclick="window.frames[0].home()">
<observes element="Browser:Throbber" attribute="busy"/>
</titledbutton>
</html:td>
</html:tr></html:table>
</toolbar>
<toolbar onclick="OpenBookmarkURL(event.target)" datasources="rdf:bookmarks" id="NC:PersonalToolbarFolder">
<titledbutton src="resource:/res/toolbar/TB_Home.gif" align="right" value="Home"
onclick="BrowserHome()"/>
<titledbutton src="resource:/res/toolbar/TB_Netscape.gif" align="right" value="Netscape"
onclick="window.frames[0].location.href='http://my.netscape.com'"/>
</toolbar>
<toolbar type="toolbar">
<titledbutton src="resource:/res/toolbar/TB_Home.gif" align="right" value="Home"
onclick="BrowserHome()"/>
<titledbutton src="resource:/res/toolbar/TB_Netscape.gif" align="right" value="Netscape"
onclick="window.frames[0].location.href='http://my.netscape.com'"/>
<spring flex="100%"/>
</toolbar>
</toolbox>
</html:div>
<html:div id="main">
<html:iframe html:name="content" html:src="BrowserInitPage.html" html:width="100%" html:height="440px"></html:iframe>
</html:div>
<!-- side tool bar test
<box flex="100%">
<html:div id="footer">
<html:script>
<toolbox align="horizontal">
<toolbar align="vertical">
<titledbutton src="resource:/res/toolbar/TB_Back.gif" align="bottom" value="Back" onclick="BrowserBack()">
<observes element="canGoBack" attribute="disabled"/>
</titledbutton>
<titledbutton src="resource:/res/toolbar/TB_Forward.gif" align="bottom" value="Forward"
onclick="BrowserForward()">
<observes element="canGoForward" attribute="disabled"/>
</titledbutton>
<titledbutton src="resource:/res/toolbar/TB_Reload.gif" align="bottom" value="Reload"
onclick="window.frames[0].location.reload()">
<observes element="canReload" attribute="disabled"/>
</titledbutton>
<titledbutton src="resource:/res/toolbar/TB_Stop.gif" align="bottom" value="Stop"
onclick="window.frames[0].stop()">
<observes element="canStop" attribute="disabled"/>
</titledbutton>
</toolbar>
</toolbox>
<html:iframe html:name="content" html:src="BrowserInitPage.html" flex="100%" style="width: 100px; height: 100px" />
</box>
-->
<html:iframe html:name="content" html:src="BrowserInitPage.html" flex="100%" style="width: 100px; height: 100px" />
<html:script>
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[^;]*;/, "" );
if ( security.getAttribute("secure") == "true" ) {
// Set indicator to display:normal;
style = style + "display:normal;width:120px;";
color = "border-top-color:yellow;"
} else {
// Set indicator to display:none;
style = style + "display:none;width:0%;";
color = "border-top-color:rgb(192,192,192);"
}
indicator.setAttribute("style",style);
var indicator = document.getElementById("security-box");
var icon = document.getElementById("security-button");
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);
if ( security.getAttribute("secure") == "true" ) {
indicator.setAttribute("class","secure");
icon.setAttribute("class","secure");
} else {
indicator.setAttribute("class","insecure");
icon.setAttribute("class","insecure");
}
}
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 @@
}
</html:script>
<box align="horizontal" id="status-bar">
<broadcaster id="Browser:LoadingProgress"/>
<broadcaster id="Browser:Status"/>
<broadcaster id="Browser:OnStartBinding"/>
@ -755,90 +719,53 @@
<broadcaster id="Browser:Security" secure="false"/>
<broadcaster id="Browser:Throbber" busy="false"/>
<html:center>
<titledbutton value="[Notification Component]" onclick="doTests()"/>
<box id="security-box" class="insecure" align="horizontal" flex="100%">
<box align="vertical" style="width:100px">
<spring flex="100%"/>
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
<html:table class="statusbar" style="table-spacing:0;table-padding:0;width:99%;border:1px;">
<titledbutton id="statusText" align="right" flex="1%" value="Document: Done" style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value" onchange="onStatus()"/>
</titledbutton>
<spring flex="100%"/>
<html:tr>
<html:td class="notification" style="width:200px;font-family:sans-serif;font-size:2.5mm;">
<html:div onclick="doTests()">
[Notification Component]
</html:div>
</html:td>
<html:td id="statusbar-meter" class="statusbar-meter" onclick="dumpProgress()" style="width:100px;border-top:2px solid;">
<progressmeter id="meter" mode="normal" value="0" style="width:100px; height: 16px;">
<!-- <observes element="Browser:LoadingProgress" attribute="value"/> -->
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
</progressmeter>
</html:td>
<html:td id="statusbar-text" class="statusbar-text" style="width:*;font-family:sans-serif;font-size:2.5mm;border-top:2px solid;">
<html:div id="statusText">
Document: Done
<observes element="Browser:Status" attribute="text" onchange="onStatus()"/>
<!--
<observes element="Browser:OnStartBinding" attribute="url" onchange="onStartBinding()"/>
<observes element="Browser:OnStopBinding" attribute="url" onchange="onStopBinding()"/>
-->
</html:div>
Build ID: 00000000
</html:td>
<html:td id="statusbar-indicator" class="statusbar-indicator" style="display:none;background-color:yellow;font-family:sans-serif;font-size:8pt;border-top:2px solid yellow;">
<html:div onclick="securityOff();">
<html:img src="resource:/res/toolbar/StatusBar-secure.gif" style="vertical-align:middle"/>Secure Conn.
</html:div>
</html:td>
</html:tr>
</html:table>
</html:center>
</html:div>
<html:div id="footer_bar">
<toolbox>
<toolbar id="taskbar">
<html:table class="statusbar" style="table-spacing:0;table-padding:0;width:99%;border:1px;">
<html:tr>
<html:td>
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Web" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Mail" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Chat" />
</html:td>
<html:td>
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="DayPlanner" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Shopping" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="My Desk" />
</html:td>
<html:td>
</html:td>
<html:td align="right">
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Open Windows" />
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniNav.gif" value="" />
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniMail.gif" value="" onclick="OpenMessenger()"/>
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniAddr.gif" value="" />
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniComp.gif" value="" />
</html:td>
</html:tr>
</html:table>
</toolbar>
</toolbox>
</html:div>
<titledbutton align="right" value="Build ID: 99032911" style="font-family:sans-serif;font-size:2.5mm">
</titledbutton>
<titledbutton id="security-button" class="insecure" value="Secure Conn" align="right" src="resource:/res/toolbar/StatusBar-secure.gif" onclick="securityOff();"/>
</box>
</box>
<toolbox>
<toolbar id="taskbar">
<box align="horizontal">
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Web" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Mail" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Chat" />
</box>
<spring flex="100%"/>
<box align="horizontal">
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="DayPlanner" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Shopping" />
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="My Desk" />
</box>
<spring flex="100%"/>
<box align="horizontal">
<titledbutton align="left" src="resource:/res/toolbar/TB_popup.gif" value="Open Windows" />
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniNav.gif" value="" />
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniMail.gif" value="" onclick="OpenMessenger()"/>
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniAddr.gif" value="" />
<titledbutton align="left" src="resource:/res/toolbar/TB_MiniComp.gif" value="" />
</box>
</toolbar>
</toolbox>
</box>
</window>

Просмотреть файл

@ -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,17 +113,64 @@ 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;
color:white;
@ -153,52 +178,36 @@ toolbar#taskbar titledbutton[pseudoclass~="hover"] {
padding: 1px;
}
titledbutton[pseudoclass~="hover"]:-moz-outline {
border : 1px solid black;
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;
}
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;
}
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=secure] {
border-top: 2px solid yellow;
margin-top: 0px;
}
titledbutton[pseudoclass~="active"]:-moz-outline {
border : 1px solid black;
box#status-bar titledbutton {
font: 2.5mm sans-serif;
}
titledbutton:-moz-focus-inner {
titledbutton[class=secure] {
background-color: yellow;
}
titledbutton:-moz-focus-outer {
titledbutton[class=insecure] {
}
titledbutton[pseudoclass~="focus"] {
}
titledbutton[pseudoclass~="focus"]:-moz-focus-inner {
}
titledbutton[pseudoclass~="focus"]:-moz-focus-outer {
}
titledbutton[disabled] {
opacity: 0.5;
}