Bug 893117: Remove nsIDOMHTMLMeterElement r=bz

This commit is contained in:
David Zbarsky 2013-08-01 15:24:24 -07:00
Родитель f30a5268e1
Коммит 08edbc4f4a
6 изменённых файлов: 26 добавлений и 156 удалений

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

@ -29,11 +29,8 @@ NS_IMPL_ADDREF_INHERITED(HTMLMeterElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLMeterElement, Element)
NS_INTERFACE_TABLE_HEAD(HTMLMeterElement)
NS_INTERFACE_MAP_BEGIN(HTMLMeterElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLMeterElement,
nsIDOMHTMLMeterElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLMeterElement)
@ -223,88 +220,6 @@ HTMLMeterElement::Optimum() const
return std::min(optimum, max);
}
/*
* XPCOM methods
*/
NS_IMETHODIMP
HTMLMeterElement::GetMin(double* aValue)
{
*aValue = Min();
return NS_OK;
}
NS_IMETHODIMP
HTMLMeterElement::SetMin(double aValue)
{
return SetDoubleAttr(nsGkAtoms::min, aValue);
}
NS_IMETHODIMP
HTMLMeterElement::GetMax(double* aValue)
{
*aValue = Max();
return NS_OK;
}
NS_IMETHODIMP
HTMLMeterElement::SetMax(double aValue)
{
return SetDoubleAttr(nsGkAtoms::max, aValue);
}
NS_IMETHODIMP
HTMLMeterElement::GetValue(double* aValue)
{
*aValue = Value();
return NS_OK;
}
NS_IMETHODIMP
HTMLMeterElement::SetValue(double aValue)
{
return SetDoubleAttr(nsGkAtoms::value, aValue);
}
NS_IMETHODIMP
HTMLMeterElement::GetLow(double* aValue)
{
*aValue = Low();
return NS_OK;
}
NS_IMETHODIMP
HTMLMeterElement::SetLow(double aValue)
{
return SetDoubleAttr(nsGkAtoms::low, aValue);
}
NS_IMETHODIMP
HTMLMeterElement::GetHigh(double* aValue)
{
*aValue = High();
return NS_OK;
}
NS_IMETHODIMP
HTMLMeterElement::SetHigh(double aValue)
{
return SetDoubleAttr(nsGkAtoms::high, aValue);
}
NS_IMETHODIMP
HTMLMeterElement::GetOptimum(double* aValue)
{
*aValue = Optimum();
return NS_OK;
}
NS_IMETHODIMP
HTMLMeterElement::SetOptimum(double aValue)
{
return SetDoubleAttr(nsGkAtoms::optimum, aValue);
}
nsEventStates
HTMLMeterElement::GetOptimumState() const
{

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

@ -7,7 +7,6 @@
#define mozilla_dom_HTMLMeterElement_h
#include "mozilla/Attributes.h"
#include "nsIDOMHTMLMeterElement.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
@ -19,7 +18,7 @@ namespace mozilla {
namespace dom {
class HTMLMeterElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLMeterElement
public nsIDOMHTMLElement
{
public:
HTMLMeterElement(already_AddRefed<nsINodeInfo> aNodeInfo);
@ -37,9 +36,6 @@ public:
/* nsIDOMHTMLElement */
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
/* nsIDOMHTMLMeterElement */
NS_DECL_NSIDOMHTMLMETERELEMENT
virtual nsEventStates IntrinsicState() const MOZ_OVERRIDE;
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
@ -55,42 +51,42 @@ public:
double Value() const;
void SetValue(double aValue, ErrorResult& aRv)
{
aRv = SetValue(aValue);
aRv = SetDoubleAttr(nsGkAtoms::value, aValue);
}
/* @return the minimum value */
double Min() const;
void SetMin(double aValue, ErrorResult& aRv)
{
aRv = SetMin(aValue);
aRv = SetDoubleAttr(nsGkAtoms::min, aValue);
}
/* @return the maximum value */
double Max() const;
void SetMax(double aValue, ErrorResult& aRv)
{
aRv = SetMax(aValue);
aRv = SetDoubleAttr(nsGkAtoms::max, aValue);
}
/* @return the low value */
double Low() const;
void SetLow(double aValue, ErrorResult& aRv)
{
aRv = SetLow(aValue);
aRv = SetDoubleAttr(nsGkAtoms::low, aValue);
}
/* @return the high value */
double High() const;
void SetHigh(double aValue, ErrorResult& aRv)
{
aRv = SetHigh(aValue);
aRv = SetDoubleAttr(nsGkAtoms::high, aValue);
}
/* @return the optimum value */
double Optimum() const;
void SetOptimum(double aValue, ErrorResult& aRv)
{
aRv = SetOptimum(aValue);
aRv = SetDoubleAttr(nsGkAtoms::optimum, aValue);
}
protected:

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

@ -41,7 +41,6 @@ XPIDL_SOURCES += [
'nsIDOMHTMLMenuElement.idl',
'nsIDOMHTMLMenuItemElement.idl',
'nsIDOMHTMLMetaElement.idl',
'nsIDOMHTMLMeterElement.idl',
'nsIDOMHTMLOListElement.idl',
'nsIDOMHTMLObjectElement.idl',
'nsIDOMHTMLOptGroupElement.idl',

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

@ -1,30 +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 nsIDOMHTMLMeterElement interface is the interface to a HTML
* <meter> element.
*
* For more information on this interface, please see
* http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-meter-element
*/
[scriptable, uuid(6b1fc313-a7c1-4064-ba24-b72e099b05fa)]
interface nsIDOMHTMLMeterElement : nsIDOMHTMLElement
{
attribute double value;
attribute double min;
attribute double max;
attribute double low;
attribute double high;
attribute double optimum;
/**
* The labels attribute will be done with bug 556743.
*/
//readonly attribute NodeList labels;
};

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

@ -5,7 +5,6 @@
#include "nsMeterFrame.h"
#include "nsIDOMHTMLMeterElement.h"
#include "nsIContent.h"
#include "nsPresContext.h"
#include "nsGkAtoms.h"
@ -20,9 +19,11 @@
#include "nsFontMetrics.h"
#include "nsContentList.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLMeterElement.h"
#include "nsContentList.h"
#include <algorithm>
using mozilla::dom::HTMLMeterElement;
nsIFrame*
NS_NewMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -150,15 +151,13 @@ nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nscoord yoffset = aReflowState.mComputedBorderPadding.top;
// NOTE: Introduce a new function getPosition in the content part ?
double position, max, min, value;
nsCOMPtr<nsIDOMHTMLMeterElement> meterElement =
do_QueryInterface(mContent);
HTMLMeterElement* meterElement = static_cast<HTMLMeterElement*>(mContent);
meterElement->GetMax(&max);
meterElement->GetMin(&min);
meterElement->GetValue(&value);
double max = meterElement->Max();
double min = meterElement->Min();
double value = meterElement->Value();
position = max - min;
double position = max - min;
position = position != 0 ? (value - min) / position : 1;
size = NSToCoordRound(size * position);

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

@ -24,8 +24,8 @@
#include "nsCocoaWindow.h"
#include "nsNativeThemeColors.h"
#include "nsIScrollableFrame.h"
#include "nsIDOMHTMLMeterElement.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLMeterElement.h"
#include "nsLookAndFeel.h"
#include "gfxContext.h"
@ -34,6 +34,7 @@
#include <algorithm>
using namespace mozilla::gfx;
using mozilla::dom::HTMLMeterElement;
#define DRAW_IN_FRAME_DEBUG 0
#define SCROLLBARS_VISUAL_DEBUG 0
@ -1390,33 +1391,23 @@ nsNativeThemeCocoa::DrawMeter(CGContextRef cgContext, const HIRect& inBoxRect,
NS_PRECONDITION(aFrame, "aFrame should not be null here!");
nsCOMPtr<nsIDOMHTMLMeterElement> meterElement =
do_QueryInterface(aFrame->GetContent());
// When using -moz-meterbar on an non meter element, we will not be able to
// get all the needed information so we just draw an empty meter.
if (!meterElement) {
nsIContent* content = aFrame->GetContent();
if (!(content && content->IsHTML(nsGkAtoms::meter))) {
DrawCellWithSnapping(mMeterBarCell, cgContext, inBoxRect,
meterSetting, VerticalAlignFactor(aFrame),
mCellDrawView, IsFrameRTL(aFrame));
return;
}
double value;
double min;
double max;
double low;
double high;
double optimum;
// NOTE: if we were allowed to static_cast to HTMLMeterElement we would be
// able to use nicer getters...
meterElement->GetValue(&value);
meterElement->GetMin(&min);
meterElement->GetMax(&max);
meterElement->GetLow(&low);
meterElement->GetHigh(&high);
meterElement->GetOptimum(&optimum);
HTMLMeterElement* meterElement = static_cast<HTMLMeterElement*>(content);
double value = meterElement->Value();
double min = meterElement->Min();
double max = meterElement->Max();
double low = meterElement->Low();
double high = meterElement->High();
double optimum = meterElement->Optimum();
NSLevelIndicatorCell* cell = mMeterBarCell;