From d52c9a362c660fdddabe1b7c917700625420aeff Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Wed, 31 Jul 2013 23:12:38 -0700 Subject: [PATCH] Bug 893117: Remove nsIDOMHTMLProgressElement r=peterv --- .../html/content/src/HTMLProgressElement.cpp | 42 +------------------ .../html/content/src/HTMLProgressElement.h | 6 +-- dom/interfaces/html/moz.build | 1 - .../html/nsIDOMHTMLProgressElement.idl | 29 ------------- layout/forms/nsProgressFrame.cpp | 8 ++-- widget/xpwidgets/nsNativeTheme.cpp | 24 ++++------- 6 files changed, 12 insertions(+), 98 deletions(-) delete mode 100644 dom/interfaces/html/nsIDOMHTMLProgressElement.idl diff --git a/content/html/content/src/HTMLProgressElement.cpp b/content/html/content/src/HTMLProgressElement.cpp index e9aa9a040d45..6549fae1bc77 100644 --- a/content/html/content/src/HTMLProgressElement.cpp +++ b/content/html/content/src/HTMLProgressElement.cpp @@ -31,11 +31,8 @@ NS_IMPL_ADDREF_INHERITED(HTMLProgressElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLProgressElement, Element) -NS_INTERFACE_TABLE_HEAD(HTMLProgressElement) +NS_INTERFACE_MAP_BEGIN(HTMLProgressElement) NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement) - NS_INTERFACE_TABLE_INHERITED1(HTMLProgressElement, - nsIDOMHTMLProgressElement) - NS_INTERFACE_TABLE_TO_MAP_SEGUE NS_ELEMENT_INTERFACE_MAP_END NS_IMPL_ELEMENT_CLONE(HTMLProgressElement) @@ -67,13 +64,6 @@ HTMLProgressElement::ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute, aValue, aResult); } -NS_IMETHODIMP -HTMLProgressElement::GetValue(double* aValue) -{ - *aValue = Value(); - return NS_OK; -} - double HTMLProgressElement::Value() const { @@ -86,21 +76,6 @@ HTMLProgressElement::Value() const return std::min(attrValue->GetDoubleValue(), Max()); } -NS_IMETHODIMP -HTMLProgressElement::SetValue(double aValue) -{ - ErrorResult rv; - SetValue(aValue, rv); - return rv.ErrorCode(); -} - -NS_IMETHODIMP -HTMLProgressElement::GetMax(double* aValue) -{ - *aValue = Max(); - return NS_OK; -} - double HTMLProgressElement::Max() const { @@ -113,21 +88,6 @@ HTMLProgressElement::Max() const return attrMax->GetDoubleValue(); } -NS_IMETHODIMP -HTMLProgressElement::SetMax(double aValue) -{ - ErrorResult rv; - SetMax(aValue, rv); - return rv.ErrorCode(); -} - -NS_IMETHODIMP -HTMLProgressElement::GetPosition(double* aPosition) -{ - *aPosition = Position(); - return NS_OK; -} - double HTMLProgressElement::Position() const { diff --git a/content/html/content/src/HTMLProgressElement.h b/content/html/content/src/HTMLProgressElement.h index 0be9491a8d8d..985a1c3fee56 100644 --- a/content/html/content/src/HTMLProgressElement.h +++ b/content/html/content/src/HTMLProgressElement.h @@ -7,7 +7,6 @@ #define mozilla_dom_HTMLProgressElement_h #include "mozilla/Attributes.h" -#include "nsIDOMHTMLProgressElement.h" #include "nsGenericHTMLElement.h" #include "nsAttrValue.h" #include "nsAttrValueInlines.h" @@ -18,7 +17,7 @@ namespace mozilla { namespace dom { class HTMLProgressElement MOZ_FINAL : public nsGenericHTMLElement, - public nsIDOMHTMLProgressElement + public nsIDOMHTMLElement { public: HTMLProgressElement(already_AddRefed aNodeInfo); @@ -36,9 +35,6 @@ public: // nsIDOMHTMLElement NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLProgressElement - NS_DECL_NSIDOMHTMLPROGRESSELEMENT - nsEventStates IntrinsicState() const MOZ_OVERRIDE; nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE; diff --git a/dom/interfaces/html/moz.build b/dom/interfaces/html/moz.build index e58d46cbac65..67def7b987ff 100644 --- a/dom/interfaces/html/moz.build +++ b/dom/interfaces/html/moz.build @@ -55,7 +55,6 @@ XPIDL_SOURCES += [ 'nsIDOMHTMLParagraphElement.idl', 'nsIDOMHTMLParamElement.idl', 'nsIDOMHTMLPreElement.idl', - 'nsIDOMHTMLProgressElement.idl', 'nsIDOMHTMLQuoteElement.idl', 'nsIDOMHTMLScriptElement.idl', 'nsIDOMHTMLSelectElement.idl', diff --git a/dom/interfaces/html/nsIDOMHTMLProgressElement.idl b/dom/interfaces/html/nsIDOMHTMLProgressElement.idl deleted file mode 100644 index bd14c078cb41..000000000000 --- a/dom/interfaces/html/nsIDOMHTMLProgressElement.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsIDOMHTMLElement.idl" - -/** - * The nsIDOMHTMLProgressElement interface is the interface to a HTML - * element. - * - * For more information on this interface, please see - * http://www.whatwg.org/specs/web-apps/current-work/#the-progress-element - * - * @status UNDER_DEVELOPMENT - */ - -[scriptable, uuid(4b4bec16-c65f-4a08-97d1-dff624efdca4)] -interface nsIDOMHTMLProgressElement : nsIDOMHTMLElement -{ - attribute double value; - attribute double max; - readonly attribute double position; - /** - * The labels attribute will be done with bug 567740. - */ - //readonly attribute NodeList labels; -}; - diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index 139b643dba34..25e9e3e25d92 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -5,7 +5,6 @@ #include "nsProgressFrame.h" -#include "nsIDOMHTMLProgressElement.h" #include "nsIContent.h" #include "nsPresContext.h" #include "nsGkAtoms.h" @@ -20,9 +19,11 @@ #include "nsContentList.h" #include "nsFontMetrics.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/HTMLProgressElement.h" #include "nsContentList.h" #include +using namespace mozilla::dom; nsIFrame* NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -157,10 +158,7 @@ nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame, nscoord xoffset = aReflowState.mComputedBorderPadding.left; nscoord yoffset = aReflowState.mComputedBorderPadding.top; - double position; - nsCOMPtr progressElement = - do_QueryInterface(mContent); - progressElement->GetPosition(&position); + double position = static_cast(mContent)->Position(); // Force the bar's size to match the current progress. // When indeterminate, the progress' size will be 100%. diff --git a/widget/xpwidgets/nsNativeTheme.cpp b/widget/xpwidgets/nsNativeTheme.cpp index ad272f8e4fca..2dfe2d241ab3 100644 --- a/widget/xpwidgets/nsNativeTheme.cpp +++ b/widget/xpwidgets/nsNativeTheme.cpp @@ -14,7 +14,6 @@ #include "nsString.h" #include "nsINameSpaceManager.h" #include "nsIDOMHTMLInputElement.h" -#include "nsIDOMHTMLProgressElement.h" #include "nsIDOMXULMenuListElement.h" #include "nsThemeConstants.h" #include "nsIComponentManager.h" @@ -26,9 +25,12 @@ #include "nsCSSRendering.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/HTMLBodyElement.h" +#include "mozilla/dom/HTMLProgressElement.h" #include "nsIDocumentInlines.h" #include +using namespace mozilla::dom; + nsNativeTheme::nsNativeTheme() : mAnimatedContentTimeout(UINT32_MAX) { @@ -150,14 +152,8 @@ nsNativeTheme::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; - } + if (aFrame && aFrame->GetContent()->IsHTML(nsGkAtoms::progress)) { + return static_cast(aFrame->GetContent())->Value(); } return (double)nsNativeTheme::CheckIntAttr(aFrame, nsGkAtoms::value, 0); @@ -169,14 +165,8 @@ nsNativeTheme::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; - } + if (aFrame && aFrame->GetContent()->IsHTML(nsGkAtoms::progress)) { + return static_cast(aFrame->GetContent())->Max(); } return (double)std::max(nsNativeTheme::CheckIntAttr(aFrame, nsGkAtoms::max, 100), 1);