Bug 17484

Summary: Add Windows (Cairo) support in WebKit.dll
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cedricv, lunaris, poirot.alex
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 27087, 27240    
Bug Blocks:    
Attachments:
Description Flags
Patch to conditionalize some CG/Cairo calls in WebKit proper.
darin: review-
Tweak for current SVN
none
Tweak for 2008-03-07
none
Tweak for 2008-05-28
none
Patch against current sources
none
Patch against current sources.
none
Configuration Patches for Cairo build.
none
Full Patch versus ToT
none
Patch against current sources
none
Patch against ToT
none
Patch against ToT
none
Update against ToT (2008-12-14)
none
Update Against ToT (2008-12-18)
none
Update against ToT (2009-01-05)
none
Patch against ToT
none
Patch against ToT (2009-01-23)
none
Patch against ToT (2009-03-24)
none
Patch against TotT (2009-05-29)
none
Patch against ToT (@r45831) none

Description Brent Fulgham 2008-02-21 17:30:38 PST
A small number or routines in the WebKit API classes assume a CoreGraphics backend.  This patch conditionalizes these regions of the code to allow a Cairo-based WebKit.dll to be built.
Comment 1 Brent Fulgham 2008-02-21 17:42:35 PST
Created attachment 19268 [details]
Patch to conditionalize some CG/Cairo calls in WebKit proper.
Comment 2 Darin Adler 2008-02-24 18:14:11 PST
Comment on attachment 19268 [details]
Patch to conditionalize some CG/Cairo calls in WebKit proper.

Good general direction. Some comments:

 #include "config.h"
+#include "NotImplemented.h"
 #include "WebDragClient.h"

This is wrong. The first include after "config.h" should be the file's own header "WebDragClient.h". There should be a blank line after that before the rest of the includes.

+#else
+    notImplemented ();
+#endif

