SVN commit 1132486 by orlovich: Don't create dangerous spurious dependencies on querySelector[All] -- they can get dangly. BUG: 239846 M +7 -3 cssstyleselector.cpp M +2 -1 cssstyleselector.h --- trunk/KDE/kdelibs/khtml/css/cssstyleselector.cpp #1132485:1132486 @@ -636,7 +636,7 @@ selectorsForCheck.append(j); // build per-element cache summaries. - prepareToMatchElement(element); + prepareToMatchElement(element, true); propsToApply.clear(); pseudoProps.clear(); @@ -779,8 +779,11 @@ return style; } -void CSSStyleSelector::prepareToMatchElement(DOM::ElementImpl* element) +void CSSStyleSelector::prepareToMatchElement(DOM::ElementImpl* e, bool withDeps) { + rememberDependencies = withDeps; + element = e; + // build caches for element so it could be used in heuristic for descendant selectors // go up the tree and cache possible tags, classes and ids tagCache.clear(); @@ -1312,7 +1315,7 @@ quint16 tag = sel->tagLocalName.id(); if (elementTagId == tag || tag == anyLocalName) { if (!inited) { - prepareToMatchElement(e); + prepareToMatchElement(e, false); inited = true; } @@ -1329,6 +1332,7 @@ void CSSStyleSelector::addDependency(int dependencyType, ElementImpl* dependency) { + if (!rememberDependencies) return; element->document()->dynamicDomRestyler().addDependency(element, dependency, (StructuralDependencyType)dependencyType); } --- trunk/KDE/kdelibs/khtml/css/cssstyleselector.h #1132485:1132486 @@ -218,7 +218,7 @@ // computes various summaries of the documents' properties, which are used in // the various checkSelector methods for optimizations - void prepareToMatchElement(DOM::ElementImpl* e); + void prepareToMatchElement(DOM::ElementImpl* e, bool withDeps); void addDependency(int dependencyType, DOM::ElementImpl* dependency); void setupDefaultRootStyle(DOM::DocumentImpl *d=0); @@ -324,6 +324,7 @@ KHTMLView *view; KHTMLPart *part; const KHTMLSettings *settings; + bool rememberDependencies; int logicalDpiY; RenderStyle* m_rootDefaultStyle; QVector m_fontSizes;