Bug 346485 - "Implement output element" [r=smaug,hsivonen,mrbkap,timeless,roc sr=jst]

This commit is contained in:
Mounir Lamouri 2010-04-26 03:42:00 -04:00
Родитель 3b21b1e58d
Коммит 69d9e7c537
24 изменённых файлов: 609 добавлений и 9 удалений

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

@ -97,6 +97,7 @@ CPPSRCS = \
nsDOMParser.cpp \ nsDOMParser.cpp \
nsDOMSerializer.cpp \ nsDOMSerializer.cpp \
nsDOMTokenList.cpp \ nsDOMTokenList.cpp \
nsDOMSettableTokenList.cpp \
nsDocument.cpp \ nsDocument.cpp \
nsDocumentEncoder.cpp \ nsDocumentEncoder.cpp \
nsDocumentFragment.cpp \ nsDocumentFragment.cpp \

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

@ -437,7 +437,8 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
if (form && form->GetType() != NS_FORM_OBJECT && if (form && form->GetType() != NS_FORM_OBJECT &&
form->GetType() != NS_FORM_FIELDSET && form->GetType() != NS_FORM_FIELDSET &&
form->GetType() != NS_FORM_LEGEND && form->GetType() != NS_FORM_LEGEND &&
form->GetType() != NS_FORM_LABEL) form->GetType() != NS_FORM_LABEL &&
form->GetType() != NS_FORM_OUTPUT)
return NS_OK; return NS_OK;
findFormParent = findFormParent->GetParent(); findFormParent = findFormParent->GetParent();
} }

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

@ -0,0 +1,80 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Implementation of nsIDOMDOMSettableTokenList specified by HTML5.
*/
#include "nsDOMSettableTokenList.h"
nsDOMSettableTokenList::nsDOMSettableTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
: nsDOMTokenList(aElement, aAttrAtom)
{
}
nsDOMSettableTokenList::~nsDOMSettableTokenList()
{
}
DOMCI_DATA(DOMSettableTokenList, nsDOMSettableTokenList)
NS_INTERFACE_TABLE_HEAD(nsDOMSettableTokenList)
NS_INTERFACE_TABLE1(nsDOMSettableTokenList,
nsIDOMDOMSettableTokenList)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMSettableTokenList)
NS_INTERFACE_MAP_END_INHERITING(nsDOMTokenList)
NS_IMPL_ADDREF_INHERITED(nsDOMSettableTokenList, nsDOMTokenList)
NS_IMPL_RELEASE_INHERITED(nsDOMSettableTokenList, nsDOMTokenList)
NS_IMETHODIMP
nsDOMSettableTokenList::GetValue(nsAString& aResult)
{
return ToString(aResult);
}
NS_IMETHODIMP
nsDOMSettableTokenList::SetValue(const nsAString& aValue)
{
if (!mElement) {
return NS_OK;
}
return mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, PR_TRUE);
}

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

@ -0,0 +1,67 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Implementation of nsIDOMDOMSettableTokenList specified by HTML5.
*/
#ifndef nsDOMSettableTokenList_h___
#define nsDOMSettableTokenList_h___
#include "nsIDOMDOMSettableTokenList.h"
#include "nsDOMTokenList.h"
class nsGenericElement;
class nsIAtom;
class nsDOMSettableTokenList : public nsDOMTokenList,
public nsIDOMDOMSettableTokenList
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMDOMSETTABLETOKENLIST
NS_FORWARD_NSIDOMDOMTOKENLIST(nsDOMTokenList::);
nsDOMSettableTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
protected:
virtual ~nsDOMSettableTokenList();
};
#endif // nsDOMSettableTokenList_h___

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

@ -56,7 +56,7 @@ public:
void DropReference(); void DropReference();
private: protected:
~nsDOMTokenList(); ~nsDOMTokenList();
const nsAttrValue* GetParsedAttr() { const nsAttrValue* GetParsedAttr() {

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

@ -62,10 +62,11 @@ class nsFormSubmission;
#define NS_FORM_LABEL 15 #define NS_FORM_LABEL 15
#define NS_FORM_OPTION 16 #define NS_FORM_OPTION 16
#define NS_FORM_OPTGROUP 17 #define NS_FORM_OPTGROUP 17
#define NS_FORM_LEGEND 18 #define NS_FORM_OUTPUT 18
#define NS_FORM_SELECT 19 #define NS_FORM_LEGEND 19
#define NS_FORM_TEXTAREA 20 #define NS_FORM_SELECT 20
#define NS_FORM_OBJECT 21 #define NS_FORM_TEXTAREA 21
#define NS_FORM_OBJECT 22
#define NS_IFORMCONTROL_IID \ #define NS_IFORMCONTROL_IID \
{ 0x52dc1f0d, 0x1683, 0x4dd7, \ { 0x52dc1f0d, 0x1683, 0x4dd7, \

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

@ -87,6 +87,7 @@ CPPSRCS = \
nsHTMLSharedObjectElement.cpp \ nsHTMLSharedObjectElement.cpp \
nsHTMLOptionElement.cpp \ nsHTMLOptionElement.cpp \
nsHTMLOptGroupElement.cpp \ nsHTMLOptGroupElement.cpp \
nsHTMLOutputElement.cpp \
nsHTMLParagraphElement.cpp \ nsHTMLParagraphElement.cpp \
nsHTMLPreElement.cpp \ nsHTMLPreElement.cpp \
nsHTMLScriptElement.cpp \ nsHTMLScriptElement.cpp \

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

@ -2570,7 +2570,8 @@ nsGenericHTMLFormElement::CanBeDisabled() const
type != NS_FORM_LABEL && type != NS_FORM_LABEL &&
type != NS_FORM_LEGEND && type != NS_FORM_LEGEND &&
type != NS_FORM_FIELDSET && type != NS_FORM_FIELDSET &&
type != NS_FORM_OBJECT; type != NS_FORM_OBJECT &&
type != NS_FORM_OUTPUT;
} }
PRBool PRBool

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

@ -1276,6 +1276,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Meta)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Object) NS_DECLARE_NS_NEW_HTML_ELEMENT(Object)
NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup) NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Option) NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph) NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre) NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script) NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)

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

@ -191,6 +191,7 @@ ShouldBeInElements(nsIFormControl* aFormControl)
case NS_FORM_TEXTAREA : case NS_FORM_TEXTAREA :
case NS_FORM_FIELDSET : case NS_FORM_FIELDSET :
case NS_FORM_OBJECT : case NS_FORM_OBJECT :
case NS_FORM_OUTPUT :
return PR_TRUE; return PR_TRUE;
} }

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

