116198 - remove progressbar tag to simplify progressmeter, r=ben, sr=hyatt

This commit is contained in:
hewitt%netscape.com 2001-12-21 01:41:32 +00:00
parent cafed259ff
commit 7f6ba9a292
8 changed files with 186 additions and 159 deletions

View File

@ -148,7 +148,7 @@ XUL_ATOM(broadcasterset, "broadcasterset")
XUL_ATOM(commands, "commands")
XUL_ATOM(commandset, "commandset")
XUL_ATOM(progressbar, "progressbar")
XUL_ATOM(progressmeter, "progressmeter")
XUL_ATOM(crop, "crop")
XUL_ATOM(mode, "mode")

View File

@ -5326,7 +5326,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
// End of TREE CONSTRUCTION code here (there's more later on in the function)
// PROGRESS METER CONSTRUCTION
else if (aTag == nsXULAtoms::progressbar) {
else if (aTag == nsXULAtoms::progressmeter) {
processChildren = PR_TRUE;
isReplaced = PR_TRUE;
rv = NS_NewProgressMeterFrame(aPresShell, &newFrame);

View File

@ -5326,7 +5326,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
// End of TREE CONSTRUCTION code here (there's more later on in the function)
// PROGRESS METER CONSTRUCTION
else if (aTag == nsXULAtoms::progressbar) {
else if (aTag == nsXULAtoms::progressmeter) {
processChildren = PR_TRUE;
isReplaced = PR_TRUE;
rv = NS_NewProgressMeterFrame(aPresShell, &newFrame);

View File

@ -117,32 +117,33 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext,
// did the progress change?
if (nsHTMLAtoms::value == aAttribute) {
PRInt32 childCount;
mContent->ChildCount(childCount);
nsIFrame* barChild = nsnull;
FirstChild(aPresContext, nsnull, &barChild);
if (!barChild) return NS_OK;
nsIFrame* remainderChild = nsnull;
barChild->GetNextSibling(&remainderChild);
if (!remainderChild) return NS_OK;
if (childCount >= 2) {
nsCOMPtr<nsIContent> progressBar;
nsCOMPtr<nsIContent> progressRemainder;
nsCOMPtr<nsIContent> progressBar;
barChild->GetContent(getter_AddRefs(progressBar));
nsCOMPtr<nsIContent> progressRemainder;
remainderChild->GetContent(getter_AddRefs(progressRemainder));
mContent->ChildAt(0, *getter_AddRefs(progressBar));
mContent->ChildAt(1, *getter_AddRefs(progressRemainder));
nsAutoString value;
mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, value);
nsAutoString value;
mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, value);
PRInt32 error;
PRInt32 flex = value.ToInteger(&error);
if (flex < 0) flex = 0;
if (flex > 100) flex = 100;
PRInt32 error;
PRInt32 flex = value.ToInteger(&error);
if (flex < 0) flex = 0;
if (flex > 100) flex = 100;
PRInt32 remainder = 100 - flex;
PRInt32 remainder = 100 - flex;
nsAutoString leftFlex, rightFlex;
leftFlex.AppendInt(flex);
rightFlex.AppendInt(remainder);
progressBar->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, leftFlex, PR_TRUE);
progressRemainder->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, rightFlex, PR_TRUE);
}
nsAutoString leftFlex, rightFlex;
leftFlex.AppendInt(flex);
rightFlex.AppendInt(remainder);
progressBar->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, leftFlex, PR_TRUE);
progressRemainder->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, rightFlex, PR_TRUE);
}
return NS_OK;
}

View File

