diff --git a/content/html/content/src/HTMLTableElement.cpp b/content/html/content/src/HTMLTableElement.cpp index eb73744963af..2d5e42dd0fe5 100644 --- a/content/html/content/src/HTMLTableElement.cpp +++ b/content/html/content/src/HTMLTableElement.cpp @@ -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" diff --git a/content/html/content/src/HTMLTableRowElement.cpp b/content/html/content/src/HTMLTableRowElement.cpp index 37a71be0f4a8..d88954228b21 100644 --- a/content/html/content/src/HTMLTableRowElement.cpp +++ b/content/html/content/src/HTMLTableRowElement.cpp @@ -47,12 +47,16 @@ NS_IMPL_ELEMENT_CLONE(HTMLTableRowElement) // protected method -already_AddRefed +HTMLTableSectionElement* HTMLTableRowElement::GetSection() const { - nsCOMPtr 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(parent); + } + return nullptr; } // protected method @@ -104,15 +108,12 @@ HTMLTableRowElement::GetRowIndex(int32_t* aValue) int32_t HTMLTableRowElement::SectionRowIndex() const { - nsCOMPtr section = GetSection(); + HTMLTableSectionElement* section = GetSection(); if (!section) { return -1; } - nsCOMPtr rows; - section->GetRows(getter_AddRefs(rows)); - - nsCOMPtr coll = do_QueryInterface(rows); + nsCOMPtr coll = section->Rows(); uint32_t numRows = coll->Length(); for (uint32_t i = 0; i < numRows; i++) { if (coll->GetElementAt(i) == this) { diff --git a/content/html/content/src/HTMLTableRowElement.h b/content/html/content/src/HTMLTableRowElement.h index edbb0149fd71..5c1827928c58 100644 --- a/content/html/content/src/HTMLTableRowElement.h +++ b/content/html/content/src/HTMLTableRowElement.h @@ -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 aScope) MOZ_OVERRIDE; - already_AddRefed GetSection() const; + HTMLTableSectionElement* GetSection() const; HTMLTableElement* GetTable() const; nsRefPtr mCells; }; diff --git a/content/html/content/src/HTMLTableSectionElement.cpp b/content/html/content/src/HTMLTableSectionElement.cpp index 9312a9a7e33d..320538f1f32c 100644 --- a/content/html/content/src/HTMLTableSectionElement.cpp +++ b/content/html/content/src/HTMLTableSectionElement.cpp @@ -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 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 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 } diff --git a/content/html/content/src/HTMLTableSectionElement.h b/content/html/content/src/HTMLTableSectionElement.h index 015730407f0d..7e97c5f60ef2 100644 --- a/content/html/content/src/HTMLTableSectionElement.h +++ b/content/html/content/src/HTMLTableSectionElement.h @@ -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 aNodeInfo) @@ -34,9 +33,6 @@ public: // nsIDOMHTMLElement NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC - // nsIDOMHTMLTableSectionElement - NS_DECL_NSIDOMHTMLTABLESECTIONELEMENT - nsIHTMLCollection* Rows(); already_AddRefed InsertRow(int32_t aIndex, ErrorResult& aError); diff --git a/dom/interfaces/base/domstubs.idl b/dom/interfaces/base/domstubs.idl index dc1126a703f4..459e9407e0b6 100644 --- a/dom/interfaces/base/domstubs.idl +++ b/dom/interfaces/base/domstubs.idl @@ -73,7 +73,6 @@ interface nsIDOMRect; interface nsIDOMCSSStyleRule; interface nsIDOMCSSStyleRuleCollection; interface nsIDOMHTMLTableCaptionElement; -interface nsIDOMHTMLTableSectionElement; // Range interface nsIDOMRange; diff --git a/dom/interfaces/html/moz.build b/dom/interfaces/html/moz.build index 623c810926bf..7a48faca3ec6 100644 --- a/dom/interfaces/html/moz.build +++ b/dom/interfaces/html/moz.build @@ -65,7 +65,6 @@ XPIDL_SOURCES += [ 'nsIDOMHTMLTableColElement.idl', 'nsIDOMHTMLTableElement.idl', 'nsIDOMHTMLTableRowElement.idl', - 'nsIDOMHTMLTableSectionElement.idl', 'nsIDOMHTMLTextAreaElement.idl', 'nsIDOMHTMLTitleElement.idl', 'nsIDOMHTMLUListElement.idl', diff --git a/dom/interfaces/html/nsIDOMHTMLTableSectionElement.idl b/dom/interfaces/html/nsIDOMHTMLTableSectionElement.idl deleted file mode 100644 index f732820108e5..000000000000 --- a/dom/interfaces/html/nsIDOMHTMLTableSectionElement.idl +++ /dev/null @@ -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); -};