mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Backed out changeset 05ae078ca073 (bug 893117)
This commit is contained in:
parent
9c24e1a0d2
commit
90a6661c77
@ -6,6 +6,7 @@
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "mozilla/dom/HTMLTableElement.h"
|
||||
#include "nsIDOMHTMLTableSectionElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
|
@ -47,15 +47,12 @@ NS_IMPL_ELEMENT_CLONE(HTMLTableRowElement)
|
||||
|
||||
|
||||
// protected method
|
||||
HTMLTableSectionElement*
|
||||
already_AddRefed<nsIDOMHTMLTableSectionElement>
|
||||
HTMLTableRowElement::GetSection() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
if (parent->IsHTML() && (parent->Tag() == nsGkAtoms::thead ||
|
||||
parent->Tag() == nsGkAtoms::tfoot)) {
|
||||
return static_cast<HTMLTableSectionElement*>(parent);
|
||||
}
|
||||
return nullptr;
|
||||
nsCOMPtr<nsIDOMHTMLTableSectionElement> section =
|
||||
do_QueryInterface(GetParent());
|
||||
return section.forget();
|
||||
}
|
||||
|
||||
// protected method
|
||||
@ -107,12 +104,15 @@ HTMLTableRowElement::GetRowIndex(int32_t* aValue)
|
||||
int32_t
|
||||
HTMLTableRowElement::SectionRowIndex() const
|
||||
{
|
||||
HTMLTableSectionElement* section = GetSection();
|
||||
nsCOMPtr<nsIDOMHTMLTableSectionElement> section = GetSection();
|
||||
if (!section) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHTMLCollection> coll = section->Rows();
|
||||
nsCOMPtr<nsIDOMHTMLCollection> rows;
|
||||
section->GetRows(getter_AddRefs(rows));
|
||||
|
||||
nsCOMPtr<nsIHTMLCollection> coll = do_QueryInterface(rows);
|
||||
uint32_t numRows = coll->Length();
|
||||
for (uint32_t i = 0; i < numRows; i++) {
|
||||
if (coll->GetElementAt(i) == this) {
|
||||
|
@ -10,13 +10,12 @@
|
||||
#include "nsIDOMHTMLTableRowElement.h"
|
||||
|
||||
class nsIDOMHTMLTableElement;
|
||||
class nsIDOMHTMLTableSectionElement;
|
||||
class nsContentList;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLTableSectionElement;
|
||||
|
||||
class HTMLTableRowElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLTableRowElement
|
||||
{
|
||||
@ -109,7 +108,7 @@ protected:
|
||||
virtual JSObject* WrapNode(JSContext *aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
HTMLTableSectionElement* GetSection() const;
|
||||
already_AddRefed<nsIDOMHTMLTableSectionElement> GetSection() const;
|
||||
HTMLTableElement* GetTable() const;
|
||||
nsRefPtr<nsContentList> mCells;
|
||||
};
|
||||
|
@ -37,12 +37,82 @@ NS_IMPL_RELEASE_INHERITED(HTMLTableSectionElement, Element)
|
||||
// QueryInterface implementation for HTMLTableSectionElement
|
||||
NS_INTERFACE_TABLE_HEAD_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()
|
||||
{
|
||||
@ -57,6 +127,13 @@ 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)
|
||||
{
|
||||
@ -95,6 +172,15 @@ 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)
|
||||
{
|
||||
@ -127,6 +213,14 @@ 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,
|
||||
@ -161,7 +255,7 @@ HTMLTableSectionElement::ParseAttribute(int32_t aNamespaceID,
|
||||
aResult);
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
|
||||
{
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
|
||||
@ -200,7 +294,7 @@ NS_IMETHODIMP_(bool)
|
||||
HTMLTableSectionElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsGkAtoms::align },
|
||||
{ &nsGkAtoms::align },
|
||||
{ &nsGkAtoms::valign },
|
||||
{ &nsGkAtoms::height },
|
||||
{ nullptr }
|
||||
|
@ -7,13 +7,14 @@
|
||||
|
||||
#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 nsIDOMHTMLElement
|
||||
public nsIDOMHTMLTableSectionElement
|
||||
{
|
||||
public:
|
||||
HTMLTableSectionElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
@ -33,6 +34,9 @@ public:
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLTableSectionElement
|
||||
NS_DECL_NSIDOMHTMLTABLESECTIONELEMENT
|
||||
|
||||
nsIHTMLCollection* Rows();
|
||||
already_AddRefed<nsGenericHTMLElement>
|
||||
InsertRow(int32_t aIndex, ErrorResult& aError);
|
||||
|
@ -73,6 +73,7 @@ interface nsIDOMRect;
|
||||
interface nsIDOMCSSStyleRule;
|
||||
interface nsIDOMCSSStyleRuleCollection;
|
||||
interface nsIDOMHTMLTableCaptionElement;
|
||||
interface nsIDOMHTMLTableSectionElement;
|
||||
|
||||
// Range
|
||||
interface nsIDOMRange;
|
||||
|
@ -65,6 +65,7 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMHTMLTableColElement.idl',
|
||||
'nsIDOMHTMLTableElement.idl',
|
||||
'nsIDOMHTMLTableRowElement.idl',
|
||||
'nsIDOMHTMLTableSectionElement.idl',
|
||||
'nsIDOMHTMLTextAreaElement.idl',
|
||||
'nsIDOMHTMLTitleElement.idl',
|
||||
'nsIDOMHTMLUListElement.idl',
|
||||
|
33
dom/interfaces/html/nsIDOMHTMLTableSectionElement.idl
Normal file
33
dom/interfaces/html/nsIDOMHTMLTableSectionElement.idl
Normal file
@ -0,0 +1,33 @@
|
||||
/* -*- 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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user