Permalink
Browse files

Refactor.

  • Loading branch information...
higepon committed Apr 30, 2012
1 parent e268a75 commit 2066dd0518fdcba7b9f381d71255a6bec3162051
@@ -51,17 +51,13 @@
namespace WebCore {
-EditorClientMona::EditorClientMona()
- : m_editing(false)
- , m_inUndoRedo(false)
+EditorClientMona::EditorClientMona(WebPage* webPage)
+ : m_page(webPage),
+ m_editing(false),
+ m_inUndoRedo(false)
{
}
-void EditorClientMona::setPage(Page* page)
-{
- m_page = page;
-}
-
void EditorClientMona::pageDestroyed()
{
notImplemented();
@@ -42,10 +42,11 @@
namespace WebCore {
+class WebPage;
+
class EditorClientMona : public EditorClient, public TextCheckerClient {
public:
- EditorClientMona();
- void setPage( Page* page );
+ EditorClientMona(WebPage* webPage);
virtual void pageDestroyed();
@@ -120,7 +121,7 @@ class EditorClientMona : public EditorClient, public TextCheckerClient {
private:
bool handleEditingKeyboardEvent(KeyboardEvent* event);
const char* interpretKeyEvent(const KeyboardEvent* event);
- Page* m_page;
+ WebPage* m_page;
bool m_editing;
bool m_inUndoRedo; // our undo stack works differently - don't re-enter!
};
@@ -38,7 +38,6 @@ namespace WebCore {
class Frame;
class KURL;
class WebPage;
-class WebFramePrivate;
class WebView;
class HTMLFrameOwnerElement;
@@ -58,9 +57,6 @@ class WebFrame : public RefCounted<WebFrame> {
private:
static PassRefPtr<WebFrame> create();
void init(WebPage*, const String& frameName, WebCore::HTMLFrameOwnerElement*);
- friend class WebPage;
-
- friend class WebCore::FrameLoaderClientMona;
WebCore::Frame* m_coreFrame;
FrameLoaderClientMona m_frameLoaderClient;
@@ -55,17 +55,15 @@ WebPage::WebPage(WebView* web_view, const IntSize& viewSize) :
}
cairo_ = cairo_create(surface_);
- // todo: life cycle of clients
- Page::PageClients* clients = new Page::PageClients;
- ASSERT(clients);
- clients->chromeClient = new ChromeClientMona(this);
- clients->contextMenuClient = new ContextMenuClientMona();
- EditorClientMona* editorClient = new EditorClientMona();
- clients->editorClient = editorClient;
- clients->dragClient = new DragClientMona();
- clients->inspectorClient = new InspectorClientMona();
-
- m_page = adoptPtr(new Page(*clients));
+ Page::PageClients clients;
+ clients.chromeClient = new ChromeClientMona(this);
+ clients.contextMenuClient = new ContextMenuClientMona();
+ EditorClientMona* editorClient = new EditorClientMona(this);
+ clients.editorClient = editorClient;
+ clients.dragClient = new DragClientMona();
+ clients.inspectorClient = new InspectorClientMona();
+
+ m_page = adoptPtr(new Page(clients));
m_page->settings()->setLoadsImagesAutomatically(true);
m_page->settings()->setJavaScriptEnabled(true);
m_page->settings()->setCaretBrowsingEnabled(true);
@@ -74,7 +72,6 @@ WebPage::WebPage(WebView* web_view, const IntSize& viewSize) :
m_page->settings()->setShouldPaintCustomScrollbars(true);
m_page->settings()->setShowDebugBorders(true);
m_page->settings()->setShowRepaintCounter(true);
- editorClient->setPage(m_page.get()); // todo: compare to webkit2
m_mainFrame = WebFrame::createMainFrame(this);
}

0 comments on commit 2066dd0

Please sign in to comment.