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"
|
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 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
|
|
|
|
|
|
|
|
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,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2008-01-09 01:36:46 +03:00
|
|
|
const nsAString& aValue,
|
2017-11-02 06:35:52 +03:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
2008-01-09 01:36:46 +03:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
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
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
static void MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
2018-06-22 19:48:42 +03:00
|
|
|
mozilla::MappedDeclarations&);
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2018-04-05 20:42:41 +03:00
|
|
|
void GetEventTargetParent(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;
|
2017-04-20 22:57:48 +03:00
|
|
|
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
|
|
|
|
bool aPreallocateChildren) const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
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;
|
2011-06-24 16:54:28 +04:00
|
|
|
|
2017-04-15 18:55:05 +03:00
|
|
|
virtual void NodeInfoChanged(nsIDocument* aOldDoc) override
|
|
|
|
{
|
|
|
|
ClearHasPendingLinkUpdate();
|
|
|
|
nsMathMLElementBase::NodeInfoChanged(aOldDoc);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
2017-06-07 20:28:20 +03:00
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
2017-06-07 20:28:20 +03:00
|
|
|
bool aNotify) override;
|
|
|
|
|
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
|