Back out bug 514437, bug 567872, bug 568825, bug 633209, bug 633913, bug 634086, bug 634088, bug 634549, bug 634551, bug 638176, bug 641517, bug 641905, bug 641942, bug 642127, and bug 642667 to undo the performance regression tracked by bug 655860.

This commit is contained in:
Shawn Wilsher 2011-05-09 15:48:39 -07:00
parent e9af9e5eaa
commit d616bf2fcb
54 changed files with 64 additions and 2189 deletions

View File

@ -38,7 +38,6 @@
#include "nsIDOMHTMLProgressElement.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValue.h"
#include "nsEventStateManager.h"
class nsHTMLProgressElement : public nsGenericHTMLFormElement,
@ -68,8 +67,6 @@ public:
NS_IMETHOD Reset();
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission);
nsEventStates IntrinsicState() const;
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
@ -137,18 +134,6 @@ nsHTMLProgressElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
return NS_OK;
}
nsEventStates
nsHTMLProgressElement::IntrinsicState() const
{
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
if (IsIndeterminate()) {
state |= NS_EVENT_STATE_INDETERMINATE;
}
return state;
}
PRBool
nsHTMLProgressElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult)

View File

@ -262,7 +262,6 @@ _TEST_FILES = \
test_bug641219.html \
test_bug643051.html \
test_bug583514.html \
test_bug514437.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -1,323 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=514437
https://bugzilla.mozilla.org/show_bug.cgi?id=633913
-->
<head>
<title>Test for Bug 514437 and Bug 633913</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=514437">Mozilla Bug 514437</a>
and
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633913">Mozilla Bug 633913</a>
<p id="display"></p>
<iframe name="submit_frame" onload="onFormSubmission();" style="visibility: hidden;"></iframe>
<div id="content" style="visibility: hidden;">
<form id='f' method='get' target='submit_frame' action='foo'>
<progress id='p'></progress>
</form>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 514437 and Bug 633913 **/
function checkFormIDLAttribute(aElement)
{
var form = document.forms[0];
var content = document.getElementById('content');
is(aElement.form, form, "The form IDL attribute should be the parent form");
content.removeChild(form);
content.appendChild(aElement);
is(aElement.form, null, "The form IDL attribute should be null");
// Cleaning-up.
content.appendChild(form);
form.appendChild(aElement);
}
function checkAttribute(aElement, aAttribute, aNewValue, aExpectedValueForIDL)
{
var expectedValueForIDL = aNewValue;
var expectedValueForContent = aNewValue;
if (aExpectedValueForIDL !== undefined) {
expectedValueForIDL = aExpectedValueForIDL;
}
if (aNewValue != null) {
aElement.setAttribute(aAttribute, aNewValue);
is(aElement.getAttribute(aAttribute), expectedValueForContent,
aAttribute + " content attribute should be " + expectedValueForContent);
is(aElement[aAttribute], expectedValueForIDL,
aAttribute + " IDL attribute should be " + expectedValueForIDL);
if (parseFloat(aNewValue) == aNewValue) {
aElement[aAttribute] = aNewValue;
is(aElement.getAttribute(aAttribute), expectedValueForContent,
aAttribute + " content attribute should be " + expectedValueForContent);
is(aElement[aAttribute], parseFloat(expectedValueForIDL),
aAttribute + " IDL attribute should be " + parseFloat(expectedValueForIDL));
}
} else {
aElement.removeAttribute(aAttribute);
is(aElement.getAttribute(aAttribute), expectedValueForContent,
aAttribute + " content attribute should be " + expectedValueForContent);
is(aElement[aAttribute], expectedValueForIDL,
aAttribute + " IDL attribute should be " + expectedValueForIDL);
}
}
function checkValueAttribute()
{
var tests = [
// value has to be a valid float, its default value is 0.0 otherwise.
[ null, 0.0 ],
[ 'fo', 0.0 ],
// If value < 0.0, 0.0 is used instead.
[ -1.0, 0.0 ],
// If value >= max, max is used instead (max default value is 1.0).
[ 2.0, 1.0 ],
[ 1.0, 0.5, 0.5 ],
[ 10.0, 5.0, 5.0 ],
[ 13.37, 13.37, 42.0 ],
// Regular reflection.
[ 0.0 ],
[ 0.5 ],
[ 1.0 ],
// Check double-precision value.
[ 0.234567898765432 ],
];
var element = document.createElement('progress');
for each(var test in tests) {
if (test[2]) {
element.setAttribute('max', test[2]);
}
checkAttribute(element, 'value', test[0], test[1]);
element.removeAttribute('max');
}
}
function checkMaxAttribute()
{
var tests = [
// max default value is 1.0.
[ null, 1.0 ],
// If value <= 0.0, 1.0 is used instead.
[ 0.0, 1.0 ],
[ -1.0, 1.0 ],
// Regular reflection.
[ 0.5 ],
[ 1.0 ],
[ 2.0 ],
// Check double-precision value.
[ 0.234567898765432 ],
];
var element = document.createElement('progress');
for each(var test in tests) {
checkAttribute(element, 'max', test[0], test[1]);
}
}
function checkPositionAttribute()
{
function checkPositionValue(aElement, aValue, aMax, aExpected) {
if (aValue != null) {
aElement.setAttribute('value', aValue);
} else {
aElement.removeAttribute('value');
}
if (aMax != null) {
aElement.setAttribute('max', aMax);
} else {
aElement.removeAttribute('max');
}
is(aElement.position, aExpected, "position IDL attribute should be " + aExpected);
}
var tests = [
// value has to be defined (indeterminate state).
[ null, null, -1.0 ],
[ null, 1.0, -1.0 ],
// value has to be defined to a valid float (indeterminate state).
[ 'foo', 1.0, -1.0 ],
// If value < 0.0, 0.0 is used instead.
[ -1.0, 1.0, 0.0 ],
// If value >= max, max is used instead.
[ 2.0, 1.0, 1.0 ],
// If max isn't present, max is set to 1.0.
[ 1.0, null, 1.0 ],
// If max isn't a valid float, max is set to 1.0.
[ 1.0, 'foo', 1.0 ],
// If max isn't > 0, max is set to 1.0.
[ 1.0, -1.0, 1.0 ],
// A few simple and valid values.
[ 0.0, 1.0, 0.0 ],
[ 0.1, 1.0, 0.1/1.0 ],
[ 0.1, 2.0, 0.1/2.0 ],
[ 10, 50, 10/50 ],
// Values implying .position is a double.
[ 1.0, 3.0, 1.0/3.0 ],
[ 0.1, 0.7, 0.1/0.7 ],
];
var element = document.createElement('progress');
for each(var test in tests) {
checkPositionValue(element, test[0], test[1], test[2], test[3]);
}
}
function checkIndeterminatePseudoClass()
{
function checkIndeterminate(aElement, aValue, aMax, aIndeterminate) {
if (aValue != null) {
aElement.setAttribute('value', aValue);
} else {
aElement.removeAttribute('value');
}
if (aMax != null) {
aElement.setAttribute('max', aMax);
} else {
aElement.removeAttribute('max');
}
is(aElement.mozMatchesSelector("progress:indeterminate"), aIndeterminate,
"<progress> indeterminate state should be " + aIndeterminate);
}
var tests = [
// Indeterminate state: (value is undefined, or not a float)
// value has to be defined (indeterminate state).
[ null, null, true ],
[ null, 1.0, true ],
[ 'foo', 1.0, true ],
// Determined state:
[ -1.0, 1.0, false ],
[ 2.0, 1.0, false ],
[ 1.0, null, false ],
[ 1.0, 'foo', false ],
[ 1.0, -1.0, false ],
[ 0.0, 1.0, false ],
];
var element = document.createElement('progress');
for each(var test in tests) {
checkIndeterminate(element, test[0], test[1], test[2]);
}
}
function checkFormListedElement(aElement)
{
is(document.forms[0].elements.length, 0, "the form should have no element");
}
function checkLabelable(aElement)
{
var content = document.getElementById('content');
var label = document.createElement('label');
content.appendChild(label);
label.appendChild(aElement);
is(label.control, aElement, "progress should be labelable");
// Cleaning-up.
content.removeChild(label);
content.appendChild(aElement);
}
function checkNotResetableAndFormSubmission(aElement)
{
// Creating an input element to check the submission worked.
var form = document.forms[0];
var input = document.createElement('input');
input.name = 'a';
input.value = 'tulip';
form.appendChild(input);
// Setting values.
aElement.value = 42.0;
aElement.max = 100.0;
// This is going to call onFormSubmission().
form.submit();
}
function onFormSubmission()
{
/**
* All elements values have been set just before the submission.
* The input element value should be in the submit url but the progress
* element value should not appear.
*/
is(frames['submit_frame'].location.href,
'http://mochi.test:8888/tests/content/html/content/test/foo?a=tulip',
"The progress element value should not be submitted");
checkNotResetable();
}
function checkNotResetable()
{
// Try to reset the form.
var form = document.forms[0];
var element = document.getElementById('p');
element.value = 3.0;
element.max = 42.0;
form.reset();
SimpleTest.executeSoon(function() {
is(element.value, 3.0, "progress.value should not have changed");
is(element.max, 42.0, "progress.max should not have changed");
SimpleTest.finish();
});
}
SimpleTest.waitForExplicitFinish();
var p = document.getElementById('p');
ok(p instanceof HTMLProgressElement,
"The progress element should be instance of HTMLProgressElement");
is(p.constructor, HTMLProgressElement,
"The progress element constructor should be HTMLProgressElement");
checkFormIDLAttribute(p);
checkValueAttribute();
checkMaxAttribute();
checkPositionAttribute();
checkIndeterminatePseudoClass();
checkFormListedElement(p);
checkLabelable(p);
checkNotResetableAndFormSubmission(p);
</script>
</pre>
</body>
</html>

