Bug 5672

Summary: RenderObject should be thinned out and some methods made pure virtual
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ian, robert
Priority: P4    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   

Description Eric Seidel (no email) 2005-11-09 02:44:38 PST
RenderObject should be thinned out and some methods made pure virtual

RenderObject has lots of methods on it that it IMO really shouldn't.  This makes it *really* hard when 
writing a new RenderObject subclass, and likely has lead to other previous errors made when editing 
the existing tree.

Examples of methods which should be removed (i.e. only exist on subclasses):

    virtual RenderObject *firstChild() const { return 0; }
    virtual RenderObject *lastChild() const { return 0; }


Examples of methods which should be made pure virtual:

    virtual void setWidth( int /*width*/ ) { }
    virtual void setHeight( int /*height*/ ) { }

The usage model would then be to ask the RenderObject in question:

renderObject->isContainer()

then cast it to the appropriate type:

RenderContainer *renderContainer = static_cast<RenderContainer *>(renderObject);

finally then, can you ask it the questions you care about:

renderContainer->firstChild()
Comment 1 Robert Hogan 2013-06-04 10:38:10 PDT
The things this bug wishes for don't exist yet - but are they still valid? Seems like we should just close it.
Comment 2 Alexey Proskuryakov 2013-06-05 10:56:41 PDT
Yes, this bug hasn't helped since 2005, so it's unlikely to help in the future.