XML Patch For FOUC

Peter Kelly pmk@post.com
Wed, 15 Jan 2003 23:11:24 +1030 (CST)


On Wed, 15 Jan 2003, Alexander Kellett wrote:

> On Wed, Jan 15, 2003 at 10:22:32PM +1030, Peter Kelly wrote:
> > On Wed, 15 Jan 2003, Alexander Kellett wrote:
> > > quick question to cvs khtml people, why is parentNode()->renderer() 
> > > asserted in some attach() methods but not in others?, bugs?
> > 
> > IIRC, The way that the attaching process works is that children are 
> > always suposed to be attached after their parents, and detached before 
> > their parents. So you can never have a situation where a child is attached 
> > but not a parent.
> > 
> > So the asserts could probably be put in all places - it's probably just 
> > been overlooked when some methods were written.
> 
> okay now i'm really confused :). why are there lots of parentNode()->renderer()
> codepaths being added in that case?. from what i see parentNode() is the 
> parent (logically :)), and therefore given how you describe the attach process
> (thanks for the explanation btw!)

Looking through the code again it turns out I was wrong about the asserts. 
These are only in the FRAME, FRAMESET and HTML elements, which by 
by their nature require the parent to have a renderer. So they should 
stay.

In other cases it's ok for parentNode()->renderer() be null, the child 
just doesn't get added to the rendering tree at all. This would be the 
case for example if the parent has a "display: none" style rule.

> 
> but the parentNode()->renderer() otoh is not always there from what i see.
> therefore the renderer()'s are created in a delayed fashion once all the
> pending stylesheets are loaded. thus, the attach() methods are called twice?
> once for the addChild and once for the rendering style addition? or are the
> setStyle's done via some other hierarchical/recursive process once the 
> stylesheets are available?, is this maybe the purpose of the addition to
> 
>    +++ html/html_documentimpl.cpp  15 Jan 2003 11:57:47 -0000
>    @@ -302,6 +302,13 @@ void HTMLDocumentImpl::close()
>                 getDocument()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false);
> 
>             updateRendering();
>    +
>    +        // Always do a layout/repaint after loading.
>    +        if (renderer()) {
>    +            if (!renderer()->layouted())
>    +                renderer()->layout();
>    +            renderer()->repaint();
>    +        }
>         }
>     }
> 
> okay, so, i'm quite amazingly confused now :)
> 
> Alex
> 
> p.s: code pointers are just as good as explanations :)
> 
> 

-- 
Peter Kelly
pmk@post.com