View File

@ -401,12 +401,13 @@ var forms = [
var elementNames = [
'button', 'fieldset', 'input', 'label', 'object', 'output', 'select',
'textarea', 'progress',
'textarea',
];
var todoElements = [
['keygen', 'Keygen'],
['meter', 'Meter'],
['progress', 'Progress'],
];
for each(var e in todoElements) {

View File

@ -3548,8 +3548,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
SIMPLE_TAG_CREATE(video, NS_NewHTMLVideoFrame),
SIMPLE_TAG_CREATE(audio, NS_NewHTMLVideoFrame),
#endif
SIMPLE_TAG_CREATE(isindex, NS_NewIsIndexFrame),
SIMPLE_TAG_CREATE(progress, NS_NewProgressFrame)
SIMPLE_TAG_CREATE(isindex, NS_NewIsIndexFrame)
};
return FindDataByTag(aTag, aElement, aStyleContext, sHTMLData,

View File

@ -72,7 +72,6 @@ CPPSRCS = \
nsGfxButtonControlFrame.cpp \
nsGfxCheckboxControlFrame.cpp \
nsGfxRadioControlFrame.cpp \
nsProgressFrame.cpp \
nsTextControlFrame.cpp \
nsHTMLButtonControlFrame.cpp \
nsImageControlFrame.cpp \

View File

@ -1,289 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsProgressFrame.h"
#include "nsIDOMHTMLProgressElement.h"
#include "nsIContent.h"
#include "prtypes.h"
#include "nsPresContext.h"
#include "nsGkAtoms.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsNodeInfoManager.h"
#include "nsINodeInfo.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsFormControlFrame.h"
#include "nsFontMetrics.h"
nsIFrame*
NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsProgressFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsProgressFrame)
nsProgressFrame::nsProgressFrame(nsStyleContext* aContext)
: nsHTMLContainerFrame(aContext)
, mBarDiv(nsnull)
{
}
nsProgressFrame::~nsProgressFrame()
{
}
NS_IMETHODIMP
nsProgressFrame::SetInitialChildList(nsIAtom* aListName,
nsFrameList& aChildList)
{
NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
nsresult rv = nsHTMLContainerFrame::SetInitialChildList(aListName,
aChildList);
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozProgressBar;
nsRefPtr<nsStyleContext> newStyleContext;
newStyleContext = barFrame->PresContext()->StyleSet()->
ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
barFrame->GetParent()->GetStyleContext());
if (newStyleContext) {
barFrame->SetStyleContext(newStyleContext);
}
return rv;
}
void
nsProgressFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
NS_ASSERTION(!GetPrevContinuation(),
"nsProgressFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), PR_FALSE);
nsContentUtils::DestroyAnonymousContent(&mBarDiv);
nsHTMLContainerFrame::DestroyFrom(aDestructRoot);
}
nsresult
nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
// Get the NodeInfoManager and tag necessary to create the progress bar div.
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nsnull,
kNameSpaceID_XHTML);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
// Create the div.
nsresult rv = NS_NewHTMLElement(getter_AddRefs(mBarDiv), nodeInfo.forget(),
mozilla::dom::NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
if (!aElements.AppendElement(mBarDiv)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
void
nsProgressFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mBarDiv);
}
NS_QUERYFRAME_HEAD(nsProgressFrame)
NS_QUERYFRAME_ENTRY(nsProgressFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
NS_IMETHODIMP nsProgressFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsProgressFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
NS_ASSERTION(!GetPrevContinuation(),
"nsProgressFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
if (mState & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(this, PR_TRUE);
}
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
ReflowBarFrame(barFrame, aPresContext, aReflowState, aStatus);
aDesiredSize.width = aReflowState.ComputedWidth() +
aReflowState.mComputedBorderPadding.LeftRight();
aDesiredSize.height = aReflowState.ComputedHeight() +
aReflowState.mComputedBorderPadding.TopBottom();
aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height,
aReflowState.mComputedMinHeight,
aReflowState.mComputedMaxHeight);
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}
void
nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
nsHTMLReflowState reflowState(aPresContext, aReflowState, aBarFrame,
nsSize(aReflowState.ComputedWidth(),
NS_UNCONSTRAINEDSIZE));
nscoord width = aReflowState.ComputedWidth();
nscoord xoffset = aReflowState.mComputedBorderPadding.left;
nscoord yoffset = aReflowState.mComputedBorderPadding.top;
double position;
nsCOMPtr<nsIDOMHTMLProgressElement> progressElement =
do_QueryInterface(mContent);
progressElement->GetPosition(&position);
// Force the bar's width to match the current progress.
// When indeterminate, the progress' width will be 100%.
if (position >= 0.0) {
width *= position;
}
if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
xoffset += aReflowState.ComputedWidth() - width;
}
// The bar width is fixed in these cases:
// - the progress position is determined: the bar width is fixed according
// to it's value.
// - the progress position is indeterminate and the bar appearance should be
// shown as native: the bar width is forced to 100%.
// Otherwise (when the progress is indeterminate and the bar appearance isn't
// native), the bar width isn't fixed and can be set by the author.
if (position != -1 || ShouldUseNativeStyle()) {
width -= reflowState.mComputedMargin.LeftRight() +
reflowState.mComputedBorderPadding.LeftRight();
width = NS_MAX(width, 0);
reflowState.SetComputedWidth(width);
}
xoffset += reflowState.mComputedMargin.left;
yoffset += reflowState.mComputedMargin.top;
nsHTMLReflowMetrics barDesiredSize;
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
yoffset, 0, aStatus);
FinishReflowChild(aBarFrame, aPresContext, &reflowState, barDesiredSize,
xoffset, yoffset, 0);
}
NS_IMETHODIMP
nsProgressFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
if (aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max)) {
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
PresContext()->PresShell()->FrameNeedsReflow(barFrame, nsIPresShell::eResize,
NS_FRAME_IS_DIRTY);
}
return nsHTMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
}
nsSize
nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, PRBool aShrinkWrap)
{
nsRefPtr<nsFontMetrics> fontMet;
NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this,
getter_AddRefs(fontMet)),
nsSize(0, 0));
nsSize autoSize;
autoSize.height = autoSize.width = fontMet->Font().size; // 1em
autoSize.width *= 10; // 10em
return autoSize;
}
bool
nsProgressFrame::ShouldUseNativeStyle() const
{
// Use the native style if these conditions are satisfied:
// - both frames use the native appearance;
// - neither frame has author specified rules setting the border or the
// background.
return GetStyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR &&
mBarDiv->GetPrimaryFrame()->GetStyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(const_cast<nsProgressFrame*>(this),
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
!PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(),
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}

View File

@ -1,115 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsProgressFrame_h___
#define nsProgressFrame_h___
#include "nsHTMLContainerFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsCOMPtr.h"
class nsProgressFrame : public nsHTMLContainerFrame,
public nsIAnonymousContentCreator
{
public:
NS_DECL_QUERYFRAME_TARGET(nsProgressFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
nsProgressFrame(nsStyleContext* aContext);
virtual ~nsProgressFrame();
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
nsFrameList& aChildList);
virtual void DestroyFrom(nsIFrame* aDestructRoot);
NS_IMETHOD Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
#ifdef NS_DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const {
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
}
#endif
virtual PRBool IsLeaf() const { return PR_TRUE; }
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, PRBool aShrinkWrap);
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
{
return nsHTMLContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
/**
* Returns whether the frame and its child should use the native style.
*/
bool ShouldUseNativeStyle() const;
protected:
// Helper function which reflow the anonymous div frame.
void ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
/**
* The div used to show the progress bar.
* @see nsProgressFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mBarDiv;
};
#endif

View File

@ -204,8 +204,6 @@ nsIFrame*
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
nsIFrame*
NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
// Table frame factories
nsIFrame*

View File

@ -185,7 +185,6 @@ public:
nsPageFrame_id,
nsPlaceholderFrame_id,
nsPopupSetFrame_id,
nsProgressFrame_id,
nsProgressMeterFrame_id,
nsResizerFrame_id,
nsRootBoxFrame_id,

View File

@ -10,7 +10,6 @@
background-color: blue;
}
#prog .progress-bar {
-moz-appearance: none;
border-radius: 3px 3px;
background-color: red;
}

View File

@ -10,7 +10,6 @@
background-color: blue;
}
#prog .progress-bar {
-moz-appearance: none;
border-radius: 3px 3px;
background-color: red;
}

View File

@ -1,105 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > div:nth-child(1) > .progress-bar { margin: 10px; padding: 0px; }
body > div:nth-child(2) > .progress-bar { margin: 0px; padding: 10px; }
body > div:nth-child(3) > .progress-bar { margin: 10px; padding: 10px; }
body > div:nth-child(4) > .progress-bar { margin: 5px; padding: 5px; }
body > div:nth-child(5) > .progress-bar { margin: 50px; padding: 50px; }
body > div:nth-child(6) > .progress-bar { margin: 100px; padding: 100px; }
body > div:nth-child(7) > .progress-bar { margin: 10px 0px 0px 0px; padding: 0px; }
body > div:nth-child(8) > .progress-bar { margin: 0px 10px 0px 0px; padding: 0px; }
body > div:nth-child(9) > .progress-bar { margin: 0px 0px 10px 0px; padding: 0px; }
body > div:nth-child(10) > .progress-bar { margin: 0px 0px 0px 10px; padding: 0px; }
body > div:nth-child(11) > .progress-bar { margin: 0px; padding: 10px 0px 0px 0px; }
body > div:nth-child(12) > .progress-bar { margin: 0px; padding: 0px 10px 0px 0px; }
body > div:nth-child(13) > .progress-bar { margin: 0px; padding: 0px 0px 10px 0px; }
body > div:nth-child(14) > .progress-bar { margin: 0px; padding: 0px 0px 0px 10px; }
body > div:nth-child(15) > .progress-bar { margin: 200px; padding: 0px; }
body > div:nth-child(16) > .progress-bar { margin: 0px; padding: 200px; }
/* 15 - 18 should have 100% width, no need to specify. */
</style>
<body>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,45 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > div:nth-child(1) > .progress-bar { margin: 0px 10px 0px 0px; padding: 0px; }
body > div:nth-child(2) > .progress-bar { margin: 0px 0px 0px 10px; padding: 0px; }
body > div:nth-child(3) > .progress-bar { margin: 0px; padding: 0px 10px 0px 0px; }
body > div:nth-child(4) > .progress-bar { margin: 0px; padding: 0px 0px 0px 10px; }
/* 15 - 18 should have 100% width, no need to specify. */
</style>
<body dir='rtl'>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > progress:nth-child(1)::-moz-progress-bar { margin: 0px 10px 0px 0px; padding: 0px; }
body > progress:nth-child(2)::-moz-progress-bar { margin: 0px 0px 0px 10px; padding: 0px; }
body > progress:nth-child(3)::-moz-progress-bar { margin: 0px; padding: 0px 10px 0px 0px; }
body > progress:nth-child(4)::-moz-progress-bar { margin: 0px; padding: 0px 0px 0px 10px; }
body > progress:nth-child(5)::-moz-progress-bar { width: 1000px; }
body > progress:nth-child(6)::-moz-progress-bar { width: 10px; }
body > progress:nth-child(7)::-moz-progress-bar { width: 10%; }
body > progress:nth-child(8)::-moz-progress-bar { width: 200%; }
</style>
<body dir='rtl'>
<!-- Those will be used to change padding/margin on ::-moz-progress-bar -->
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<!-- Those will be used to change width. -->
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
</body>
</html>

View File

@ -1,50 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > progress:nth-child(1)::-moz-progress-bar { margin: 10px; padding: 0px; }
body > progress:nth-child(2)::-moz-progress-bar { margin: 0px; padding: 10px; }
body > progress:nth-child(3)::-moz-progress-bar { margin: 10px; padding: 10px; }
body > progress:nth-child(4)::-moz-progress-bar { margin: 5px; padding: 5px; }
body > progress:nth-child(5)::-moz-progress-bar { margin: 50px; padding: 50px; }
body > progress:nth-child(6)::-moz-progress-bar { margin: 100px; padding: 100px; }
body > progress:nth-child(7)::-moz-progress-bar { margin: 10px 0px 0px 0px; padding: 0px; }
body > progress:nth-child(8)::-moz-progress-bar { margin: 0px 10px 0px 0px; padding: 0px; }
body > progress:nth-child(9)::-moz-progress-bar { margin: 0px 0px 10px 0px; padding: 0px; }
body > progress:nth-child(10)::-moz-progress-bar { margin: 0px 0px 0px 10px; padding: 0px; }
body > progress:nth-child(11)::-moz-progress-bar { margin: 0px; padding: 10px 0px 0px 0px; }
body > progress:nth-child(12)::-moz-progress-bar { margin: 0px; padding: 0px 10px 0px 0px; }
body > progress:nth-child(13)::-moz-progress-bar { margin: 0px; padding: 0px 0px 10px 0px; }
body > progress:nth-child(14)::-moz-progress-bar { margin: 0px; padding: 0px 0px 0px 10px; }
body > progress:nth-child(15)::-moz-progress-bar { margin: 200px; padding: 0px; }
body > progress:nth-child(16)::-moz-progress-bar { margin: 0px; padding: 200px; }
body > progress:nth-child(17)::-moz-progress-bar { width: 1000px; }
body > progress:nth-child(18)::-moz-progress-bar { width: 10px; }
body > progress:nth-child(19)::-moz-progress-bar { width: 10%; }
body > progress:nth-child(20)::-moz-progress-bar { width: 200%; }
</style>
<body>
<!-- Those will be used to change padding/margin on ::-moz-progress-bar -->
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<!-- Those will be used to change width. -->
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
div.progress-bar {
width:100%;
}
body > div:nth-child(1) > .progress-bar { width: 20px; }
body > div:nth-child(2) > .progress-bar { width: 0px; }
body > div:nth-child(3) > .progress-bar { width: 50%; }
body > div:nth-child(4) > .progress-bar { width: 1em; }
body > div:nth-child(5) > .progress-bar { width: 100%; }
</style>
<body>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > progress:nth-child(1)::-moz-progress-bar { width: 20px; }
body > progress:nth-child(2)::-moz-progress-bar { width: 0px; }
body > progress:nth-child(3)::-moz-progress-bar { width: 50%; }
body > progress:nth-child(4)::-moz-progress-bar { width: 1em; }
/* last one is for the default value: width=100%. */
</style>
<body>
<!-- Those will be used to change padding/margin on ::-moz-progress-bar -->
<progress></progress>
<progress></progress>
<progress></progress>
<progress></progress>
<progress></progress>
</body>
</html>

View File

@ -1,88 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > div:nth-child(1) { margin: 10px; padding: 0px; }
body > div:nth-child(2) { margin: 0px; padding: 10px; }
body > div:nth-child(3) { margin: 10px; padding: 10px; }
body > div:nth-child(4) { margin: 5px; padding: 5px; }
body > div:nth-child(5) { margin: 50px; padding: 50px; }
body > div:nth-child(6) { margin: 100px; padding: 100px; }
body > div:nth-child(7) { margin: 10px 0px 0px 0px; padding: 0px; }
body > div:nth-child(8) { margin: 0px 10px 0px 0px; padding: 0px; }
body > div:nth-child(9) { margin: 0px 0px 10px 0px; padding: 0px; }
body > div:nth-child(10) { margin: 0px 0px 0px 10px; padding: 0px; }
body > div:nth-child(11) { margin: 0px; padding: 10px 0px 0px 0px; }
body > div:nth-child(12) { margin: 0px; padding: 0px 10px 0px 0px; }
body > div:nth-child(13) { margin: 0px; padding: 0px 0px 10px 0px; }
body > div:nth-child(14) { margin: 0px; padding: 0px 0px 0px 10px; }
body > div:nth-child(15) { margin: 0px; padding: 2px 4px 6px 8px; }
body > div:nth-child(16) { margin: 2px 4px 6px 8px; padding: 0px; }
</style>
<body>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,88 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > div:nth-child(1) { margin: 10px; padding: 0px; }
body > div:nth-child(2) { margin: 0px; padding: 10px; }
body > div:nth-child(3) { margin: 10px; padding: 10px; }
body > div:nth-child(4) { margin: 5px; padding: 5px; }
body > div:nth-child(5) { margin: 50px; padding: 50px; }
body > div:nth-child(6) { margin: 100px; padding: 100px; }
body > div:nth-child(7) { margin: 10px 0px 0px 0px; padding: 0px; }
body > div:nth-child(8) { margin: 0px 10px 0px 0px; padding: 0px; }
body > div:nth-child(9) { margin: 0px 0px 10px 0px; padding: 0px; }
body > div:nth-child(10) { margin: 0px 0px 0px 10px; padding: 0px; }
body > div:nth-child(11) { margin: 0px; padding: 10px 0px 0px 0px; }
body > div:nth-child(12) { margin: 0px; padding: 0px 10px 0px 0px; }
body > div:nth-child(13) { margin: 0px; padding: 0px 0px 10px 0px; }
body > div:nth-child(14) { margin: 0px; padding: 0px 0px 0px 10px; }
body > div:nth-child(15) { margin: 0px; padding: 2px 4px 6px 8px; }
body > div:nth-child(16) { margin: 2px 4px 6px 8px; padding: 0px; }
</style>
<body dir='rtl'>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
progress:nth-child(1) { margin: 10px; padding: 0px; }
progress:nth-child(2) { margin: 0px; padding: 10px; }
progress:nth-child(3) { margin: 10px; padding: 10px; }
progress:nth-child(4) { margin: 5px; padding: 5px; }
progress:nth-child(5) { margin: 50px; padding: 50px; }
progress:nth-child(6) { margin: 100px; padding: 100px; }
progress:nth-child(7) { margin: 10px 0px 0px 0px; padding: 0px; }
progress:nth-child(8) { margin: 0px 10px 0px 0px; padding: 0px; }
progress:nth-child(9) { margin: 0px 0px 10px 0px; padding: 0px; }
progress:nth-child(10) { margin: 0px 0px 0px 10px; padding: 0px; }
progress:nth-child(11) { margin: 0px; padding: 10px 0px 0px 0px; }
progress:nth-child(12) { margin: 0px; padding: 0px 10px 0px 0px; }
progress:nth-child(13) { margin: 0px; padding: 0px 0px 10px 0px; }
progress:nth-child(14) { margin: 0px; padding: 0px 0px 0px 10px; }
progress:nth-child(15) { margin: 0px; padding: 2px 4px 6px 8px; }
progress:nth-child(16) { margin: 2px 4px 6px 8px; padding: 0px; }
</style>
<body dir='rtl'>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
</body>
</html>

View File

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
progress:nth-child(1) { margin: 10px; padding: 0px; }
progress:nth-child(2) { margin: 0px; padding: 10px; }
progress:nth-child(3) { margin: 10px; padding: 10px; }
progress:nth-child(4) { margin: 5px; padding: 5px; }
progress:nth-child(5) { margin: 50px; padding: 50px; }
progress:nth-child(6) { margin: 100px; padding: 100px; }
progress:nth-child(7) { margin: 10px 0px 0px 0px; padding: 0px; }
progress:nth-child(8) { margin: 0px 10px 0px 0px; padding: 0px; }
progress:nth-child(9) { margin: 0px 0px 10px 0px; padding: 0px; }
progress:nth-child(10) { margin: 0px 0px 0px 10px; padding: 0px; }
progress:nth-child(11) { margin: 0px; padding: 10px 0px 0px 0px; }
progress:nth-child(12) { margin: 0px; padding: 0px 10px 0px 0px; }
progress:nth-child(13) { margin: 0px; padding: 0px 0px 10px 0px; }
progress:nth-child(14) { margin: 0px; padding: 0px 0px 0px 10px; }
progress:nth-child(15) { margin: 0px; padding: 2px 4px 6px 8px; }
progress:nth-child(16) { margin: 2px 4px 6px 8px; padding: 0px; }
</style>
<body>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
</body>
</html>

View File

@ -1,12 +0,0 @@
== values.html values-ref.html
== values-rtl.html values-rtl-ref.html
== margin-padding.html margin-padding-ref.html
== margin-padding-rtl.html margin-padding-rtl-ref.html
== bar-pseudo-element.html bar-pseudo-element-ref.html
== bar-pseudo-element-rtl.html bar-pseudo-element-rtl-ref.html
== indeterminate-style-width.html indeterminate-style-width-ref.html
# The following test is disabled but kept in the repository because the
# transformations will not behave exactly the same for <progress> and two divs.
# However, it would be possible to manually check those.
# == transformations.html transformations-ref.html

View File

@ -1,32 +0,0 @@
div.progress-element {
-moz-appearance: progressbar;
display: inline-block;
height: 1em;
width: 10em;
vertical-align: -0.2em;
/* Default style in case of there is -moz-appearance: none; */
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;
}
div.progress-bar {
-moz-appearance: progresschunk;
height: 100%;
/*
* We can't apply the following style to the reference because it will have
* underisable effectes:
* width: 100%;
*/
/* Default style in case of there is -moz-appearance: none; */
background-color: ThreeDShadow;
}
progress, progress::-moz-progress-bar, div.progress-element, div.progress-bar {
-moz-appearance: none;
}

View File

@ -1,78 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
body > div:nth-child(1) { -moz-transform: matrix(1, -0.2, 0, 1, 0, 0); }
body > div:nth-child(2) { -moz-transform: matrix(1, 0, 0.6, 1, 15em, 0); }
body > div:nth-child(3) { -moz-transform: rotate(30deg); }
body > div:nth-child(4) { -moz-transform: scale(2, 4); }
body > div:nth-child(5) { -moz-transform: scale(0.1, 0.4); }
body > div:nth-child(6) { -moz-transform: scale(1, 0.4); }
body > div:nth-child(7) { -moz-transform: scale(0.1, 1); }
body > div:nth-child(8) { -moz-transform: skew(30deg, -10deg); }
body > div:nth-child(9) { -moz-transform: skew(-30deg, 10deg); }
body > div:nth-child(10) { -moz-transform: translate(10px, 30px); }
body > div:nth-child(11) { -moz-transform: translate(30px, 10px); }
body > div:nth-child(12) { -moz-transform: translate(-10px, 30px); }
body > div:nth-child(13) { -moz-transform: translate(30px, -10px); }
body > div:nth-child(14) { -moz-transform: scale(0, 0); }
</style>
<body>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,36 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
progress:nth-child(1) { -moz-transform: matrix(1, -0.2, 0, 1, 0, 0); }
progress:nth-child(2) { -moz-transform: matrix(1, 0, 0.6, 1, 15em, 0); }
progress:nth-child(3) { -moz-transform: rotate(30deg); }
progress:nth-child(4) { -moz-transform: scale(2, 4); }
progress:nth-child(5) { -moz-transform: scale(0.1, 0.4); }
progress:nth-child(6) { -moz-transform: scale(1, 0.4); }
progress:nth-child(7) { -moz-transform: scale(0.1, 1); }
progress:nth-child(8) { -moz-transform: skew(30deg, -10deg); }
progress:nth-child(9) { -moz-transform: skew(-30deg, 10deg); }
progress:nth-child(10) { -moz-transform: translate(10px, 30px); }
progress:nth-child(11) { -moz-transform: translate(30px, 10px); }
progress:nth-child(12) { -moz-transform: translate(-10px, 30px); }
progress:nth-child(13) { -moz-transform: translate(30px, -10px); }
progress:nth-child(14) { -moz-transform: scale(0, 0); }
</style>
<body>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
<progress value='1'></progress>
</body>
</html>

View File

@ -1,58 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
div:nth-child(1) > .progress-bar { width: 100%; }
div:nth-child(2) > .progress-bar { width: 0%; }
div:nth-child(3) > .progress-bar { width: 10%; }
div:nth-child(4) > .progress-bar { width: 50%; }
div:nth-child(5) > .progress-bar { width: 0%; }
div:nth-child(6) > .progress-bar { width: 100%; }
div:nth-child(7) > .progress-bar { width: 42%; }
div:nth-child(8) > .progress-bar { width: 100%; }
div:nth-child(9) > .progress-bar { width: 100%; }
div:nth-child(10) > .progress-bar { width: 10%; }
</style>
<body>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,58 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<style>
div:nth-child(1) > .progress-bar { width: 100%; }
div:nth-child(2) > .progress-bar { width: 0%; }
div:nth-child(3) > .progress-bar { width: 10%; }
div:nth-child(4) > .progress-bar { width: 50%; }
div:nth-child(5) > .progress-bar { width: 0%; }
div:nth-child(6) > .progress-bar { width: 100%; }
div:nth-child(7) > .progress-bar { width: 42%; }
div:nth-child(8) > .progress-bar { width: 100%; }
div:nth-child(9) > .progress-bar { width: 100%; }
div:nth-child(10) > .progress-bar { width: 10%; }
</style>
<body dir='rtl'>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
<div class="progress-element">
<div class="progress-bar">
</div>
</div>
</body>
</html>

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<body dir='rtl'>
<progress value="1.0"></progress>
<progress value="0.0"></progress>
<progress value="0.1"></progress>
<progress value="0.5"></progress>
<progress value="-1"></progress>
<progress value="42"></progress>
<progress value="42" max="100"></progress>
<progress value="42" max="1"></progress>
<progress value="42" max="-1"></progress>
<progress value="0.1" max="-1"></progress>
</body>
</html>

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<progress value="1.0"></progress>
<progress value="0.0"></progress>
<progress value="0.1"></progress>
<progress value="0.5"></progress>
<progress value="-1"></progress>
<progress value="42"></progress>
<progress value="42" max="100"></progress>
<progress value="42" max="1"></progress>
<progress value="42" max="-1"></progress>
<progress value="0.1" max="-1"></progress>
</body>
</html>

View File

@ -59,6 +59,3 @@ include input/reftest.list
# output element
include output/reftest.list
# progress element
include progress/reftest.list

View File

@ -1,7 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<div style="-moz-appearance: progressbar; width:180px; height:6px;">
</div>
</body>
</html>

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<div style="overflow: hidden; -moz-appearance: progressbar; width:180px; height:40px;">
<div style="-moz-appearance: progresschunk; width:50%; height:100%;">
</div>
</div>
</body>
</html>

View File

@ -1,9 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<div style="-moz-appearance: progressbar; width:180px; height:6px;">
<div style="-moz-appearance: progresschunk; width:50%; height:100%;">
</div>
</div>
</body>
</html>

View File

@ -1,9 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<div style="-moz-appearance: progressbar; width:180px; height:40px;">
<div style="-moz-appearance: progresschunk; width:50%; height:100%;">
</div>
</div>
</body>
</html>

View File

@ -64,9 +64,3 @@ skip-if(!winWidget) == scroll-thumb-minimum-size-notheme.html scroll-thumb-minim
== border-radius.html border-radius-ref.html
== checkbox-dynamic-1.html checkbox-dynamic-1-ref.html
# These tests have been written to test the overflow of the window widget
# (bug 568825) but we can't test it on Windows and Cocoa because they have
# animated progress bars.
skip-if(cocoaWidget) skip-if(winWidget) == progress-overflow.html progress-overflow-ref.html
skip-if(cocoaWidget) skip-if(winWidget) != progress-overflow-small.html progress-nobar.html

View File

@ -668,35 +668,6 @@ output:-moz-ui-invalid {
input[type="file"] { height: 2em; }
}
progress {
-moz-appearance: progressbar;
display: inline-block;
vertical-align: -0.2em;
/* Default style in case of there is -moz-appearance: none; */
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;
}
::-moz-progress-bar {
/* Block styles that would change the type of frame we construct. */
display: inline-block ! important;
float: none ! important;
position: static ! important;
overflow: visible ! important;
-moz-appearance: progresschunk;
height: 100%;
width: 100%;
/* Default style in case of there is -moz-appearance: none; */
background-color: ThreeDShadow;
}
%if OSARCH==OS2
input {
font: medium serif; font-family: inherit

View File

@ -695,75 +695,32 @@ canvas {
}
/* focusable content: anything w/ tabindex >=0 is focusable */
abbr:-moz-focusring,
acronym:-moz-focusring,
address:-moz-focusring,
abbr:-moz-focusring, acronym:-moz-focusring, address:-moz-focusring,
applet:-moz-focusring,
b:-moz-focusring,
base:-moz-focusring,
big:-moz-focusring,
blockquote:-moz-focusring,
br:-moz-focusring,
canvas:-moz-focusring,
caption:-moz-focusring,
center:-moz-focusring,
cite:-moz-focusring,
code:-moz-focusring,
col:-moz-focusring,
colgroup:-moz-focusring,
dd:-moz-focusring,
del:-moz-focusring,
dfn:-moz-focusring,
dir:-moz-focusring,
div:-moz-focusring,
dl:-moz-focusring,
dt:-moz-focusring,
em:-moz-focusring,
b:-moz-focusring, base:-moz-focusring, big:-moz-focusring,
blockquote:-moz-focusring, br:-moz-focusring, canvas:-moz-focusring,
caption:-moz-focusring, center:-moz-focusring, cite:-moz-focusring,
code:-moz-focusring, col:-moz-focusring, colgroup:-moz-focusring,
dd:-moz-focusring, del:-moz-focusring, dfn:-moz-focusring, dir:-moz-focusring,
div:-moz-focusring, dl:-moz-focusring, dt:-moz-focusring, em:-moz-focusring,
embed:-moz-focusring,
fieldset:-moz-focusring,
font:-moz-focusring,
form:-moz-focusring,
h1:-moz-focusring,
h2:-moz-focusring,
h3:-moz-focusring,
h4:-moz-focusring,
h5:-moz-focusring,
h6:-moz-focusring,
hr:-moz-focusring,
i:-moz-focusring,
img:-moz-focusring,
ins:-moz-focusring,
kbd:-moz-focusring,
label:-moz-focusring,
legend:-moz-focusring,
li:-moz-focusring,
fieldset:-moz-focusring, font:-moz-focusring, form:-moz-focusring,
h1:-moz-focusring, h2:-moz-focusring, h3:-moz-focusring, h4:-moz-focusring,
h5:-moz-focusring, h6:-moz-focusring, hr:-moz-focusring, i:-moz-focusring,
img:-moz-focusring, ins:-moz-focusring, kbd:-moz-focusring,
label:-moz-focusring, legend:-moz-focusring, li:-moz-focusring,
link:-moz-focusring,
menu:-moz-focusring,
object:-moz-focusring,
ol:-moz-focusring,
p:-moz-focusring,
pre:-moz-focusring,
progress:-moz-focusring,
q:-moz-focusring,
s:-moz-focusring,
samp:-moz-focusring,
small:-moz-focusring,
span:-moz-focusring,
strike:-moz-focusring,
strong:-moz-focusring,
sub:-moz-focusring,
sup:-moz-focusring,
table:-moz-focusring,
tbody:-moz-focusring,
td:-moz-focusring,
tfoot:-moz-focusring,
th:-moz-focusring,
thead:-moz-focusring,
tr:-moz-focusring,
tt:-moz-focusring,
u:-moz-focusring,
ul:-moz-focusring,
var:-moz-focusring {
pre:-moz-focusring, q:-moz-focusring, s:-moz-focusring, samp:-moz-focusring,
small:-moz-focusring, span:-moz-focusring, strike:-moz-focusring,
strong:-moz-focusring, sub:-moz-focusring, sup:-moz-focusring,
table:-moz-focusring, tbody:-moz-focusring, td:-moz-focusring,
tfoot:-moz-focusring, th:-moz-focusring, thead:-moz-focusring,
tr:-moz-focusring, tt:-moz-focusring, u:-moz-focusring,
ul:-moz-focusring, var:-moz-focusring {
/* Don't specify the outline-color, we should always use initial value. */
outline: 1px dotted;
}

View File

@ -86,6 +86,3 @@ CSS_PSEUDO_ELEMENT(mozMathStretchy, ":-moz-math-stretchy", 0)
CSS_PSEUDO_ELEMENT(mozMathAnonymous, ":-moz-math-anonymous", 0)
#endif
// HTML5 Forms pseudo elements
CSS_PSEUDO_ELEMENT(mozProgressBar, ":-moz-progress-bar", 0)

View File

@ -75,7 +75,7 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
mBits(((PRUint32)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT),
mRefCnt(0)
{
PR_STATIC_ASSERT((PR_UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
PR_STATIC_ASSERT((PR_UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >
nsCSSPseudoElements::ePseudo_MAX);
mNextSibling = this;

View File

@ -1,64 +0,0 @@
<!DOCTYPE html>
<html>
<style>
div.progress-element {
/**
* The purpose of this test is to not show the native style.
* -moz-appearance: progressbar;
*/
display: inline-block;
height: 1em;
width: 10em;
vertical-align: -0.2em;
/* Default style in case of there is -moz-appearance: none; */
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;
}
div.progress-bar {
/**
* The purpose of this test is to not show the native style.
* -moz-appearance: progresschunk;
*/
height: 100%;
width: 100%;
/* Default style in case of there is -moz-appearance: none; */
background-color: ThreeDShadow;
}
div.progress-element { padding: 5px; }
body > div:nth-child(1) { -moz-appearance: none; }
body > div:nth-child(2) > .progress-bar { -moz-appearance: none; }
body > div:nth-child(3) { background-color: red; }
body > div:nth-child(4) > .progress-bar { background-color: red; }
body > div:nth-child(5) { border: 2px solid red; }
body > div:nth-child(6) > .progress-bar { border: 5px solid red; }
</style>
<body>
<div class="progress-element">
<div class="progress-bar"></div>
</div>
<div class="progress-element">
<div class="progress-bar"></div>
</div>
<div class="progress-element">
<div class="progress-bar"></div>
</div>
<div class="progress-element">
<div class="progress-bar"></div>
</div>
<div class="progress-element">
<div class="progress-bar"></div>
</div>
<div class="progress-element">
<div class="progress-bar"></div>
</div>
</body>
</html>

View File

@ -1,20 +0,0 @@
<!DOCTYPE html>
<html>
<style>
progress { padding: 5px }
body > progress:nth-child(1) { -moz-appearance: none; }
body > progress:nth-child(2)::-moz-progress-bar { -moz-appearance: none; }
body > progress:nth-child(3) { background-color: red; }
body > progress:nth-child(4)::-moz-progress-bar { background-color: red; }
body > progress:nth-child(5) { border: 2px solid red; }
body > progress:nth-child(6)::-moz-progress-bar { border: 5px solid red; }
</style>
<body>
<progress></progress>
<progress></progress>
<progress></progress>
<progress></progress>
<progress></progress>
<progress></progress>
</body>
</html>

View File

@ -1,2 +1 @@
skip-if(!cocoaWidget) != 507947.html about:blank
== progressbar-fallback-default-style.html progressbar-fallback-default-style-ref.html

View File

@ -49,7 +49,6 @@
#include "gfxASurface.h"
@class CellDrawView;
@class NSProgressBarCell;
class nsDeviceContext;
class nsNativeThemeCocoa : private nsNativeTheme,
@ -97,17 +96,13 @@ protected:
nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID);
nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame);
// Helpers for progressbar.
double GetProgressValue(nsIFrame* aFrame);
double GetProgressMaxValue(nsIFrame* aFrame);
// HITheme drawing routines
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
const HIRect& inBoxRect, PRBool inReadOnly,
nsEventStates inState);
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
PRBool inIsIndeterminate, PRBool inIsHorizontal,
double inValue, double inMaxValue, nsIFrame* aFrame);
PRInt32 inValue, PRInt32 inMaxValue, nsIFrame* aFrame);
void DrawTab(CGContextRef context, HIRect inBoxRect, nsEventStates inState,
nsIFrame* aFrame);
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
@ -153,7 +148,6 @@ private:
NSSearchFieldCell* mSearchFieldCell;
NSPopUpButtonCell* mDropdownCell;
NSComboBoxCell* mComboBoxCell;
NSProgressBarCell* mProgressBarCell;
CellDrawView* mCellDrawView;
};

View File

@ -61,7 +61,6 @@
#include "nsCocoaWindow.h"
#include "nsNativeThemeColors.h"
#include "nsIScrollableFrame.h"
#include "nsIDOMHTMLProgressElement.h"
#include "gfxContext.h"
#include "gfxQuartzSurface.h"
@ -111,108 +110,6 @@ extern "C" {
@end
/**
* NSProgressBarCell is used to draw progress bars of any size.
*/
@interface NSProgressBarCell : NSCell
{
/*All instance variables are private*/
double mValue;
double mMax;
bool mIsIndeterminate;
bool mIsHorizontal;
}
- (void)setValue:(double)value;
- (double)value;
- (void)setMax:(double)max;
- (double)max;
- (void)setIndeterminate:(bool)aIndeterminate;
- (bool)isIndeterminate;
- (void)setHorizontal:(bool)aIsHorizontal;
- (bool)isHorizontal;
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
@end
@implementation NSProgressBarCell
- (void)setMax:(double)aMax
{
mMax = aMax;
}
- (double)max
{
return mMax;
}
- (void)setValue:(double)aValue
{
mValue = aValue;
}
- (double)value
{
return mValue;
}
- (void)setIndeterminate:(bool)aIndeterminate
{
mIsIndeterminate = aIndeterminate;
}
- (bool)isIndeterminate
{
return mIsIndeterminate;
}
- (void)setHorizontal:(bool)aIsHorizontal
{
mIsHorizontal = aIsHorizontal;
}
- (bool)isHorizontal
{
return mIsHorizontal;
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
CGContext* cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
HIThemeTrackDrawInfo tdi;
tdi.version = 0;
tdi.min = 0;
tdi.value = PR_INT32_MAX * (mValue / mMax);
tdi.max = PR_INT32_MAX;
tdi.bounds = NSRectToCGRect(cellFrame);
tdi.attributes = mIsHorizontal ? kThemeTrackHorizontal : 0;
tdi.enableState = [self controlTint] == NSClearControlTint ? kThemeTrackInactive
: kThemeTrackActive;
NSControlSize size = [self controlSize];
if (size == NSRegularControlSize) {
tdi.kind = mIsIndeterminate ? kThemeLargeIndeterminateBar
: kThemeLargeProgressBar;
} else {
NS_ASSERTION(size == NSSmallControlSize,
"We shouldn't have another size than small and regular for the moment");
tdi.kind = mIsIndeterminate ? kThemeMediumIndeterminateBar
: kThemeMediumProgressBar;
}
PRInt32 stepsPerSecond = mIsIndeterminate ? 60 : 30;
PRInt32 milliSecondsPerStep = 1000 / stepsPerSecond;
tdi.trackInfo.progress.phase = PR_IntervalToMilliseconds(PR_IntervalNow()) /
milliSecondsPerStep % 32;
HIThemeDrawTrack(&tdi, NULL, cgContext, kHIThemeOrientationNormal);
}
@end
// Workaround for Bug 542048
// On 64-bit, NSSearchFieldCells don't draw focus rings.
#if defined(__x86_64__)
@ -368,8 +265,6 @@ nsNativeThemeCocoa::nsNativeThemeCocoa()
[mComboBoxCell setEditable:YES];
[mComboBoxCell setFocusRingType:NSFocusRingTypeExterior];
mProgressBarCell = [[NSProgressBarCell alloc] init];
mCellDrawView = [[CellDrawView alloc] init];
NS_OBJC_END_TRY_ABORT_BLOCK;
@ -379,7 +274,6 @@ nsNativeThemeCocoa::~nsNativeThemeCocoa()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
[mProgressBarCell release];
[mPushButtonCell release];
[mRadioButtonCell release];
[mCheckboxCell release];
@ -1137,65 +1031,39 @@ nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
NS_OBJC_END_TRY_ABORT_BLOCK;
}
static const CellRenderSettings progressSettings[2] = {
// Determined settings.
static void
RenderProgress(CGContextRef cgContext, const HIRect& aRenderRect, void* aData)
{
{
NSZeroSize, // mini
NSMakeSize(0, 10), // small
NSMakeSize(0, 16) // regular
},
{
NSZeroSize, NSZeroSize, NSZeroSize
},
{
{ // Leopard
{0, 0, 0, 0}, // mini
{1, 1, 1, 1}, // small
{1, 1, 1, 1} // regular
HIThemeTrackDrawInfo* tdi = (HIThemeTrackDrawInfo*)aData;
tdi->bounds = aRenderRect;
HIThemeDrawTrack(tdi, NULL, cgContext, kHIThemeOrientationNormal);
}
}
},
// There is no horizontal margin in regular undetermined size.
{
{
NSZeroSize, // mini
NSMakeSize(0, 10), // small
NSMakeSize(0, 16) // regular
},
{
NSZeroSize, NSZeroSize, NSZeroSize
},
{
{ // Leopard
{0, 0, 0, 0}, // mini
{1, 1, 1, 1}, // small
{0, 1, 0, 1} // regular
}
}
}
};
void
nsNativeThemeCocoa::DrawProgress(CGContextRef cgContext, const HIRect& inBoxRect,
PRBool inIsIndeterminate, PRBool inIsHorizontal,
double inValue, double inMaxValue,
PRInt32 inValue, PRInt32 inMaxValue,
nsIFrame* aFrame)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NSProgressBarCell* cell = mProgressBarCell;
HIThemeTrackDrawInfo tdi;
[cell setValue:inValue];
[cell setMax:inMaxValue];
[cell setIndeterminate:inIsIndeterminate];
[cell setHorizontal:inIsHorizontal];
[cell setControlTint:(FrameIsInActiveWindow(aFrame) ? [NSColor currentControlTint]
: NSClearControlTint)];
PRInt32 stepsPerSecond = inIsIndeterminate ? 60 : 30;
PRInt32 milliSecondsPerStep = 1000 / stepsPerSecond;
DrawCellWithSnapping(cell, cgContext, inBoxRect,
progressSettings[inIsIndeterminate],
VerticalAlignFactor(aFrame), mCellDrawView,
tdi.version = 0;
tdi.kind = inIsIndeterminate ? kThemeMediumIndeterminateBar: kThemeMediumProgressBar;
tdi.bounds = inBoxRect;
tdi.min = 0;
tdi.max = inMaxValue;
tdi.value = inValue;
tdi.attributes = inIsHorizontal ? kThemeTrackHorizontal : 0;
tdi.enableState = FrameIsInActiveWindow(aFrame) ? kThemeTrackActive : kThemeTrackInactive;
tdi.trackInfo.progress.phase = PR_IntervalToMilliseconds(PR_IntervalNow()) /
milliSecondsPerStep % 16;
RenderTransformedHIThemeControl(cgContext, inBoxRect, RenderProgress, &tdi,
IsFrameRTL(aFrame));
NS_OBJC_END_TRY_ABORT_BLOCK;
@ -1891,13 +1759,13 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) {
NS_WARNING("Unable to animate progressbar!");
}
DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame, eventState),
DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame),
PR_TRUE, GetProgressValue(aFrame),
GetProgressMaxValue(aFrame), aFrame);
break;
case NS_THEME_PROGRESSBAR_VERTICAL:
DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame, eventState),
DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame),
PR_FALSE, GetProgressValue(aFrame),
GetProgressMaxValue(aFrame), aFrame);
break;
@ -2659,39 +2527,3 @@ nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType)
return eUnknownTransparency;
}
}
double
nsNativeThemeCocoa::GetProgressValue(nsIFrame* aFrame)
{
// When we are using the HTML progress element,
// we can get the value from the IDL property.
if (aFrame) {
nsCOMPtr<nsIDOMHTMLProgressElement> progress =
do_QueryInterface(aFrame->GetContent());
if (progress) {
double value;
progress->GetValue(&value);
return value;
}
}
return (double)CheckIntAttr(aFrame, nsWidgetAtoms::value, 0);
}
double
nsNativeThemeCocoa::GetProgressMaxValue(nsIFrame* aFrame)
{
// When we are using the HTML progress element,
// we can get the max from the IDL property.
if (aFrame) {
nsCOMPtr<nsIDOMHTMLProgressElement> progress =
do_QueryInterface(aFrame->GetContent());
if (progress) {
double max;
progress->GetMax(&max);
return max;
}
}
return (double)PR_MAX(CheckIntAttr(aFrame, nsWidgetAtoms::max, 100), 1);
}

