2015-05-03 19:32:37 +00: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-03 23:05:25 +00: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-03 23:05:27 +00:00
|
|
|
#include "mozilla/dom/HTMLBRElementBinding.h"
|
2018-06-22 16:48:42 +00:00
|
|
|
#include "mozilla/MappedDeclarations.h"
|
2013-02-03 23:05:25 +00:00
|
|
|
#include "nsAttrValueInlines.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsMappedAttributes.h"
|
|
|
|
|
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(BR)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2018-09-21 20:45:49 +00:00
|
|
|
HTMLBRElement::HTMLBRElement(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
|
|
|
: nsGenericHTMLElement(std::move(aNodeInfo)) {}
|
2013-02-03 23:05:25 +00:00
|
|
|
|
|
|
|
HTMLBRElement::~HTMLBRElement() {}
|
|
|
|
|
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
|
|
|
|
|
|
|
|
static const nsAttrValue::EnumTable kClearTable[] = {
|
2016-09-07 02:20:17 +00:00
|
|
|
{"left", StyleClear::Left},
|
|
|
|
{"right", StyleClear::Right},
|
|
|
|
{"all", StyleClear::Both},
|
|
|
|
{"both", StyleClear::Both},
|
2016-09-07 02:20:17 +00:00
|
|
|
{nullptr, 0}};
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2013-02-03 23:05:25 +00:00
|
|
|
bool HTMLBRElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2017-11-02 03:35:52 +00:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2013-02-03 23:05:25 +00: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 03:35:52 +00:00
|
|
|
aMaybeScriptedPrincipal, aResult);
|
2013-02-03 23:05:25 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 19:21:29 +00:00
|
|
|
void HTMLBRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
2018-06-22 16:48:42 +00:00
|
|
|
MappedDeclarations& aDecls) {
|
|
|
|
if (!aDecls.PropertyIsSet(eCSSProperty_clear)) {
|
2018-03-29 01:39:07 +00:00
|
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::clear);
|
|
|
|
if (value && value->Type() == nsAttrValue::eEnum)
|
2018-06-22 16:48:42 +00:00
|
|
|
aDecls.SetKeywordValue(eCSSProperty_clear, value->GetEnumValue());
|
2013-02-03 23:05:25 +00:00
|
|
|
}
|
2018-06-22 16:48:42 +00:00
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
2013-02-03 23:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(bool)
|
2017-10-02 22:05:19 +00:00
|
|
|
HTMLBRElement::IsAttributeMapped(const nsAtom* aAttribute) const {
|
2013-02-03 23:05:25 +00:00
|
|
|
static const MappedAttributeEntry attributes[] = {{nsGkAtoms::clear},
|
|
|
|
{nullptr}};
|
|
|
|
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
attributes,
|
|
|
|
sCommonAttributeMap,
|
|
|
|
};
|
|
|
|
|
|
|
|
return FindAttributeDependence(aAttribute, map);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMapRuleToAttributesFunc HTMLBRElement::GetAttributeMappingFunction() const {
|
|
|
|
return &MapAttributesIntoRule;
|
|
|
|
}
|
|
|
|
|
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 14:13:33 +00:00
|
|
|
JSObject* HTMLBRElement::WrapNode(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLBRElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-03 23:05:27 +00:00
|
|
|
}
|
|
|
|
|
2013-02-03 23:05:25 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|