views:

101

answers:

2

Hi, very quick one, I was always wondering, do internet browsers use for rendering OS API functions to create buttons, render mages and so, or do they render it all on their own?

I first thoght that it uses system api, but there are some effects like when screen fades into grey and you see only small window in the middle, you know, thet effect used on many picture albums online, which I dont really how to achive using for example only Win32 calls.

EDIT: To be more exact, I know that final drawing on screen will always use system API, but you can send prerendered image as you want to it. Thanks.

+3  A: 

Web browsers use their own rendering engines rather than OS API. Using OS API to render buttons totally depends on the design decision of a particular rendering engine. However, to run on various operating systems these engines prefer their own rendering to offer same look-n-feel across platforms.

  • Gecko, for Firefox
  • Trident, for Internet Explorer
  • Presto, for Opera
  • KHTML, for Konqueror
  • WebKit, for Apple's Safari and Google's Chrome web browsers.

Ref: http://en.wikipedia.org/wiki/Web_browser_engine

Ankit Jain
Thanks, if I can be more specific, for example, do any of these engines use some GUI APIs? For example for drawing text? Or does even that handled completely by drawing engine?
B.Gen.Jack.O.Neill
+1  A: 

Do browser rendering engines useOs api for creating buttons, writing text, creating boxes, etc., or do they render all of this on their own using OS API just for actually show the rendered image on the screen?

I implemented something of a browser rendering engine (see e.g. Table of Supported Elements and Supported Properties for a list of the HTML elements and CSS properties that it supports).

I use system APIs (.NET Framework APIs, which are thin wrappers around underlying O/S GDI APIs) to:

  • Measure words (strings of text)
  • Paint words
  • Draw lines and boxes
  • Fill rectangles with solid color

These are the kind of API functionality that's implemented by the Windows GDI.

There are also some system (O/S or .NET) APIs that I use, to draw buttons and combo boxes (see Rewrite standard controls like edit, combo, etc?).

Becouse, the whole rendering of text, graphics and so seems pretty hard to write completely yourself

Yes, implementing CSS and everything does take a while. You've seen how long it took the browser developer teams to implement: several calendar years, many person-years.

ChrisW

related questions