View File

@ -48,7 +48,6 @@
#include <string.h>
#include "gtkdrawing.h"
#include "nsDebug.h"
#include "prinrval.h"
#include <math.h>
@ -2236,8 +2235,7 @@ moz_gtk_progressbar_paint(GdkDrawable* drawable, GdkRectangle* rect,
static gint
moz_gtk_progress_chunk_paint(GdkDrawable* drawable, GdkRectangle* rect,
GdkRectangle* cliprect, GtkTextDirection direction,
GtkThemeWidgetType widget)
GdkRectangle* cliprect, GtkTextDirection direction)
{
GtkStyle* style;
@ -2247,31 +2245,6 @@ moz_gtk_progress_chunk_paint(GdkDrawable* drawable, GdkRectangle* rect,
style = gProgressWidget->style;
TSOffsetStyleGCs(style, rect->x, rect->y);
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE) {
/**
* The bar's width and the bar speed are set depending of the progress
* bar size. These could also be constant for all progress bars easily.
*/
/* The bar is using a fifth of the element size, based on GtkProgressBar
* activity-blocks property. */
const gint barWidth = MAX(1, rect->width / 5);
/* Represents the travel that has to be done for a complete cycle. */
const gint travel = 2 * (rect->width - barWidth);
/* period equals to travel / pixelsPerMillisecond
* where pixelsPerMillisecond equals rect->width / 1000.0.
* This is equivalent to 1600. */
const guint period = 1600;
const gint t = PR_IntervalToMilliseconds(PR_IntervalNow()) % period;
const gint dx = travel * t / period;
rect->x += (dx < travel / 2) ? dx : travel - dx;
rect->width = barWidth;
}
gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
cliprect, gProgressWidget, "bar", rect->x, rect->y,
rect->width, rect->height);
@ -2985,7 +2958,6 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
case MOZ_GTK_SCALE_THUMB_VERTICAL:
case MOZ_GTK_GRIPPER:
case MOZ_GTK_PROGRESS_CHUNK:
case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
case MOZ_GTK_EXPANDER:
case MOZ_GTK_TREEVIEW_EXPANDER:
case MOZ_GTK_TOOLBAR_SEPARATOR:
@ -3332,9 +3304,8 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
return moz_gtk_progressbar_paint(drawable, rect, cliprect, direction);
break;
case MOZ_GTK_PROGRESS_CHUNK:
case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
return moz_gtk_progress_chunk_paint(drawable, rect, cliprect,
direction, widget);
direction);
break;
case MOZ_GTK_TAB:
return moz_gtk_tab_paint(drawable, rect, cliprect, state,

View File

@ -178,8 +178,6 @@ typedef enum {
MOZ_GTK_PROGRESSBAR,
/* Paints a progress chunk of a GtkProgressBar. */
MOZ_GTK_PROGRESS_CHUNK,
/* Paints a progress chunk of an indeterminated GtkProgressBar. */
MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE,
/* Paints a tab of a GtkNotebook. flags is a GtkTabFlags, defined above. */
MOZ_GTK_TAB,
/* Paints the background and border of a GtkNotebook. */

View File

@ -566,14 +566,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
break;
case NS_THEME_PROGRESSBAR_CHUNK:
case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
{
nsIFrame* stateFrame = aFrame->GetParent();
nsEventStates eventStates = GetContentState(stateFrame, aWidgetType);
aGtkWidgetType = IsIndeterminateProgress(stateFrame, eventStates)
? MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE
: MOZ_GTK_PROGRESS_CHUNK;
}
aGtkWidgetType = MOZ_GTK_PROGRESS_CHUNK;
break;
case NS_THEME_TAB_SCROLLARROW_BACK:
case NS_THEME_TAB_SCROLLARROW_FORWARD:
@ -880,13 +873,6 @@ nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
}
}
// Indeterminate progress bar are animated.
if (gtkWidgetType == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE) {
if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) {
NS_WARNING("unable to animate widget!");
}
}
return NS_OK;
}

