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