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-06-08 23:04:10 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
#ifndef HTMLFrameSetElement_h
|
|
|
|
#define HTMLFrameSetElement_h
|
2011-06-08 23:04:10 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-11-03 21:29:19 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2011-06-08 23:04:10 +04:00
|
|
|
#include "nsIDOMHTMLFrameSetElement.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The nsFramesetUnit enum is used to denote the type of each entry
|
|
|
|
* in the row or column spec.
|
|
|
|
*/
|
|
|
|
enum nsFramesetUnit {
|
|
|
|
eFramesetUnit_Fixed = 0,
|
|
|
|
eFramesetUnit_Percent,
|
|
|
|
eFramesetUnit_Relative
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The nsFramesetSpec struct is used to hold a single entry in the
|
|
|
|
* row or column spec.
|
|
|
|
*/
|
|
|
|
struct nsFramesetSpec {
|
|
|
|
nsFramesetUnit mUnit;
|
|
|
|
nscoord mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum number of entries allowed in the frame set element row
|
|
|
|
* or column spec.
|
|
|
|
*/
|
|
|
|
#define NS_MAX_FRAMESET_SPEC_COUNT 16000
|
|
|
|
|
2011-08-24 23:49:25 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-10-08 19:51:15 +04:00
|
|
|
class OnBeforeUnloadEventHandlerNonNull;
|
2012-12-21 18:07:28 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class HTMLFrameSetElement final : public nsGenericHTMLElement,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIDOMHTMLFrameSetElement
|
2011-06-08 23:04:10 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit HTMLFrameSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2012-12-21 18:06:50 +04:00
|
|
|
: nsGenericHTMLElement(aNodeInfo),
|
|
|
|
mNumRows(0),
|
|
|
|
mNumCols(0),
|
|
|
|
mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
|
|
|
|
{
|
2013-12-17 17:58:32 +04:00
|
|
|
SetHasWeirdParserInsertionMode();
|
2012-12-21 18:06:50 +04:00
|
|
|
}
|
2011-06-08 23:04:10 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFrameSetElement, frameset)
|
2012-09-26 18:17:51 +04:00
|
|
|
|
2011-06-08 23:04:10 +04:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMHTMLFrameSetElement
|
|
|
|
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
|
|
|
|
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetCols(DOMString& aCols)
|
2012-12-21 18:07:28 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::cols, aCols);
|
|
|
|
}
|
|
|
|
void SetCols(const nsAString& aCols, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::cols, aCols, aError);
|
|
|
|
}
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetRows(DOMString& aRows)
|
2012-12-21 18:07:28 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::rows, aRows);
|
|
|
|
}
|
|
|
|
void SetRows(const nsAString& aRows, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::rows, aRows, aError);
|
|
|
|
}
|
|
|
|
|
2017-07-04 23:54:30 +03:00
|
|
|
virtual bool IsEventAttributeNameInternal(nsIAtom *aName) override;
|
2013-01-03 00:24:07 +04:00
|
|
|
|
2011-08-24 23:49:25 +04:00
|
|
|
// Event listener stuff; we need to declare only the ones we need to
|
|
|
|
// forward to window that don't come from nsIDOMHTMLFrameSetElement.
|
|
|
|
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
|
2012-12-21 18:07:28 +04:00
|
|
|
#define WINDOW_EVENT_HELPER(name_, type_) \
|
|
|
|
type_* GetOn##name_(); \
|
2013-09-17 15:01:28 +04:00
|
|
|
void SetOn##name_(type_* handler);
|
2012-12-21 18:07:28 +04:00
|
|
|
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
|
|
|
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
|
|
|
|
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
2013-10-08 19:51:15 +04:00
|
|
|
WINDOW_EVENT_HELPER(name_, OnBeforeUnloadEventHandlerNonNull)
|
2014-04-01 15:42:12 +04:00
|
|
|
#include "mozilla/EventNameList.h" // IWYU pragma: keep
|
2012-12-21 18:07:28 +04:00
|
|
|
#undef BEFOREUNLOAD_EVENT
|
|
|
|
#undef WINDOW_EVENT
|
|
|
|
#undef WINDOW_EVENT_HELPER
|
2011-08-24 23:49:25 +04:00
|
|
|
#undef EVENT
|
|
|
|
|
2011-06-08 23:04:10 +04:00
|
|
|
/**
|
|
|
|
* GetRowSpec is used to get the "rows" spec.
|
2012-08-22 19:56:38 +04:00
|
|
|
* @param out int32_t aNumValues The number of row sizes specified.
|
2011-06-08 23:04:10 +04:00
|
|
|
* @param out nsFramesetSpec* aSpecs The array of size specifications.
|
|
|
|
This is _not_ owned by the caller, but by the nsFrameSetElement
|
|
|
|
implementation. DO NOT DELETE IT.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetRowSpec(int32_t *aNumValues, const nsFramesetSpec** aSpecs);
|
2011-06-08 23:04:10 +04:00
|
|
|
/**
|
|
|
|
* GetColSpec is used to get the "cols" spec
|
2012-08-22 19:56:38 +04:00
|
|
|
* @param out int32_t aNumValues The number of row sizes specified.
|
2011-06-08 23:04:10 +04:00
|
|
|
* @param out nsFramesetSpec* aSpecs The array of size specifications.
|
|
|
|
This is _not_ owned by the caller, but by the nsFrameSetElement
|
|
|
|
implementation. DO NOT DELETE IT.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetColSpec(int32_t *aNumValues, const nsFramesetSpec** aSpecs);
|
2011-06-08 23:04:10 +04:00
|
|
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2011-06-08 23:04:10 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
2011-06-08 23:04:10 +04:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) const override;
|
2011-06-08 23:04:10 +04:00
|
|
|
|
2017-04-20 22:57:48 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
|
|
|
bool aPreallocateChildren) const override;
|
2011-06-08 23:04:10 +04:00
|
|
|
|
2012-12-21 18:07:28 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLFrameSetElement();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2012-12-21 18:07:28 +04:00
|
|
|
|
2017-06-07 20:28:20 +03:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValueOrString* aValue,
|
|
|
|
bool aNotify) override;
|
|
|
|
|
2011-06-08 23:04:10 +04:00
|
|
|
private:
|
|
|
|
nsresult ParseRowCol(const nsAString& aValue,
|
2015-11-03 21:29:19 +03:00
|
|
|
int32_t& aNumSpecs,
|
|
|
|
UniquePtr<nsFramesetSpec[]>* aSpecs);
|
2011-06-08 23:04:10 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The number of size specs in our "rows" attr
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mNumRows;
|
2011-06-08 23:04:10 +04:00
|
|
|
/**
|
|
|
|
* The number of size specs in our "cols" attr
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mNumCols;
|
2011-06-08 23:04:10 +04:00
|
|
|
/**
|
|
|
|
* The style hint to return for the rows/cols attrs in
|
|
|
|
* GetAttributeChangeHint
|
|
|
|
*/
|
|
|
|
nsChangeHint mCurrentRowColHint;
|
|
|
|
/**
|
|
|
|
* The parsed representation of the "rows" attribute
|
|
|
|
*/
|
2015-11-03 21:29:19 +03:00
|
|
|
UniquePtr<nsFramesetSpec[]> mRowSpecs; // parsed, non-computed dimensions
|
2011-06-08 23:04:10 +04:00
|
|
|
/**
|
|
|
|
* The parsed representation of the "cols" attribute
|
|
|
|
*/
|
2015-11-03 21:29:19 +03:00
|
|
|
UniquePtr<nsFramesetSpec[]> mColSpecs; // parsed, non-computed dimensions
|
2011-06-08 23:04:10 +04:00
|
|
|
};
|
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // HTMLFrameSetElement_h
|