View File

@ -60,7 +60,6 @@
#include <malloc.h>
#include "nsWindow.h"
#include "nsIComboboxControlFrame.h"
#include "prinrval.h"
#include "gfxPlatform.h"
#include "gfxContext.h"
@ -344,32 +343,6 @@ static CaptionButtonPadding buttonData[3] = {
}
};
/**
* Progress bar related constants.
* These values are found by experimenting and comparing against native widgets
* used by the system. They are very unlikely exact but try to not be too wrong.
*/
// PP_CHUNK is overflowing on the bottom for no appearant reasons.
// This is a fix around this issue.
static const PRInt32 kProgressDeterminedXPOverflow = 11;
// Same thing but for PP_FILL.
static const PRInt32 kProgressDeterminedVistaOverflow = 4;
// Same thing but for indeterminate progress bar.
// The value is the same for PP_CHUNK and PP_MOVEOVERLAY in that case.
static const PRInt32 kProgressIndeterminateOverflow = 2;
// The width of the overlay used to animate the progress bar (Vista and later).
static const PRInt32 kProgressVistaOverlayWidth = 120;
// The width of the overlay used to for indeterminate progress bars on XP.
static const PRInt32 kProgressXPOverlayWidth = 55;
// Speed (px per ms) of the animation for determined Vista and later progress bars.
static const double kProgressDeterminedVistaSpeed = 0.225;
// Speed (px per ms) of the animation for indeterminate progress bars.
static const double kProgressIndeterminateSpeed = 0.175;
// Delay (in ms) between two indeterminate progress bar cycles.
static const PRInt32 kProgressIndeterminateDelay = 500;
// Delay (in ms) between two determinate progress bar animation on Vista/7.
static const PRInt32 kProgressDeterminedVistaDelay = 1000;
// Adds "hot" caption button padding to minimum widget size.
static void AddPaddingRect(nsIntSize* aSize, CaptionButton button) {
if (!aSize)
@ -685,12 +658,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
return NS_OK;
}
case NS_THEME_PROGRESSBAR_CHUNK: {
nsIFrame* stateFrame = aFrame->GetParent();
nsEventStates eventStates = GetContentState(stateFrame, aWidgetType);
// If the element is indeterminate, we are going to render it ourself so
// we have to return aPart = -1.
aPart = IsIndeterminateProgress(stateFrame, eventStates)
? -1 : nsUXThemeData::sIsVistaOrLater ? PP_FILL : PP_CHUNK;
aPart = PP_CHUNK;
aState = TS_NORMAL;
return NS_OK;
}
@ -1321,14 +1289,6 @@ RENDER_AGAIN:
}
else if (aWidgetType == NS_THEME_WINDOW_BUTTON_CLOSE) {
OffsetBackgroundRect(widgetRect, CAPTIONBUTTON_CLOSE);
} else if (aWidgetType == NS_THEME_PROGRESSBAR_CHUNK) {
nsIFrame* stateFrame = aFrame->GetParent();
nsEventStates eventStates = GetContentState(stateFrame, aWidgetType);
widgetRect.bottom -= IsIndeterminateProgress(stateFrame, eventStates)
? kProgressIndeterminateOverflow
: nsUXThemeData::sIsVistaOrLater
? kProgressDeterminedVistaOverflow
: kProgressDeterminedXPOverflow;
}
// widgetRect is the bounding box for a widget, yet the scale track is only
@ -1563,58 +1523,6 @@ RENDER_AGAIN:
ctx->Restore();
ctx->SetOperator(currentOp);
} else if (aWidgetType == NS_THEME_PROGRESSBAR_CHUNK) {
/**
* Here, we draw the animated part of the progress bar.
* A progress bar has always an animated part on Windows Vista and later.
* On Windows XP, a progress bar has an animated part when in an
* indeterminated state.
* When the progress bar is indeterminated, no background is painted so we
* only see the animated part.
* When the progress bar is determinated, the animated part is a glow draw
* on top of the background (PP_FILL).
*/
nsIFrame* stateFrame = aFrame->GetParent();
nsEventStates eventStates = GetContentState(stateFrame, aWidgetType);
bool indeterminate = IsIndeterminateProgress(stateFrame, eventStates);
if (indeterminate || nsUXThemeData::sIsVistaOrLater) {
if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 60)) {
NS_WARNING("unable to animate progress widget!");
}
const PRInt32 overlayWidth = nsUXThemeData::sIsVistaOrLater
? kProgressVistaOverlayWidth
: kProgressXPOverlayWidth;
const double pixelsPerMillisecond = indeterminate
? kProgressIndeterminateSpeed
: kProgressDeterminedVistaSpeed;
const PRInt32 delay = indeterminate ? kProgressIndeterminateDelay
: kProgressDeterminedVistaDelay;
const PRInt32 frameWidth = widgetRect.right - widgetRect.left;
const PRInt32 animationWidth = frameWidth + overlayWidth +
static_cast<PRInt32>(pixelsPerMillisecond * delay);
const double interval = animationWidth / pixelsPerMillisecond;
// We have to pass a double* to modf and we can't pass NULL.
double tempValue;
double ratio = modf(PR_IntervalToMilliseconds(PR_IntervalNow())/interval,
&tempValue);
// If the frame direction is RTL, we want to have the animation going RTL.
// ratio is in [0.0; 1.0[ range, inverting it reverse the animation.
if (IsFrameRTL(aFrame)) {
ratio = 1.0 - ratio;
}
PRInt32 dx = static_cast<PRInt32>(animationWidth * ratio) - overlayWidth;
RECT overlayRect = widgetRect;
overlayRect.left += dx;
overlayRect.right = overlayRect.left + overlayWidth;
nsUXThemeData::drawThemeBG(theme, hdc,
nsUXThemeData::sIsVistaOrLater ? PP_MOVEOVERLAY
: PP_CHUNK,
state, &overlayRect, &clipRect);
}
}

