On Fri, Oct 24, 2008 at 06:30:59PM +0200, Johannes Hofmann wrote:
On Fri, Oct 24, 2008 at 11:28:01AM -0300, Jorge Arellano Cid wrote:
On Wed, Oct 22, 2008 at 06:36:33PM +0200, Johannes Hofmann wrote:
Hi,
here comes my proposal to get css support started. Note that I'm new to this stuff so I will probabely simplify things a lot and miss many issues that will have to be addressed later on.
I like this approach, but please note I'm also new to CSS stuff. Sebastian was the main expert, and he used to give a lot of thought to things before implementing, so I'd rather keep what's in dw2 instead of removing/making changes, at least until more solid knowledge is gained.
I don't intend to change/remove anything in dw/.
http://www.dillo.org/CSS.html was written circa 2003, so dw2 probably has a smoother design for CSS.
Yes, it was obviously designed with CSS in mind.
Now, what I like of this approach is it's simplicity and that more or less it's understandable. :)
That's the main point. As we are probabely all new to CSS, let's start simple.
* Separate out the style handling from html.cc in a new class StyleEngine (better name welcome). This class will be fed the html tree via a SAX like interface as the document is parsed and will hand out the current Style object.
By "html tree" do you mean the generated DOM tree? (which scripting would need BTW).
No, for now I would not create a DOM tree at all. We may come back to this later.
* Initially StyleEngine will be implemented to just mimic the current behaviour of html.cc. So after this step everything should work as currently.
* Does this mean StyleEngine should understand and parse plain HTML style attributes too (e.g. bgcolor="#FEFEFE")?
No. I would keep that in html.cc.
(I assume it'll parse inline CSS).
Yes.
* Or will it get a style object made by the HTML parser?
I currently think about a class that looks more or less like StyleAttrs together with a map indicating which of it's values are actually set. One can then start with a basic style and apply any number of objects of this new class according to the order of precedence. Applying here means overriding those values that are set according to the map.
Where/how would attribute values be stored?
* In case of clash, which one takes precedence, HTML attribute or CSS style?
According to http://www.w3.org/TR/CSS2/cascade.html such attributes are overidden by CSS and it's not even required for a CSS capable browser to honor them at all.
Thanks, I didn't have that info. -- Cheers Jorge.-