本文整理汇总了C++中NodeImpl::hasChangedChild方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeImpl::hasChangedChild方法的具体用法?C++ NodeImpl::hasChangedChild怎么用?C++ NodeImpl::hasChangedChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeImpl
的用法示例。
在下文中一共展示了NodeImpl::hasChangedChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recalcStyle
void ElementImpl::recalcStyle( StyleChange change )
{
// ### should go away and be done in renderobject
RenderStyle* _style = m_render ? m_render->style() : 0;
bool hasParentRenderer = parent() ? parent()->renderer() : false;
#if 0
const char* debug;
switch(change) {
case NoChange: debug = "NoChange";
break;
case NoInherit: debug= "NoInherit";
break;
case Inherit: debug = "Inherit";
break;
case Force: debug = "Force";
break;
}
qDebug("recalcStyle(%d: %s)[%p: %s]", change, debug, this, tagName().string().latin1());
#endif
if ( hasParentRenderer && (change >= Inherit || changed()) ) {
RenderStyle *newStyle = getDocument()->styleSelector()->styleForElement(this);
newStyle->ref();
StyleChange ch = diff( _style, newStyle );
if (ch == Detach) {
if (attached()) detach();
// ### Suboptimal. Style gets calculated again.
attach();
// attach recalulates the style for all children. No need to do it twice.
setChanged( false );
setHasChangedChild( false );
newStyle->deref(getDocument()->renderArena());
return;
}
else if (ch != NoChange) {
if( m_render && newStyle ) {
//qDebug("--> setting style on render element bgcolor=%s", newStyle->backgroundColor().name().latin1());
m_render->setStyle(newStyle);
}
}
else if (changed() && m_render && newStyle && (getDocument()->usesSiblingRules() || getDocument()->usesDescendantRules())) {
// Although no change occurred, we use the new style so that the cousin style sharing code won't get
// fooled into believing this style is the same. This is only necessary if the document actually uses
// sibling/descendant rules, since otherwise it isn't possible for ancestor styles to affect sharing of
// descendants.
m_render->setStyleInternal(newStyle);
}
newStyle->deref(getDocument()->renderArena());
if ( change != Force) {
if (getDocument()->usesDescendantRules())
change = Force;
else
change = ch;
}
}
NodeImpl *n;
for (n = _first; n; n = n->nextSibling()) {
//qDebug(" (%p) calling recalcStyle on child %s/%p, change=%d", this, n, n->isElementNode() ? ((ElementImpl *)n)->tagName().string().latin1() : n->isTextNode() ? "text" : "unknown", change );
if ( change >= Inherit || n->isTextNode() ||
n->hasChangedChild() || n->changed() )
n->recalcStyle( change );
}
setChanged( false );
setHasChangedChild( false );
}
示例2: recalcStyle
void ElementImpl::recalcStyle(StyleChange change)
{
// ### should go away and be done in renderobject
RenderStyle *_style = m_render ? m_render->style() : 0;
bool hasParentRenderer = parent() ? parent()->attached() : false;
#if 0
const char* debug;
switch(change) {
case NoChange: debug = "NoChange";
break;
case NoInherit: debug= "NoInherit";
break;
case Inherit: debug = "Inherit";
break;
case Force: debug = "Force";
break;
}
qDebug("recalcStyle(%d: %s, changed: %d)[%p: %s]", change, debug, changed(), this, tagName().string().latin1());
#endif
if(hasParentRenderer && (change >= Inherit || changed()))
{
RenderStyle *newStyle = getDocument()->styleSelector()->styleForElement(this);
newStyle->ref();
StyleChange ch = diff(_style, newStyle);
if(ch == Detach)
{
if(attached())
detach();
// ### Suboptimal. Style gets calculated again.
attach();
// attach recalulates the style for all children. No need to do it twice.
setChanged(false);
setHasChangedChild(false);
newStyle->deref();
return;
}
else if(ch != NoChange)
{
if(m_render && newStyle)
{
m_render->setStyle(newStyle);
}
}
newStyle->deref();
if(change != Force)
change = ch;
}
// If a changed attribute has ancestor dependencies, restyle all children
if(changedAscendentAttribute())
{
change = Force;
setChangedAscendentAttribute(false);
}
NodeImpl *n;
for(n = _first; n; n = n->nextSibling())
{
if(change >= Inherit || n->isTextNode() || n->hasChangedChild() || n->changed())
{
// qDebug(" (%p) calling recalcStyle on child %p/%s, change=%d", this, n, n->isElementNode() ? ((ElementImpl
// *)n)->tagName().string().latin1() : n->isTextNode() ? "text" : "unknown", change );
n->recalcStyle(change);
}
}
setChanged(false);
setHasChangedChild(false);
}