@ -0,0 +1,278 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLOutputElement.h"
#include "nsGenericHTMLElement.h"
#include "nsIFormSubmission.h"
#include "nsDOMSettableTokenList.h"
#include "nsStubMutationObserver.h"
class nsHTMLOutputElement : public nsGenericHTMLFormElement,
public nsIDOMHTMLOutputElement,
public nsStubMutationObserver
{
public:
nsHTMLOutputElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLOutputElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
// nsIDOMHTMLOutputElement
NS_DECL_NSIDOMHTMLOUTPUTELEMENT
// nsIFormControl
NS_IMETHOD_(PRInt32) GetType() const { return NS_FORM_OUTPUT; }
NS_IMETHOD Reset();
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission,
nsIContent* aSubmitElement);
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult);
// This function is called when a callback function from nsIMutationObserver
// has to be used to update the defaultValue attribute.
void DescendantsChanged();
// nsIMutationObserver
void CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
CharacterDataChangeInfo* aInfo);
void ContentAppended (nsIDocument* aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
void ContentInserted (nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
void ContentRemoved (nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLOutputElement,
nsGenericHTMLFormElement)
protected:
enum ValueModeFlag {
eModeDefault,
eModeValue
};
ValueModeFlag mValueModeFlag;
nsString mDefaultValue;
nsRefPtr<nsDOMSettableTokenList> mTokenList;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Output)
nsHTMLOutputElement::nsHTMLOutputElement(nsINodeInfo *aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo)
, mValueModeFlag(eModeDefault)
{
AddMutationObserver(this);
}
nsHTMLOutputElement::~nsHTMLOutputElement()
{
if (mTokenList) {
mTokenList->DropReference();
}
}
NS_IMPL_ADDREF_INHERITED(nsHTMLOutputElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLOutputElement, nsGenericElement)
DOMCI_DATA(HTMLOutputElement, nsHTMLOutputElement)
NS_INTERFACE_TABLE_HEAD(nsHTMLOutputElement)
NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLOutputElement,
nsIDOMHTMLOutputElement,
nsIMutationObserver)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLOutputElement,
nsGenericHTMLFormElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLOutputElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLOutputElement)
NS_IMPL_STRING_ATTR(nsHTMLOutputElement, Name, name)
NS_IMETHODIMP
nsHTMLOutputElement::Reset()
{
mValueModeFlag = eModeDefault;
nsresult rv = nsContentUtils::SetNodeTextContent(this, mDefaultValue,
PR_TRUE);
return rv;
}
NS_IMETHODIMP
nsHTMLOutputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission,
nsIContent* aSubmitElement)
{
// The output element is not submittable.
return NS_OK;
}
PRBool
nsHTMLOutputElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::_for) {
aResult.ParseAtomArray(aValue);
return PR_TRUE;
}
}
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
NS_IMETHODIMP
nsHTMLOutputElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
return nsGenericHTMLFormElement::GetForm(aForm);
}
NS_IMETHODIMP
nsHTMLOutputElement::GetType(nsAString& aType)
{
aType.AssignLiteral("output");
return NS_OK;
}
NS_IMETHODIMP
nsHTMLOutputElement::GetValue(nsAString& aValue)
{
nsContentUtils::GetNodeTextContent(this, PR_TRUE, aValue);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLOutputElement::SetValue(const nsAString& aValue)
{
mValueModeFlag = eModeValue;
return nsContentUtils::SetNodeTextContent(this, aValue, PR_TRUE);
}
NS_IMETHODIMP
nsHTMLOutputElement::GetDefaultValue(nsAString& aDefaultValue)
{
aDefaultValue = mDefaultValue;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLOutputElement::SetDefaultValue(const nsAString& aDefaultValue)
{
mDefaultValue = aDefaultValue;
if (mValueModeFlag == eModeDefault) {
return nsContentUtils::SetNodeTextContent(this, mDefaultValue, PR_TRUE);
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLOutputElement::GetHtmlFor(nsIDOMDOMSettableTokenList** aResult)
{
if (!mTokenList) {
mTokenList = new nsDOMSettableTokenList(this, nsGkAtoms::_for);
}
NS_ADDREF(*aResult = mTokenList);
return NS_OK;
}
void nsHTMLOutputElement::DescendantsChanged()
{
if (mValueModeFlag == eModeDefault) {
nsContentUtils::GetNodeTextContent(this, PR_TRUE, mDefaultValue);
}
}
// nsIMutationObserver
void nsHTMLOutputElement::CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
CharacterDataChangeInfo* aInfo)
{
DescendantsChanged();
}
void nsHTMLOutputElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer)
{
DescendantsChanged();
}
void nsHTMLOutputElement::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer)
{
DescendantsChanged();
}
void nsHTMLOutputElement::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer)
{
DescendantsChanged();
}

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

