From 19e43c66476bdba0a7bae8dd9ef09b1465ea2d94 Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Sun, 21 May 2006 21:00:09 +0000 Subject: [PATCH] Fix for bug 236873 (Share class for more elements). r/sr=sicking. git-svn-id: svn://10.0.0.236/trunk@198125 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/content/src/Makefile.in | 4 +- .../html/content/src/nsGenericHTMLElement.h | 5 +- .../html/content/src/nsHTMLAppletElement.cpp | 340 --------------- .../html/content/src/nsHTMLObjectElement.cpp | 145 +++--- .../html/content/src/nsHTMLSharedElement.cpp | 248 +---------- .../content/src/nsHTMLSharedObjectElement.cpp | 412 +++++++++--------- .../parser/htmlparser/public/nsHTMLTagList.h | 4 +- 7 files changed, 266 insertions(+), 892 deletions(-) delete mode 100644 mozilla/content/html/content/src/nsHTMLAppletElement.cpp diff --git a/mozilla/content/html/content/src/Makefile.in b/mozilla/content/html/content/src/Makefile.in index 7ce6be7fe9e..c5b410b45bb 100644 --- a/mozilla/content/html/content/src/Makefile.in +++ b/mozilla/content/html/content/src/Makefile.in @@ -85,7 +85,6 @@ CPPSRCS = \ nsFormSubmission.cpp \ nsImageMapUtils.cpp \ nsHTMLAnchorElement.cpp \ - nsHTMLAppletElement.cpp \ nsHTMLAreaElement.cpp \ nsHTMLBRElement.cpp \ nsHTMLBodyElement.cpp \ @@ -111,8 +110,9 @@ CPPSRCS = \ nsHTMLLinkElement.cpp \ nsHTMLMapElement.cpp \ nsHTMLMetaElement.cpp \ - nsHTMLOListElement.cpp \ nsHTMLObjectElement.cpp \ + nsHTMLOListElement.cpp \ + nsHTMLSharedObjectElement.cpp \ nsHTMLOptionElement.cpp \ nsHTMLOptGroupElement.cpp \ nsHTMLParagraphElement.cpp \ diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 5a4b4933619..bf5b877a905 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -1090,8 +1090,10 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \ PRBool aFromParser = PR_FALSE); NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared) +NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList) +NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject) + NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor) -NS_DECLARE_NS_NEW_HTML_ELEMENT(Applet) NS_DECLARE_NS_NEW_HTML_ELEMENT(Area) NS_DECLARE_NS_NEW_HTML_ELEMENT(BR) NS_DECLARE_NS_NEW_HTML_ELEMENT(Body) @@ -1117,7 +1119,6 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Legend) NS_DECLARE_NS_NEW_HTML_ELEMENT(Link) NS_DECLARE_NS_NEW_HTML_ELEMENT(Map) NS_DECLARE_NS_NEW_HTML_ELEMENT(Meta) -NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList) NS_DECLARE_NS_NEW_HTML_ELEMENT(Object) NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup) NS_DECLARE_NS_NEW_HTML_ELEMENT(Option) diff --git a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp deleted file mode 100644 index f284c5abada..00000000000 --- a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/* -*- 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 Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Pierre Phaneuf - * - * 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 "nsIDOMHTMLAppletElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsPresContext.h" -#include "nsIDocument.h" - -#include "nsObjectLoadingContent.h" - -// XXX this is to get around conflicts with windows.h defines -// introduced through jni.h -#if defined (XP_WIN) && ! defined (WINCE) -#undef GetClassName -#undef GetObject -#endif - - -class nsHTMLAppletElement : public nsGenericHTMLElement, - public nsObjectLoadingContent, - public nsIDOMHTMLAppletElement -{ -public: - nsHTMLAppletElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE); - virtual ~nsHTMLAppletElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLAppletElement - NS_DECL_NSIDOMHTMLAPPLETELEMENT - - virtual void DoneAddingChildren(PRBool aHaveNotified); - virtual PRBool IsDoneAddingChildren(); - - // nsIContent - // Have to override tabindex for to act right - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - // Let applet decide whether it wants focus from mouse clicks - virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull); - virtual PRUint32 GetDesiredIMEState(); - - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, - PRBool aCompileEventHandlers); - virtual void UnbindFromTree(PRBool aDeep = PR_TRUE, - PRBool aNullParent = PR_TRUE); - virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - PRBool aNotify); - - virtual PRBool ParseAttribute(PRInt32 aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); - virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; - virtual PRInt32 IntrinsicState() const; - - // nsObjectLoadingContent - virtual PRUint32 GetCapabilities() const; -protected: - /** - * Calls LoadObject with the correct arguments to start the plugin - * load. - */ - NS_HIDDEN_(void) StartAppletLoad(PRBool aNotify); - - PRPackedBool mReflectedApplet; - PRPackedBool mIsDoneAddingChildren; -}; - - -NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Applet) - - -nsHTMLAppletElement::nsHTMLAppletElement(nsINodeInfo *aNodeInfo, PRBool aFromParser) - : nsGenericHTMLElement(aNodeInfo), mReflectedApplet(PR_FALSE), - mIsDoneAddingChildren(!aFromParser) -{ -} - -nsHTMLAppletElement::~nsHTMLAppletElement() -{ -} - -PRBool -nsHTMLAppletElement::IsDoneAddingChildren() -{ - return mIsDoneAddingChildren; -} - - -PRUint32 -nsHTMLAppletElement::GetCapabilities() const -{ - return eSupportPlugins | eOverrideServerType; -} - -void -nsHTMLAppletElement::DoneAddingChildren(PRBool aHaveNotified) -{ - mIsDoneAddingChildren = PR_TRUE; - // If we're already in the document, start the load, because BindToTree - // didn't. - if (IsInDoc()) { - StartAppletLoad(aHaveNotified); - } -} - -NS_IMPL_ADDREF_INHERITED(nsHTMLAppletElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLAppletElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLAppletElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLAppletElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLAppletElement) - NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver) - NS_INTERFACE_MAP_ENTRY(nsIStreamListener) - NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) - NS_INTERFACE_MAP_ENTRY(nsIFrameLoaderOwner) - NS_INTERFACE_MAP_ENTRY(nsIObjectLoadingContent) - NS_INTERFACE_MAP_ENTRY(nsIImageLoadingContent) - NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) - NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink) - NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLAppletElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -NS_IMPL_DOM_CLONENODE(nsHTMLAppletElement) - - -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Align, align) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Alt, alt) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Archive, archive) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Code, code) -NS_IMPL_URI_ATTR(nsHTMLAppletElement, CodeBase, codebase) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Height, height) -NS_IMPL_INT_ATTR(nsHTMLAppletElement, Hspace, hspace) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Name, name) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Object, object) -NS_IMPL_INT_ATTR(nsHTMLAppletElement, Vspace, vspace) -NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width) -NS_IMPL_INT_ATTR(nsHTMLAppletElement, TabIndex, tabindex) - -PRBool -nsHTMLAppletElement::ParseAttribute(PRInt32 aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) -{ - if (aNamespaceID == kNameSpaceID_None) { - if (aAttribute == nsHTMLAtoms::align) { - return nsGenericHTMLElement::ParseAlignValue(aValue, aResult); - } - if (nsGenericHTMLElement::ParseImageAttribute(aAttribute, - aValue, aResult)) { - return PR_TRUE; - } - } - - return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue, - aResult); -} - -static void -MapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) -{ - nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); - nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - -NS_IMETHODIMP_(PRBool) -nsHTMLAppletElement::IsAttributeMapped(const nsIAtom* aAttribute) const -{ - static const MappedAttributeEntry* const map[] = { - sCommonAttributeMap, - sImageMarginSizeAttributeMap, - sImageAlignAttributeMap, - sImageBorderAttributeMap - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); -} - -nsMapRuleToAttributesFunc -nsHTMLAppletElement::GetAttributeMappingFunction() const -{ - return &MapAttributesIntoRule; -} - -nsresult -nsHTMLAppletElement::BindToTree(nsIDocument* aDocument, - nsIContent* aParent, - nsIContent* aBindingParent, - PRBool aCompileEventHandlers) -{ - nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, - aBindingParent, - aCompileEventHandlers); - if (NS_FAILED(rv)) { - return rv; - } - - // Must start loading stuff after being in the document, but only when we - // already have all our children. - if (mIsDoneAddingChildren) { - // Don't need to notify: We have no frames yet, since we weren't in a - // document - StartAppletLoad(PR_FALSE); - } - return rv; -} - - -void -nsHTMLAppletElement::UnbindFromTree(PRBool aDeep, - PRBool aNullParent) -{ - RemovedFromDocument(); - nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); -} - -nsresult -nsHTMLAppletElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - PRBool aNotify) -{ - // If we plan to call LoadObject, we want to do it first so that the - // object load kicks off _before_ the reflow triggered by the SetAttr. But if - // aNotify is false, we are coming from the parser or some such place; we'll - // get bound after all the attributes have been set, so we'll do the - // object load from BindToTree/DoneAddingChildren. - // Skip the LoadObject call in that case. - if (aNotify && - aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::code) { - LoadObject(aValue, aNotify, NS_LITERAL_CSTRING("application/x-java-vm"), - PR_TRUE); - } - - - return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, - aValue, aNotify); -} - -void -nsHTMLAppletElement::StartAppletLoad(PRBool aNotify) -{ - nsAutoString uri; - if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, uri)) { - LoadObject(uri, aNotify, NS_LITERAL_CSTRING("application/x-java-vm")); - } else { - // The constructor set the type to eType_Loading; but if we have no code - // attribute, then we aren't really a plugin - Fallback(aNotify); - } -} - -PRInt32 -nsHTMLAppletElement::IntrinsicState() const -{ - return nsGenericHTMLElement::IntrinsicState() | ObjectState(); -} - -PRBool -nsHTMLAppletElement::IsFocusable(PRInt32 *aTabIndex) -{ - if (Type() == eType_Plugin) { - // Has plugin content (java): let the plugin decide what to do in terms of - // internal focus from mouse clicks - if (aTabIndex) { - GetTabIndex(aTabIndex); - } - - return PR_TRUE; - } - - return nsGenericHTMLElement::IsFocusable(aTabIndex); -} - -PRUint32 -nsHTMLAppletElement::GetDesiredIMEState() -{ - if (Type() == eType_Plugin) - return nsIContent::IME_STATUS_ENABLE; - return nsGenericHTMLElement::GetDesiredIMEState(); -} - diff --git a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp index 55419111e91..8ceb6f251cf 100644 --- a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp @@ -35,17 +35,14 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLObjectElement.h" + #include "nsGenericHTMLElement.h" #include "nsObjectLoadingContent.h" #include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" #include "nsDOMError.h" - #include "nsIDocument.h" -#include "nsIPresShell.h" #include "nsIDOMDocument.h" -#include "nsIWebNavigation.h" +#include "nsIDOMHTMLObjectElement.h" #include "nsIFormSubmission.h" #include "nsIObjectFrame.h" #include "nsIPluginInstance.h" @@ -57,7 +54,6 @@ class nsHTMLObjectElement : public nsGenericHTMLFormElement, { public: nsHTMLObjectElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE); - virtual ~nsHTMLObjectElement(); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -74,45 +70,45 @@ public: // nsIDOMHTMLObjectElement NS_DECL_NSIDOMHTMLOBJECTELEMENT - // nsIContent - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, + virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent, + nsIContent *aBindingParent, PRBool aCompileEventHandlers); virtual void UnbindFromTree(PRBool aDeep = PR_TRUE, PRBool aNullParent = PR_TRUE); - virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName, + nsIAtom *aPrefix, const nsAString &aValue, PRBool aNotify); virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull); virtual PRUint32 GetDesiredIMEState(); // Overriden nsIFormControl methods - NS_IMETHOD_(PRInt32) GetType() const { return NS_FORM_OBJECT; } + NS_IMETHOD_(PRInt32) GetType() const + { + return NS_FORM_OBJECT; + } + NS_IMETHOD Reset(); - NS_IMETHOD SubmitNamesValues(nsIFormSubmission* aFormSubmission, - nsIContent* aSubmitElement); - NS_IMETHOD SaveState(); - virtual PRBool RestoreState(nsPresState* aState); + NS_IMETHOD SubmitNamesValues(nsIFormSubmission *aFormSubmission, + nsIContent *aSubmitElement); virtual void DoneAddingChildren(PRBool aHaveNotified); virtual PRBool IsDoneAddingChildren(); virtual PRBool ParseAttribute(PRInt32 aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); + nsIAtom *aAttribute, + const nsAString &aValue, + nsAttrValue &aResult); virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; + NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom *aAttribute) const; virtual PRInt32 IntrinsicState() const; // nsObjectLoadingContent virtual PRUint32 GetCapabilities() const; -protected: +private: /** - * Calls LoadObject with the correct arguments to start the plugin - * load. + * Calls LoadObject with the correct arguments to start the plugin load. */ NS_HIDDEN_(void) StartObjectLoad(PRBool aNotify); @@ -125,11 +121,8 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object) nsHTMLObjectElement::nsHTMLObjectElement(nsINodeInfo *aNodeInfo, PRBool aFromParser) - : nsGenericHTMLFormElement(aNodeInfo), mIsDoneAddingChildren(!aFromParser) -{ -} - -nsHTMLObjectElement::~nsHTMLObjectElement() + : nsGenericHTMLFormElement(aNodeInfo), + mIsDoneAddingChildren(!aFromParser) { } @@ -154,7 +147,6 @@ nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified) NS_IMPL_ADDREF_INHERITED(nsHTMLObjectElement, nsGenericElement) NS_IMPL_RELEASE_INHERITED(nsHTMLObjectElement, nsGenericElement) -// QueryInterface implementation for nsHTMLObjectElement NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLObjectElement, nsGenericHTMLFormElement) NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLObjectElement) @@ -170,33 +162,25 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLObjectElement, NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLObjectElement) NS_HTML_CONTENT_INTERFACE_MAP_END - -// nsIDOMHTMLObjectElement - - NS_IMPL_DOM_CLONENODE(nsHTMLObjectElement) NS_IMETHODIMP -nsHTMLObjectElement::GetForm(nsIDOMHTMLFormElement** aForm) +nsHTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm) { return nsGenericHTMLFormElement::GetForm(aForm); } -// nsIContent - nsresult -nsHTMLObjectElement::BindToTree(nsIDocument* aDocument, - nsIContent* aParent, - nsIContent* aBindingParent, +nsHTMLObjectElement::BindToTree(nsIDocument *aDocument, + nsIContent *aParent, + nsIContent *aBindingParent, PRBool aCompileEventHandlers) { nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent, aBindingParent, aCompileEventHandlers); - if (NS_FAILED(rv)) { - return rv; - } + NS_ENSURE_SUCCESS(rv, rv); // If we already have all the children, start the load. if (mIsDoneAddingChildren) { @@ -219,8 +203,8 @@ nsHTMLObjectElement::UnbindFromTree(PRBool aDeep, nsresult -nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, +nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName, + nsIAtom *aPrefix, const nsAString &aValue, PRBool aNotify) { // If we plan to call LoadObject, we want to do it first so that the @@ -229,19 +213,19 @@ nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, // get bound after all the attributes have been set, so we'll do the // object load from BindToTree/DoneAddingChildren. // Skip the LoadObject call in that case. - if (aNotify && - aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::data) { + if (aNotify && aNameSpaceID == kNameSpaceID_None && + aName == nsGkAtoms::data) { nsAutoString type; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); + GetAttr(kNameSpaceID_None, nsGkAtoms::type, type); LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE); } - return nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue, aNotify); } -PRBool nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex) +PRBool +nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex) { if (Type() == eType_Plugin) { // Has plugin content: let the plugin decide what to do in terms of @@ -259,13 +243,13 @@ PRBool nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex) PRUint32 nsHTMLObjectElement::GetDesiredIMEState() { - if (Type() == eType_Plugin) + if (Type() == eType_Plugin) { return nsIContent::IME_STATUS_ENABLE; + } + return nsGenericHTMLFormElement::GetDesiredIMEState(); } -// nsIFormControl - NS_IMETHODIMP nsHTMLObjectElement::Reset() { @@ -273,11 +257,11 @@ nsHTMLObjectElement::Reset() } NS_IMETHODIMP -nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, - nsIContent* aSubmitElement) +nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission *aFormSubmission, + nsIContent *aSubmitElement) { nsAutoString name; - if (!GetAttr(kNameSpaceID_None, nsHTMLAtoms::name, name)) { + if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) { // No name, don't submit. return NS_OK; @@ -314,22 +298,10 @@ nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, return aFormSubmission->AddNameValuePair(this, name, value); } -NS_IMETHODIMP -nsHTMLObjectElement::SaveState() -{ - return NS_OK; -} - -PRBool -nsHTMLObjectElement::RestoreState(nsPresState* aState) -{ - return PR_FALSE; -} - -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Code, code) NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Align, align) NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Archive, archive) NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Border, border) +NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Code, code) NS_IMPL_URI_ATTR(nsHTMLObjectElement, CodeBase, codebase) NS_IMPL_STRING_ATTR(nsHTMLObjectElement, CodeType, codetype) NS_IMPL_URI_ATTR(nsHTMLObjectElement, Data, data) @@ -345,7 +317,7 @@ NS_IMPL_INT_ATTR(nsHTMLObjectElement, Vspace, vspace) NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Width, width) NS_IMETHODIMP -nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument) +nsHTMLObjectElement::GetContentDocument(nsIDOMDocument **aContentDocument) { NS_ENSURE_ARG_POINTER(aContentDocument); @@ -357,7 +329,6 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument) // XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue! nsIDocument *sub_doc = GetOwnerDoc()->GetSubDocumentFor(this); - if (!sub_doc) { return NS_OK; } @@ -367,12 +338,12 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument) PRBool nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) + nsIAtom *aAttribute, + const nsAString &aValue, + nsAttrValue &aResult) { if (aNamespaceID == kNameSpaceID_None) { - if (aAttribute == nsHTMLAtoms::align) { + if (aAttribute == nsGkAtoms::align) { return ParseAlignValue(aValue, aResult); } if (ParseImageAttribute(aAttribute, aValue, aResult)) { @@ -385,8 +356,8 @@ nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID, } static void -MapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) +MapAttributesIntoRule(const nsMappedAttributes *aAttributes, + nsRuleData *aData) { nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aData); nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aData); @@ -396,7 +367,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes, } NS_IMETHODIMP_(PRBool) -nsHTMLObjectElement::IsAttributeMapped(const nsIAtom* aAttribute) const +nsHTMLObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const { static const MappedAttributeEntry* const map[] = { sCommonAttributeMap, @@ -418,18 +389,20 @@ nsHTMLObjectElement::GetAttributeMappingFunction() const void nsHTMLObjectElement::StartObjectLoad(PRBool aNotify) { - nsAutoString uri, type; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); + nsAutoString type; + GetAttr(kNameSpaceID_None, nsGkAtoms::type, type); NS_ConvertUTF16toUTF8 ctype(type); - // Be sure to call the nsIURI version if we have no attribute - // That handles the case where no URI is specified. An empty string would get - // interpreted as the page itself, instead of absence of URI. - if (!GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, uri)) { - LoadObject(nsnull, aNotify, ctype); - } else { + nsAutoString uri; + if (GetAttr(kNameSpaceID_None, nsGkAtoms::data, uri)) { LoadObject(uri, aNotify, ctype); } + else { + // Be sure to call the nsIURI version if we have no attribute + // That handles the case where no URI is specified. An empty string would + // get interpreted as the page itself, instead of absence of URI. + LoadObject(nsnull, aNotify, ctype); + } } PRInt32 @@ -443,5 +416,3 @@ nsHTMLObjectElement::GetCapabilities() const { return nsObjectLoadingContent::GetCapabilities() | eSupportClassID; } - - diff --git a/mozilla/content/html/content/src/nsHTMLSharedElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedElement.cpp index 1e0f18a74d5..94b818a659d 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedElement.cpp @@ -34,7 +34,6 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLEmbedElement.h" #include "nsIDOMHTMLIsIndexElement.h" #include "nsIDOMHTMLParamElement.h" #include "nsIDOMHTMLBaseElement.h" @@ -42,9 +41,7 @@ #include "nsIDOMHTMLMenuElement.h" #include "nsIDOMHTMLQuoteElement.h" #include "nsIDOMHTMLBaseFontElement.h" -#include "nsIDOMEventReceiver.h" #include "nsGenericHTMLElement.h" -#include "nsObjectLoadingContent.h" #include "nsHTMLAtoms.h" #include "nsStyleConsts.h" #include "nsPresContext.h" @@ -52,21 +49,10 @@ #include "nsMappedAttributes.h" #include "nsStyleContext.h" -#ifdef MOZ_SVG -#include "nsIDOMGetSVGDocument.h" -#include "nsIDOMSVGDocument.h" -#include "nsIDocument.h" -#endif - // XXX nav4 has type= start= (same as OL/UL) extern nsAttrValue::EnumTable kListTypeTable[]; class nsHTMLSharedElement : public nsGenericHTMLElement, - public nsObjectLoadingContent, - public nsIDOMHTMLEmbedElement, -#ifdef MOZ_SVG - public nsIDOMGetSVGDocument, -#endif public nsIDOMHTMLIsIndexElement, public nsIDOMHTMLParamElement, public nsIDOMHTMLBaseElement, @@ -91,25 +77,11 @@ public: // nsIDOMHTMLElement NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - // nsIDOMHTMLEmbedElement - NS_DECL_NSIDOMHTMLEMBEDELEMENT - -#ifdef MOZ_SVG - // nsIDOMGetSVGDocument - NS_DECL_NSIDOMGETSVGDOCUMENT -#endif - // nsIDOMHTMLIsIndexElement NS_DECL_NSIDOMHTMLISINDEXELEMENT - // nsIDOMHTMLParamElement Can't use the macro - // NS_DECL_NSIDOMHTMLPARAMELEMENT since some of the methods in - // nsIDOMHTMLParamElement clashes with methods in - // nsIDOMHTMLEmbedElement - NS_IMETHOD GetValue(nsAString& aValue); - NS_IMETHOD SetValue(const nsAString& aValue); - NS_IMETHOD GetValueType(nsAString& aValueType); - NS_IMETHOD SetValueType(const nsAString& aValueType); + // nsIDOMHTMLParamElement + NS_DECL_NSIDOMHTMLPARAMELEMENT // nsIDOMHTMLBaseElement NS_DECL_NSIDOMHTMLBASEELEMENT @@ -127,31 +99,12 @@ public: NS_DECL_NSIDOMHTMLBASEFONTELEMENT // nsIContent - // Have to override tabindex for to act right - NS_IMETHOD GetTabIndex(PRInt32* aTabIndex); - NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); - virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull); - virtual PRUint32 GetDesiredIMEState(); - virtual PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult); virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const; NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; - virtual PRInt32 IntrinsicState() const; - - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, - PRBool aCompileEventHandlers); - virtual void UnbindFromTree(PRBool aDeep = PR_TRUE, - PRBool aNullParent = PR_TRUE); - virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - PRBool aNotify); - - // nsObjectLoadingContent - virtual PRUint32 GetCapabilities() const; }; @@ -175,20 +128,7 @@ NS_IMPL_RELEASE_INHERITED(nsHTMLSharedElement, nsGenericElement) // QueryInterface implementation for nsHTMLSharedElement NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedElement, nsGenericHTMLElement, - nsIDOMHTMLEmbedElement) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed) -#ifdef MOZ_SVG - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMGetSVGDocument, embed) -#endif - NS_INTERFACE_MAP_ENTRY_IF_TAG(imgIDecoderObserver, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIStreamListener, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIRequestObserver, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIFrameLoaderOwner, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIObjectLoadingContent, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIImageLoadingContent, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIInterfaceRequestor, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIChannelEventSink, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsISupportsWeakReference, embed) + nsIDOMHTMLParamElement) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLParamElement, param) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLIsIndexElement, isindex) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseElement, base) @@ -198,7 +138,6 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedElement, NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, blockquote) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseFontElement, basefont) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLEmbedElement, embed) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLParamElement, param) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLWBRElement, wbr) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLIsIndexElement, isindex) @@ -212,41 +151,11 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedElement, NS_HTML_CONTENT_INTERFACE_MAP_END -NS_IMPL_DOM_CLONENODE_AMBIGUOUS(nsHTMLSharedElement, nsIDOMHTMLEmbedElement) - - -///////////////////////////////////////////// -// Implement nsIDOMHTMLEmbedElement interface -NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Align, align) -NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Height, height) -NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Width, width) -NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Name, name) -NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Type, type) -NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Src, src) - -#ifdef MOZ_SVG -// nsIDOMGetSVGDocument -NS_IMETHODIMP -nsHTMLSharedElement::GetSVGDocument(nsIDOMSVGDocument** aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - *aResult = nsnull; - - if (!mNodeInfo->Equals(nsHTMLAtoms::embed) || !IsInDoc()) { - return NS_OK; - } - - nsIDocument *sub_doc = GetOwnerDoc()->GetSubDocumentFor(this); - if (sub_doc) { - CallQueryInterface(sub_doc, aResult); - } - - return NS_OK; -} -#endif +NS_IMPL_DOM_CLONENODE_AMBIGUOUS(nsHTMLSharedElement, nsIDOMHTMLParamElement) // nsIDOMHTMLParamElement +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Name, name) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Type, type) NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Value, value) NS_IMPL_STRING_ATTR(nsHTMLSharedElement, ValueType, valuetype) @@ -267,10 +176,6 @@ NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Color, color) NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Face, face) NS_IMPL_INT_ATTR(nsHTMLSharedElement, Size, size) -// TabIndex for embed -NS_IMPL_INT_ATTR(nsHTMLSharedElement, TabIndex, tabindex) - - NS_IMETHODIMP nsHTMLSharedElement::GetForm(nsIDOMHTMLFormElement** aForm) { @@ -290,15 +195,7 @@ nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID, nsAttrValue& aResult) { if (aNamespaceID == kNameSpaceID_None) { - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - if (aAttribute == nsHTMLAtoms::align) { - return ParseAlignValue(aValue, aResult); - } - if (ParseImageAttribute(aAttribute, aValue, aResult)) { - return PR_TRUE; - } - } - else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { + if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { if (aAttribute == nsHTMLAtoms::size) { return aResult.ParseIntWithBounds(aValue, 0); } @@ -414,17 +311,6 @@ SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -static void -EmbedMapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) -{ - nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); - nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - static void DirectoryMenuMapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) @@ -449,17 +335,6 @@ DirectoryMenuMapAttributesIntoRule(const nsMappedAttributes* aAttributes, NS_IMETHODIMP_(PRBool) nsHTMLSharedElement::IsAttributeMapped(const nsIAtom* aAttribute) const { - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - static const MappedAttributeEntry* const map[] = { - sCommonAttributeMap, - sImageMarginSizeAttributeMap, - sImageAlignAttributeMap, - sImageBorderAttributeMap - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); - } - if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { static const MappedAttributeEntry attributes[] = { // XXXldb This is just wrong. @@ -500,9 +375,6 @@ nsHTMLSharedElement::IsAttributeMapped(const nsIAtom* aAttribute) const nsMapRuleToAttributesFunc nsHTMLSharedElement::GetAttributeMappingFunction() const { - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - return &EmbedMapAttributesIntoRule; - } if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { return &SpacerMapAttributesIntoRule; } @@ -513,109 +385,3 @@ nsHTMLSharedElement::GetAttributeMappingFunction() const return nsGenericHTMLElement::GetAttributeMappingFunction(); } - - -nsresult -nsHTMLSharedElement::BindToTree(nsIDocument* aDocument, - nsIContent* aParent, - nsIContent* aBindingParent, - PRBool aCompileEventHandlers) -{ - nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, - aBindingParent, - aCompileEventHandlers); - // Must start loading stuff after being in a document - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - nsAutoString type; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); - - nsAutoString uri; - if (GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, uri)) { - // Don't notify: We aren't in a document yet, so we have no frames - LoadObject(uri, PR_FALSE, NS_ConvertUTF16toUTF8(type)); - } else { - // Sometimes, code uses with no src attributes, for example using - // code="...". Handle that case. - LoadObject(nsnull, PR_FALSE, NS_ConvertUTF16toUTF8(type)); - } - } - return rv; -} - -void -nsHTMLSharedElement::UnbindFromTree(PRBool aDeep, - PRBool aNullParent) -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - RemovedFromDocument(); - } - nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); -} - - - -nsresult -nsHTMLSharedElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - PRBool aNotify) -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - // If we plan to call LoadObject, we want to do it first so that the - // image load kicks off _before_ the reflow triggered by the SetAttr. But if - // aNotify is false, we are coming from the parser or some such place; we'll - // get bound after all the attributes have been set, so we'll do the - // object load from BindToTree. Skip the LoadObject call in that case. - if (aNotify && - aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::src) { - nsAutoString type; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); - LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE); - } - } - - return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, - aValue, aNotify); -} - -PRUint32 -nsHTMLSharedElement::GetCapabilities() const -{ - return eSupportImages | eSupportPlugins | eOverrideServerType -#ifdef MOZ_SVG - | eSupportSVG -#endif - ; -} - -PRInt32 -nsHTMLSharedElement::IntrinsicState() const -{ - PRInt32 state = nsGenericHTMLElement::IntrinsicState(); - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - state |= ObjectState(); - } - return state; -} - -PRBool -nsHTMLSharedElement::IsFocusable(PRInt32 *aTabIndex) -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - // Let plugin decide whether it wants focus from mouse clicks - if (aTabIndex) { - GetTabIndex(aTabIndex); - } - return PR_TRUE; - } - - return nsGenericHTMLElement::IsFocusable(aTabIndex); -} - -PRUint32 -nsHTMLSharedElement::GetDesiredIMEState() -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed) && - Type() == eType_Plugin) - return nsIContent::IME_STATUS_ENABLE; - return nsGenericHTMLElement::GetDesiredIMEState(); -} diff --git a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp index 55419111e91..a0a67df272c 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -35,112 +35,144 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLObjectElement.h" + #include "nsGenericHTMLElement.h" #include "nsObjectLoadingContent.h" #include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" #include "nsDOMError.h" - #include "nsIDocument.h" -#include "nsIPresShell.h" #include "nsIDOMDocument.h" -#include "nsIWebNavigation.h" -#include "nsIFormSubmission.h" -#include "nsIObjectFrame.h" -#include "nsIPluginInstance.h" -#include "nsIPluginInstanceInternal.h" +#include "nsIDOMHTMLAppletElement.h" +#include "nsIDOMHTMLEmbedElement.h" +#ifdef MOZ_SVG +#include "nsIDOMGetSVGDocument.h" +#include "nsIDOMSVGDocument.h" +#endif -class nsHTMLObjectElement : public nsGenericHTMLFormElement, - public nsObjectLoadingContent, - public nsIDOMHTMLObjectElement +// XXX this is to get around conflicts with windows.h defines +// introduced through jni.h +#if defined (XP_WIN) && ! defined (WINCE) +#undef GetClassName +#undef GetObject +#endif + +class nsHTMLSharedObjectElement : public nsGenericHTMLElement, + public nsObjectLoadingContent, + public nsIDOMHTMLAppletElement, + public nsIDOMHTMLEmbedElement +#ifdef MOZ_SVG + , public nsIDOMGetSVGDocument +#endif { public: - nsHTMLObjectElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE); - virtual ~nsHTMLObjectElement(); + nsHTMLSharedObjectElement(nsINodeInfo *aNodeInfo, + PRBool aFromParser = PR_FALSE); // nsISupports NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - // nsIDOMHTMLObjectElement - NS_DECL_NSIDOMHTMLOBJECTELEMENT + // nsIDOMHTMLAppletElement + NS_DECL_NSIDOMHTMLAPPLETELEMENT - // nsIContent - virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, + // Can't use macro for nsIDOMHTMLEmbedElement because it has conflicts with + // NS_DECL_NSIDOMHTMLAPPLETELEMENT. + + // nsIDOMHTMLEmbedElement + NS_IMETHOD GetSrc(nsAString &aSrc); + NS_IMETHOD SetSrc(const nsAString &aSrc); + NS_IMETHOD GetType(nsAString &aType); + NS_IMETHOD SetType(const nsAString &aType); + +#ifdef MOZ_SVG + // nsIDOMGetSVGDocument + NS_DECL_NSIDOMGETSVGDOCUMENT +#endif + + virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent, + nsIContent *aBindingParent, PRBool aCompileEventHandlers); virtual void UnbindFromTree(PRBool aDeep = PR_TRUE, PRBool aNullParent = PR_TRUE); - virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, + virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName, + nsIAtom *aPrefix, const nsAString &aValue, PRBool aNotify); + NS_IMETHOD GetTabIndex(PRInt32 *aTabIndex); + NS_IMETHOD SetTabIndex(PRInt32 aTabIndex); virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull); virtual PRUint32 GetDesiredIMEState(); - // Overriden nsIFormControl methods - NS_IMETHOD_(PRInt32) GetType() const { return NS_FORM_OBJECT; } - NS_IMETHOD Reset(); - NS_IMETHOD SubmitNamesValues(nsIFormSubmission* aFormSubmission, - nsIContent* aSubmitElement); - NS_IMETHOD SaveState(); - virtual PRBool RestoreState(nsPresState* aState); - virtual void DoneAddingChildren(PRBool aHaveNotified); virtual PRBool IsDoneAddingChildren(); virtual PRBool ParseAttribute(PRInt32 aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); + nsIAtom *aAttribute, + const nsAString &aValue, + nsAttrValue &aResult); virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; + NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom *aAttribute) const; virtual PRInt32 IntrinsicState() const; // nsObjectLoadingContent virtual PRUint32 GetCapabilities() const; -protected: +private: /** - * Calls LoadObject with the correct arguments to start the plugin - * load. + * Calls LoadObject with the correct arguments to start the plugin load. */ NS_HIDDEN_(void) StartObjectLoad(PRBool aNotify); + void GetTypeAttrValue(nsCString &aValue) const + { + if (mNodeInfo->Equals(nsGkAtoms::applet)) { + aValue.AppendLiteral("application/x-java-vm"); + } + else { + nsAutoString type; + GetAttr(kNameSpaceID_None, nsGkAtoms::type, type); + + CopyUTF16toUTF8(type, aValue); + } + } + + nsIAtom *URIAttrName() const + { + return mNodeInfo->Equals(nsGkAtoms::applet) ? + nsGkAtoms::code : + nsGkAtoms::src; + } + PRPackedBool mIsDoneAddingChildren; }; -NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object) +NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject) -nsHTMLObjectElement::nsHTMLObjectElement(nsINodeInfo *aNodeInfo, - PRBool aFromParser) - : nsGenericHTMLFormElement(aNodeInfo), mIsDoneAddingChildren(!aFromParser) -{ -} - -nsHTMLObjectElement::~nsHTMLObjectElement() +nsHTMLSharedObjectElement::nsHTMLSharedObjectElement(nsINodeInfo *aNodeInfo, + PRBool aFromParser) + : nsGenericHTMLElement(aNodeInfo), + mIsDoneAddingChildren(!aFromParser) { } PRBool -nsHTMLObjectElement::IsDoneAddingChildren() +nsHTMLSharedObjectElement::IsDoneAddingChildren() { return mIsDoneAddingChildren; } void -nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified) +nsHTMLSharedObjectElement::DoneAddingChildren(PRBool aHaveNotified) { mIsDoneAddingChildren = PR_TRUE; @@ -151,13 +183,17 @@ nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified) } } -NS_IMPL_ADDREF_INHERITED(nsHTMLObjectElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLObjectElement, nsGenericElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLSharedObjectElement, nsGenericElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLSharedObjectElement, nsGenericElement) -// QueryInterface implementation for nsHTMLObjectElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLObjectElement, - nsGenericHTMLFormElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLObjectElement) +NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedObjectElement, + nsGenericHTMLElement, + nsIDOMHTMLAppletElement) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLAppletElement, applet) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed) +#ifdef MOZ_SVG + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMGetSVGDocument, embed) +#endif NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver) NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) NS_INTERFACE_MAP_ENTRY(nsIStreamListener) @@ -167,39 +203,26 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLObjectElement, NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLObjectElement) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLAppletElement, applet) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLEmbedElement, embed) NS_HTML_CONTENT_INTERFACE_MAP_END - -// nsIDOMHTMLObjectElement - - -NS_IMPL_DOM_CLONENODE(nsHTMLObjectElement) - - -NS_IMETHODIMP -nsHTMLObjectElement::GetForm(nsIDOMHTMLFormElement** aForm) -{ - return nsGenericHTMLFormElement::GetForm(aForm); -} - -// nsIContent +NS_IMPL_DOM_CLONENODE_AMBIGUOUS(nsHTMLSharedObjectElement, + nsIDOMHTMLAppletElement) nsresult -nsHTMLObjectElement::BindToTree(nsIDocument* aDocument, - nsIContent* aParent, - nsIContent* aBindingParent, - PRBool aCompileEventHandlers) +nsHTMLSharedObjectElement::BindToTree(nsIDocument *aDocument, + nsIContent *aParent, + nsIContent *aBindingParent, + PRBool aCompileEventHandlers) { - nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent, - aBindingParent, - aCompileEventHandlers); - if (NS_FAILED(rv)) { - return rv; - } + nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, + aBindingParent, + aCompileEventHandlers); + NS_ENSURE_SUCCESS(rv, rv); // If we already have all the children, start the load. - if (mIsDoneAddingChildren) { + if (mIsDoneAddingChildren || mNodeInfo->Equals(nsGkAtoms::embed)) { // Don't need to notify: We have no frames yet, since we weren't in a // document StartObjectLoad(PR_FALSE); @@ -209,19 +232,19 @@ nsHTMLObjectElement::BindToTree(nsIDocument* aDocument, } void -nsHTMLObjectElement::UnbindFromTree(PRBool aDeep, - PRBool aNullParent) +nsHTMLSharedObjectElement::UnbindFromTree(PRBool aDeep, + PRBool aNullParent) { RemovedFromDocument(); - nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent); + nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); } nsresult -nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - PRBool aNotify) +nsHTMLSharedObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName, + nsIAtom *aPrefix, const nsAString &aValue, + PRBool aNotify) { // If we plan to call LoadObject, we want to do it first so that the // object load kicks off _before_ the reflow triggered by the SetAttr. But if @@ -229,21 +252,21 @@ nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, // get bound after all the attributes have been set, so we'll do the // object load from BindToTree/DoneAddingChildren. // Skip the LoadObject call in that case. - if (aNotify && - aNameSpaceID == kNameSpaceID_None && aName == nsHTMLAtoms::data) { - nsAutoString type; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); - LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE); + if (aNotify && aNameSpaceID == kNameSpaceID_None && + aName == URIAttrName()) { + nsCAutoString type; + GetTypeAttrValue(type); + LoadObject(aValue, aNotify, type, PR_TRUE); } - - return nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aName, aPrefix, - aValue, aNotify); + return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue, + aNotify); } -PRBool nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex) +PRBool +nsHTMLSharedObjectElement::IsFocusable(PRInt32 *aTabIndex) { - if (Type() == eType_Plugin) { + if (mNodeInfo->Equals(nsGkAtoms::embed) || Type() == eType_Plugin) { // Has plugin content: let the plugin decide what to do in terms of // internal focus from mouse clicks if (aTabIndex) { @@ -253,103 +276,41 @@ PRBool nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex) return PR_TRUE; } - return nsGenericHTMLFormElement::IsFocusable(aTabIndex); + return nsGenericHTMLElement::IsFocusable(aTabIndex); } PRUint32 -nsHTMLObjectElement::GetDesiredIMEState() +nsHTMLSharedObjectElement::GetDesiredIMEState() { - if (Type() == eType_Plugin) + if (Type() == eType_Plugin) { return nsIContent::IME_STATUS_ENABLE; - return nsGenericHTMLFormElement::GetDesiredIMEState(); -} - -// nsIFormControl - -NS_IMETHODIMP -nsHTMLObjectElement::Reset() -{ - return NS_OK; -} - -NS_IMETHODIMP -nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, - nsIContent* aSubmitElement) -{ - nsAutoString name; - if (!GetAttr(kNameSpaceID_None, nsHTMLAtoms::name, name)) { - // No name, don't submit. - - return NS_OK; } - - nsIFrame* frame = GetPrimaryFrame(PR_FALSE); - - nsIObjectFrame *objFrame = nsnull; - if (frame) { - CallQueryInterface(frame, &objFrame); - } - - if (!objFrame) { - // No frame, nothing to submit. - - return NS_OK; - } - - nsCOMPtr pi; - objFrame->GetPluginInstance(*getter_AddRefs(pi)); - - nsCOMPtr pi_internal(do_QueryInterface(pi)); - - if (!pi_internal) { - // No plugin, nothing to submit. - - return NS_OK; - } - - nsAutoString value; - nsresult rv = pi_internal->GetFormValue(value); - NS_ENSURE_SUCCESS(rv, rv); - - return aFormSubmission->AddNameValuePair(this, name, value); + + return nsGenericHTMLElement::GetDesiredIMEState(); } +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Align, align) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Alt, alt) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Archive, archive) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Code, code) +NS_IMPL_URI_ATTR(nsHTMLSharedObjectElement, CodeBase, codebase) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Height, height) +NS_IMPL_INT_ATTR(nsHTMLSharedObjectElement, Hspace, hspace) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Name, name) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Object, object) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Src, src) +NS_IMPL_INT_ATTR(nsHTMLSharedObjectElement, TabIndex, tabindex) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Type, type) +NS_IMPL_INT_ATTR(nsHTMLSharedObjectElement, Vspace, vspace) +NS_IMPL_STRING_ATTR(nsHTMLSharedObjectElement, Width, width) + +#ifdef MOZ_SVG NS_IMETHODIMP -nsHTMLObjectElement::SaveState() +nsHTMLSharedObjectElement::GetSVGDocument(nsIDOMSVGDocument **aResult) { - return NS_OK; -} + NS_ENSURE_ARG_POINTER(aResult); -PRBool -nsHTMLObjectElement::RestoreState(nsPresState* aState) -{ - return PR_FALSE; -} - -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Code, code) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Align, align) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Archive, archive) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Border, border) -NS_IMPL_URI_ATTR(nsHTMLObjectElement, CodeBase, codebase) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, CodeType, codetype) -NS_IMPL_URI_ATTR(nsHTMLObjectElement, Data, data) -NS_IMPL_BOOL_ATTR(nsHTMLObjectElement, Declare, declare) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Height, height) -NS_IMPL_INT_ATTR(nsHTMLObjectElement, Hspace, hspace) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Name, name) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Standby, standby) -NS_IMPL_INT_ATTR(nsHTMLObjectElement, TabIndex, tabindex) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Type, type) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, UseMap, usemap) -NS_IMPL_INT_ATTR(nsHTMLObjectElement, Vspace, vspace) -NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Width, width) - -NS_IMETHODIMP -nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument) -{ - NS_ENSURE_ARG_POINTER(aContentDocument); - - *aContentDocument = nsnull; + *aResult = nsnull; if (!IsInDoc()) { return NS_OK; @@ -357,22 +318,22 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument) // XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue! nsIDocument *sub_doc = GetOwnerDoc()->GetSubDocumentFor(this); - if (!sub_doc) { return NS_OK; } - return CallQueryInterface(sub_doc, aContentDocument); + return CallQueryInterface(sub_doc, aResult); } +#endif PRBool -nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) +nsHTMLSharedObjectElement::ParseAttribute(PRInt32 aNamespaceID, + nsIAtom *aAttribute, + const nsAString &aValue, + nsAttrValue &aResult) { if (aNamespaceID == kNameSpaceID_None) { - if (aAttribute == nsHTMLAtoms::align) { + if (aAttribute == nsGkAtoms::align) { return ParseAlignValue(aValue, aResult); } if (ParseImageAttribute(aAttribute, aValue, aResult)) { @@ -380,23 +341,23 @@ nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID, } } - return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute, - aValue, aResult); + return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue, + aResult); } static void -MapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) +MapAttributesIntoRule(const nsMappedAttributes *aAttributes, + nsRuleData *aData) { - nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aData); - nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aData); - nsGenericHTMLFormElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLFormElement::MapImageSizeAttributesInto(aAttributes, aData); - nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); + nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } NS_IMETHODIMP_(PRBool) -nsHTMLObjectElement::IsAttributeMapped(const nsIAtom* aAttribute) const +nsHTMLSharedObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const { static const MappedAttributeEntry* const map[] = { sCommonAttributeMap, @@ -410,38 +371,53 @@ nsHTMLObjectElement::IsAttributeMapped(const nsIAtom* aAttribute) const nsMapRuleToAttributesFunc -nsHTMLObjectElement::GetAttributeMappingFunction() const +nsHTMLSharedObjectElement::GetAttributeMappingFunction() const { return &MapAttributesIntoRule; } void -nsHTMLObjectElement::StartObjectLoad(PRBool aNotify) +nsHTMLSharedObjectElement::StartObjectLoad(PRBool aNotify) { - nsAutoString uri, type; - GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); - NS_ConvertUTF16toUTF8 ctype(type); + nsCAutoString type; + GetTypeAttrValue(type); - // Be sure to call the nsIURI version if we have no attribute - // That handles the case where no URI is specified. An empty string would get - // interpreted as the page itself, instead of absence of URI. - if (!GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, uri)) { - LoadObject(nsnull, aNotify, ctype); - } else { - LoadObject(uri, aNotify, ctype); + nsAutoString uri; + if (!GetAttr(kNameSpaceID_None, URIAttrName(), uri)) { + if (mNodeInfo->Equals(nsGkAtoms::applet)) { + // The constructor set the type to eType_Loading; but if we have no code + // attribute, then we aren't really a plugin + Fallback(aNotify); + } + else { + // Be sure to call the nsIURI version if we have no attribute + // That handles the case where no URI is specified. An empty string would + // get interpreted as the page itself, instead of absence of URI. + LoadObject(nsnull, aNotify, type); + } + } + else { + LoadObject(uri, aNotify, type); } } PRInt32 -nsHTMLObjectElement::IntrinsicState() const +nsHTMLSharedObjectElement::IntrinsicState() const { - return nsGenericHTMLFormElement::IntrinsicState() | ObjectState(); + return nsGenericHTMLElement::IntrinsicState() | ObjectState(); } PRUint32 -nsHTMLObjectElement::GetCapabilities() const +nsHTMLSharedObjectElement::GetCapabilities() const { - return nsObjectLoadingContent::GetCapabilities() | eSupportClassID; + PRUint32 capabilities = eSupportPlugins | eOverrideServerType; + if (mNodeInfo->Equals(nsGkAtoms::embed)) { + capabilities |= +#ifdef MOZ_SVG + eSupportSVG | +#endif + eSupportImages; + } + + return capabilities; } - - diff --git a/mozilla/parser/htmlparser/public/nsHTMLTagList.h b/mozilla/parser/htmlparser/public/nsHTMLTagList.h index 1e5c8c756c1..3fb90962f09 100644 --- a/mozilla/parser/htmlparser/public/nsHTMLTagList.h +++ b/mozilla/parser/htmlparser/public/nsHTMLTagList.h @@ -67,7 +67,7 @@ HTML_TAG(a, Anchor) HTML_TAG(abbr, Span) HTML_TAG(acronym, Span) HTML_TAG(address, Span) -HTML_TAG(applet, Applet) +HTML_TAG(applet, SharedObject) HTML_TAG(area, Area) HTML_TAG(b, Span) HTML_TAG(base, Shared) @@ -95,7 +95,7 @@ HTML_TAG(div, Div) HTML_TAG(dl, SharedList) HTML_TAG(dt, Span) HTML_TAG(em, Span) -HTML_TAG(embed, Shared) +HTML_TAG(embed, SharedObject) HTML_TAG(fieldset, FieldSet) HTML_TAG(font, Font) HTML_TAG(form, Form)