View File

@ -116,8 +116,6 @@
#define PP_BARVERT 2
#define PP_CHUNK 3
#define PP_CHUNKVERT 4
#define PP_FILL 5
#define PP_MOVEOVERLAY 8
// Tab constants
#define TABP_TAB 4

View File

@ -100,9 +100,6 @@ endif
LOCAL_INCLUDES += \
-I$(srcdir)/../$(MOZ_WIDGET_TOOLKIT) \
-I$(srcdir)/../shared \
-I$(topsrcdir)/layout/forms \
-I$(topsrcdir)/layout/generic \
-I$(topsrcdir)/layout/xul/base/src \
-I$(srcdir) \
$(NULL)

View File

@ -51,7 +51,6 @@
#include "nsThemeConstants.h"
#include "nsIComponentManager.h"
#include "nsPIDOMWindow.h"
#include "nsProgressFrame.h"
nsNativeTheme::nsNativeTheme()
: mAnimatedContentTimeout(PR_UINT32_MAX)
@ -252,19 +251,6 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
}
}
/**
* Progress bar appearance should be the same for the bar and the container
* frame. nsProgressFrame owns the logic and will tell us what we should do.
*/
if (aWidgetType == NS_THEME_PROGRESSBAR_CHUNK ||
aWidgetType == NS_THEME_PROGRESSBAR) {
nsProgressFrame* progressFrame = do_QueryFrame(aWidgetType == NS_THEME_PROGRESSBAR_CHUNK
? aFrame->GetParent() : aFrame);
if (progressFrame) {
return !progressFrame->ShouldUseNativeStyle();
}
}
return (aWidgetType == NS_THEME_BUTTON ||
aWidgetType == NS_THEME_TEXTFIELD ||
aWidgetType == NS_THEME_TEXTFIELD_MULTILINE ||
@ -457,16 +443,11 @@ nsNativeTheme::IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset)
// progressbar:
PRBool
nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame,
nsEventStates aEventStates)
nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame)
{
if (!aFrame)
return PR_FALSE;
if (aFrame->GetContent()->IsHTML(nsWidgetAtoms::progress)) {
return aEventStates.HasState(NS_EVENT_STATE_INDETERMINATE);
}
return aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::mode,
NS_LITERAL_STRING("undetermined"),
eCaseMatters);

View File

@ -160,7 +160,15 @@ class nsNativeTheme : public nsITimerCallback
PRBool IsHorizontal(nsIFrame* aFrame);
// progressbar:
PRBool IsIndeterminateProgress(nsIFrame* aFrame, nsEventStates aEventStates);
PRBool IsIndeterminateProgress(nsIFrame* aFrame);
PRInt32 GetProgressValue(nsIFrame* aFrame) {
return CheckIntAttr(aFrame, nsWidgetAtoms::value, 0);
}
PRInt32 GetProgressMaxValue(nsIFrame* aFrame) {
return PR_MAX(CheckIntAttr(aFrame, nsWidgetAtoms::max, 100), 1);
}
// textfield:
PRBool IsReadOnly(nsIFrame* aFrame) {

View File

@ -104,7 +104,6 @@ WIDGET_ATOM(open, "open") // Whether or not a menu, tree, etc. is open
WIDGET_ATOM(orient, "orient")
WIDGET_ATOM(pageincrement, "pageincrement")
WIDGET_ATOM(parentfocused, "parentfocused")
WIDGET_ATOM(progress, "progress")
WIDGET_ATOM(radio, "radio")
WIDGET_ATOM(readonly, "readonly")
WIDGET_ATOM(Reload, "Reload")