2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-02-04 03:05:25 +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/. */
|
|
|
|
|
|
|
|
#include "mozilla/dom/HTMLBRElement.h"
|
2013-02-04 03:05:27 +04:00
|
|
|
#include "mozilla/dom/HTMLBRElementBinding.h"
|
2018-06-22 19:48:42 +03:00
|
|
|
#include "mozilla/MappedDeclarations.h"
|
2013-02-04 03:05:25 +04:00
|
|
|
#include "nsAttrValueInlines.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsMappedAttributes.h"
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(BR)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
HTMLBRElement::HTMLBRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-02-04 03:05:25 +04:00
|
|
|
: nsGenericHTMLElement(aNodeInfo)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLBRElement::~HTMLBRElement()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
|
|
|
|
|
|
|
|
static const nsAttrValue::EnumTable kClearTable[] = {
|
2016-09-07 05:20:17 +03:00
|
|
|
{ "left", StyleClear::Left },
|
|
|
|
{ "right", StyleClear::Right },
|
|
|
|
{ "all", StyleClear::Both },
|
|
|
|
{ "both", StyleClear::Both },
|
2016-09-07 05:20:17 +03:00
|
|
|
{ nullptr, 0 }
|
2013-02-04 03:05:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
bool
|
|
|
|
HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2013-02-04 03:05:25 +04:00
|
|
|
const nsAString& aValue,
|
2017-11-02 06:35:52 +03:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2013-02-04 03:05:25 +04:00
|
|
|
nsAttrValue& aResult)
|
|
|
|
{
|
|
|
|
if (aAttribute == nsGkAtoms::clear && aNamespaceID == kNameSpaceID_None) {
|
|
|
|
return aResult.ParseEnumValue(aValue, kClearTable, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
2017-11-02 06:35:52 +03:00
|
|
|
aMaybeScriptedPrincipal, aResult);
|
2013-02-04 03:05:25 +04:00
|
|
|
}
|
|
|
|
|
2013-11-19 23:21:29 +04:00
|
|
|
void
|
|
|
|
HTMLBRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
2018-06-22 19:48:42 +03:00
|
|
|
MappedDeclarations& aDecls)
|
2013-02-04 03:05:25 +04:00
|
|
|
{
|
2018-06-22 19:48:42 +03:00
|
|
|
if (!aDecls.PropertyIsSet(eCSSProperty_clear)) {
|
2018-03-29 04:39:07 +03:00
|
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::clear);
|
|
|
|
if (value && value->Type() == nsAttrValue::eEnum)
|
2018-06-22 19:48:42 +03:00
|
|
|
aDecls.SetKeywordValue(eCSSProperty_clear, value->GetEnumValue());
|
2013-02-04 03:05:25 +04:00
|
|
|
}
|
2018-06-22 19:48:42 +03:00
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
2013-02-04 03:05:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(bool)
|
2017-10-03 01:05:19 +03:00
|
|
|
HTMLBRElement::IsAttributeMapped(const nsAtom* aAttribute) const
|
2013-02-04 03:05:25 +04:00
|
|
|
{
|
|
|
|
static const MappedAttributeEntry attributes[] = {
|
2018-04-11 11:22:05 +03:00
|
|
|
{ &nsGkAtoms::clear },
|
2013-02-04 03:05:25 +04:00
|
|
|
{ nullptr }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
attributes,
|
|
|
|
sCommonAttributeMap,
|
|
|
|
};
|
|
|
|
|
|
|
|
return FindAttributeDependence(aAttribute, map);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMapRuleToAttributesFunc
|
|
|
|
HTMLBRElement::GetAttributeMappingFunction() const
|
|
|
|
{
|
|
|
|
return &MapAttributesIntoRule;
|
|
|
|
}
|
|
|
|
|
2013-02-04 03:05:27 +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
|
|
|
HTMLBRElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-02-04 03:05:27 +04:00
|
|
|
{
|
2018-06-26 00:20:54 +03:00
|
|
|
return HTMLBRElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-04 03:05:27 +04:00
|
|
|
}
|
|
|
|
|
2013-02-04 03:05:25 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|