#ifndef LocalFrame_h
#define LocalFrame_h
#include "core/frame/Frame.h"
#include "core/loader/FrameLoader.h"
#include "core/loader/NavigationScheduler.h"
#include "core/page/FrameTree.h"
#include "platform/heap/Handle.h"
#include "platform/scroll/ScrollTypes.h"
namespace WebCore {
class Color;
class DragImage;
class Editor;
class EventHandler;
class FetchContext;
class FloatSize;
class FrameSelection;
class FrameView;
class InputMethodController;
class IntPoint;
class IntSize;
class Node;
class Range;
class TreeScope;
class ScriptController;
class SpellChecker;
class TreeScope;
class VisiblePosition;
class LocalFrame : public Frame {
public:
static PassRefPtr<LocalFrame> create(FrameLoaderClient*, FrameHost*, HTMLFrameOwnerElement*);
virtual bool isLocalFrame() const OVERRIDE { return true; }
void init();
void setView(PassRefPtr<FrameView>);
void createView(const IntSize&, const Color&, bool,
ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
ScrollbarMode = ScrollbarAuto, bool verticalLock = false);
virtual ~LocalFrame();
virtual void willDetachFrameHost() OVERRIDE;
virtual void detachFromFrameHost() OVERRIDE;
virtual void setDOMWindow(PassRefPtrWillBeRawPtr<DOMWindow>) OVERRIDE;
FrameView* view() const;
Editor& editor() const;
EventHandler& eventHandler() const;
FrameLoader& loader() const;
FrameTree& tree() const;
NavigationScheduler& navigationScheduler() const;
FrameSelection& selection() const;
InputMethodController& inputMethodController() const;
FetchContext& fetchContext() const { return loader().fetchContext(); }
ScriptController& script();
SpellChecker& spellChecker() const;
void didChangeVisibilityState();
bool inScope(TreeScope*) const;
void countObjectsNeedingLayout(unsigned& needsLayoutObjects, unsigned& totalObjects, bool& isPartial);
String layerTreeAsText(unsigned flags = 0) const;
String trackedRepaintRectsAsText() const;
void setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio);
bool shouldUsePrintingLayout() const;
FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);
bool inViewSourceMode() const;
void setInViewSourceMode(bool = true);
void setPageZoomFactor(float factor);
float pageZoomFactor() const { return m_pageZoomFactor; }
void setTextZoomFactor(float factor);
float textZoomFactor() const { return m_textZoomFactor; }
void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor);
void deviceOrPageScaleFactorChanged();
double devicePixelRatio() const;
void sendOrientationChangeEvent(int orientation);
int orientation() const { return m_orientation; }
String documentTypeString() const;
PassOwnPtr<DragImage> nodeImage(Node&);
PassOwnPtr<DragImage> dragImageForSelection();
String selectedText() const;
String selectedTextForClipboard() const;
VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
Document* documentAtPoint(const IntPoint& windowPoint);
PassRefPtrWillBeRawPtr<Range> rangeForPoint(const IntPoint& framePoint);
void notifyChromeClientWheelEventHandlerCountChanged() const;
bool isURLAllowed(const KURL&) const;
private:
LocalFrame(FrameLoaderClient*, FrameHost*, HTMLFrameOwnerElement*);
mutable FrameTree m_treeNode;
mutable FrameLoader m_loader;
mutable NavigationScheduler m_navigationScheduler;
RefPtr<FrameView> m_view;
OwnPtr<ScriptController> m_script;
const OwnPtr<Editor> m_editor;
const OwnPtr<SpellChecker> m_spellChecker;
const OwnPtr<FrameSelection> m_selection;
const OwnPtr<EventHandler> m_eventHandler;
OwnPtr<InputMethodController> m_inputMethodController;
float m_pageZoomFactor;
float m_textZoomFactor;
int m_orientation;
bool m_inViewSourceMode;
};
inline void LocalFrame::init()
{
m_loader.init();
}
inline FrameLoader& LocalFrame::loader() const
{
return m_loader;
}
inline NavigationScheduler& LocalFrame::navigationScheduler() const
{
return m_navigationScheduler;
}
inline FrameView* LocalFrame::view() const
{
return m_view.get();
}
inline ScriptController& LocalFrame::script()
{
return *m_script;
}
inline FrameSelection& LocalFrame::selection() const
{
return *m_selection;
}
inline Editor& LocalFrame::editor() const
{
return *m_editor;
}
inline SpellChecker& LocalFrame::spellChecker() const
{
return *m_spellChecker;
}
inline InputMethodController& LocalFrame::inputMethodController() const
{
return *m_inputMethodController;
}
inline bool LocalFrame::inViewSourceMode() const
{
return m_inViewSourceMode;
}
inline void LocalFrame::setInViewSourceMode(bool mode)
{
m_inViewSourceMode = mode;
}
inline FrameTree& LocalFrame::tree() const
{
return m_treeNode;
}
inline EventHandler& LocalFrame::eventHandler() const
{
ASSERT(m_eventHandler);
return *m_eventHandler;
}
DEFINE_TYPE_CASTS(LocalFrame, Frame, localFrame, localFrame->isLocalFrame(), localFrame.isLocalFrame());
}
#define toLocalFrameTemporary toLocalFrame
#endif