No space before the parenthesis.

 void WebFrame::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge)
 {
+#if USE(CFNETWORK)

Not answering the challenge at all will simply make the browser hang. You should probably do something better than that. Or is there some reason this is OK?

+#if PLATFORM(CG)

It seems strange to just conditionalize the printing code without adding a call to notImplemented(). How is this different from the createDragImage case?

+#if !PLATFORM(CAIRO)
 #if !defined(NDEBUG) && defined(USE_DEBUG_SAFARI_THEME)

I think this is backwards. It should be #if PLATFORM(CG), since SafariTheme relies on CG. In the future we might need to add a conditional about whether SafariTheme is being included, since someone with CG still might not want SafariTheme. I definitely don't think that "CAIRO" is a good way to say "no SafariTheme".

The purpose of WebKitGraphics is to give a way to draw text if you can't compile C++ code. There's no reason to have it if the context is a WebCore::GraphicsContext object. I suggest leaving these functions out entirely for non-CG platforms.
Comment 3 Brent Fulgham 2008-02-27 17:49:15 PST
Created attachment 19421 [details]
Tweak for current SVN

Not intending this for review.  Just making it available for other windows porters.
Comment 4 Brent Fulgham 2008-03-07 15:18:00 PST
Created attachment 19596 [details]
Tweak for 2008-03-07
Comment 5 Brent Fulgham 2008-05-28 13:35:10 PDT
Created attachment 21400 [details]
Tweak for 2008-05-28
Comment 6 Brent Fulgham 2008-10-22 23:11:00 PDT
Created attachment 24590 [details]
Patch against current sources
Comment 7 Brent Fulgham 2008-11-11 21:45:54 PST
Created attachment 25086 [details]
Patch against current sources.
Comment 8 Brent Fulgham 2008-11-11 21:48:24 PST
Created attachment 25087 [details]
Configuration Patches for Cairo build.

Changes to configurations needed to build under Cairo.
Comment 9 Brent Fulgham 2008-11-11 21:49:37 PST
The main set of patches (the 26.62 KB patch) works around various build errors in WebKit.dll.  The COM stuff makes heavy use of Apple-specific libraries, which must be commented out.

The small patch (965 bytes) just modifies the configuration as necessary to build.
Comment 10 Brent Fulgham 2008-11-11 22:04:35 PST
I have placed a tarball of the requirements to build WebKit (Cairo) here:  http://web.me.com/bfulgham/Site/Downloads.html.
Comment 11 Franco Lucchini 2008-11-16 12:13:42 PST
I managed to build a version of webkit completely independent from CoreGraphics.
It wasn't difficult, because i just closed all the #include CoreGraphics/* in an #if PLATFORM(CG) directive.
That way I built a WinLauncher executable that doesn't require CoreGraphics.dll.

I did the same for the CFNetwork library, but I wonder how to replace the CFURLCache mechanism implemented in WebView.cpp.
Any idea?

Eventually I will post a patch containing my modifications.
Comment 12 Brent Fulgham 2008-11-25 16:30:41 PST
Created attachment 25510 [details]
Full Patch versus ToT
Comment 13 Brent Fulgham 2008-11-26 14:06:33 PST
Created attachment 25535 [details]
Patch against current sources

Small update that enables the scroll/pan function (i.e., click mouse wheel, then mouse movement becomes scroll).
Comment 14 Brent Fulgham 2008-11-29 19:34:57 PST
Created attachment 25604 [details]
Patch against ToT

No longer includes visual studio changes, as these are part of the main tree now.
Comment 15 Brent Fulgham 2008-12-11 13:36:27 PST
Created attachment 25963 [details]
Patch against ToT
Comment 16 Brent Fulgham 2008-12-14 21:59:10 PST
Created attachment 26021 [details]
Update against ToT (2008-12-14)
Comment 17 Mital Vora 2008-12-17 21:06:07 PST
Created attachment 26111 [details]
Update Against ToT (2008-12-18)

Update Against ToT (2008-12-18) SVN Version: 39368.
Comment 18 Brent Fulgham 2009-01-05 18:07:00 PST
Created attachment 26448 [details]
Update against ToT (2009-01-05)

Much of this patch is a duplicate of 23092.  Once that patch is approved and landed this patch will nearly go away.
Comment 19 Brent Fulgham 2009-01-11 14:03:53 PST
Created attachment 26615 [details]
Patch against ToT

Current patch.  Boy it's small now that the CFNetwork stuff is in place!
Comment 20 Brent Fulgham 2009-01-23 21:28:49 PST
Created attachment 26992 [details]
Patch against ToT (2009-01-23)
Comment 21 Brent Fulgham 2009-03-24 13:58:05 PDT
Created attachment 28910 [details]
Patch against ToT (2009-03-24)
Comment 22 Brent Fulgham 2009-05-29 11:54:39 PDT
Created attachment 30783 [details]
Patch against TotT (2009-05-29)
Comment 23 Joonghoon Kim 2009-06-03 00:20:03 PDT
New patch (2009-05-29) prevents for all ports from including winsock. 
In WebCore/config.h, the code to define _WINSOCKAPI_ should be moved 
into #if PLATFORM(WIN) ~ #endif that defines WTF_USE_CURL. And every file
that includes curl.h should include winsock2.h before. 

WebCore/HistoryPropertyList.h should be copied into WEBKITOUTPUTDIR. 

I think it's better to use some environmental variable (as $PRODUCTION) 
than use config.h only. WebCorePrefix.h includes CoreServices.h but CF-Lite 
doesn't have it.
Comment 24 Brent Fulgham 2009-06-04 14:52:03 PDT
(In reply to comment #23)
> WebCore/HistoryPropertyList.h should be copied into WEBKITOUTPUTDIR. 

This omission has been corrected in @r44434.
Comment 25 Brent Fulgham 2009-07-08 11:07:03 PDT
(In reply to comment #23)
> And every file that includes curl.h should include winsock2.h before. 

This change has been landed in @r45630.
Comment 26 Brent Fulgham 2009-07-13 12:05:31 PDT
Created attachment 32669 [details]
Patch against ToT (@r45831)
Comment 27 Brent Fulgham 2009-07-13 16:49:46 PDT
All elements of the Windows Cairo software, build system, and configuration are now part of WebKit proper.  I am closing this issue now that all sub-issue work is complete.

Thanks to everyone for their help!