2008-01-08 22:36:46 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +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/. */
|
2008-01-08 22:36:46 +00:00
|
|
|
|
|
|
|
#ifndef nsMathMLElement_h
|
|
|
|
#define nsMathMLElement_h
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-10-02 20:09:18 +00:00
|
|
|
#include "mozilla/dom/ElementInlines.h"
|
2008-01-08 22:36:46 +00:00
|
|
|
#include "nsMappedAttributeElement.h"
|
|
|
|
#include "nsIDOMElement.h"
|
2011-06-24 12:54:28 +00:00
|
|
|
#include "Link.h"
|
2013-09-20 10:21:03 +00:00
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2008-01-08 22:36:46 +00:00
|
|
|
|
|
|
|
class nsCSSValue;
|
|
|
|
|
|
|
|
typedef nsMappedAttributeElement nsMathMLElementBase;
|
|
|
|
|
2014-03-18 04:48:19 +00:00
|
|
|
namespace mozilla {
|
2014-03-18 04:48:20 +00:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 04:48:19 +00:00
|
|
|
class EventChainPreVisitor;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2008-01-08 22:36:46 +00:00
|
|
|
/*
|
|
|
|
* The base class for MathML elements.
|
|
|
|
*/
|
2013-07-11 21:26:54 +00:00
|
|
|
class nsMathMLElement MOZ_FINAL : public nsMathMLElementBase,
|
|
|
|
public nsIDOMElement,
|
|
|
|
public mozilla::dom::Link
|
2008-01-08 22:36:46 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
|
|
|
explicit nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2008-01-08 22:36:46 +00:00
|
|
|
|
|
|
|
// Implementation of nsISupports is inherited from nsMathMLElementBase
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// Forward implementations of parent interfaces of nsMathMLElement to
|
|
|
|
// our base class
|
2012-10-09 12:31:24 +00:00
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
2012-10-16 11:51:00 +00:00
|
|
|
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
2008-01-08 22:36:46 +00:00
|
|
|
|
|
|
|
nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aNullParent = true) MOZ_OVERRIDE;
|
2008-01-08 22:36:46 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2008-01-08 22:36:46 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2013-05-29 20:43:41 +00:00
|
|
|
nsAttrValue& aResult) MOZ_OVERRIDE;
|
2008-01-08 22:36:46 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
|
2008-01-08 22:36:46 +00:00
|
|
|
|
2008-02-07 04:09:03 +00:00
|
|
|
enum {
|
|
|
|
PARSE_ALLOW_UNITLESS = 0x01, // unitless 0 will be turned into 0px
|
2012-12-27 16:12:05 +00:00
|
|
|
PARSE_ALLOW_NEGATIVE = 0x02,
|
2013-01-07 03:24:13 +00:00
|
|
|
PARSE_SUPPRESS_WARNINGS = 0x04,
|
|
|
|
CONVERT_UNITLESS_TO_PERCENT = 0x08
|
2008-02-07 04:09:03 +00:00
|
|
|
};
|
2012-05-15 22:30:14 +00:00
|
|
|
static bool ParseNamedSpaceValue(const nsString& aString,
|
|
|
|
nsCSSValue& aCSSValue,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aFlags);
|
2012-05-15 22:30:14 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool ParseNumericValue(const nsString& aString,
|
2012-12-27 16:12:05 +00:00
|
|
|
nsCSSValue& aCSSValue,
|
|
|
|
uint32_t aFlags,
|
|
|
|
nsIDocument* aDocument);
|
2008-01-08 22:36:46 +00:00
|
|
|
|
|
|
|
static void MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aRuleData);
|
|
|
|
|
2014-03-18 04:48:19 +00:00
|
|
|
virtual nsresult PreHandleEvent(
|
|
|
|
mozilla::EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
2014-03-18 04:48:20 +00:00
|
|
|
virtual nsresult PostHandleEvent(
|
|
|
|
mozilla::EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
2014-06-20 02:01:40 +00:00
|
|
|
nsresult Clone(mozilla::dom::NodeInfo*, nsINode**) const MOZ_OVERRIDE;
|
2014-04-03 04:18:36 +00:00
|
|
|
virtual mozilla::EventStates IntrinsicState() const MOZ_OVERRIDE;
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
2008-01-08 22:36:46 +00:00
|
|
|
|
|
|
|
// Set during reflow as necessary. Does a style change notification,
|
|
|
|
// aNotify must be true.
|
2011-09-29 06:19:26 +00:00
|
|
|
void SetIncrementScriptLevel(bool aIncrementScriptLevel, bool aNotify);
|
|
|
|
bool GetIncrementScriptLevel() const {
|
2008-01-08 22:36:46 +00:00
|
|
|
return mIncrementScriptLevel;
|
|
|
|
}
|
|
|
|
|
2013-11-19 22:21:16 +00:00
|
|
|
virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) MOZ_OVERRIDE;
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual bool IsLink(nsIURI** aURI) const MOZ_OVERRIDE;
|
|
|
|
virtual void GetLinkTarget(nsAString& aTarget) MOZ_OVERRIDE;
|
|
|
|
virtual already_AddRefed<nsIURI> GetHrefURI() const MOZ_OVERRIDE;
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-09-29 06:19:26 +00:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2011-06-24 12:54:28 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2011-06-24 12:54:28 +00:00
|
|
|
}
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-06-24 12:54:28 +00:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2011-06-24 12:54:28 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
|
2013-02-06 09:42:16 +00:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 21:23:15 +00:00
|
|
|
virtual ~nsMathMLElement() {}
|
|
|
|
|
2014-04-08 22:27:17 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2013-02-06 09:42:16 +00:00
|
|
|
|
2008-01-08 22:36:46 +00:00
|
|
|
private:
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIncrementScriptLevel;
|
2008-01-08 22:36:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsMathMLElement_h
|