Bug 5672 - RenderObject should be thinned out and some methods made pure virtual
Summary: RenderObject should be thinned out and some methods made pure virtual
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-09 02:44 PST by Eric Seidel (no email)
Modified: 2013-06-05 10:56 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.