Introduce more explicit types into the rendering tree
Created attachment 63216 [details] work in progress
I am very interested in Darin and Hyatt's comments on this approach. The goal was to start moving the code towards stronger typed pointers (RenderBoxModelObject* instead of RenderObject*) so we could move more code down into RenderBoxModelObject (and eventually RenderBox and RenderBlock) instead of it all being on RenderObject. I chose this approach to try and leverage the compiler as much as possible. Moving "is-a" functions onto RenderBoxModelObject makes the compiler point out to me places where we have a RenderObject but secretly know it's a RenderBoxModelObject. Moving the "is-a" functions first also prevents further creep of RenderObject pointers. I also learned from this exercise that our Accessibility code is poor shape, wrt the rest of WebKit. It's especially abusive of the Render tree and I expect we could find a bunch of bad static_cast-turn-security bug holes as a result.
(In reply to comment #2) > The goal was to start moving the code towards stronger typed pointers (RenderBoxModelObject* instead of RenderObject*) so we could move more code down into RenderBoxModelObject (and eventually RenderBox and RenderBlock) instead of it all being on RenderObject. Seems OK. But functions that walk the tree still end up returning RenderObject* since that's the type of parent and firstChild. > I chose this approach to try and leverage the compiler as much as possible. Moving "is-a" functions onto RenderBoxModelObject makes the compiler point out to me places where we have a RenderObject but secretly know it's a RenderBoxModelObject. I have often done this myself, but you don’t have to check in such changes for them to do their thing. > Moving the "is-a" functions first also prevents further creep of RenderObject pointers. As long as it doesn't make common operations awkward, more specific types are good.
Created attachment 63486 [details] wip renderer
The patch compiles now. I'm going to need to run the layout tests and then split it up into pieces.
I should come back to this at some point. This effort helped me find a couple bad-casts in the AX code iirc.
I actually didn't mean to close this bug, I meant to close another one... but this should probably be closed too. This patch is too old to be useful.
This is awesome, but just way too *big*! It'd be great if we could pair it down to something more manageable.
Feel free to knock yourself out. :)