2006-03-01 Eric Seidel <eseidel@apple.com>
[WebKit-https.git] / WebKitTools / Spinneret / Spinneret / WebView.cpp
index 168d6bd080486025c2641b0afbdbc1b55ee3eab8..3d816ff6439b971a38934c34cc3335d3de0fcbc1 100755 (executable)
@@ -69,16 +69,16 @@ static ATOM registerWebViewWithInstance(HINSTANCE hInstance)
 \r
     wcex.cbSize = sizeof(WNDCLASSEX);\r
 \r
-    wcex.style            = CS_HREDRAW | CS_VREDRAW; // CS_DBLCLKS?\r
+    wcex.style          = CS_HREDRAW | CS_VREDRAW; // CS_DBLCLKS?\r
     wcex.lpfnWndProc    = WndProc;\r
-    wcex.cbClsExtra        = 0;\r
-    wcex.cbWndExtra        = 0;\r
-    wcex.hInstance        = hInstance;\r
-    wcex.hIcon            = 0;\r
+    wcex.cbClsExtra     = 0;\r
+    wcex.cbWndExtra     = 0;\r
+    wcex.hInstance      = hInstance;\r
+    wcex.hIcon          = 0;\r
     wcex.hCursor        = LoadCursor(0, IDC_ARROW);\r
-    wcex.hbrBackground    = (HBRUSH)(COLOR_WINDOW+1);\r
-    wcex.lpszMenuName    = 0;\r
-    wcex.lpszClassName    = kWebViewWindowClassName;\r
+    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);\r
+    wcex.lpszMenuName   = 0;\r
+    wcex.lpszClassName  = kWebViewWindowClassName;\r
     wcex.hIconSm        = 0;\r
 \r
     return RegisterClassEx(&wcex);\r
@@ -108,17 +108,21 @@ WebView::WebView(HWND hWnd)
     d->frame = new FrameWin(page, 0);\r
     FrameView *frameView = new FrameView(d->frame);\r
     d->frame->setView(frameView);\r
+\r
+    d->frame->begin();\r
+    d->frame->write("<img src=\"data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7\" alt=\"Larry\"><div style=\"border: 1px black\">foo</div><ul><li>foo<li>bar<li>baz</ul>");\r
+    d->frame->end();\r
 }\r
 \r
 WebView::~WebView()\r
 {\r
-    \r
+    delete d;\r
 }\r
 \r
-void WebView::drawRect(const RECT& dirtyRect)\r
+void WebView::drawRect(const PAINTSTRUCT& ps)\r
 {\r
-    GraphicsContext context;\r
-    d->frame->paint(&context, dirtyRect);\r
+    GraphicsContext context(ps.hdc);\r
+    d->frame->paint(&context, ps.rcPaint);\r
 }\r
 \r
 HWND WebView::windowHandle()\r
@@ -126,15 +130,6 @@ HWND WebView::windowHandle()
     return d->windowHandle;\r
 }\r
 \r
-//\r
-//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)\r
-//\r
-//  PURPOSE:  Processes messages for the main window.\r
-//\r
-//  WM_COMMAND    - process the application menu\r
-//  WM_PAINT    - Paint the main window\r
-//  WM_DESTROY    - post a quit message and return\r
-//\r
 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
     int wmId, wmEvent;\r
@@ -159,7 +154,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         PAINTSTRUCT ps;\r
         hdc = BeginPaint(hWnd, &ps);\r
         // TODO: Add any drawing code here...\r
-        gSharedWebViewHack->drawRect(ps.rcPaint);\r
+        gSharedWebViewHack->drawRect(ps);\r
         EndPaint(hWnd, &ps);\r
         break;\r
     case WM_DESTROY:\r