mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 05:45:33 +00:00
new
This commit is contained in:
parent
79c343a754
commit
a56efddfcc
292
layout/html/content/src/nsHTMLArea.cpp
Normal file
292
layout/html/content/src/nsHTMLArea.cpp
Normal file
@ -0,0 +1,292 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLAreaElementIID, NS_IDOMHTMLAREAELEMENT_IID);
|
||||
|
||||
class nsHTMLArea : public nsIDOMHTMLAreaElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLArea(nsIAtom* aTag);
|
||||
~nsHTMLArea();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLAreaElement
|
||||
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
|
||||
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
|
||||
NS_IMETHOD GetAlt(nsString& aAlt);
|
||||
NS_IMETHOD SetAlt(const nsString& aAlt);
|
||||
NS_IMETHOD GetCoords(nsString& aCoords);
|
||||
NS_IMETHOD SetCoords(const nsString& aCoords);
|
||||
NS_IMETHOD GetHref(nsString& aHref);
|
||||
NS_IMETHOD SetHref(const nsString& aHref);
|
||||
NS_IMETHOD GetNoHref(PRBool* aNoHref);
|
||||
NS_IMETHOD SetNoHref(PRBool aNoHref);
|
||||
NS_IMETHOD GetShape(nsString& aShape);
|
||||
NS_IMETHOD SetShape(const nsString& aShape);
|
||||
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
|
||||
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
|
||||
NS_IMETHOD GetTarget(nsString& aTarget);
|
||||
NS_IMETHOD SetTarget(const nsString& aTarget);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLArea(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLArea(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLArea::nsHTMLArea(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLArea::~nsHTMLArea()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLArea)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLArea)
|
||||
|
||||
nsresult
|
||||
nsHTMLArea::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLAreaElementIID)) {
|
||||
nsIDOMHTMLAreaElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLArea::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLArea* it = new nsHTMLArea(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetAccessKey(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::accesskey, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetAccessKey(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::accesskey, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetAlt(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::alt, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetAlt(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::alt, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetCoords(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::coords, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetCoords(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::coords, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetHref(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::href, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetHref(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetNoHref(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::nohref, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetNoHref(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::nohref, empty, eSetAttrNotify_None);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::nohref);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetShape(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::shape, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetShape(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::shape, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetTabIndex(PRInt32* aValue)
|
||||
{
|
||||
nsHTMLValue value;
|
||||
*aValue = -1;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::tabindex, value)) {
|
||||
if (value.GetUnit() == eHTMLUnit_Integer) {
|
||||
*aValue = value.GetIntValue();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetTabIndex(PRInt32 aValue)
|
||||
{
|
||||
nsHTMLValue value(aValue, eHTMLUnit_Integer);
|
||||
return mInner.SetAttr(nsHTMLAtoms::tabindex, value, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::GetTarget(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::target, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::SetTarget(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLArea::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
185
layout/html/content/src/nsHTMLBase.cpp
Normal file
185
layout/html/content/src/nsHTMLBase.cpp
Normal file
@ -0,0 +1,185 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLBaseElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLBaseElementIID, NS_IDOMHTMLBASEELEMENT_IID);
|
||||
|
||||
class nsHTMLBase : public nsIDOMHTMLBaseElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLBase(nsIAtom* aTag);
|
||||
~nsHTMLBase();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLBaseElement
|
||||
NS_IMETHOD GetHref(nsString& aHref);
|
||||
NS_IMETHOD SetHref(const nsString& aHref);
|
||||
NS_IMETHOD GetTarget(nsString& aTarget);
|
||||
NS_IMETHOD SetTarget(const nsString& aTarget);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBase(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLBase(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLBase::nsHTMLBase(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLBase::~nsHTMLBase()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLBase)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLBase)
|
||||
|
||||
nsresult
|
||||
nsHTMLBase::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLBaseElementIID)) {
|
||||
nsIDOMHTMLBaseElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBase::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLBase* it = new nsHTMLBase(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::GetHref(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::href, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::SetHref(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::GetTarget(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::target, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::SetTarget(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBase::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
200
layout/html/content/src/nsHTMLBaseFont.cpp
Normal file
200
layout/html/content/src/nsHTMLBaseFont.cpp
Normal file
@ -0,0 +1,200 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLBaseFontElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLBaseFontElementIID, NS_IDOMHTMLBASEFONTELEMENT_IID);
|
||||
|
||||
class nsHTMLBaseFont : public nsIDOMHTMLBaseFontElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLBaseFont(nsIAtom* aTag);
|
||||
~nsHTMLBaseFont();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLBaseElement
|
||||
NS_IMETHOD GetColor(nsString& aColor);
|
||||
NS_IMETHOD SetColor(const nsString& aColor);
|
||||
NS_IMETHOD GetFace(nsString& aFace);
|
||||
NS_IMETHOD SetFace(const nsString& aFace);
|
||||
NS_IMETHOD GetSize(nsString& aSize);
|
||||
NS_IMETHOD SetSize(const nsString& aSize);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBaseFont(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLBaseFont(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLBaseFont::nsHTMLBaseFont(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLBaseFont::~nsHTMLBaseFont()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLBaseFont)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLBaseFont)
|
||||
|
||||
nsresult
|
||||
nsHTMLBaseFont::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLBaseFontElementIID)) {
|
||||
nsIDOMHTMLBaseFontElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBaseFont::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLBaseFont* it = new nsHTMLBaseFont(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::GetColor(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::color, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::SetColor(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::color, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::GetFace(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::face, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::SetFace(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::face, aValue, eSetAttrNotify_Reflow);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::GetSize(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::size, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::SetSize(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::size, aValue, eSetAttrNotify_Reflow);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFont::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
500
layout/html/content/src/nsHTMLInput.cpp
Normal file
500
layout/html/content/src/nsHTMLInput.cpp
Normal file
@ -0,0 +1,500 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
// XXX align=left, hspace, vspace, border? other nav4 attrs
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID);
|
||||
|
||||
class nsHTMLInput : public nsIDOMHTMLInputElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLInput(nsIAtom* aTag);
|
||||
~nsHTMLInput();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLInputElement
|
||||
NS_IMETHOD GetDefaultValue(nsString& aDefaultValue);
|
||||
NS_IMETHOD SetDefaultValue(const nsString& aDefaultValue);
|
||||
NS_IMETHOD GetDefaultChecked(PRBool* aDefaultChecked);
|
||||
NS_IMETHOD SetDefaultChecked(PRBool aDefaultChecked);
|
||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
||||
NS_IMETHOD GetAccept(nsString& aAccept);
|
||||
NS_IMETHOD SetAccept(const nsString& aAccept);
|
||||
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
|
||||
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
|
||||
NS_IMETHOD GetAlign(nsString& aAlign);
|
||||
NS_IMETHOD SetAlign(const nsString& aAlign);
|
||||
NS_IMETHOD GetAlt(nsString& aAlt);
|
||||
NS_IMETHOD SetAlt(const nsString& aAlt);
|
||||
NS_IMETHOD GetChecked(PRBool* aChecked);
|
||||
NS_IMETHOD SetChecked(PRBool aChecked);
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled);
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled);
|
||||
NS_IMETHOD GetMaxLength(PRInt32* aMaxLength);
|
||||
NS_IMETHOD SetMaxLength(PRInt32 aMaxLength);
|
||||
NS_IMETHOD GetName(nsString& aName);
|
||||
NS_IMETHOD SetName(const nsString& aName);
|
||||
NS_IMETHOD GetReadOnly(PRBool* aReadOnly);
|
||||
NS_IMETHOD SetReadOnly(PRBool aReadOnly);
|
||||
NS_IMETHOD GetSize(nsString& aSize);
|
||||
NS_IMETHOD SetSize(const nsString& aSize);
|
||||
NS_IMETHOD GetSrc(nsString& aSrc);
|
||||
NS_IMETHOD SetSrc(const nsString& aSrc);
|
||||
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
|
||||
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD GetUseMap(nsString& aUseMap);
|
||||
NS_IMETHOD SetUseMap(const nsString& aUseMap);
|
||||
NS_IMETHOD GetValue(nsString& aValue);
|
||||
NS_IMETHOD SetValue(const nsString& aValue);
|
||||
NS_IMETHOD Blur();
|
||||
NS_IMETHOD Focus();
|
||||
NS_IMETHOD Select();
|
||||
NS_IMETHOD Click();
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLInput(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLInput(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLInput::nsHTMLInput(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLInput::~nsHTMLInput()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLInput)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLInput)
|
||||
|
||||
nsresult
|
||||
nsHTMLInput::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLInputElementIID)) {
|
||||
nsIDOMHTMLInputElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLInput::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLInput* it = new nsHTMLInput(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetDefaultValue(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::defaultvalue, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetDefaultValue(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::defaultvalue, aValue,
|
||||
eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetDefaultChecked(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::defaultchecked, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetDefaultChecked(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::defaultchecked, empty,
|
||||
eSetAttrNotify_Render);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::defaultchecked);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
*aForm = nsnull;/* XXX */
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetAccept(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::accept, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetAccept(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::accept, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetAccessKey(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::accesskey, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetAccessKey(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::accesskey, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetAlign(nsString& aValue)
|
||||
{
|
||||
return NS_OK;/* XXX */
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetAlign(const nsString& aValue)
|
||||
{
|
||||
return NS_OK;/* XXX */
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetAlt(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::alt, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetAlt(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::alt, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetChecked(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::checked, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetChecked(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::checked, empty, eSetAttrNotify_Render);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::checked);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetDisabled(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::disabled, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetDisabled(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::disabled, empty, eSetAttrNotify_Render);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::disabled);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetMaxLength(PRInt32* aValue)
|
||||
{
|
||||
nsHTMLValue value;
|
||||
*aValue = -1;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::maxlength, value)) {
|
||||
if (value.GetUnit() == eHTMLUnit_Integer) {
|
||||
*aValue = value.GetIntValue();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetMaxLength(PRInt32 aValue)
|
||||
{
|
||||
nsHTMLValue value(aValue, eHTMLUnit_Integer);
|
||||
return mInner.SetAttr(nsHTMLAtoms::maxlength, value, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetName(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::name, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetName(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::name, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetReadOnly(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::readonly, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetReadOnly(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::readonly, empty, eSetAttrNotify_Render);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::readonly);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetSize(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::size, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetSize(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::size, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetSrc(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::src, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetSrc(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::src, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetTabIndex(PRInt32* aValue)
|
||||
{
|
||||
nsHTMLValue value;
|
||||
*aValue = -1;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::tabindex, value)) {
|
||||
if (value.GetUnit() == eHTMLUnit_Integer) {
|
||||
*aValue = value.GetIntValue();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetTabIndex(PRInt32 aValue)
|
||||
{
|
||||
nsHTMLValue value(aValue, eHTMLUnit_Integer);
|
||||
return mInner.SetAttr(nsHTMLAtoms::tabindex, value, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetType(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::type, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetUseMap(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::usemap, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetUseMap(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::usemap, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::GetValue(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::value, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::SetValue(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::value, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::Blur()
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::Focus()
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::Select()
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::Click()
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
// XXX align
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
// XXX align
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInput::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
299
layout/html/content/src/nsHTMLLink.cpp
Normal file
299
layout/html/content/src/nsHTMLLink.cpp
Normal file
@ -0,0 +1,299 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLLinkElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLLinkElementIID, NS_IDOMHTMLLINKELEMENT_IID);
|
||||
|
||||
class nsHTMLLink : public nsIDOMHTMLLinkElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLLink(nsIAtom* aTag);
|
||||
~nsHTMLLink();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLLinkElement
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled);
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled);
|
||||
NS_IMETHOD GetCharset(nsString& aCharset);
|
||||
NS_IMETHOD SetCharset(const nsString& aCharset);
|
||||
NS_IMETHOD GetHref(nsString& aHref);
|
||||
NS_IMETHOD SetHref(const nsString& aHref);
|
||||
NS_IMETHOD GetHreflang(nsString& aHreflang);
|
||||
NS_IMETHOD SetHreflang(const nsString& aHreflang);
|
||||
NS_IMETHOD GetMedia(nsString& aMedia);
|
||||
NS_IMETHOD SetMedia(const nsString& aMedia);
|
||||
NS_IMETHOD GetRel(nsString& aRel);
|
||||
NS_IMETHOD SetRel(const nsString& aRel);
|
||||
NS_IMETHOD GetRev(nsString& aRev);
|
||||
NS_IMETHOD SetRev(const nsString& aRev);
|
||||
NS_IMETHOD GetTarget(nsString& aTarget);
|
||||
NS_IMETHOD SetTarget(const nsString& aTarget);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD SetType(const nsString& aType);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLLink(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLLink(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLLink::nsHTMLLink(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLLink::~nsHTMLLink()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLLink)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLLink)
|
||||
|
||||
nsresult
|
||||
nsHTMLLink::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLLinkElementIID)) {
|
||||
nsIDOMHTMLLinkElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLLink::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLLink* it = new nsHTMLLink(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetCharset(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetCharset(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetDisabled(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::disabled, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetDisabled(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::disabled, empty, eSetAttrNotify_Render);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::disabled);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetHref(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::href, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetHref(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::href, aValue, eSetAttrNotify_Render);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetHreflang(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::hreflang, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetHreflang(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::hreflang, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetMedia(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::media, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetMedia(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::media, aValue, eSetAttrNotify_Restart);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetRel(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::rel, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetRel(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::rel, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetRev(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::rev, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetRev(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::rev, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetTarget(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::target, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetTarget(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::target, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::GetType(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::type, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::SetType(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLink::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
215
layout/html/content/src/nsHTMLParam.cpp
Normal file
215
layout/html/content/src/nsHTMLParam.cpp
Normal file
@ -0,0 +1,215 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLParamElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLParamElementIID, NS_IDOMHTMLPARAMELEMENT_IID);
|
||||
|
||||
class nsHTMLParam : public nsIDOMHTMLParamElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLParam(nsIAtom* aTag);
|
||||
~nsHTMLParam();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLParamElement
|
||||
NS_IMETHOD GetName(nsString& aName);
|
||||
NS_IMETHOD SetName(const nsString& aName);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD SetType(const nsString& aType);
|
||||
NS_IMETHOD GetValue(nsString& aValue);
|
||||
NS_IMETHOD SetValue(const nsString& aValue);
|
||||
NS_IMETHOD GetValueType(nsString& aValueType);
|
||||
NS_IMETHOD SetValueType(const nsString& aValueType);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLParam(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLParam(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLParam::nsHTMLParam(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLParam::~nsHTMLParam()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLParam)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLParam)
|
||||
|
||||
nsresult
|
||||
nsHTMLParam::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLParamElementIID)) {
|
||||
nsIDOMHTMLParamElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLParam::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLParam* it = new nsHTMLParam(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::GetName(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::name, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::SetName(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::name, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::GetType(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::type, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::SetType(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::GetValue(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::value, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::SetValue(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::value, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::GetValueType(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::valuetype, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::SetValueType(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::valuetype, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLParam::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
279
layout/html/content/src/nsHTMLScript.cpp
Normal file
279
layout/html/content/src/nsHTMLScript.cpp
Normal file
@ -0,0 +1,279 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLScriptElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLScriptElementIID, NS_IDOMHTMLSCRIPTELEMENT_IID);
|
||||
|
||||
class nsHTMLScript : public nsIDOMHTMLScriptElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLScript(nsIAtom* aTag);
|
||||
~nsHTMLScript();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLScriptElement
|
||||
NS_IMETHOD GetText(nsString& aText);
|
||||
NS_IMETHOD SetText(const nsString& aText);
|
||||
NS_IMETHOD GetHtmlFor(nsString& aHtmlFor);
|
||||
NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor);
|
||||
NS_IMETHOD GetEvent(nsString& aEvent);
|
||||
NS_IMETHOD SetEvent(const nsString& aEvent);
|
||||
NS_IMETHOD GetCharset(nsString& aCharset);
|
||||
NS_IMETHOD SetCharset(const nsString& aCharset);
|
||||
NS_IMETHOD GetDefer(PRBool* aDefer);
|
||||
NS_IMETHOD SetDefer(PRBool aDefer);
|
||||
NS_IMETHOD GetSrc(nsString& aSrc);
|
||||
NS_IMETHOD SetSrc(const nsString& aSrc);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD SetType(const nsString& aType);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
nsString mText;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLScript(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLScript(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLScript::nsHTMLScript(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLScript::~nsHTMLScript()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLScript)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLScript)
|
||||
|
||||
nsresult
|
||||
nsHTMLScript::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLScriptElementIID)) {
|
||||
nsIDOMHTMLScriptElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLScript::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLScript* it = new nsHTMLScript(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetText(nsString& aValue)
|
||||
{
|
||||
// XXX out of memory errors
|
||||
aValue = mText;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetText(const nsString& aValue)
|
||||
{
|
||||
// XXX out of memory errors
|
||||
mText = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetHtmlFor(nsString& aValue)
|
||||
{
|
||||
// XXX write me
|
||||
// mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetHtmlFor(const nsString& aValue)
|
||||
{
|
||||
// XXX write me
|
||||
// return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetEvent(nsString& aValue)
|
||||
{
|
||||
// XXX write me
|
||||
// mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetEvent(const nsString& aValue)
|
||||
{
|
||||
// XXX write me
|
||||
// return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetCharset(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetCharset(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::charset, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetDefer(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::defer, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetDefer(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::defer, empty, eSetAttrNotify_None);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::defer);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetSrc(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::src, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetSrc(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::src, aValue, eSetAttrNotify_Restart);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::GetType(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::type, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::SetType(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_None);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLScript::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
211
layout/html/content/src/nsHTMLStyle.cpp
Normal file
211
layout/html/content/src/nsHTMLStyle.cpp
Normal file
@ -0,0 +1,211 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (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/NPL/
|
||||
*
|
||||
* 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 Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*/
|
||||
#include "nsIDOMHTMLStyleElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLGenericContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
// XXX no SRC attribute
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLStyleElementIID, NS_IDOMHTMLSTYLEELEMENT_IID);
|
||||
|
||||
class nsHTMLStyle : public nsIDOMHTMLStyleElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLStyle(nsIAtom* aTag);
|
||||
~nsHTMLStyle();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLStyleElement
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled);
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled);
|
||||
NS_IMETHOD GetMedia(nsString& aMedia);
|
||||
NS_IMETHOD SetMedia(const nsString& aMedia);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD SetType(const nsString& aType);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsHTMLGenericLeafContent mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLStyle(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLStyle(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsHTMLStyle::nsHTMLStyle(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLStyle::~nsHTMLStyle()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLStyle)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLStyle)
|
||||
|
||||
nsresult
|
||||
nsHTMLStyle::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLStyleElementIID)) {
|
||||
nsIDOMHTMLStyleElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLStyle::CloneNode(nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLStyle* it = new nsHTMLStyle(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::GetDisabled(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
*aValue = NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mInner.GetAttribute(nsHTMLAtoms::disabled, val);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::SetDisabled(PRBool aValue)
|
||||
{
|
||||
nsAutoString empty;
|
||||
if (aValue) {
|
||||
return mInner.SetAttr(nsHTMLAtoms::disabled, empty, eSetAttrNotify_Render);
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(nsHTMLAtoms::disabled);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::GetMedia(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::media, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::SetMedia(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::media, aValue, eSetAttrNotify_Restart);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::GetType(nsString& aValue)
|
||||
{
|
||||
mInner.GetAttribute(nsHTMLAtoms::type, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::SetType(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttr(nsHTMLAtoms::type, aValue, eSetAttrNotify_Restart);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::AttributeToString(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::MapAttributesInto(nsIStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyle::HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user