зеркало из https://github.com/mozilla/gecko-dev.git
Bug 838343 - Convert HTMLFrameElement to WebIDL r=peterv
--HG-- rename : content/html/content/src/nsHTMLFrameElement.cpp => content/html/content/src/HTMLFrameElement.cpp rename : content/html/content/src/nsHTMLFrameElement.cpp => content/html/content/src/HTMLFrameElement.h extra : rebase_source : b22a6371050e987aeba86937b120584e7c5a1422
This commit is contained in:
Родитель
3c73b37dac
Коммит
7353e0e472
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "HTMLFrameElement.h"
|
||||
#include "mozilla/dom/HTMLFrameElementBinding.h"
|
||||
|
||||
class nsIDOMDocument;
|
||||
|
||||
|
@ -17,6 +18,7 @@ HTMLFrameElement::HTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
|||
FromParser aFromParser)
|
||||
: nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
HTMLFrameElement::~HTMLFrameElement()
|
||||
|
@ -114,5 +116,39 @@ HTMLFrameElement::GetAttributeMappingFunction() const
|
|||
return &MapAttributesIntoRule;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDocument>
|
||||
HTMLFrameElement::GetContentDocument(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
nsresult rv = nsGenericHTMLFrameElement::GetContentDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> ret = do_QueryInterface(doc);
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindow>
|
||||
HTMLFrameElement::GetContentWindow(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> win;
|
||||
nsresult rv = nsGenericHTMLFrameElement::GetContentWindow(getter_AddRefs(win));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return win.forget();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
HTMLFrameElement::WrapNode(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap)
|
||||
{
|
||||
return HTMLFrameElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
} // namespace dom
|
||||
|
|
|
@ -49,6 +49,66 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
|
||||
// WebIDL API
|
||||
// The XPCOM GetFrameBorder is OK for us
|
||||
void SetFrameBorder(const nsAString& aFrameBorder, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder, aError);
|
||||
}
|
||||
|
||||
// The XPCOM GetLongDesc is OK for us
|
||||
void SetLongDesc(const nsAString& aLongDesc, ErrorResult& aError)
|
||||
{
|
||||
SetAttrHelper(nsGkAtoms::longdesc, aLongDesc);
|
||||
}
|
||||
|
||||
// The XPCOM GetMarginHeight is OK for us
|
||||
void SetMarginHeight(const nsAString& aMarginHeight, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight, aError);
|
||||
}
|
||||
|
||||
// The XPCOM GetMarginWidth is OK for us
|
||||
void SetMarginWidth(const nsAString& aMarginWidth, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth, aError);
|
||||
}
|
||||
|
||||
// The XPCOM GetName is OK for us
|
||||
void SetName(const nsAString& aName, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::name, aName, aError);
|
||||
}
|
||||
|
||||
bool NoResize() const
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::noresize);
|
||||
}
|
||||
void SetNoResize(bool& aNoResize, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::noresize, aNoResize, aError);
|
||||
}
|
||||
|
||||
// The XPCOM GetScrolling is OK for us
|
||||
void SetScrolling(const nsAString& aScrolling, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::scrolling, aScrolling, aError);
|
||||
}
|
||||
|
||||
// The XPCOM GetSrc is OK for us
|
||||
void SetSrc(const nsAString& aSrc, ErrorResult& aError)
|
||||
{
|
||||
SetAttrHelper(nsGkAtoms::src, aSrc);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDocument> GetContentDocument(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsIDOMWindow> GetContentWindow(ErrorResult& aRv);
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope,
|
||||
bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -39,6 +39,7 @@ EXPORTS_mozilla/dom = \
|
|||
HTMLDivElement.h \
|
||||
HTMLFieldSetElement.h \
|
||||
HTMLFontElement.h \
|
||||
HTMLFrameElement.h \
|
||||
HTMLFrameSetElement.h \
|
||||
HTMLHeadingElement.h \
|
||||
HTMLHRElement.h \
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* -*- 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.whatwg.org/specs/web-apps/current-work/#htmlframeelement
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#htmlframeelement
|
||||
interface HTMLFrameElement : HTMLElement {
|
||||
[SetterThrows]
|
||||
attribute DOMString name;
|
||||
[SetterThrows]
|
||||
attribute DOMString scrolling;
|
||||
[SetterThrows]
|
||||
attribute DOMString src;
|
||||
[SetterThrows]
|
||||
attribute DOMString frameBorder;
|
||||
[SetterThrows]
|
||||
attribute DOMString longDesc;
|
||||
[SetterThrows]
|
||||
attribute boolean noResize;
|
||||
[GetterThrows]
|
||||
readonly attribute Document? contentDocument;
|
||||
[GetterThrows]
|
||||
readonly attribute WindowProxy? contentWindow;
|
||||
|
||||
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString marginHeight;
|
||||
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString marginWidth;
|
||||
};
|
|
@ -71,6 +71,7 @@ webidl_files = \
|
|||
HTMLElement.webidl \
|
||||
HTMLFieldSetElement.webidl \
|
||||
HTMLFontElement.webidl \
|
||||
HTMLFrameElement.webidl \
|
||||
HTMLFrameSetElement.webidl \
|
||||
HTMLHeadElement.webidl \
|
||||
HTMLHeadingElement.webidl \
|
||||
|
|
Загрузка…
Ссылка в новой задаче