Bug 893117: Remove nsIDOMHTMLTableSectionElement r=peterv

This commit is contained in:
David Zbarsky 2013-07-30 14:55:10 -07:00
Родитель 753bdd48e3
Коммит 08732280f1
8 изменённых файлов: 17 добавлений и 150 удалений

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

@ -6,7 +6,6 @@
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "nsIDOMHTMLTableSectionElement.h"
#include "nsAttrValueInlines.h"
#include "nsRuleData.h"
#include "nsHTMLStyleSheet.h"

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

@ -47,12 +47,16 @@ NS_IMPL_ELEMENT_CLONE(HTMLTableRowElement)
// protected method
already_AddRefed<nsIDOMHTMLTableSectionElement>
HTMLTableSectionElement*
HTMLTableRowElement::GetSection() const
{
nsCOMPtr<nsIDOMHTMLTableSectionElement> section =
do_QueryInterface(GetParent());
return section.forget();
nsIContent* parent = GetParent();
if (parent->IsHTML() && (parent->Tag() == nsGkAtoms::thead ||
parent->Tag() == nsGkAtoms::tbody ||
parent->Tag() == nsGkAtoms::tfoot)) {
return static_cast<HTMLTableSectionElement*>(parent);
}
return nullptr;
}
// protected method
@ -104,15 +108,12 @@ HTMLTableRowElement::GetRowIndex(int32_t* aValue)
int32_t
HTMLTableRowElement::SectionRowIndex() const
{
nsCOMPtr<nsIDOMHTMLTableSectionElement> section = GetSection();
HTMLTableSectionElement* section = GetSection();
if (!section) {
return -1;
}
nsCOMPtr<nsIDOMHTMLCollection> rows;
section->GetRows(getter_AddRefs(rows));
nsCOMPtr<nsIHTMLCollection> coll = do_QueryInterface(rows);
nsCOMPtr<nsIHTMLCollection> coll = section->Rows();
uint32_t numRows = coll->Length();
for (uint32_t i = 0; i < numRows; i++) {
if (coll->GetElementAt(i) == this) {

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

@ -10,12 +10,13 @@
#include "nsIDOMHTMLTableRowElement.h"
class nsIDOMHTMLTableElement;
class nsIDOMHTMLTableSectionElement;
class nsContentList;
namespace mozilla {
namespace dom {
class HTMLTableSectionElement;
class HTMLTableRowElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLTableRowElement
{
@ -108,7 +109,7 @@ protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
already_AddRefed<nsIDOMHTMLTableSectionElement> GetSection() const;
HTMLTableSectionElement* GetSection() const;
HTMLTableElement* GetTable() const;
nsRefPtr<nsContentList> mCells;
};

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

@ -35,84 +35,13 @@ NS_IMPL_ADDREF_INHERITED(HTMLTableSectionElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLTableSectionElement, Element)
// QueryInterface implementation for HTMLTableSectionElement
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLTableSectionElement)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLTableSectionElement)
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(HTMLTableSectionElement,
nsIDOMHTMLTableSectionElement)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_ELEMENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLTableSectionElement)
NS_IMETHODIMP
HTMLTableSectionElement::SetAlign(const nsAString& aAlign)
{
ErrorResult rv;
SetAlign(aAlign, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableSectionElement::GetAlign(nsAString& aAlign)
{
nsString align;
GetAlign(align);
aAlign = align;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableSectionElement::SetVAlign(const nsAString& aVAlign)
{
ErrorResult rv;
SetVAlign(aVAlign, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableSectionElement::GetVAlign(nsAString& aVAlign)
{
nsString vAlign;
GetVAlign(vAlign);
aVAlign = vAlign;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableSectionElement::SetCh(const nsAString& aCh)
{
ErrorResult rv;
SetCh(aCh, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableSectionElement::GetCh(nsAString& aCh)
{
nsString ch;
GetCh(ch);
aCh = ch;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableSectionElement::SetChOff(const nsAString& aChOff)
{
ErrorResult rv;
SetChOff(aChOff, rv);
return rv.ErrorCode();
}
NS_IMETHODIMP
HTMLTableSectionElement::GetChOff(nsAString& aChOff)
{
nsString chOff;
GetChOff(chOff);
aChOff = chOff;
return NS_OK;
}
nsIHTMLCollection*
HTMLTableSectionElement::Rows()
{
@ -127,13 +56,6 @@ HTMLTableSectionElement::Rows()
return mRows;
}
NS_IMETHODIMP
HTMLTableSectionElement::GetRows(nsIDOMHTMLCollection** aValue)
{
NS_ADDREF(*aValue = Rows());
return NS_OK;
}
already_AddRefed<nsGenericHTMLElement>
HTMLTableSectionElement::InsertRow(int32_t aIndex, ErrorResult& aError)
{
@ -172,15 +94,6 @@ HTMLTableSectionElement::InsertRow(int32_t aIndex, ErrorResult& aError)
return rowContent.forget();
}
NS_IMETHODIMP
HTMLTableSectionElement::InsertRow(int32_t aIndex,
nsIDOMHTMLElement** aValue)
{
ErrorResult rv;
nsRefPtr<nsGenericHTMLElement> row = InsertRow(aIndex, rv);
return rv.Failed() ? rv.ErrorCode() : CallQueryInterface(row, aValue);
}
void
HTMLTableSectionElement::DeleteRow(int32_t aValue, ErrorResult& aError)
{
@ -213,14 +126,6 @@ HTMLTableSectionElement::DeleteRow(int32_t aValue, ErrorResult& aError)
nsINode::RemoveChild(*row, aError);
}
NS_IMETHODIMP
HTMLTableSectionElement::DeleteRow(int32_t aValue)
{
ErrorResult rv;
DeleteRow(aValue, rv);
return rv.ErrorCode();
}
bool
HTMLTableSectionElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
@ -255,7 +160,7 @@ HTMLTableSectionElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
@ -294,7 +199,7 @@ NS_IMETHODIMP_(bool)
HTMLTableSectionElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry attributes[] = {
{ &nsGkAtoms::align },
{ &nsGkAtoms::align },
{ &nsGkAtoms::valign },
{ &nsGkAtoms::height },
{ nullptr }

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

@ -7,14 +7,13 @@
#include "mozilla/Attributes.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLTableSectionElement.h"
#include "nsContentList.h" // For ctor.
namespace mozilla {
namespace dom {
class HTMLTableSectionElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLTableSectionElement
public nsIDOMHTMLElement
{
public:
HTMLTableSectionElement(already_AddRefed<nsINodeInfo> aNodeInfo)
@ -34,9 +33,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLTableSectionElement
NS_DECL_NSIDOMHTMLTABLESECTIONELEMENT
nsIHTMLCollection* Rows();
already_AddRefed<nsGenericHTMLElement>
InsertRow(int32_t aIndex, ErrorResult& aError);

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

@ -73,7 +73,6 @@ interface nsIDOMRect;
interface nsIDOMCSSStyleRule;
interface nsIDOMCSSStyleRuleCollection;
interface nsIDOMHTMLTableCaptionElement;
interface nsIDOMHTMLTableSectionElement;
// Range
interface nsIDOMRange;

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

@ -65,7 +65,6 @@ XPIDL_SOURCES += [
'nsIDOMHTMLTableColElement.idl',
'nsIDOMHTMLTableElement.idl',
'nsIDOMHTMLTableRowElement.idl',
'nsIDOMHTMLTableSectionElement.idl',
'nsIDOMHTMLTextAreaElement.idl',
'nsIDOMHTMLTitleElement.idl',
'nsIDOMHTMLUListElement.idl',

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

@ -1,33 +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 nsIDOMHTMLTableSectionElement interface is the interface to a
* [X]HTML thead, tbody, and tfoot element.
*
* This interface is trying to follow the DOM Level 2 HTML specification:
* http://www.w3.org/TR/DOM-Level-2-HTML/
*
* with changes from the work-in-progress WHATWG HTML specification:
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, builtinclass, uuid(7b91cf4c-5194-4122-bc29-7bbd18ba0020)]
interface nsIDOMHTMLTableSectionElement : nsIDOMHTMLElement
{
attribute DOMString align;
attribute DOMString ch;
attribute DOMString chOff;
attribute DOMString vAlign;
readonly attribute nsIDOMHTMLCollection rows;
// Modified in DOM Level 2:
nsIDOMHTMLElement insertRow(in long index)
raises(DOMException);
// Modified in DOM Level 2:
void deleteRow(in long index)
raises(DOMException);
};