2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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-10 22:50:08 -07:00
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
#include "HTMLDivElement.h"
|
2008-02-21 12:39:20 -08:00
|
|
|
#include "nsGenericHTMLElement.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsMappedAttributes.h"
|
2012-11-22 03:09:57 -08:00
|
|
|
#include "mozilla/dom/HTMLDivElementBinding.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Div)
|
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
HTMLDivElement::~HTMLDivElement()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-04-27 00:06:00 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(HTMLDivElement, nsGenericHTMLElement,
|
|
|
|
nsIDOMHTMLDivElement)
|
2008-02-21 12:39:20 -08:00
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLDivElement)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-22 03:09:57 -08:00
|
|
|
JSObject*
|
2014-04-08 15:27:17 -07:00
|
|
|
HTMLDivElement::WrapNode(JSContext *aCx)
|
2012-11-22 03:09:57 -08:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-08 15:27:17 -07:00
|
|
|
return dom::HTMLDivElementBinding::Wrap(aCx, this);
|
2012-11-22 03:09:57 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2012-12-21 06:06:50 -08:00
|
|
|
HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
|
|
|
|
if ((aAttribute == nsGkAtoms::width) ||
|
|
|
|
(aAttribute == nsGkAtoms::height)) {
|
2011-02-04 11:46:16 -08:00
|
|
|
return aResult.ParseSpecialIntValue(aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
if (aAttribute == nsGkAtoms::bgcolor) {
|
2010-07-17 01:09:14 -07:00
|
|
|
return aResult.ParseColor(aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
if ((aAttribute == nsGkAtoms::hspace) ||
|
|
|
|
(aAttribute == nsGkAtoms::vspace)) {
|
|
|
|
return aResult.ParseIntWithBounds(aValue, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::div) &&
|
|
|
|
aAttribute == nsGkAtoms::align) {
|
|
|
|
return ParseDivAlignValue(aValue, aResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
|
|
|
}
|
|
|
|
|
2013-11-19 11:21:29 -08:00
|
|
|
void
|
|
|
|
HTMLDivElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
MapMarqueeAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
|
|
|
|
{
|
|
|
|
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapBGColorInto(aAttributes, aData);
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHODIMP_(bool)
|
2012-12-21 06:06:50 -08:00
|
|
|
HTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::div)) {
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
sDivAlignAttributeMap,
|
|
|
|
sCommonAttributeMap
|
|
|
|
};
|
2011-12-18 02:09:27 -08:00
|
|
|
return FindAttributeDependence(aAttribute, map);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
sImageMarginSizeAttributeMap,
|
|
|
|
sBackgroundColorAttributeMap,
|
|
|
|
sCommonAttributeMap
|
|
|
|
};
|
2011-12-18 02:09:27 -08:00
|
|
|
return FindAttributeDependence(aAttribute, map);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::IsAttributeMapped(aAttribute);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMapRuleToAttributesFunc
|
2012-12-21 06:06:50 -08:00
|
|
|
HTMLDivElement::GetAttributeMappingFunction() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::div)) {
|
|
|
|
return &MapAttributesIntoRule;
|
|
|
|
}
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
|
|
|
|
return &MapMarqueeAttributesIntoRule;
|
|
|
|
}
|
|
|
|
return nsGenericHTMLElement::GetAttributeMappingFunction();
|
|
|
|
}
|
2010-07-23 02:49:57 -07:00
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|