标签:
顾名思义,WebPage就是指网页。这一点也可以从Webkit的WebCore的架构看出来:WebCore->page。在page目录下,实现了一些DOM的全局对象,比如Window,Timer,popup窗口,DOM的选择,焦点的控制、history等等。
总之,与WebView类似,WebPage就是WebCore用来编辑、查看网页内容的对象。
WebCore::page:
void setMainFrame();
Frame* mainFrame() const ;
BackForwardList* backForwardList() const;
bool goBack();
bool goForward();
bool canGoBackOrForward(int distance) const;
page的以下类的定义,需要平台实现,使得page具有缺省的client:
struct PageClients {
WTF_MAKE_NONCOPYABLE(PageClients); WTF_MAKE_FAST_ALLOCATED;
public:
PageClients();
~PageClients();
AlternativeTextClient* alternativeTextClient;
ChromeClient* chromeClient;
#if ENABLE(CONTEXT_MENUS)
ContextMenuClient* contextMenuClient;
#endif
EditorClient* editorClient;
DragClient* dragClient;
InspectorClient* inspectorClient;
RefPtr<BackForwardList> backForwardClient;
};
我们来看看Qt是如何实现的,Qt实现了一个QWebPage,里面的一些方法是为了呈现page而定义的:
QWebFrame * | mainFrame () const |
QWebHistory * | history () const |
QWebFrame * | currentFrame () const |
bool | findText ( const QString & subString, FindFlags options = 0 ) |
bool | focusNextPrevChild ( bool next ) |
bool | forwardUnsupportedContent () const |
QWebFrame * | frameAt ( const QPoint & pos ) const |
bool | hasSelection () const |
标签:
原文地址:http://blog.csdn.net/lichwei1983/article/details/43987351