2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2011-10-11 09:50:08 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
#include "HTMLBodyElement.h"
|
2012-12-21 18:07:28 +04:00
|
|
|
#include "mozilla/dom/HTMLBodyElementBinding.h"
|
2012-09-30 20:40:24 +04:00
|
|
|
#include "nsAttrValueInlines.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
1998-09-01 23:07:50 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
1998-09-05 08:00:06 +04:00
|
|
|
#include "nsIPresShell.h"
|
1998-09-04 02:21:32 +04:00
|
|
|
#include "nsIDocument.h"
|
2004-04-13 01:56:09 +04:00
|
|
|
#include "nsHTMLStyleSheet.h"
|
2012-12-24 06:38:41 +04:00
|
|
|
#include "nsIEditor.h"
|
2004-01-26 22:22:05 +03:00
|
|
|
#include "nsMappedAttributes.h"
|
2004-07-20 10:11:27 +04:00
|
|
|
#include "nsRuleData.h"
|
2000-03-11 03:37:07 +03:00
|
|
|
#include "nsIDocShell.h"
|
2001-10-24 04:01:09 +04:00
|
|
|
#include "nsRuleWalker.h"
|
2012-12-21 18:07:28 +04:00
|
|
|
#include "nsGlobalWindow.h"
|
1998-09-01 23:07:50 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Body)
|
2011-08-24 23:49:25 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
1998-09-04 02:21:32 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
BodyRule::BodyRule(HTMLBodyElement* aPart)
|
2013-06-12 11:00:09 +04:00
|
|
|
: mPart(aPart)
|
1998-09-04 02:21:32 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BodyRule::~BodyRule()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(BodyRule, nsIStyleRule)
|
1998-09-04 02:21:32 +04:00
|
|
|
|
2010-05-20 06:28:00 +04:00
|
|
|
/* virtual */ void
|
2001-06-01 02:19:43 +04:00
|
|
|
BodyRule::MapRuleInfoInto(nsRuleData* aData)
|
1999-04-16 01:23:05 +04:00
|
|
|
{
|
2011-03-18 06:14:31 +03:00
|
|
|
if (!(aData->mSIDs & NS_STYLE_INHERIT_BIT(Margin)) || !mPart)
|
2010-05-20 06:28:00 +04:00
|
|
|
return; // We only care about margins.
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t bodyMarginWidth = -1;
|
|
|
|
int32_t bodyMarginHeight = -1;
|
|
|
|
int32_t bodyTopMargin = -1;
|
|
|
|
int32_t bodyBottomMargin = -1;
|
|
|
|
int32_t bodyLeftMargin = -1;
|
|
|
|
int32_t bodyRightMargin = -1;
|
2001-08-16 02:22:41 +04:00
|
|
|
|
|
|
|
// check the mode (fortunately, the ruleData has a presContext for us to use!)
|
|
|
|
NS_ASSERTION(aData->mPresContext, "null presContext in ruleNode was unexpected");
|
2003-12-25 00:51:50 +03:00
|
|
|
nsCompatibility mode = aData->mPresContext->CompatibilityMode();
|
2001-08-16 02:22:41 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2005-01-25 03:02:58 +03:00
|
|
|
const nsAttrValue* value;
|
2003-09-27 08:18:26 +04:00
|
|
|
if (mPart->GetAttrCount() > 0) {
|
2001-06-01 02:19:43 +04:00
|
|
|
// if marginwidth/marginheight are set, reflect them as 'margin'
|
2006-12-26 20:47:52 +03:00
|
|
|
value = mPart->GetParsedAttr(nsGkAtoms::marginwidth);
|
2005-01-25 03:02:58 +03:00
|
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
|
|
bodyMarginWidth = value->GetIntegerValue();
|
2001-06-01 02:19:43 +04:00
|
|
|
if (bodyMarginWidth < 0) bodyMarginWidth = 0;
|
2015-01-17 07:16:02 +03:00
|
|
|
nsCSSValue* marginLeft = aData->ValueForMarginLeft();
|
2011-03-18 06:14:31 +03:00
|
|
|
if (marginLeft->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginLeft->SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel);
|
2015-01-17 07:16:02 +03:00
|
|
|
nsCSSValue* marginRight = aData->ValueForMarginRight();
|
2011-03-18 06:14:31 +03:00
|
|
|
if (marginRight->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginRight->SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
1999-04-16 01:23:05 +04:00
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
value = mPart->GetParsedAttr(nsGkAtoms::marginheight);
|
2005-01-25 03:02:58 +03:00
|
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
|
|
bodyMarginHeight = value->GetIntegerValue();
|
2001-06-01 02:19:43 +04:00
|
|
|
if (bodyMarginHeight < 0) bodyMarginHeight = 0;
|
2011-03-18 06:14:31 +03:00
|
|
|
nsCSSValue* marginTop = aData->ValueForMarginTop();
|
|
|
|
if (marginTop->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginTop->SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel);
|
|
|
|
nsCSSValue* marginBottom = aData->ValueForMarginBottom();
|
|
|
|
if (marginBottom->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginBottom->SetFloatValue((float)bodyMarginHeight, eCSSUnit_Pixel);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2001-08-16 02:22:41 +04:00
|
|
|
|
|
|
|
// topmargin (IE-attribute)
|
2014-09-28 00:02:07 +04:00
|
|
|
value = mPart->GetParsedAttr(nsGkAtoms::topmargin);
|
|
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
|
|
bodyTopMargin = value->GetIntegerValue();
|
|
|
|
if (bodyTopMargin < 0) bodyTopMargin = 0;
|
|
|
|
nsCSSValue* marginTop = aData->ValueForMarginTop();
|
|
|
|
if (marginTop->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginTop->SetFloatValue((float)bodyTopMargin, eCSSUnit_Pixel);
|
|
|
|
}
|
2001-08-16 02:22:41 +04:00
|
|
|
|
2003-06-13 09:00:35 +04:00
|
|
|
// bottommargin (IE-attribute)
|
2014-09-28 00:02:07 +04:00
|
|
|
value = mPart->GetParsedAttr(nsGkAtoms::bottommargin);
|
|
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
|
|
bodyBottomMargin = value->GetIntegerValue();
|
|
|
|
if (bodyBottomMargin < 0) bodyBottomMargin = 0;
|
|
|
|
nsCSSValue* marginBottom = aData->ValueForMarginBottom();
|
|
|
|
if (marginBottom->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginBottom->SetFloatValue((float)bodyBottomMargin, eCSSUnit_Pixel);
|
|
|
|
}
|
2003-06-13 09:00:35 +04:00
|
|
|
|
2001-08-16 02:22:41 +04:00
|
|
|
// leftmargin (IE-attribute)
|
2014-09-28 00:02:07 +04:00
|
|
|
value = mPart->GetParsedAttr(nsGkAtoms::leftmargin);
|
|
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
|
|
bodyLeftMargin = value->GetIntegerValue();
|
|
|
|
if (bodyLeftMargin < 0) bodyLeftMargin = 0;
|
2015-01-17 07:16:02 +03:00
|
|
|
nsCSSValue* marginLeft = aData->ValueForMarginLeft();
|
2014-09-28 00:02:07 +04:00
|
|
|
if (marginLeft->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginLeft->SetFloatValue((float)bodyLeftMargin, eCSSUnit_Pixel);
|
|
|
|
}
|
2003-06-13 09:00:35 +04:00
|
|
|
|
|
|
|
// rightmargin (IE-attribute)
|
2014-09-28 00:02:07 +04:00
|
|
|
value = mPart->GetParsedAttr(nsGkAtoms::rightmargin);
|
|
|
|
if (value && value->Type() == nsAttrValue::eInteger) {
|
|
|
|
bodyRightMargin = value->GetIntegerValue();
|
|
|
|
if (bodyRightMargin < 0) bodyRightMargin = 0;
|
2015-01-17 07:16:02 +03:00
|
|
|
nsCSSValue* marginRight = aData->ValueForMarginRight();
|
2014-09-28 00:02:07 +04:00
|
|
|
if (marginRight->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginRight->SetFloatValue((float)bodyRightMargin, eCSSUnit_Pixel);
|
2001-08-16 02:22:41 +04:00
|
|
|
}
|
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
1999-04-16 01:23:05 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
// if marginwidth or marginheight is set in the <frame> and not set in the <body>
|
|
|
|
// reflect them as margin in the <body>
|
|
|
|
if (bodyMarginWidth == -1 || bodyMarginHeight == -1) {
|
2013-11-20 23:18:25 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docShell(aData->mPresContext->GetDocShell());
|
|
|
|
if (docShell) {
|
|
|
|
nscoord frameMarginWidth=-1; // default value
|
|
|
|
nscoord frameMarginHeight=-1; // default value
|
|
|
|
docShell->GetMarginWidth(&frameMarginWidth); // -1 indicates not set
|
|
|
|
docShell->GetMarginHeight(&frameMarginHeight);
|
|
|
|
if ((frameMarginWidth >= 0) && (bodyMarginWidth == -1)) { // set in <frame> & not in <body>
|
|
|
|
if (eCompatibility_NavQuirks == mode) {
|
|
|
|
if ((bodyMarginHeight == -1) && (0 > frameMarginHeight)) // nav quirk
|
|
|
|
frameMarginHeight = 0;
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
2013-11-20 23:18:25 +04:00
|
|
|
}
|
|
|
|
if ((frameMarginHeight >= 0) && (bodyMarginHeight == -1)) { // set in <frame> & not in <body>
|
|
|
|
if (eCompatibility_NavQuirks == mode) {
|
|
|
|
if ((bodyMarginWidth == -1) && (0 > frameMarginWidth)) // nav quirk
|
|
|
|
frameMarginWidth = 0;
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
2013-11-20 23:18:25 +04:00
|
|
|
}
|
1999-01-09 07:31:51 +03:00
|
|
|
|
2013-11-20 23:18:25 +04:00
|
|
|
if ((bodyMarginWidth == -1) && (frameMarginWidth >= 0)) {
|
2015-01-17 07:16:02 +03:00
|
|
|
nsCSSValue* marginLeft = aData->ValueForMarginLeft();
|
2013-11-20 23:18:25 +04:00
|
|
|
if (marginLeft->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginLeft->SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel);
|
2015-01-17 07:16:02 +03:00
|
|
|
nsCSSValue* marginRight = aData->ValueForMarginRight();
|
2013-11-20 23:18:25 +04:00
|
|
|
if (marginRight->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginRight->SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel);
|
|
|
|
}
|
1999-01-09 07:31:51 +03:00
|
|
|
|
2013-11-20 23:18:25 +04:00
|
|
|
if ((bodyMarginHeight == -1) && (frameMarginHeight >= 0)) {
|
|
|
|
nsCSSValue* marginTop = aData->ValueForMarginTop();
|
|
|
|
if (marginTop->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginTop->SetFloatValue((float)frameMarginHeight, eCSSUnit_Pixel);
|
|
|
|
nsCSSValue* marginBottom = aData->ValueForMarginBottom();
|
|
|
|
if (marginBottom->GetUnit() == eCSSUnit_Null)
|
|
|
|
marginBottom->SetFloatValue((float)frameMarginHeight, eCSSUnit_Pixel);
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-16 09:31:36 +04:00
|
|
|
#ifdef DEBUG
|
2010-05-20 06:28:00 +04:00
|
|
|
/* virtual */ void
|
2012-08-22 19:56:38 +04:00
|
|
|
BodyRule::List(FILE* out, int32_t aIndent) const
|
1998-09-04 02:21:32 +04:00
|
|
|
{
|
2014-11-27 09:29:44 +03:00
|
|
|
nsAutoCString indent;
|
2014-11-27 09:29:44 +03:00
|
|
|
for (int32_t index = aIndent; --index >= 0; ) {
|
2014-11-27 09:29:44 +03:00
|
|
|
indent.AppendLiteral(" ");
|
2014-11-27 09:29:44 +03:00
|
|
|
}
|
2014-11-27 09:29:44 +03:00
|
|
|
fprintf_stderr(out, "%s[body rule] {}\n", indent.get());
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
2001-10-16 09:31:36 +04:00
|
|
|
#endif
|
2000-03-31 11:08:36 +04:00
|
|
|
|
1998-09-04 02:21:32 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::~HTMLBodyElement()
|
1998-09-01 23:07:50 +04:00
|
|
|
{
|
2002-01-08 02:46:07 +03:00
|
|
|
if (mContentStyleRule) {
|
2012-07-30 18:20:58 +04:00
|
|
|
mContentStyleRule->mPart = nullptr;
|
2002-01-08 02:46:07 +03:00
|
|
|
}
|
1998-09-01 23:07:50 +04:00
|
|
|
}
|
|
|
|
|
2012-12-21 18:07:28 +04:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
HTMLBodyElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2012-12-21 18:07:28 +04:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
return HTMLBodyElementBinding::Wrap(aCx, this, aGivenProto);
|
2012-12-21 18:07:28 +04:00
|
|
|
}
|
1998-09-01 23:07:50 +04:00
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(HTMLBodyElement, nsGenericHTMLElement,
|
|
|
|
nsIDOMHTMLBodyElement)
|
1998-09-01 23:07:50 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLBodyElement)
|
1998-09-01 23:07:50 +04:00
|
|
|
|
2012-12-21 18:07:28 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::SetBackground(const nsAString& aBackground)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetBackground(aBackground, rv);
|
|
|
|
return rv.ErrorCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::GetBackground(nsAString& aBackground)
|
|
|
|
{
|
2015-02-13 04:27:39 +03:00
|
|
|
DOMString background;
|
2012-12-21 18:07:28 +04:00
|
|
|
GetBackground(background);
|
2015-02-13 04:27:39 +03:00
|
|
|
background.ToString(aBackground);
|
2012-12-21 18:07:28 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::SetVLink(const nsAString& aVLink)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetVLink(aVLink, rv);
|
|
|
|
return rv.ErrorCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::GetVLink(nsAString& aVLink)
|
|
|
|
{
|
2015-02-13 04:27:39 +03:00
|
|
|
DOMString vLink;
|
2012-12-21 18:07:28 +04:00
|
|
|
GetVLink(vLink);
|
2015-02-13 04:27:39 +03:00
|
|
|
vLink.ToString(aVLink);
|
2012-12-21 18:07:28 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::SetALink(const nsAString& aALink)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetALink(aALink, rv);
|
|
|
|
return rv.ErrorCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::GetALink(nsAString& aALink)
|
|
|
|
{
|
2015-02-13 04:27:39 +03:00
|
|
|
DOMString aLink;
|
2012-12-21 18:07:28 +04:00
|
|
|
GetALink(aLink);
|
2015-02-13 04:27:39 +03:00
|
|
|
aLink.ToString(aALink);
|
2012-12-21 18:07:28 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::SetLink(const nsAString& aLink)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetLink(aLink, rv);
|
|
|
|
return rv.ErrorCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::GetLink(nsAString& aLink)
|
|
|
|
{
|
2015-02-13 04:27:39 +03:00
|
|
|
DOMString link;
|
2012-12-21 18:07:28 +04:00
|
|
|
GetLink(link);
|
2015-02-13 04:27:39 +03:00
|
|
|
link.ToString(aLink);
|
2012-12-21 18:07:28 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::SetText(const nsAString& aText)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetText(aText, rv);
|
|
|
|
return rv.ErrorCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::GetText(nsAString& aText)
|
|
|
|
{
|
2015-02-13 04:27:39 +03:00
|
|
|
DOMString text;
|
2012-12-21 18:07:28 +04:00
|
|
|
GetText(text);
|
2015-02-13 04:27:39 +03:00
|
|
|
text.ToString(aText);
|
2012-12-21 18:07:28 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::SetBgColor(const nsAString& aBgColor)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetBgColor(aBgColor, rv);
|
|
|
|
return rv.ErrorCode();
|
|
|
|
}
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2012-12-21 18:07:28 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLBodyElement::GetBgColor(nsAString& aBgColor)
|
|
|
|
{
|
2015-02-13 04:27:39 +03:00
|
|
|
DOMString bgColor;
|
2012-12-21 18:07:28 +04:00
|
|
|
GetBgColor(bgColor);
|
2015-02-13 04:27:39 +03:00
|
|
|
bgColor.ToString(aBgColor);
|
2012-12-21 18:07:28 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 16:27:00 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
1998-09-01 23:07:50 +04:00
|
|
|
{
|
2005-11-29 19:37:15 +03:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
2006-12-26 20:47:52 +03:00
|
|
|
if (aAttribute == nsGkAtoms::bgcolor ||
|
|
|
|
aAttribute == nsGkAtoms::text ||
|
|
|
|
aAttribute == nsGkAtoms::link ||
|
|
|
|
aAttribute == nsGkAtoms::alink ||
|
|
|
|
aAttribute == nsGkAtoms::vlink) {
|
2010-07-17 12:09:14 +04:00
|
|
|
return aResult.ParseColor(aValue);
|
2005-11-29 19:37:15 +03:00
|
|
|
}
|
2006-12-26 20:47:52 +03:00
|
|
|
if (aAttribute == nsGkAtoms::marginwidth ||
|
|
|
|
aAttribute == nsGkAtoms::marginheight ||
|
|
|
|
aAttribute == nsGkAtoms::topmargin ||
|
|
|
|
aAttribute == nsGkAtoms::bottommargin ||
|
|
|
|
aAttribute == nsGkAtoms::leftmargin ||
|
|
|
|
aAttribute == nsGkAtoms::rightmargin) {
|
2005-11-29 19:37:15 +03:00
|
|
|
return aResult.ParseIntWithBounds(aValue, 0);
|
|
|
|
}
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
1998-09-01 23:07:50 +04:00
|
|
|
|
2012-08-24 21:50:49 +04:00
|
|
|
return nsGenericHTMLElement::ParseBackgroundAttribute(aNamespaceID,
|
|
|
|
aAttribute, aValue,
|
|
|
|
aResult) ||
|
|
|
|
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
2005-11-29 19:37:15 +03:00
|
|
|
aResult);
|
1998-09-01 23:07:50 +04:00
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
void
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2002-01-08 02:46:07 +03:00
|
|
|
{
|
2005-04-06 03:54:35 +04:00
|
|
|
if (mContentStyleRule) {
|
2012-07-30 18:20:58 +04:00
|
|
|
mContentStyleRule->mPart = nullptr;
|
2013-06-12 11:00:09 +04:00
|
|
|
mContentStyleRule = nullptr;
|
2002-01-08 02:46:07 +03:00
|
|
|
}
|
2005-04-06 03:54:35 +04:00
|
|
|
|
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
2002-01-08 02:46:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-19 23:21:29 +04:00
|
|
|
void
|
|
|
|
HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData)
|
1998-09-01 23:07:50 +04:00
|
|
|
{
|
2007-10-09 01:58:22 +04:00
|
|
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
|
2001-06-01 02:19:43 +04:00
|
|
|
// When display if first asked for, go ahead and get our colors set up.
|
2003-12-21 08:36:36 +03:00
|
|
|
nsIPresShell *presShell = aData->mPresContext->GetPresShell();
|
1999-02-12 21:41:26 +03:00
|
|
|
if (presShell) {
|
2004-08-02 08:52:55 +04:00
|
|
|
nsIDocument *doc = presShell->GetDocument();
|
1999-02-12 21:41:26 +03:00
|
|
|
if (doc) {
|
2004-04-13 01:56:09 +04:00
|
|
|
nsHTMLStyleSheet* styleSheet = doc->GetAttributeStyleSheet();
|
2004-01-14 02:14:49 +03:00
|
|
|
if (styleSheet) {
|
2004-04-13 20:45:59 +04:00
|
|
|
const nsAttrValue* value;
|
2004-02-11 03:09:59 +03:00
|
|
|
nscolor color;
|
2006-12-26 20:47:52 +03:00
|
|
|
value = aAttributes->GetAttr(nsGkAtoms::link);
|
2004-04-13 20:45:59 +04:00
|
|
|
if (value && value->GetColorValue(color)) {
|
2004-02-11 03:09:59 +03:00
|
|
|
styleSheet->SetLinkColor(color);
|
2004-01-14 02:14:49 +03:00
|
|
|
}
|
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
value = aAttributes->GetAttr(nsGkAtoms::alink);
|
2004-04-13 20:45:59 +04:00
|
|
|
if (value && value->GetColorValue(color)) {
|
2004-02-11 03:09:59 +03:00
|
|
|
styleSheet->SetActiveLinkColor(color);
|
2004-01-14 02:14:49 +03:00
|
|
|
}
|
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
value = aAttributes->GetAttr(nsGkAtoms::vlink);
|
2004-04-13 20:45:59 +04:00
|
|
|
if (value && value->GetColorValue(color)) {
|
2004-02-11 03:09:59 +03:00
|
|
|
styleSheet->SetVisitedLinkColor(color);
|
1998-09-05 08:00:06 +04:00
|
|
|
}
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
1998-09-04 02:21:32 +04:00
|
|
|
|
2007-10-09 01:58:22 +04:00
|
|
|
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) {
|
2011-03-18 06:14:31 +03:00
|
|
|
nsCSSValue *colorValue = aData->ValueForColor();
|
|
|
|
if (colorValue->GetUnit() == eCSSUnit_Null &&
|
2007-11-16 06:46:42 +03:00
|
|
|
aData->mPresContext->UseDocumentColors()) {
|
2001-06-01 02:19:43 +04:00
|
|
|
// color: color
|
2004-02-11 03:09:59 +03:00
|
|
|
nscolor color;
|
2006-12-26 20:47:52 +03:00
|
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::text);
|
2004-04-13 20:45:59 +04:00
|
|
|
if (value && value->GetColorValue(color))
|
2011-03-18 06:14:31 +03:00
|
|
|
colorValue->SetColorValue(color);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
1998-09-04 02:21:32 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
|
|
|
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
1998-09-01 23:07:50 +04:00
|
|
|
}
|
|
|
|
|
2005-01-12 22:45:38 +03:00
|
|
|
nsMapRuleToAttributesFunc
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::GetAttributeMappingFunction() const
|
1998-09-05 08:00:06 +04:00
|
|
|
{
|
2005-01-12 22:45:38 +03:00
|
|
|
return &MapAttributesIntoRule;
|
1998-09-05 08:00:06 +04:00
|
|
|
}
|
|
|
|
|
1998-09-04 02:21:32 +04:00
|
|
|
NS_IMETHODIMP
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
1998-09-04 02:21:32 +04:00
|
|
|
{
|
2004-02-10 22:36:43 +03:00
|
|
|
nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
|
1999-05-27 03:46:45 +04:00
|
|
|
|
2004-08-10 14:22:36 +04:00
|
|
|
if (!mContentStyleRule && IsInDoc()) {
|
2014-10-02 23:07:24 +04:00
|
|
|
// XXXbz should this use OwnerDoc() or GetComposedDoc()?
|
2004-10-11 20:14:27 +04:00
|
|
|
// sXBL/XBL2 issue!
|
2004-10-31 20:33:50 +03:00
|
|
|
mContentStyleRule = new BodyRule(this);
|
1998-12-02 03:34:06 +03:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
if (aRuleWalker && mContentStyleRule) {
|
|
|
|
aRuleWalker->Forward(mContentStyleRule);
|
1999-05-27 03:46:45 +04:00
|
|
|
}
|
1998-12-02 03:34:06 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP_(bool)
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
1998-12-11 02:52:46 +03:00
|
|
|
{
|
2004-02-26 00:04:50 +03:00
|
|
|
static const MappedAttributeEntry attributes[] = {
|
2006-12-26 20:47:52 +03:00
|
|
|
{ &nsGkAtoms::link },
|
|
|
|
{ &nsGkAtoms::vlink },
|
|
|
|
{ &nsGkAtoms::alink },
|
|
|
|
{ &nsGkAtoms::text },
|
2003-07-12 01:16:12 +04:00
|
|
|
// These aren't mapped through attribute mapping, but they are
|
|
|
|
// mapped through a style rule, so it is attribute dependent style.
|
|
|
|
// XXXldb But we don't actually replace the body rule when we have
|
|
|
|
// dynamic changes...
|
2006-12-26 20:47:52 +03:00
|
|
|
{ &nsGkAtoms::marginwidth },
|
|
|
|
{ &nsGkAtoms::marginheight },
|
2012-07-30 18:20:58 +04:00
|
|
|
{ nullptr },
|
2003-04-17 00:54:20 +04:00
|
|
|
};
|
|
|
|
|
2004-02-26 00:04:50 +03:00
|
|
|
static const MappedAttributeEntry* const map[] = {
|
2003-04-17 00:54:20 +04:00
|
|
|
attributes,
|
|
|
|
sCommonAttributeMap,
|
|
|
|
sBackgroundAttributeMap,
|
|
|
|
};
|
|
|
|
|
2011-12-18 14:09:27 +04:00
|
|
|
return FindAttributeDependence(aAttribute, map);
|
1999-01-15 02:14:02 +03:00
|
|
|
}
|
2006-07-29 04:04:40 +04:00
|
|
|
|
|
|
|
already_AddRefed<nsIEditor>
|
2012-12-21 18:06:50 +04:00
|
|
|
HTMLBodyElement::GetAssociatedEditor()
|
2006-07-29 04:04:40 +04:00
|
|
|
{
|
2012-12-24 06:38:41 +04:00
|
|
|
nsCOMPtr<nsIEditor> editor = GetEditorInternal();
|
|
|
|
if (editor) {
|
|
|
|
return editor.forget();
|
2006-07-29 04:04:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure this is the actual body of the document
|
|
|
|
if (!IsCurrentBodyElement()) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2006-07-29 04:04:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// For designmode, try to get document's editor
|
2014-08-23 00:11:27 +04:00
|
|
|
nsPresContext* presContext = GetPresContext(eForComposedDoc);
|
2006-07-29 04:04:40 +04:00
|
|
|
if (!presContext) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2006-07-29 04:04:40 +04:00
|
|
|
}
|
|
|
|
|
2013-11-20 23:18:25 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = presContext->GetDocShell();
|
2013-02-14 02:39:30 +04:00
|
|
|
if (!docShell) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2006-07-29 04:04:40 +04:00
|
|
|
}
|
|
|
|
|
2013-02-14 02:39:30 +04:00
|
|
|
docShell->GetEditor(getter_AddRefs(editor));
|
2012-12-24 06:38:41 +04:00
|
|
|
return editor.forget();
|
2006-07-29 04:04:40 +04:00
|
|
|
}
|
2011-08-24 23:49:25 +04:00
|
|
|
|
2013-01-03 00:24:07 +04:00
|
|
|
bool
|
|
|
|
HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
|
|
|
|
{
|
|
|
|
return nsContentUtils::IsEventAttributeName(aName,
|
|
|
|
EventNameType_HTML |
|
|
|
|
EventNameType_HTMLBodyOrFramesetOnly);
|
|
|
|
}
|
|
|
|
|
2011-08-24 23:49:25 +04:00
|
|
|
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
|
2012-11-26 18:19:02 +04:00
|
|
|
// nsGenericHTMLElement::GetOnError returns
|
|
|
|
// already_AddRefed<EventHandlerNonNull> while other getters return
|
|
|
|
// EventHandlerNonNull*, so allow passing in the type to use here.
|
2012-12-21 18:07:28 +04:00
|
|
|
#define WINDOW_EVENT_HELPER(name_, type_) \
|
|
|
|
type_* \
|
|
|
|
HTMLBodyElement::GetOn##name_() \
|
2012-12-21 18:06:50 +04:00
|
|
|
{ \
|
|
|
|
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
2013-04-29 19:34:16 +04:00
|
|
|
if (win) { \
|
2012-12-21 18:07:28 +04:00
|
|
|
nsCOMPtr<nsISupports> supports = do_QueryInterface(win); \
|
|
|
|
nsGlobalWindow* globalWin = nsGlobalWindow::FromSupports(supports); \
|
|
|
|
return globalWin->GetOn##name_(); \
|
2012-12-21 18:06:50 +04:00
|
|
|
} \
|
2012-12-21 18:07:28 +04:00
|
|
|
return nullptr; \
|
2012-12-21 18:06:50 +04:00
|
|
|
} \
|
2012-12-21 18:07:28 +04:00
|
|
|
void \
|
2013-09-17 15:01:28 +04:00
|
|
|
HTMLBodyElement::SetOn##name_(type_* handler) \
|
2012-12-21 18:06:50 +04:00
|
|
|
{ \
|
|
|
|
nsPIDOMWindow* win = OwnerDoc()->GetInnerWindow(); \
|
2013-04-29 19:34:16 +04:00
|
|
|
if (!win) { \
|
2012-12-21 18:07:28 +04:00
|
|
|
return; \
|
2012-12-21 18:06:50 +04:00
|
|
|
} \
|
2012-12-21 18:07:28 +04:00
|
|
|
\
|
|
|
|
nsCOMPtr<nsISupports> supports = do_QueryInterface(win); \
|
|
|
|
nsGlobalWindow* globalWin = nsGlobalWindow::FromSupports(supports); \
|
2013-09-17 15:01:28 +04:00
|
|
|
return globalWin->SetOn##name_(handler); \
|
2013-11-16 16:31:37 +04:00
|
|
|
}
|
2012-12-21 18:07:28 +04:00
|
|
|
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
|
|
|
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
|
|
|
|
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
2013-10-08 19:51:15 +04:00
|
|
|
WINDOW_EVENT_HELPER(name_, OnBeforeUnloadEventHandlerNonNull)
|
2014-04-01 15:42:12 +04:00
|
|
|
#include "mozilla/EventNameList.h" // IWYU pragma: keep
|
2012-12-21 18:07:28 +04:00
|
|
|
#undef BEFOREUNLOAD_EVENT
|
2011-08-24 23:49:25 +04:00
|
|
|
#undef WINDOW_EVENT
|
2012-12-21 18:07:28 +04:00
|
|
|
#undef WINDOW_EVENT_HELPER
|
2011-08-24 23:49:25 +04:00
|
|
|
#undef EVENT
|
2012-12-21 18:06:50 +04:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|