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-01-20 21:02:48 +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/. */
|
|
|
|
|
2013-02-27 19:38:32 +04:00
|
|
|
#ifndef nsGenericHTMLFrameElement_h
|
|
|
|
#define nsGenericHTMLFrameElement_h
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-11-21 13:56:27 +03:00
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/nsBrowserElement.h"
|
|
|
|
|
|
|
|
#include "nsFrameLoader.h"
|
2012-01-20 21:02:48 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
2014-11-21 13:56:27 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
2012-06-06 11:40:02 +04:00
|
|
|
#include "nsIFrameLoader.h"
|
2012-03-04 20:02:00 +04:00
|
|
|
#include "nsIMozBrowserFrame.h"
|
2012-06-06 11:40:02 +04:00
|
|
|
|
2013-02-26 21:02:32 +04:00
|
|
|
class nsXULElement;
|
|
|
|
|
2012-01-20 21:02:48 +04:00
|
|
|
/**
|
|
|
|
* A helper class for frame elements
|
|
|
|
*/
|
|
|
|
class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
|
2015-02-11 14:20:50 +03:00
|
|
|
public nsIFrameLoaderOwner,
|
2014-11-21 13:56:27 +03:00
|
|
|
public mozilla::nsBrowserElement,
|
2012-03-28 22:36:04 +04:00
|
|
|
public nsIMozBrowserFrame
|
2012-01-20 21:02:48 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-06-20 06:01:40 +04:00
|
|
|
nsGenericHTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2012-01-20 21:02:48 +04:00
|
|
|
mozilla::dom::FromParser aFromParser)
|
|
|
|
: nsGenericHTMLElement(aNodeInfo)
|
2014-11-21 13:56:27 +03:00
|
|
|
, nsBrowserElement()
|
2015-02-11 14:20:50 +03:00
|
|
|
, mNetworkCreated(aFromParser == mozilla::dom::FROM_PARSER_NETWORK)
|
|
|
|
, mIsPrerendered(false)
|
|
|
|
, mBrowserFrameListenersRegistered(false)
|
|
|
|
, mFrameLoaderCreationDisallowed(false)
|
2012-01-20 21:02:48 +04:00
|
|
|
{
|
|
|
|
}
|
2012-01-27 03:03:22 +04:00
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2015-02-11 14:20:50 +03:00
|
|
|
NS_DECL_NSIFRAMELOADEROWNER
|
2012-01-20 21:02:48 +04:00
|
|
|
NS_DECL_NSIDOMMOZBROWSERFRAME
|
2012-03-04 20:02:00 +04:00
|
|
|
NS_DECL_NSIMOZBROWSERFRAME
|
2012-01-20 21:02:48 +04:00
|
|
|
|
|
|
|
// nsIContent
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
|
2012-01-20 21:02:48 +04:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2012-01-20 21:02:48 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-01-20 21:02:48 +04:00
|
|
|
const nsAString& aValue, bool aNotify)
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2012-01-20 21:02:48 +04:00
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-01-20 21:02:48 +04:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2013-03-15 09:38:27 +04:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2014-01-12 08:05:49 +04:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValue* aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual void DestroyContent() override;
|
2012-01-20 21:02:48 +04:00
|
|
|
|
2012-11-15 02:10:08 +04:00
|
|
|
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
2012-01-20 21:02:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int32_t TabIndexDefault() override;
|
2012-01-20 21:02:48 +04:00
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsGenericHTMLFrameElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2015-02-11 14:20:50 +03:00
|
|
|
void SwapFrameLoaders(nsXULElement& aOtherOwner, mozilla::ErrorResult& aError);
|
2014-01-12 08:05:49 +04:00
|
|
|
|
2015-02-11 14:20:50 +03:00
|
|
|
static bool BrowserFramesEnabled();
|
2014-11-21 13:56:27 +03:00
|
|
|
|
2014-01-12 08:05:49 +04:00
|
|
|
/**
|
|
|
|
* Helper method to map a HTML 'scrolling' attribute value to a nsIScrollable
|
|
|
|
* enum value. scrolling="no" (and its synonyms) maps to
|
|
|
|
* nsIScrollable::Scrollbar_Never, and anything else (including nullptr) maps
|
|
|
|
* to nsIScrollable::Scrollbar_Auto.
|
|
|
|
* @param aValue the attribute value to map or nullptr
|
|
|
|
* @return nsIScrollable::Scrollbar_Never or nsIScrollable::Scrollbar_Auto
|
|
|
|
*/
|
|
|
|
static int32_t MapScrollingAttribute(const nsAttrValue* aValue);
|
|
|
|
|
2012-01-20 21:02:48 +04:00
|
|
|
protected:
|
2015-02-11 14:20:50 +03:00
|
|
|
virtual ~nsGenericHTMLFrameElement();
|
2014-07-09 01:23:16 +04:00
|
|
|
|
2015-02-11 14:20:50 +03:00
|
|
|
// This doesn't really ensure a frame loader in all cases, only when
|
|
|
|
// it makes sense.
|
|
|
|
void EnsureFrameLoader();
|
|
|
|
nsresult LoadSrc();
|
|
|
|
nsIDocument* GetContentDocument();
|
|
|
|
nsresult GetContentDocument(nsIDOMDocument** aContentDocument);
|
|
|
|
already_AddRefed<nsPIDOMWindow> GetContentWindow();
|
|
|
|
nsresult GetContentWindow(nsIDOMWindow** aContentWindow);
|
|
|
|
|
|
|
|
nsRefPtr<nsFrameLoader> mFrameLoader;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* True when the element is created by the parser using the
|
|
|
|
* NS_FROM_PARSER_NETWORK flag.
|
|
|
|
* If the element is modified, it may lose the flag.
|
|
|
|
*/
|
|
|
|
bool mNetworkCreated;
|
|
|
|
|
|
|
|
bool mIsPrerendered;
|
|
|
|
bool mBrowserFrameListenersRegistered;
|
|
|
|
bool mFrameLoaderCreationDisallowed;
|
2014-08-19 18:14:08 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void GetManifestURLByType(nsIAtom *aAppType, nsAString& aOut);
|
2012-01-20 21:02:48 +04:00
|
|
|
};
|
2013-02-27 19:38:32 +04:00
|
|
|
|
|
|
|
#endif // nsGenericHTMLFrameElement_h
|