@ -125,6 +125,7 @@
#include "nsIDOMNamedNodeMap.h" #include "nsIDOMNamedNodeMap.h"
#include "nsIDOMDOMStringList.h" #include "nsIDOMDOMStringList.h"
#include "nsIDOMDOMTokenList.h" #include "nsIDOMDOMTokenList.h"
#include "nsIDOMDOMSettableTokenList.h"
#include "nsIDOMNameList.h" #include "nsIDOMNameList.h"
#include "nsIDOMNSElement.h" #include "nsIDOMNSElement.h"
@ -288,6 +289,7 @@
#include "nsIDOMHTMLOListElement.h" #include "nsIDOMHTMLOListElement.h"
#include "nsIDOMHTMLObjectElement.h" #include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptGroupElement.h" #include "nsIDOMHTMLOptGroupElement.h"
#include "nsIDOMHTMLOutputElement.h"
#include "nsIDOMHTMLParagraphElement.h" #include "nsIDOMHTMLParagraphElement.h"
#include "nsIDOMHTMLParamElement.h" #include "nsIDOMHTMLParamElement.h"
#include "nsIDOMHTMLPreElement.h" #include "nsIDOMHTMLPreElement.h"
@ -656,6 +658,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DOMTokenList, nsDOMTokenListSH, NS_DEFINE_CLASSINFO_DATA(DOMTokenList, nsDOMTokenListSH,
ARRAY_SCRIPTABLE_FLAGS) ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DOMSettableTokenList, nsDOMTokenListSH,
ARRAY_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DocumentFragment, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(DocumentFragment, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(Element, nsElementSH, NS_DEFINE_CLASSINFO_DATA(Element, nsElementSH,
@ -784,6 +788,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS) ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLOptionElement, nsElementSH, NS_DEFINE_CLASSINFO_DATA(HTMLOptionElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS) ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLOutputElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLParagraphElement, nsElementSH, NS_DEFINE_CLASSINFO_DATA(HTMLParagraphElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS) ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLParamElement, nsElementSH, NS_DEFINE_CLASSINFO_DATA(HTMLParamElement, nsElementSH,
@ -2155,6 +2161,10 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMTokenList) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMTokenList)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(DOMSettableTokenList, nsIDOMDOMSettableTokenList)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMSettableTokenList)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(DocumentFragment, nsIDOMDocumentFragment) DOM_CLASSINFO_MAP_BEGIN(DocumentFragment, nsIDOMDocumentFragment)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentFragment) DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentFragment)
DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node) DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
@ -2511,6 +2521,11 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLOutputElement, nsIDOMHTMLOutputElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLOutputElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLParagraphElement, nsIDOMHTMLParagraphElement) DOM_CLASSINFO_MAP_BEGIN(HTMLParagraphElement, nsIDOMHTMLParagraphElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLParagraphElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLParagraphElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES

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

@ -55,6 +55,7 @@ DOMCI_CLASS(DocumentType)
DOMCI_CLASS(DOMImplementation) DOMCI_CLASS(DOMImplementation)
DOMCI_CLASS(DOMException) DOMCI_CLASS(DOMException)
DOMCI_CLASS(DOMTokenList) DOMCI_CLASS(DOMTokenList)
DOMCI_CLASS(DOMSettableTokenList)
DOMCI_CLASS(DocumentFragment) DOMCI_CLASS(DocumentFragment)
DOMCI_CLASS(Element) DOMCI_CLASS(Element)
DOMCI_CLASS(Attr) DOMCI_CLASS(Attr)
@ -120,6 +121,7 @@ DOMCI_CLASS(HTMLOListElement)
DOMCI_CLASS(HTMLObjectElement) DOMCI_CLASS(HTMLObjectElement)
DOMCI_CLASS(HTMLOptGroupElement) DOMCI_CLASS(HTMLOptGroupElement)
DOMCI_CLASS(HTMLOptionElement) DOMCI_CLASS(HTMLOptionElement)
DOMCI_CLASS(HTMLOutputElement)
DOMCI_CLASS(HTMLParagraphElement) DOMCI_CLASS(HTMLParagraphElement)
DOMCI_CLASS(HTMLParamElement) DOMCI_CLASS(HTMLParamElement)
DOMCI_CLASS(HTMLPreElement) DOMCI_CLASS(HTMLPreElement)

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

@ -82,6 +82,7 @@ XPIDLSRCS = \
nsIDOMNSElement.idl \ nsIDOMNSElement.idl \
nsIDOMNodeSelector.idl \ nsIDOMNodeSelector.idl \
nsIDOMDOMTokenList.idl \ nsIDOMDOMTokenList.idl \
nsIDOMDOMSettableTokenList.idl \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

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

@ -0,0 +1,52 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMDOMTokenList.idl"
/**
* The DOMSettableTokenList interface is the same as the DOMTokenList interface,
* except that it allows the underlying string to be directly changed.
*
* For more information on this interface please see:
* http://dev.w3.org/html5/spec/infrastructure.html#domsettabletokenlist
*/
[scriptable, uuid(cdac274e-6619-4b5f-ba1a-cd1dbfae44b8)]
interface nsIDOMDOMSettableTokenList : nsIDOMDOMTokenList
{
attribute DOMString value;
};

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

@ -87,6 +87,7 @@ SDK_XPIDLSRCS = \
nsIDOMHTMLOptGroupElement.idl \ nsIDOMHTMLOptGroupElement.idl \
nsIDOMHTMLOptionElement.idl \ nsIDOMHTMLOptionElement.idl \
nsIDOMHTMLOptionsCollection.idl \ nsIDOMHTMLOptionsCollection.idl \
nsIDOMHTMLOutputElement.idl \
nsIDOMHTMLParagraphElement.idl \ nsIDOMHTMLParagraphElement.idl \
nsIDOMHTMLParamElement.idl \ nsIDOMHTMLParamElement.idl \
nsIDOMHTMLPreElement.idl \ nsIDOMHTMLPreElement.idl \

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

@ -0,0 +1,79 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLElement.idl"
/**
* The nsIDOMHTMLOutputElement interface is the interface to a HTML
* <output> element.
*
* For more information on this interface, please see
* http://dev.w3.org/html5/spec/forms.html#the-output-element
*
* @status UNDER_DEVELOPMENT
*/
interface nsIDOMDOMSettableTokenList;
[scriptable, uuid(0f7f15a9-ea72-4feb-b2b5-2fcbc9c10ab8)]
interface nsIDOMHTMLOutputElement : nsIDOMHTMLElement
{
readonly attribute nsIDOMDOMSettableTokenList htmlFor;
readonly attribute nsIDOMHTMLFormElement form;
attribute DOMString name;
readonly attribute DOMString type;
attribute DOMString defaultValue;
attribute DOMString value;
/**
* The next attributes depend on the constraint validation API.
* Keeping them commented until the constraint validation API is implemented.
* See bug bug 345624.
*/
//readonly attribute boolean willValidate;
//readonly attribute ValidityState validity;
//readonly attribute DOMString validationMessage;
//boolean checkValidity();
//void setCustomValidity(in DOMString error);
/**
* The labels IDL attribute will be added with bug 556743.
*/
//readonly attribute nsIDOMNodeList labels;
};

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

@ -95,6 +95,7 @@ EDITOR_ATOM(select, "select")
EDITOR_ATOM(textarea, "textarea") EDITOR_ATOM(textarea, "textarea")
EDITOR_ATOM(label, "label") EDITOR_ATOM(label, "label")
EDITOR_ATOM(button, "button") EDITOR_ATOM(button, "button")
EDITOR_ATOM(output, "output")
// block tags // block tags
EDITOR_ATOM(p, "p") EDITOR_ATOM(p, "p")
EDITOR_ATOM(div, "div") EDITOR_ATOM(div, "div")

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

@ -431,6 +431,7 @@ nsHTMLEditUtils::IsFormWidget(nsIDOMNode *node)
return (nodeAtom == nsEditProperty::textarea) return (nodeAtom == nsEditProperty::textarea)
|| (nodeAtom == nsEditProperty::select) || (nodeAtom == nsEditProperty::select)
|| (nodeAtom == nsEditProperty::button) || (nodeAtom == nsEditProperty::button)
|| (nodeAtom == nsEditProperty::output)
|| (nodeAtom == nsEditProperty::input); || (nodeAtom == nsEditProperty::input);
} }
@ -481,8 +482,8 @@ nsHTMLEditUtils::SupportsAlignAttr(nsIDOMNode * aNode)
// abbr, acronym, cite, code, del, dfn, em, ins, kbd, samp, strong, var // abbr, acronym, cite, code, del, dfn, em, ins, kbd, samp, strong, var
#define GROUP_PHRASE (1 << 4) #define GROUP_PHRASE (1 << 4)
// a, applet, basefont, bdo, br, font, iframe, img, map, object, q, script, // a, applet, basefont, bdo, br, font, iframe, img, map, object, output, q,
// span, sub, sup // script, span, sub, sup
#define GROUP_SPECIAL (1 << 5) #define GROUP_SPECIAL (1 << 5)
// button, form, input, label, select, textarea // button, form, input, label, select, textarea
@ -650,6 +651,7 @@ static const nsElementInfo kElements[eHTMLTag_userdefined] = {
GROUP_OPTGROUP_CONTENT), GROUP_OPTGROUP_CONTENT),
ELEM(option, PR_TRUE, PR_FALSE, ELEM(option, PR_TRUE, PR_FALSE,
GROUP_SELECT_CONTENT | GROUP_OPTGROUP_CONTENT, GROUP_LEAF), GROUP_SELECT_CONTENT | GROUP_OPTGROUP_CONTENT, GROUP_LEAF),
ELEM(output, PR_TRUE, PR_TRUE, GROUP_SPECIAL, GROUP_INLINE_ELEMENT),
ELEM(p, PR_TRUE, PR_FALSE, GROUP_BLOCK | GROUP_P, GROUP_INLINE_ELEMENT), ELEM(p, PR_TRUE, PR_FALSE, GROUP_BLOCK | GROUP_P, GROUP_INLINE_ELEMENT),
ELEM(param, PR_FALSE, PR_FALSE, GROUP_OBJECT_CONTENT, GROUP_NONE), ELEM(param, PR_FALSE, PR_FALSE, GROUP_OBJECT_CONTENT, GROUP_NONE),
ELEM(plaintext, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE), ELEM(plaintext, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),

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

