zomgistania

Main page | About | Articles | Previous Posts | Archives

Friday, March 24, 2006

Developing a web browser

I've been coding a web browser, for fun obviously, since there's really no need for a crap browser made by a random coder ;)

There have been numerous questions to begin with.. How should I implement things like CSS? DOM? Am I ever going to go that far as in implement CSS support at all?

I didn't even have an idea how things should be drawn to the screen... Windows Forms? Custom GDI drawing? How?

I did some research on google and found out that you can redefine the layout engine used in Windows Forms.

So I did that.. created a new control based on the Panel class, which allowed me to change the layout engine used to a custom one.
I made a very simple layout engine, which would take some values and create Labels for every one of them and lay them on the panel.

I also had made some simple classes to open TCP/IP connections to the server and to send HTTP requests. They're a buggy pile of crap at the moment, I will look at them (maybe) at the point when I get the actual HTML outputted to the screen in somewhat similar manner as in Lynx (a text-only browser on *nix).


For saving the HTML data, I created some basic classes, with somewhat similar features as XmlNode and some ideas borrowed from W3C's DOM specification. Basically just something to contain possible text-data which the HTML element had, the attributes of the tag and possible child elements.

I also made some structures to be used with CSS. I thought that I'd use something like CSS to format the documents to begin with, so it would be easy to add support for it later.


Now I'm in the point where the HTML structure is parsed correctly (afaik) and I need to make a new layout engine which loads and displays the site, instead of a list of the tags found in the document like it does now :)


I've had to do lots of thinking. New concepts, new programming models in C# etc.
The last time I've thought this much was when I was coding a 2D engine in C#+Direct3D (abandoned due to lack of intrest at the moment)


Oh well. Maybe it's time to go sleep now. Gotta get up early tomorrow to work and so on.

0 Comments:

Post a Comment

<< Home