[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: setAttribute doesn't mark a node as changed
From: Koos Vriezen <koos.vriezen () xs4all ! nl>
Date: 2002-01-17 13:48:53
[Download RAW message or body]
On Thu, 17 Jan 2002, Lars Knoll wrote:
> > In the HTMLImageElementImpl case, recalcStyle does only
> > if (m_render) {
> > RenderImage* renderImage = static_cast<RenderImage*>( m_render );
> > renderImage->setImageUrl(m_imageURL, getDocument()->docLoader());
> > renderImage->setAlt(altText());
> > }
> > So, why not do this in HTMLImageElementImpl::parseAttribute:
> > case ATTR_SRC:
> > m_imageURL = khtml::parseURL(attr->value());
> > if (m_render)
> > static_cast<RenderImage*>(m_render)->setImageUrl(m_imageURL,
> > ...); break;
> > and remove the recalcStyle override? Or shorter:
> > case ATTR_SRC:
> > if (m_render)
> >
> > static_cast<RenderImage*>(m_render)->setImageUrl(khtml::parseURL(attr->valu
> >e(), ....); break;
> > which also removes m_imageURL from HTMLImageElementImpl.
> >
> > Setting altText in RenderImage seems unnecessary, it could do
> > element()->getAttribute(ATTR_ALT).
> >
> > Don't know if this is enough for triggering a re-rendering of the image.
>
> It's not that easy, as m_render might not exist when we parse the attributes.
There is a 'if (m_render)' check in parseAttribute
> I'd propose a different way of doing this (which works as the renderobject
> now has a pointer to the node):
>
> If some attribute has changed that does not affect the style, we just tell the
> renderobject to reread non style settings from the Element.
>
> Something like:
>
> m_render->updateNonStyleAttributes()
>
> and then the renderImage will reread things by itself.
Then it would be
case ATTR_SRC:
if (m_render)
m_render->updateNonStyleAttributes();
or in void ElementImpl::setAttribute(NodeImpl:
else if (old && value) {
old->setValue(value);
parseAttribute(old);
if (attached())
m_render->updateNonStyleAttributes();
Well not in this case, but it might trigger a re-read of unchanged
attributes.
> If we do this for all classes, we can maybe aswell avoid the virtual attach()
> call in NodeImpl.
Isn't attach() responsible for creating a render object for the node and
its children?
Koos
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic