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/. */
|
2011-05-20 21:23:49 +04:00
|
|
|
|
|
|
|
#ifndef nsDOMStringMap_h
|
|
|
|
#define nsDOMStringMap_h
|
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2012-10-17 05:09:42 +04:00
|
|
|
#include "nsWrapperCache.h"
|
2016-08-11 23:56:34 +03:00
|
|
|
#include "mozilla/dom/Element.h"
|
2013-08-24 06:42:42 +04:00
|
|
|
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
|
2011-05-20 21:23:49 +04:00
|
|
|
|
2012-11-05 20:58:03 +04:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
2017-11-27 11:10:27 +03:00
|
|
|
namespace dom {
|
|
|
|
class DocGroup;
|
|
|
|
} // namespace dom
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2012-11-05 20:58:03 +04:00
|
|
|
|
2013-06-18 00:31:03 +04:00
|
|
|
class nsDOMStringMap : public nsStubMutationObserver,
|
2012-10-17 05:09:42 +04:00
|
|
|
public nsWrapperCache
|
2011-05-20 21:23:49 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-10-17 05:09:42 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMStringMap)
|
|
|
|
|
2013-06-18 00:31:03 +04:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
|
2012-10-17 05:09:42 +04:00
|
|
|
nsINode* GetParentObject()
|
|
|
|
{
|
|
|
|
return mElement;
|
|
|
|
}
|
|
|
|
|
2017-11-27 11:10:27 +03:00
|
|
|
mozilla::dom::DocGroup* GetDocGroup() const;
|
|
|
|
|
2016-08-11 23:56:34 +03:00
|
|
|
explicit nsDOMStringMap(mozilla::dom::Element* aElement);
|
2011-05-20 21:23:49 +04:00
|
|
|
|
2012-11-05 20:58:03 +04:00
|
|
|
// WebIDL API
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-05-11 02:57:58 +04:00
|
|
|
void NamedGetter(const nsAString& aProp, bool& found,
|
|
|
|
mozilla::dom::DOMString& aResult) const;
|
2012-11-05 20:58:03 +04:00
|
|
|
void NamedSetter(const nsAString& aProp, const nsAString& aValue,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
void NamedDeleter(const nsAString& aProp, bool &found);
|
2016-05-10 05:25:40 +03:00
|
|
|
void GetSupportedNames(nsTArray<nsString>& aNames);
|
2011-05-20 21:23:49 +04:00
|
|
|
|
2013-06-18 00:31:03 +04:00
|
|
|
js::ExpandoAndGeneration mExpandoAndGeneration;
|
|
|
|
|
2011-05-20 21:23:49 +04:00
|
|
|
private:
|
|
|
|
virtual ~nsDOMStringMap();
|
|
|
|
|
|
|
|
protected:
|
2016-08-11 23:56:34 +03:00
|
|
|
RefPtr<mozilla::dom::Element> mElement;
|
2011-05-20 21:23:49 +04:00
|
|
|
// Flag to guard against infinite recursion.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mRemovingProp;
|
2013-05-11 02:57:58 +04:00
|
|
|
static bool DataPropToAttr(const nsAString& aProp, nsAutoString& aResult);
|
|
|
|
static bool AttrToDataProp(const nsAString& aAttr, nsAutoString& aResult);
|
2011-05-20 21:23:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|