@ -1,67 +1,80 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* ===== progressmeter.css ==============================================
== Styles used by the XUL progressmeter element.
======================================================================= */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/**
* XUL <progressmeter>
**/
progressmeter[mode="undetermined"] > .progressmeter-internal-box
{
background : url(chrome://global/skin/progressmeter/progressmeter-busy.gif) repeat-x;
}
progressmeter[mode="undetermined"] > .progressmeter-internal-box > .progressmeter-stack > .progressmeter-progressbar {
visibility: collapse;
}
/* ::::: progressmeter ::::: */
progressmeter
{
min-width : 100px;
margin : 0px 4px 0px 4px;
border-top : 1px solid #AAAAAA;
border-left : 1px solid #AAAAAA;
border-right : 1px solid #FFFFFF;
border-bottom : 1px solid #FFFFFF;
}
progressmeter {
margin: 2px 4px;
border: 2px solid;
-moz-border-top-colors: #AAAAAA #000000;
-moz-border-right-colors: #FFFFFF #000000;
-moz-border-bottom-colors: #FFFFFF #000000;
-moz-border-left-colors: #AAAAAA #000000;
min-width: 128px;
height: 12px;
}
progressmeter > .progressmeter-internal-box
{
border : 1px solid #000000;
height : 10px;
progressmeter[mode="undetermined"] {
background: url("chrome://global/skin/progressmeter/progressmeter-busy.gif") repeat-x 0% 50%;
}
}
.progressmeter-statusbar
{
border-left : 1px solid #FFFFFF;
border-top : 1px solid #FFFFFF;
border-right : 1px solid #9D9D9D;
border-bottom : 1px solid #9D9D9D;
margin : 0px;
}
.progressmeter-statusbar > .progressmeter-internal-box
{
border : 1px solid #DDDDDD;
/** change this value if status bar height changes **/
margin-top : 5px;
}
.progress-bar {
min-width: 0px;
background: url("chrome://global/skin/progressmeter/progressmeter-bar.gif") repeat-x 0% 50%;
}
/* progress indicators */
.progress-bar
{
background-color : #9999FF;
background : url(chrome://global/skin/progressmeter/progressmeter-bar.gif) repeat-x;
.progress-bar[mode="undetermined"],
.progress-remainder[mode="undetermined"] {
visibility: collapsed;
}
}
.progressmeter-progressbar
{
height : 10px;
}
/* No progress text in mac status bars */
.progress-text
{
display : none;
}
/* ::::: statusbar progressmeter ::::: */
.progressmeter-statusbar {
margin: 0;
border-width: 1px;
-moz-border-top-colors: ThreeDHighlight;
-moz-border-right-colors: ThreeDShadow;
-moz-border-bottom-colors: ThreeDShadow;
-moz-border-left-colors: ThreeDHighlight;
}

View File

@ -1,64 +1,80 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (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.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joe Hewitt <hewitt@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* ===== progressmeter.css ==============================================
== Styles used by the XUL progressmeter element.
======================================================================= */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/**
* XUL <progressmeter>
**/
progressmeter[mode="undetermined"] > .progressmeter-internal-box
{
background-image : url("chrome://global/skin/progressmeter/progressmeter-busy.gif");
}
progressmeter[mode="undetermined"] > .progressmeter-internal-box > .progressmeter-stack > .progressmeter-progressbar
{
visibility : collapse;
}
/* ::::: progressmeter ::::: */
progressmeter
{
min-width: 100px;
min-height: 14px;
border-left: 1px solid ThreeDShadow;
border-top: 1px solid ThreeDShadow;
border-right: 1px solid ThreeDHighlight;
border-bottom: 1px solid ThreeDHighlight;
background-color: -moz-Dialog;
}
progressmeter {
margin: 2px 4px;
border: 2px solid;
-moz-border-top-colors: ThreeDShadow -moz-Dialog;
-moz-border-right-colors: ThreeDHighlight -moz-Dialog;
-moz-border-bottom-colors: ThreeDHighlight -moz-Dialog;
-moz-border-left-colors: ThreeDShadow -moz-Dialog;
background-color: -moz-Dialog;
min-width: 128px;
height: 15px;
}
.progressmeter-statusbar
{
border-left : 1px solid ThreeDHighlight;
border-top : 1px solid ThreeDHighlight;
border-right : 1px solid ThreeDShadow;
border-bottom : 1px solid ThreeDShadow;
}
.progress-text
{
visibility : collapse;
}
progressmeter[mode="undetermined"] {
background: url("chrome://global/skin/progressmeter/progressmeter-busy.gif") repeat-x 0% 50%;
}
.progressmeter-internal-box
{
border : 1px solid -moz-Dialog;
padding : 1px;
}
.progressmeter-inset
{
margin : 1px 5px 2px 5px;
}
.progressmeter-inset > .progressmeter-internal-box
{
border-left : 1px solid ThreeDDarkShadow;
border-top : 1px solid ThreeDDarkShadow;
border-right : 1px solid ThreeDHighlight;
border-bottom : 1px solid ThreeDHighlight;
}
.progress-bar {
min-width: 0px;
background-color: ThreeDShadow;
}
/* progress indicators */
.progress-bar
{
background-color : ThreeDShadow;
}
.progress-bar[mode="undetermined"],
.progress-remainder[mode="undetermined"] {
visibility: collapsed;
}
/* ::::: statusbar progressmeter ::::: */
.progressmeter-statusbar {
margin: 0;
-moz-border-top-colors: ThreeDHighlight -moz-Dialog;
-moz-border-right-colors: ThreeDShadow -moz-Dialog;
-moz-border-bottom-colors: ThreeDShadow -moz-Dialog;
-moz-border-left-colors: ThreeDHighlight -moz-Dialog;
}

View File

@ -45,25 +45,24 @@
progressmeter {
margin: 2px 4px;
border-top: 1px solid #8997A1;
border-right: 1px solid #E0ECF6;
border-bottom: 1px solid #E0ECF6;
border-left: 1px solid #8997A1;
padding: 1px;
border: 2px solid;
-moz-border-top-colors: #8997A1 #C7D0D9;
-moz-border-right-colors: #E0ECF6 #C7D0D9;
-moz-border-bottom-colors: #E0ECF6 #C7D0D9;
-moz-border-left-colors: #8997A1 #C7D0D9;
min-width: 128px;
height: 14px;
}
progressmeter[mode="undetermined"] {
background: url("chrome://global/skin/progressmeter/progress-busy.gif");
}
.progress-bar {
min-width: 0px;
background-color: #6B7B8D;
}
.progressmeter-progressbar[mode="undetermined"] {
background: url("chrome://global/skin/progressmeter/progress-busy.gif");
visibility: visible !important;
}
.progress-bar[mode="undetermined"],
.progress-remainder[mode="undetermined"] {
visibility: hidden;
@ -72,10 +71,10 @@ progressmeter {
/* ::::: statusbar progressmeter ::::: */
.progressmeter-statusbar {
margin: 0px;
border-top: 1px solid #E0ECF6;
border-left: 1px solid #E0ECF6;
border-right: 1px solid #8997A1;
margin: 0;
border-bottom: none;
-moz-border-top-colors: #E0ECF6 #C7D0D9;
-moz-border-right-colors: #8997A1 #C7D0D9;
-moz-border-left-colors: #E0ECF6 #C7D0D9;
}

View File

@ -10,10 +10,8 @@
</resources>
<content>
<xul:progressbar class="progressmeter-progressbar" inherits="value,mode" flex="1">
<xul:box class="progress-bar" inherits="mode"/>
<xul:box class="progress-remainder" inherits="mode"/>
</xul:progressbar>
<xul:spacer class="progress-bar" inherits="mode"/>
<xul:spacer class="progress-remainder" inherits="mode"/>
</content>
<implementation implements="nsIAccessibleProvider">