Fixing bug 281741. We should implement the GetSVGDocument interface for HTMLEmbedElement. r=tor@acm.org, sr=jst@mozilla.org

This commit is contained in:
jwatt%jwatt.org 2005-03-23 01:42:22 +00:00
Родитель f9ba88f296
Коммит 48177b8d52
4 изменённых файлов: 90 добавлений и 0 удалений

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

@ -52,12 +52,21 @@
#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 nsImageLoadingContent,
public nsIDOMHTMLEmbedElement,
#ifdef MOZ_SVG
public nsIDOMGetSVGDocument,
#endif
public nsIDOMHTMLIsIndexElement,
public nsIDOMHTMLParamElement,
public nsIDOMHTMLBaseElement,
@ -85,6 +94,11 @@ public:
// nsIDOMHTMLEmbedElement
NS_DECL_NSIDOMHTMLEMBEDELEMENT
#ifdef MOZ_SVG
// nsIDOMGetSVGDocument
NS_DECL_NSIDOMGETSVGDOCUMENT
#endif
// nsIDOMHTMLIsIndexElement
NS_DECL_NSIDOMHTMLISINDEXELEMENT
@ -150,6 +164,9 @@ 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(nsIImageLoadingContent, embed)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLParamElement, param)
@ -187,6 +204,26 @@ 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
// nsIDOMHTMLParamElement
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Value, value)
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, ValueType, valuetype)

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

@ -49,6 +49,7 @@ XPIDL_MODULE = dom_svg
XPIDLSRCS = \
nsIDOMGetSVGDocument.idl \
nsIDOMSVGAngle.idl \
nsIDOMSVGAnimatedAngle.idl \
nsIDOMSVGAnimatedEnum.idl \

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

@ -0,0 +1,48 @@
/* -*- 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 SVG Project code.
*
* The Initial Developer of the Original Code is
* Jonathan Watt.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jonathan Watt <jonathan.watt@strath.ac.uk> (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 "domstubs.idl"
interface nsIDOMSVGDocument;
[scriptable, uuid(0401f299-685b-43a1-82b4-ce1a0011598c)]
interface nsIDOMGetSVGDocument : nsISupports
{
nsIDOMSVGDocument getSVGDocument ( );
// raises( DOMException );
};

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

@ -307,6 +307,7 @@
#include "nsIDOMXPathEvaluator.h"
#ifdef MOZ_SVG
#include "nsIDOMGetSVGDocument.h"
#include "nsIDOMSVGAngle.h"
#include "nsIDOMSVGAnimatedAngle.h"
#include "nsIDOMSVGAnimatedEnum.h"
@ -1824,6 +1825,9 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(HTMLEmbedElement, nsIDOMHTMLEmbedElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLEmbedElement)
#ifdef MOZ_SVG
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGetSVGDocument)
#endif
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END