Monday, January 07, 2008

Browser and WebKit progress


Thanks to the continuous dedication of Nikolaus who worked and works on SimpleWebKit, a new, pure Objective-C WWW implementation compatible with Apple's WebKit implementation. It shows once again the real power of Objective-C and the Foundation and AppKit frameworks (and also shows what kind of unnecessary kludge Apple did).

Thanks to the efforts of Fred, Nikolaus himself, Gregory and me, SimpleWebKit and GNUstep AppKit evolved enough so that SWK can now display pages pretty decently, close to what the first screenshots from a mac showed.

Images, links, font size, rudimentary Header and list support is there. Horizontal rules. Bakcground and Font colors.

Also the DOM tree is pretty complete, so parsing is even more advanced than the display itself.

Thanks to the power of OpenStep Vespuccci already supports easily multi-window browsing. And scrolling inside the pages thanks to the scrolling of text views which Fred fixed.

The way to something usable is still long. No history, no tables, many small quirks even in basic 1.0 HTML when doing formatting.

But what counts is I think that an extremely big step was done. I was amazed when I saw everything working so smooth.

12 comments:

Anonymous said...

It's a hell of a stretch to claim WebKit is a "kludge" simply because it is possible to write a basic HTML renderer in Objective-C. Heck, OmniWeb did this years ago, not to mention the first web browser, WorldWideWeb. It's all about the constraints. An Objective-C renderer will be both slower and use more memory, and a new renderer will clearly take a very long time to catch up with the real-world compatibility of other engines.

I'd suggest you take a break from your little Objective-C fantasy land at some point and visit us down here in reality.

hns said...

Hm. Can you prove any of your assertions? Did you ever look at the architecture of SWK?

I'd suggest that you take a break from your arrogance.

Anonymous said...

Your engine isn't even capable of rendering Web 1.0 sites and yet you're spouting off about how it's a much better approach than is used by WebKit. Claiming that someone calling you on that is "arrogant" is ironic beyond belief. Save the rhetoric until you have something approaching a usable state.

As for the architecture: NSTextView's for the rendering will provide the perfect fit for advanced layout like floats absolute positioning, etc. Rendering tied to the DOM will provide great flexibility when working with CSS stylesheets. Foundation datatypes for JavaScript surely provide optimal speed.

I'll be amazed if SimpleWebKit could run the HTML iBench in ten times the amount of time WebKit could, or SunSpider in twenty times the amount of time as JavaScriptCore.

GregC said...

"I'd suggest you take a break from your little Objective-C fantasy land at some point and visit us down here in reality."

I find it moderately amusing that you complain about arrogance when your first comment is a prime example of it. If you had some counter arguments to make, I believe that you could have made them in a more constructive manner. Belittling the work of someone else is not a good way to do that.

From experience, yelling at someone is less likely to produce positive results than is telling them your point calmly. Enough of the manners lesson and on to the technical discussion...

I can't speak for Riccardo or Nikolas, but I don't believe it's fair to start complaining about and deprecating SimpleWebKit just yet, when it's just getting started.

"Your engine isn't even capable of rendering Web 1.0 sites and yet you're spouting off about how it's a much better approach than is used by WebKit."

Well, I have to admit that Apple hacking KHTML into an Objective-C framework to give birth to WebKit was a little surprising to me given that, as you yourself said, pure ObjC HTML parsers were written by Omni Group that ran acceptably... mind you on 68k hardware running at 25MHz-33MHz with 32MB of RAM.

So, I guess my question, really is... if it can be done on ancient NeXT hardware within their constraints, then why are saying it's impossible on modern hardware with a similar framework when the modern harder is 20x faster and has 10x more RAM (or more in both cases)?

Also, speed is not one of the thing that is being focused on right now. The main focus is to get it working. Then to make it faster.

I, personally, am amazed at the progress made so far.

Regards,

Gregory Casamento
- GNUstep Chief Maintainer

Anonymous said...

if it can be done on ancient NeXT hardware within their constraints, then why are saying it's impossible on modern hardware with a similar framework when the modern harder is 20x faster and has 10x more RAM (or more in both cases)?

Web 2.0. CSS, JavaScript, dynamic web pages. Larger pages, more complex layouts, higher-resolution graphics. The web hasn't stood still in the last 10 years.

GregC said...

Web 2.0. CSS, JavaScript, dynamic web pages. Larger pages, more complex layouts, higher-resolution graphics. The web hasn't stood still in the last 10 years.

Yes, I am aware of the advances. :)

Javascript and CSS were already around when OmniWeb was done.

As far as dynamic webpages, I don't see anything in your posting which rules out doing it in pure Objective-C.

It seems to me that, given the power of todays machines it's more than possible to do what SimpleWebKit aims to do.

Also.. some of the implementation of the more speed critical things can be done in pure C, if needed. I'm not sure how much faster it would need to be.

All of what you are saying is conjecture... and, unfortunately, until it's done, what I'm saying is too.

GJC

Riccardo said...

Thanks for the support, Greg and Nikolaus.

I too find that comment by "anonymous" is quite bold. Especially by someone who is "anonymous".

Sure, we are at the beginning, what I say is that the project shows promises. It starts from scratch, so you need to start from the basics.
Apple started from a complete thing (that needed a lot of rework too, KHTML had terrible CSS and even worse JavaScript). But it had to fix rendering bugs, memory leaks, unresponsive engine and events... And there is/was a company behind it. Obj-c++ is a kludge. No excuses.
By having pure Obj-C code we have a much easier control about memory managment.

In any case, being API compatible, no one stops anybody from porting WebKit. We can just provide an alternative. Our alternative could prove to be better embeddable or more customizable engine. More choice. Better for everybody.

There are gecko/firefox/seamonkey users. Yet, KHTML was created. What did people think back then? And links, dillo have their users.

Maciej Stachowiak said...

Did you notice that both of the web pages in the screenshot are significantly misrendered, even though they are very basic (HTML 3.2, no styles, no scripts, no tables)? It seems pretty bold to insult the internal design of WebKit based on these very early results, while at the same time copying its API. The anonymous commenter was a little harsh, but the original blog post was somewhat rude as well.

It is an interesting experiment to build a web rendering engine with pure Objective-C. Both Apple and OmniGroup had pure ObjC web engines (htmldisplay and OmniWeb's old engine) which they abandoned for WebKit. I think this is pretty telling, given that Apple and OmniGroup are the biggest supporters of Objective-C in the industry. Perhaps you guys will ultimately be more successful, and I wish you luck in your endeavors. But please try to be courteous to the WebKit team in the meantime.

rkennke said...

Riccardo, please ignore the naysayers. Even if the thing is crap and even if it is stupid to reinvent the wheel, the most important thing is the fun of hacking on it anyway. I can say this, I implemented the HTML renderer in Classpath's Swing, and it was great to see it rendering its first couple of pages, even if far from perfect. The point is not to compete with anything, the point is to have fun.

Anonymous said...

The point is not to compete with anything, the point is to have fun.

If the point is not to compete there would be no reason for the petty trash talk. The attitude of the blog post clearly indicates that they're interested in more than fun.

hns said...

maciej stachowiak said...
Did you notice that both of the web pages in the screenshot are significantly misrendered, even though they are very basic (HTML 3.2, no styles, no scripts, no tables)?


Thank you very much for these hints. I have found three rendering differences to e.g. Safari:

1. The heading "Literature..." is not centered.
The source of this page uses a feature that is deprecated in HTML 4.0 (align=center in a H1 tag)
This is approx. 2 LOC to fix.

BTW: we don't aim to fulfill all HTML 3.x options but (X)HTML 4.x

2. The spacing between paragraphs is the same as between lines

Not tested, but probably 1 LOC to fix (by using the correct call to -[NSMutableParagraphStyle setParagraphSpacing:])

3. There is a spurious blank character at the beginning of the first paragraph "We the people..."

This is a known bug which has something to do with the inline/block layout mechanism and ignorable whitespace

This is obviously the most difficult to fix.

So, I estimate that we are approx. 5-10 code lines to fix apart from visual perfection (needs to be done&tested of course) of these pages.

Please let us know if you see additional significant misrenderings (we become blind to see them ourselves).

Ex!T said...

I completely fail to see why this is "arrogant", I personally am quite pleased that someone is making the effort to:

1) Port Webkit to GNUStep
2) Port GNUStep to HURD.

A simple view is that Webkit will eventually come to HURD, showing the real power behind the entire Free Software/Open Source community. To me, THAT is the real importance of all of this, the fact that great ideas and implementations can be shared in such wonderful ways. I wish you the best of luck, dear friend. Me and my personal projects will keep tabs on your progress.