2011-06-08 12:04:10 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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 12:04:10 -07:00
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
#ifndef HTMLFrameSetElement_h
|
|
|
|
#define HTMLFrameSetElement_h
|
2011-06-08 12:04:10 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-06-08 12:04:10 -07: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 12:49:25 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-10-08 08:51:15 -07:00
|
|
|
class OnBeforeUnloadEventHandlerNonNull;
|
2012-12-21 06:07:28 -08:00
|
|
|
|
2013-07-11 14:26:54 -07:00
|
|
|
class HTMLFrameSetElement MOZ_FINAL : public nsGenericHTMLElement,
|
|
|
|
public nsIDOMHTMLFrameSetElement
|
2011-06-08 12:04:10 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit HTMLFrameSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2012-12-21 06:06:50 -08:00
|
|
|
: nsGenericHTMLElement(aNodeInfo),
|
|
|
|
mNumRows(0),
|
|
|
|
mNumCols(0),
|
|
|
|
mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
|
|
|
|
{
|
2013-12-17 05:58:32 -08:00
|
|
|
SetHasWeirdParserInsertionMode();
|
2012-12-21 06:06:50 -08:00
|
|
|
}
|
2011-06-08 12:04:10 -07:00
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFrameSetElement, frameset)
|
2012-09-26 07:17:51 -07:00
|
|
|
|
2011-06-08 12:04:10 -07:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMHTMLFrameSetElement
|
|
|
|
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
|
|
|
|
|
2012-12-21 06:07:28 -08:00
|
|
|
void GetCols(nsString& aCols)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::cols, aCols);
|
|
|
|
}
|
|
|
|
void SetCols(const nsAString& aCols, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::cols, aCols, aError);
|
|
|
|
}
|
|
|
|
void GetRows(nsString& aRows)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::rows, aRows);
|
|
|
|
}
|
|
|
|
void SetRows(const nsAString& aRows, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::rows, aRows, aError);
|
|
|
|
}
|
|
|
|
|
2013-01-02 12:24:07 -08:00
|
|
|
virtual bool IsEventAttributeName(nsIAtom *aName) MOZ_OVERRIDE;
|
|
|
|
|
2011-08-24 12:49:25 -07: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 06:07:28 -08:00
|
|
|
#define WINDOW_EVENT_HELPER(name_, type_) \
|
|
|
|
type_* GetOn##name_(); \
|
2013-09-17 04:01:28 -07:00
|
|
|
void SetOn##name_(type_* handler);
|
2012-12-21 06:07:28 -08:00
|
|
|
#define WINDOW_EVENT(name_, id_, type_, struct_) \
|
|
|
|
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
|
|
|
|
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
|
2013-10-08 08:51:15 -07:00
|
|
|
WINDOW_EVENT_HELPER(name_, OnBeforeUnloadEventHandlerNonNull)
|
2014-04-01 04:42:12 -07:00
|
|
|
#include "mozilla/EventNameList.h" // IWYU pragma: keep
|
2012-12-21 06:07:28 -08:00
|
|
|
#undef BEFOREUNLOAD_EVENT
|
|
|
|
#undef WINDOW_EVENT
|
|
|
|
#undef WINDOW_EVENT_HELPER
|
2011-08-24 12:49:25 -07:00
|
|
|
#undef EVENT
|
|
|
|
|
2011-06-08 12:04:10 -07:00
|
|
|
// These override the SetAttr methods in nsGenericHTMLElement (need
|
|
|
|
// both here to silence compiler warnings).
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-09-28 23:19:26 -07:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2011-06-08 12:04:10 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2011-06-08 12:04:10 -07:00
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-06-08 12:04:10 -07:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2011-06-08 12:04:10 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GetRowSpec is used to get the "rows" spec.
|
2012-08-22 08:56:38 -07:00
|
|
|
* @param out int32_t aNumValues The number of row sizes specified.
|
2011-06-08 12:04:10 -07: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 08:56:38 -07:00
|
|
|
nsresult GetRowSpec(int32_t *aNumValues, const nsFramesetSpec** aSpecs);
|
2011-06-08 12:04:10 -07:00
|
|
|
/**
|
|
|
|
* GetColSpec is used to get the "cols" spec
|
2012-08-22 08:56:38 -07:00
|
|
|
* @param out int32_t aNumValues The number of row sizes specified.
|
2011-06-08 12:04:10 -07: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 08:56:38 -07:00
|
|
|
nsresult GetColSpec(int32_t *aNumValues, const nsFramesetSpec** aSpecs);
|
2011-06-08 12:04:10 -07:00
|
|
|
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2011-06-08 12:04:10 -07:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAttrValue& aResult) MOZ_OVERRIDE;
|
2011-06-08 12:04:10 -07:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2013-05-29 13:43:41 -07:00
|
|
|
int32_t aModType) const MOZ_OVERRIDE;
|
2011-06-08 12:04:10 -07:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2011-06-08 12:04:10 -07:00
|
|
|
|
2012-12-21 06:07:28 -08:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~HTMLFrameSetElement();
|
|
|
|
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2012-12-21 06:07:28 -08:00
|
|
|
|
2011-06-08 12:04:10 -07:00
|
|
|
private:
|
|
|
|
nsresult ParseRowCol(const nsAString& aValue,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t& aNumSpecs,
|
2011-06-08 12:04:10 -07:00
|
|
|
nsFramesetSpec** aSpecs);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The number of size specs in our "rows" attr
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mNumRows;
|
2011-06-08 12:04:10 -07:00
|
|
|
/**
|
|
|
|
* The number of size specs in our "cols" attr
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mNumCols;
|
2011-06-08 12:04:10 -07:00
|
|
|
/**
|
|
|
|
* The style hint to return for the rows/cols attrs in
|
|
|
|
* GetAttributeChangeHint
|
|
|
|
*/
|
|
|
|
nsChangeHint mCurrentRowColHint;
|
|
|
|
/**
|
|
|
|
* The parsed representation of the "rows" attribute
|
|
|
|
*/
|
|
|
|
nsAutoArrayPtr<nsFramesetSpec> mRowSpecs; // parsed, non-computed dimensions
|
|
|
|
/**
|
|
|
|
* The parsed representation of the "cols" attribute
|
|
|
|
*/
|
|
|
|
nsAutoArrayPtr<nsFramesetSpec> mColSpecs; // parsed, non-computed dimensions
|
|
|
|
};
|
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // HTMLFrameSetElement_h
|