+2006-03-01 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by andersca.
+
+ Make spinneret take advantage of the new GraphicsContextCairo.
+
+ * DumpRenderTree/DumpRenderTree.vcproj/DumpRenderTree/DumpRenderTree.cpp:
+ (main): updated to match style guidelines.
+ * Spinneret/Spinneret/Spinneret.cpp:
+ (_tWinMain):
+ * Spinneret/Spinneret/WebView.cpp:
+ (WebKit::registerWebViewWithInstance):
+ (WebKit::WebView::WebView):
+ (WebKit::WebView::~WebView):
+ (WebKit::WebView::drawRect):
+ (WebKit::WndProc):
+ * Spinneret/Spinneret/WebView.h:
+
2006-03-01 Justin Garcia <justin.garcia@apple.com>
Reviewed by darin
int main(int argc, char* argv[])
{
- Page *page = new Page();
- FrameWin *frame = new FrameWin(page, 0);
- FrameView *frameView = new FrameView(frame);
+ Page* page = new Page();
+ FrameWin* frame = new FrameWin(page, 0);
+ FrameView* frameView = new FrameView(frame);
frame->setView(frameView);
frame->begin();
#if LOCAL_FILE_TEST
- char *path = "c:\\cygwin\\tmp\\test.html";
- FILE *file = fopen(path, "rb");
+ char* path = "c:\\cygwin\\tmp\\test.html";
+ FILE* file = fopen(path, "rb");
if (!file) {
printf("Failed to open file: %s\n", path);
printf("Current path: %s\n", _getcwd(0,0));
\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
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
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
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