mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 824327: Convert SVGTitleElement to WebIDL r=bz
--HG-- rename : content/svg/content/src/nsSVGTitleElement.cpp => content/svg/content/src/SVGTitleElement.cpp rename : content/svg/content/src/nsSVGTitleElement.cpp => content/svg/content/src/SVGTitleElement.h
This commit is contained in:
parent
f7f39fe99c
commit
521e01e330
@ -87,7 +87,6 @@ CPPSRCS = \
|
||||
nsSVGTextElement.cpp \
|
||||
nsSVGTextPathElement.cpp \
|
||||
nsSVGTextPositioningElement.cpp \
|
||||
nsSVGTitleElement.cpp \
|
||||
nsSVGUnknownElement.cpp \
|
||||
nsSVGUseElement.cpp \
|
||||
nsSVGViewBox.cpp \
|
||||
@ -110,6 +109,7 @@ CPPSRCS = \
|
||||
SVGPointList.cpp \
|
||||
SVGPreserveAspectRatio.cpp \
|
||||
SVGStringList.cpp \
|
||||
SVGTitleElement.cpp \
|
||||
SVGTransform.cpp \
|
||||
SVGTransformList.cpp \
|
||||
SVGTransformListParser.cpp \
|
||||
@ -155,6 +155,7 @@ EXPORTS_mozilla/dom = \
|
||||
SVGAnimatedAngle.h \
|
||||
SVGAnimatedBoolean.h \
|
||||
SVGDescElement.h \
|
||||
SVGTitleElement.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
131
content/svg/content/src/SVGTitleElement.cpp
Normal file
131
content/svg/content/src/SVGTitleElement.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGTitleElement.h"
|
||||
#include "mozilla/dom/SVGTitleElementBinding.h"
|
||||
|
||||
DOMCI_NODE_DATA(SVGTitleElement, mozilla::dom::SVGTitleElement)
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Title)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
SVGTitleElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
{
|
||||
return SVGTitleElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGTitleElement, SVGTitleElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGTitleElement, SVGTitleElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(SVGTitleElement)
|
||||
NS_NODE_INTERFACE_TABLE4(SVGTitleElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIMutationObserver)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTitleElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGTitleElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
SVGTitleElement::SVGTitleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGTitleElementBase(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
AddMutationObserver(this);
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||
nsIContent *aContent,
|
||||
CharacterDataChangeInfo *aInfo)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent *aContainer,
|
||||
nsIContent *aFirstNewContent,
|
||||
int32_t aNewIndexInContainer)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::ContentInserted(nsIDocument *aDocument,
|
||||
nsIContent *aContainer,
|
||||
nsIContent *aChild,
|
||||
int32_t aIndexInContainer)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent *aContainer,
|
||||
nsIContent *aChild,
|
||||
int32_t aIndexInContainer,
|
||||
nsIContent *aPreviousSibling)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
SVGTitleElement::BindToTree(nsIDocument *aDocument,
|
||||
nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
{
|
||||
// Let this fall through.
|
||||
nsresult rv = SVGTitleElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SendTitleChangeEvent(true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
|
||||
// Let this fall through.
|
||||
SVGTitleElementBase::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::DoneAddingChildren(bool aHaveNotified)
|
||||
{
|
||||
if (!aHaveNotified) {
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SVGTitleElement::SendTitleChangeEvent(bool aBound)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
doc->NotifyPossibleTitleChange(aBound);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTitleElement)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
69
content/svg/content/src/SVGTitleElement.h
Normal file
69
content/svg/content/src/SVGTitleElement.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGTitleElement_h
|
||||
#define mozilla_dom_SVGTitleElement_h
|
||||
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsIDOMSVGTitleElement.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
|
||||
typedef nsSVGElement SVGTitleElementBase;
|
||||
|
||||
nsresult NS_NewSVGTitleElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGTitleElement MOZ_FINAL : public SVGTitleElementBase,
|
||||
public nsStubMutationObserver,
|
||||
public nsIDOMSVGTitleElement
|
||||
{
|
||||
protected:
|
||||
friend nsresult (::NS_NewSVGTitleElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
SVGTitleElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGTitleElementBase::)
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
|
||||
virtual void DoneAddingChildren(bool aHaveNotified);
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
private:
|
||||
void SendTitleChangeEvent(bool aBound);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGTitleElement_h
|
||||
|
@ -1,173 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsIDOMSVGTitleElement.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
|
||||
typedef nsSVGElement nsSVGTitleElementBase;
|
||||
|
||||
class nsSVGTitleElement : public nsSVGTitleElementBase,
|
||||
public nsIDOMSVGTitleElement,
|
||||
public nsStubMutationObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGTitleElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGTitleElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsresult Init();
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGTITLEELEMENT
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTitleElementBase::)
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
|
||||
virtual void DoneAddingChildren(bool aHaveNotified);
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
private:
|
||||
void SendTitleChangeEvent(bool aBound);
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(Title)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGTitleElement, nsSVGTitleElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGTitleElement, nsSVGTitleElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGTitleElement, nsSVGTitleElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGTitleElement)
|
||||
NS_NODE_INTERFACE_TABLE5(nsSVGTitleElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement, nsIDOMSVGTitleElement,
|
||||
nsIMutationObserver)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTitleElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGTitleElementBase)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGTitleElement::nsSVGTitleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGTitleElementBase(aNodeInfo)
|
||||
{
|
||||
AddMutationObserver(this);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGTitleElement::Init()
|
||||
{
|
||||
return nsSVGTitleElementBase::Init();
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||
nsIContent *aContent,
|
||||
CharacterDataChangeInfo *aInfo)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent *aContainer,
|
||||
nsIContent *aFirstNewContent,
|
||||
int32_t aNewIndexInContainer)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::ContentInserted(nsIDocument *aDocument,
|
||||
nsIContent *aContainer,
|
||||
nsIContent *aChild,
|
||||
int32_t aIndexInContainer)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent *aContainer,
|
||||
nsIContent *aChild,
|
||||
int32_t aIndexInContainer,
|
||||
nsIContent *aPreviousSibling)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGTitleElement::BindToTree(nsIDocument *aDocument,
|
||||
nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
{
|
||||
// Let this fall through.
|
||||
nsresult rv = nsSVGTitleElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SendTitleChangeEvent(true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
SendTitleChangeEvent(false);
|
||||
|
||||
// Let this fall through.
|
||||
nsSVGTitleElementBase::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::DoneAddingChildren(bool aHaveNotified)
|
||||
{
|
||||
if (!aHaveNotified) {
|
||||
SendTitleChangeEvent(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTitleElement::SendTitleChangeEvent(bool aBound)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
doc->NotifyPossibleTitleChange(aBound);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTitleElement)
|
@ -716,6 +716,10 @@ DOMInterfaces = {
|
||||
'headerFile': 'SVGPreserveAspectRatio.h'
|
||||
},
|
||||
|
||||
'SVGTitleElement': {
|
||||
'hasInstanceInterface': 'nsIDOMSVGTitleElement',
|
||||
},
|
||||
|
||||
'SVGTransform': {
|
||||
'nativeType': 'mozilla::DOMSVGTransform',
|
||||
'headerFile': 'DOMSVGTransform.h'
|
||||
|
15
dom/webidl/SVGTitleElement.webidl
Normal file
15
dom/webidl/SVGTitleElement.webidl
Normal file
@ -0,0 +1,15 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/SVG2/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGTitleElement : SVGElement {
|
||||
};
|
||||
|
@ -106,6 +106,7 @@ webidl_files = \
|
||||
SVGPoint.webidl \
|
||||
SVGPointList.webidl \
|
||||
SVGPreserveAspectRatio.webidl \
|
||||
SVGTitleElement.webidl \
|
||||
SVGTransform.webidl \
|
||||
SVGTransformList.webidl \
|
||||
Text.webidl \
|
||||
|
Loading…
Reference in New Issue
Block a user