Tuesday, February 26, 2008

Creating a new tag

I've been searching around the code for places which would need to be edited in order to create a new HTML element. I found the WebKit/WebCore/html directory which contains classes for all the elements. I also found some of the classes in the WebKit/WebCore/rendering directory. HTML elements seem to derive from the HTMLElement base class. Next, I picked an HTML element which I would like to "clone." My approach is basically to create a simple element achieved by copying a current element and renaming the classes and files. I chose to grep for the HTMLHeadElement which is one the simplest elements. I found references in more places than just the WebKit/WebCore directory. However, because the WebOpenGL element will resemble the HTMLCanvasElement more closely, I decided to repeat the grep search for this element. The results showed that most files which had references to HTMLHeadElement also had references to HTMLCanvasElement, but, there were files unique to each set of results. Curious, I also searched for references to HTMLDivElement and HTMLParagraphElement. These results were closer to the results from HTMLHeadElement--there were more files in common. There were a set a files that were unique to the results from the HTMLCanvasElement which makes sense since it is quite a different tag from head, div, and p. As I mentioned my project is more like the HTMLCanvasElement so I've decided that I'm going to "clone" the HTMCanvasElement instead of the HTMLHeadElement.

No comments: