diff --git a/content/html/content/src/nsHTMLProgressElement.cpp b/content/html/content/src/nsHTMLProgressElement.cpp index c639b27b322..191ca89acd6 100644 --- a/content/html/content/src/nsHTMLProgressElement.cpp +++ b/content/html/content/src/nsHTMLProgressElement.cpp @@ -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) diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index b913716ad95..713d1ccd52c 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -262,7 +262,6 @@ _TEST_FILES = \ test_bug641219.html \ test_bug643051.html \ test_bug583514.html \ - test_bug514437.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/content/test/test_bug514437.html b/content/html/content/test/test_bug514437.html deleted file mode 100644 index 8e02bce7765..00000000000 --- a/content/html/content/test/test_bug514437.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - Test for Bug 514437 and Bug 633913 - - - - - -Mozilla Bug 514437 -and -Mozilla Bug 633913 -

- - -
-
-
- - diff --git a/content/html/content/test/test_bug588683-1.html b/content/html/content/test/test_bug588683-1.html index 44f7977bc7f..0cbdd8162b1 100644 --- a/content/html/content/test/test_bug588683-1.html +++ b/content/html/content/test/test_bug588683-1.html @@ -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) { diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 769aec2e73a..af1aa23f1f5 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -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, diff --git a/layout/forms/Makefile.in b/layout/forms/Makefile.in index 6fb5c1f0797..78a28ef46f9 100644 --- a/layout/forms/Makefile.in +++ b/layout/forms/Makefile.in @@ -72,7 +72,6 @@ CPPSRCS = \ nsGfxButtonControlFrame.cpp \ nsGfxCheckboxControlFrame.cpp \ nsGfxRadioControlFrame.cpp \ - nsProgressFrame.cpp \ nsTextControlFrame.cpp \ nsHTMLButtonControlFrame.cpp \ nsImageControlFrame.cpp \ diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp deleted file mode 100644 index 6c572fdc434..00000000000 --- a/layout/forms/nsProgressFrame.cpp +++ /dev/null @@ -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 (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 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(this), PR_FALSE); - nsContentUtils::DestroyAnonymousContent(&mBarDiv); - nsHTMLContainerFrame::DestroyFrom(aDestructRoot); -} - -nsresult -nsProgressFrame::CreateAnonymousContent(nsTArray& aElements) -{ - // Get the NodeInfoManager and tag necessary to create the progress bar div. - nsCOMPtr doc = mContent->GetDocument(); - - nsCOMPtr 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 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 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(this), - NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) && - !PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(), - NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND); -} - diff --git a/layout/forms/nsProgressFrame.h b/layout/forms/nsProgressFrame.h deleted file mode 100644 index 4ff4ee0ec4d..00000000000 --- a/layout/forms/nsProgressFrame.h +++ /dev/null @@ -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 (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& 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 mBarDiv; -}; - -#endif - diff --git a/layout/generic/nsHTMLParts.h b/layout/generic/nsHTMLParts.h index 4428c865d3f..56f323a8c0a 100644 --- a/layout/generic/nsHTMLParts.h +++ b/layout/generic/nsHTMLParts.h @@ -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* diff --git a/layout/generic/nsQueryFrame.h b/layout/generic/nsQueryFrame.h index e88fcdf919e..e474daa9a13 100644 --- a/layout/generic/nsQueryFrame.h +++ b/layout/generic/nsQueryFrame.h @@ -185,7 +185,6 @@ public: nsPageFrame_id, nsPlaceholderFrame_id, nsPopupSetFrame_id, - nsProgressFrame_id, nsProgressMeterFrame_id, nsResizerFrame_id, nsRootBoxFrame_id, diff --git a/layout/reftests/bugs/474336-1-ref.xul b/layout/reftests/bugs/474336-1-ref.xul index 6d11e409231..d9d75462d8c 100644 --- a/layout/reftests/bugs/474336-1-ref.xul +++ b/layout/reftests/bugs/474336-1-ref.xul @@ -10,7 +10,6 @@ background-color: blue; } #prog .progress-bar { - -moz-appearance: none; border-radius: 3px 3px; background-color: red; } diff --git a/layout/reftests/bugs/474336-1.xul b/layout/reftests/bugs/474336-1.xul index 958d6c49832..ec918284153 100644 --- a/layout/reftests/bugs/474336-1.xul +++ b/layout/reftests/bugs/474336-1.xul @@ -10,7 +10,6 @@ background-color: blue; } #prog .progress-bar { - -moz-appearance: none; border-radius: 3px 3px; background-color: red; } diff --git a/layout/reftests/forms/progress/bar-pseudo-element-ref.html b/layout/reftests/forms/progress/bar-pseudo-element-ref.html deleted file mode 100644 index ae95d4e233d..00000000000 --- a/layout/reftests/forms/progress/bar-pseudo-element-ref.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/bar-pseudo-element-rtl-ref.html b/layout/reftests/forms/progress/bar-pseudo-element-rtl-ref.html deleted file mode 100644 index 102fb61f5c5..00000000000 --- a/layout/reftests/forms/progress/bar-pseudo-element-rtl-ref.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/bar-pseudo-element-rtl.html b/layout/reftests/forms/progress/bar-pseudo-element-rtl.html deleted file mode 100644 index 711dc26ba47..00000000000 --- a/layout/reftests/forms/progress/bar-pseudo-element-rtl.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/bar-pseudo-element.html b/layout/reftests/forms/progress/bar-pseudo-element.html deleted file mode 100644 index 15caf21ef53..00000000000 --- a/layout/reftests/forms/progress/bar-pseudo-element.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/indeterminate-style-width-ref.html b/layout/reftests/forms/progress/indeterminate-style-width-ref.html deleted file mode 100644 index 8a135b2ea4c..00000000000 --- a/layout/reftests/forms/progress/indeterminate-style-width-ref.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - diff --git a/layout/reftests/forms/progress/indeterminate-style-width.html b/layout/reftests/forms/progress/indeterminate-style-width.html deleted file mode 100644 index f5db8ff6661..00000000000 --- a/layout/reftests/forms/progress/indeterminate-style-width.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/margin-padding-ref.html b/layout/reftests/forms/progress/margin-padding-ref.html deleted file mode 100644 index 33f35c306c7..00000000000 --- a/layout/reftests/forms/progress/margin-padding-ref.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/margin-padding-rtl-ref.html b/layout/reftests/forms/progress/margin-padding-rtl-ref.html deleted file mode 100644 index dcf76f0f3b8..00000000000 --- a/layout/reftests/forms/progress/margin-padding-rtl-ref.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/margin-padding-rtl.html b/layout/reftests/forms/progress/margin-padding-rtl.html deleted file mode 100644 index fc445c36c45..00000000000 --- a/layout/reftests/forms/progress/margin-padding-rtl.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/margin-padding.html b/layout/reftests/forms/progress/margin-padding.html deleted file mode 100644 index fe4f3d003cd..00000000000 --- a/layout/reftests/forms/progress/margin-padding.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/reftest.list b/layout/reftests/forms/progress/reftest.list deleted file mode 100644 index 1412ed7d90a..00000000000 --- a/layout/reftests/forms/progress/reftest.list +++ /dev/null @@ -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 and two divs. -# However, it would be possible to manually check those. -# == transformations.html transformations-ref.html diff --git a/layout/reftests/forms/progress/style.css b/layout/reftests/forms/progress/style.css deleted file mode 100644 index 63db367696c..00000000000 --- a/layout/reftests/forms/progress/style.css +++ /dev/null @@ -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; -} diff --git a/layout/reftests/forms/progress/transformations-ref.html b/layout/reftests/forms/progress/transformations-ref.html deleted file mode 100644 index 7182d9858c5..00000000000 --- a/layout/reftests/forms/progress/transformations-ref.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/transformations.html b/layout/reftests/forms/progress/transformations.html deleted file mode 100644 index d185f476086..00000000000 --- a/layout/reftests/forms/progress/transformations.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/values-ref.html b/layout/reftests/forms/progress/values-ref.html deleted file mode 100644 index 048e1164ca8..00000000000 --- a/layout/reftests/forms/progress/values-ref.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/values-rtl-ref.html b/layout/reftests/forms/progress/values-rtl-ref.html deleted file mode 100644 index 99bf9fb2a78..00000000000 --- a/layout/reftests/forms/progress/values-rtl-ref.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/layout/reftests/forms/progress/values-rtl.html b/layout/reftests/forms/progress/values-rtl.html deleted file mode 100644 index 6a143b0c198..00000000000 --- a/layout/reftests/forms/progress/values-rtl.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/progress/values.html b/layout/reftests/forms/progress/values.html deleted file mode 100644 index 3c5e3e80b73..00000000000 --- a/layout/reftests/forms/progress/values.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/layout/reftests/forms/reftest.list b/layout/reftests/forms/reftest.list index ebe9a2f2638..5c9905b83b9 100644 --- a/layout/reftests/forms/reftest.list +++ b/layout/reftests/forms/reftest.list @@ -59,6 +59,3 @@ include input/reftest.list # output element include output/reftest.list - -# progress element -include progress/reftest.list diff --git a/layout/reftests/native-theme/progress-nobar.html b/layout/reftests/native-theme/progress-nobar.html deleted file mode 100644 index a485d38c9f5..00000000000 --- a/layout/reftests/native-theme/progress-nobar.html +++ /dev/null @@ -1,7 +0,0 @@ - - - -
-
- - diff --git a/layout/reftests/native-theme/progress-overflow-ref.html b/layout/reftests/native-theme/progress-overflow-ref.html deleted file mode 100644 index 22b3dbeddc7..00000000000 --- a/layout/reftests/native-theme/progress-overflow-ref.html +++ /dev/null @@ -1,10 +0,0 @@ - - - -
-
-
-
- - - diff --git a/layout/reftests/native-theme/progress-overflow-small.html b/layout/reftests/native-theme/progress-overflow-small.html deleted file mode 100644 index 96bccb29a68..00000000000 --- a/layout/reftests/native-theme/progress-overflow-small.html +++ /dev/null @@ -1,9 +0,0 @@ - - - -
-
-
-
- - diff --git a/layout/reftests/native-theme/progress-overflow.html b/layout/reftests/native-theme/progress-overflow.html deleted file mode 100644 index d5611c473b0..00000000000 --- a/layout/reftests/native-theme/progress-overflow.html +++ /dev/null @@ -1,9 +0,0 @@ - - - -
-
-
-
- - diff --git a/layout/reftests/native-theme/reftest.list b/layout/reftests/native-theme/reftest.list index d967068d630..4f59f445155 100644 --- a/layout/reftests/native-theme/reftest.list +++ b/layout/reftests/native-theme/reftest.list @@ -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 diff --git a/layout/style/forms.css b/layout/style/forms.css index 16c97459da0..1c5f1bc3ca2 100644 --- a/layout/style/forms.css +++ b/layout/style/forms.css @@ -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 diff --git a/layout/style/html.css b/layout/style/html.css index a0da93ca2db..908dc2a5079 100644 --- a/layout/style/html.css +++ b/layout/style/html.css @@ -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; } diff --git a/layout/style/nsCSSPseudoElementList.h b/layout/style/nsCSSPseudoElementList.h index bd2b5b45b8c..14507e572a6 100644 --- a/layout/style/nsCSSPseudoElementList.h +++ b/layout/style/nsCSSPseudoElementList.h @@ -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) - diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index ba7a70aec27..e44688db10b 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -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; diff --git a/widget/reftests/progressbar-fallback-default-style-ref.html b/widget/reftests/progressbar-fallback-default-style-ref.html deleted file mode 100644 index 19cee016917..00000000000 --- a/widget/reftests/progressbar-fallback-default-style-ref.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - diff --git a/widget/reftests/progressbar-fallback-default-style.html b/widget/reftests/progressbar-fallback-default-style.html deleted file mode 100644 index 7594e655563..00000000000 --- a/widget/reftests/progressbar-fallback-default-style.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - diff --git a/widget/reftests/reftest.list b/widget/reftests/reftest.list index 1cf1e1f3f3a..36337fc45e0 100644 --- a/widget/reftests/reftest.list +++ b/widget/reftests/reftest.list @@ -1,2 +1 @@ skip-if(!cocoaWidget) != 507947.html about:blank -== progressbar-fallback-default-style.html progressbar-fallback-default-style-ref.html diff --git a/widget/src/cocoa/nsNativeThemeCocoa.h b/widget/src/cocoa/nsNativeThemeCocoa.h index 7efbfb22233..79403605151 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/widget/src/cocoa/nsNativeThemeCocoa.h @@ -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; }; diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index fe4255384ee..cbb326e2383 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -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,66 +1031,40 @@ nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind, NS_OBJC_END_TRY_ABORT_BLOCK; } -static const CellRenderSettings progressSettings[2] = { - // Determined settings. - { - { - 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 - } - } - }, - // 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 - } - } - } -}; +static void +RenderProgress(CGContextRef cgContext, const HIRect& aRenderRect, void* aData) +{ + HIThemeTrackDrawInfo* tdi = (HIThemeTrackDrawInfo*)aData; + tdi->bounds = aRenderRect; + HIThemeDrawTrack(tdi, NULL, cgContext, kHIThemeOrientationNormal); +} 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, - IsFrameRTL(aFrame)); + 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 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 progress = - do_QueryInterface(aFrame->GetContent()); - if (progress) { - double max; - progress->GetMax(&max); - return max; - } - } - - return (double)PR_MAX(CheckIntAttr(aFrame, nsWidgetAtoms::max, 100), 1); -} diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index d824ed65d8b..dec76cc3d71 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -48,7 +48,6 @@ #include #include "gtkdrawing.h" #include "nsDebug.h" -#include "prinrval.h" #include @@ -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, diff --git a/widget/src/gtk2/gtkdrawing.h b/widget/src/gtk2/gtkdrawing.h index 32bdc719f79..283faa2ccc0 100644 --- a/widget/src/gtk2/gtkdrawing.h +++ b/widget/src/gtk2/gtkdrawing.h @@ -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. */ diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 6cc55d2b191..2198d7f8907 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -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; } diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 0c8388e653c..4b179a606cd 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -60,7 +60,6 @@ #include #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(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(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); - } } diff --git a/widget/src/windows/nsUXThemeConstants.h b/widget/src/windows/nsUXThemeConstants.h index 28e2edc29f8..0398a6f9e55 100644 --- a/widget/src/windows/nsUXThemeConstants.h +++ b/widget/src/windows/nsUXThemeConstants.h @@ -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 diff --git a/widget/src/xpwidgets/Makefile.in b/widget/src/xpwidgets/Makefile.in index 9c763ff9e6d..8e73b77a049 100644 --- a/widget/src/xpwidgets/Makefile.in +++ b/widget/src/xpwidgets/Makefile.in @@ -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) diff --git a/widget/src/xpwidgets/nsNativeTheme.cpp b/widget/src/xpwidgets/nsNativeTheme.cpp index dce6db98694..5e7a035e316 100644 --- a/widget/src/xpwidgets/nsNativeTheme.cpp +++ b/widget/src/xpwidgets/nsNativeTheme.cpp @@ -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); diff --git a/widget/src/xpwidgets/nsNativeTheme.h b/widget/src/xpwidgets/nsNativeTheme.h index 8b6cd28791c..63c49b0db99 100644 --- a/widget/src/xpwidgets/nsNativeTheme.h +++ b/widget/src/xpwidgets/nsNativeTheme.h @@ -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) { diff --git a/widget/src/xpwidgets/nsWidgetAtomList.h b/widget/src/xpwidgets/nsWidgetAtomList.h index a629ef90812..b0b902cd08d 100644 --- a/widget/src/xpwidgets/nsWidgetAtomList.h +++ b/widget/src/xpwidgets/nsWidgetAtomList.h @@ -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")