@ -235,6 +235,8 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget)
break; break;
case NS_FORM_OBJECT: case NS_FORM_OBJECT:
break; break;
case NS_FORM_OUTPUT:
break;
default: default:
break; break;
} }

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

@ -166,6 +166,7 @@ members = [
'nsIDOMDOMStringList.length', 'nsIDOMDOMStringList.length',
'nsIDOMDOMStringList.contains', 'nsIDOMDOMStringList.contains',
'nsIDOMDOMTokenList.*', 'nsIDOMDOMTokenList.*',
'nsIDOMDOMSettableTokenList.*',
'nsIDOMNameList.getName', 'nsIDOMNameList.getName',
'nsIDOMNameList.contains', 'nsIDOMNameList.contains',
'nsIDOMNameList.containsNS', 'nsIDOMNameList.containsNS',

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

@ -140,6 +140,7 @@ HTML_TAG(object, Object)
HTML_TAG(ol, SharedList) HTML_TAG(ol, SharedList)
HTML_TAG(optgroup, OptGroup) HTML_TAG(optgroup, OptGroup)
HTML_TAG(option, Option) HTML_TAG(option, Option)
HTML_TAG(output, Output)
HTML_TAG(p, Paragraph) HTML_TAG(p, Paragraph)
HTML_TAG(param, Shared) HTML_TAG(param, Shared)
HTML_TAG(plaintext, Span) HTML_TAG(plaintext, Span)

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

@ -874,6 +874,15 @@ const nsHTMLElement gHTMLElements[] = {
/*special props, prop-range*/ kNoStyleLeaksIn|kNoPropagate, kDefaultPropRange, /*special props, prop-range*/ kNoStyleLeaksIn|kNoPropagate, kDefaultPropRange,
/*special parents,kids*/ &gOptgroupParents,&gContainedInOpt, /*special parents,kids*/ &gOptgroupParents,&gContainedInOpt,
}, },
{
/*tag*/ eHTMLTag_output,
/*requiredAncestor*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kSpecial, (kInlineEntity|kSelf), kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special parents,kids*/ 0,0,
},
{ {
/*tag*/ eHTMLTag_p, /*tag*/ eHTMLTag_p,
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,

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

@ -199,6 +199,8 @@ static const PRUnichar sHTMLTagUnicodeName_optgroup[] =
{'o', 'p', 't', 'g', 'r', 'o', 'u', 'p', '\0'}; {'o', 'p', 't', 'g', 'r', 'o', 'u', 'p', '\0'};
static const PRUnichar sHTMLTagUnicodeName_option[] = static const PRUnichar sHTMLTagUnicodeName_option[] =
{'o', 'p', 't', 'i', 'o', 'n', '\0'}; {'o', 'p', 't', 'i', 'o', 'n', '\0'};
static const PRUnichar sHTMLTagUnicodeName_output[] =
{'o', 'u', 't', 'p', 'u', 't', '\0'};
static const PRUnichar sHTMLTagUnicodeName_p[] = static const PRUnichar sHTMLTagUnicodeName_p[] =
{'p', '\0'}; {'p', '\0'};
static const PRUnichar sHTMLTagUnicodeName_param[] = static const PRUnichar sHTMLTagUnicodeName_param[] =