Changeset 139128 in webkit
- Timestamp:
- Jan 8, 2013 4:16:19 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r139046 r139128 1 2013-01-08 Hajime Morrita <morrita@google.com> 2 3 [Shadow DOM] Distribution related code on ShadowRoot should be minimized. 4 https://bugs.webkit.org/show_bug.cgi?id=106282 5 6 Reviewed by Dimitri Glazkov. 7 8 * Source/autotools/symbols.filter: 9 1 10 2013-01-03 Sergio Villar Senin <svillar@igalia.com> 2 11 -
trunk/Source/WebCore/ChangeLog
r139111 r139128 1 2013-01-08 Hajime Morrita <morrita@google.com> 2 3 [Shadow DOM] Distribution related code on ShadowRoot should be minimized. 4 https://bugs.webkit.org/show_bug.cgi?id=106282 5 6 Reviewed by Dimitri Glazkov. 7 8 ShadowRoot had a certain amount of logic which is dedicated for 9 node distribution computation. These code is going to be compiled 10 out (Bug 103339) and better be part of the node distribution 11 algorithm, which is ScopeContentDistribution class. 12 13 This change 14 15 - Renames ShadowRootContentDistributionData to 16 ScopeContentDistribution. New name is concise and a bit more 17 meaningful: It owns per TreeScope distribution state. 18 - Moves distribution related code from ShadowRoot to ScopeContentDistribution 19 20 No new tests. Refactoring. 21 22 * WebCore.exp.in: 23 * css/StyleScopeResolver.cpp: 24 (WebCore::StyleScopeResolver::styleSharingCandidateMatchesHostRules): 25 (WebCore::StyleScopeResolver::matchHostRules): 26 * dom/ComposedShadowTreeWalker.cpp: 27 (WebCore::nodeCanBeDistributed): 28 (WebCore::ComposedShadowTreeWalker::traverseBackToYoungerShadowRoot): 29 (WebCore::ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost): 30 (WebCore::AncestorChainWalker::parent): 31 * dom/ElementShadow.cpp: 32 (WebCore::ElementShadow::collectSelectFeatureSetFrom): 33 * dom/ShadowRoot.cpp: 34 (WebCore::ShadowRoot::insertedInto): 35 (WebCore::ShadowRoot::removedFrom): 36 (WebCore::ShadowRoot::ensureScopeDistribution): 37 (WebCore::ShadowRoot::reportMemoryUsage): 38 * dom/ShadowRoot.h: 39 (WebCore): 40 (ShadowRoot): 41 (WebCore::ShadowRoot::scopeDistribution): 42 * html/shadow/ContentDistributor.cpp: 43 (WebCore::ScopeContentDistribution::ScopeContentDistribution): 44 (WebCore::ScopeContentDistribution::invalidateInsertionPointList): 45 (WebCore::ScopeContentDistribution::ensureInsertionPointList): 46 (WebCore::ScopeContentDistribution::registerInsertionPoint): 47 (WebCore::ScopeContentDistribution::unregisterInsertionPoint): 48 (WebCore::ScopeContentDistribution::hasShadowElement): 49 (WebCore): 50 (WebCore::ScopeContentDistribution::hasContentElement): 51 (WebCore::ScopeContentDistribution::countElementShadow): 52 (WebCore::ScopeContentDistribution::hasInsertionPoint): 53 (WebCore::ScopeContentDistribution::assignedTo): 54 (WebCore::ContentDistributor::distribute): 55 (WebCore::ContentDistributor::invalidate): 56 * html/shadow/ContentDistributor.h: 57 (ScopeContentDistribution): 58 (WebCore::ScopeContentDistribution::registerElementShadow): 59 (WebCore::ScopeContentDistribution::unregisterElementShadow): 60 (WebCore::ScopeContentDistribution::hasElementShadow): 61 * html/shadow/HTMLShadowElement.cpp: 62 (WebCore::HTMLShadowElement::olderShadowRoot): 63 * html/shadow/InsertionPoint.cpp: 64 (WebCore::InsertionPoint::insertedInto): 65 (WebCore::InsertionPoint::removedFrom): 66 (WebCore::InsertionPoint::contains): 67 (WebCore): 68 (WebCore::resolveReprojection): 69 * html/shadow/InsertionPoint.h: 70 (InsertionPoint): 71 (WebCore): 72 * testing/Internals.cpp: 73 (WebCore::Internals::hasShadowInsertionPoint): 74 (WebCore::Internals::hasContentElement): 75 (WebCore::Internals::countElementShadow): 76 1 77 2013-01-08 Tom Sepez <tsepez@chromium.org> 2 78 -
trunk/Source/WebCore/WebCore.exp.in
r139027 r139128 83 83 __ZN7WebCore10ScrollView24windowResizerRectChangedEv 84 84 __ZN7WebCore10ScrollView8addChildEN3WTF10PassRefPtrINS_6WidgetEEE 85 __ZNK7WebCore10ShadowRoot17hasContentElementEv86 __ZNK7WebCore10ShadowRoot18countElementShadowEv87 __ZNK7WebCore10ShadowRoot23hasShadowInsertionPointEv88 85 __ZNK7WebCore14ScrollableArea17reportMemoryUsageEPN3WTF16MemoryObjectInfoE 89 86 __ZN7WebCore10ShadowRoot6createEPNS_7ElementERi … … 673 670 __ZN7WebCore24FrameDestructionObserverC2EPNS_5FrameE 674 671 __ZN7WebCore24FrameDestructionObserverD2Ev 672 __ZN7WebCore24ScopeContentDistribution16hasShadowElementEPKNS_10ShadowRootE 673 __ZN7WebCore24ScopeContentDistribution18countElementShadowEPKNS_10ShadowRootE 674 __ZN7WebCore24ScopeContentDistribution17hasContentElementEPKNS_10ShadowRootE 675 675 __ZN7WebCore24createFragmentFromMarkupEPNS_8DocumentERKN3WTF6StringES5_NS_27FragmentScriptingPermissionE 676 676 __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE -
trunk/Source/WebCore/css/StyleScopeResolver.cpp
r138929 r139128 32 32 #include "CSSStyleRule.h" 33 33 #include "CSSStyleSheet.h" 34 #include "ContentDistributor.h" 34 35 #include "ContextFeatures.h" 35 36 #include "ElementShadow.h" … … 211 212 return true; 212 213 213 if (! shadowRoot->hasShadowInsertionPoint())214 if (!ScopeContentDistribution::hasShadowElement(shadowRoot)) 214 215 break; 215 216 } … … 233 234 if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot)) 234 235 matchedRules.append(ruleSet); 235 if (! shadowRoot->hasShadowInsertionPoint())236 if (!ScopeContentDistribution::hasShadowElement(shadowRoot)) 236 237 break; 237 238 } -
trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp
r137715 r139128 64 64 65 65 if (ShadowRoot* shadowRoot = parent->isShadowRoot() ? toShadowRoot(parent) : 0) 66 return shadowRoot->assignedTo();66 return ScopeContentDistribution::assignedTo(shadowRoot); 67 67 68 68 if (parent->isElementNode() && toElement(parent)->shadow()) … … 199 199 ShadowRoot* parentShadowRoot = toShadowRoot(node->parentNode()); 200 200 if (!parentShadowRoot->isYoungest()) { 201 InsertionPoint* assignedInsertionPoint = parentShadowRoot->assignedTo();201 InsertionPoint* assignedInsertionPoint = ScopeContentDistribution::assignedTo(parentShadowRoot); 202 202 ASSERT(assignedInsertionPoint); 203 203 return traverseSiblingInCurrentTree(assignedInsertionPoint, direction); … … 268 268 { 269 269 ASSERT(shadowRoot); 270 ASSERT(! shadowRoot->assignedTo());270 ASSERT(!ScopeContentDistribution::assignedTo(shadowRoot)); 271 271 272 272 if (shadowRoot->isYoungest()) { … … 344 344 if (!m_node->isShadowRoot()) { 345 345 m_node = m_node->parentNode(); 346 if (!(m_node && m_node->isShadowRoot() && toShadowRoot(m_node)->assignedTo()))346 if (!(m_node && m_node->isShadowRoot() && ScopeContentDistribution::assignedTo(toShadowRoot(m_node)))) 347 347 m_distributedNode = m_node; 348 348 m_isCrossingInsertionPoint = false; … … 351 351 352 352 const ShadowRoot* shadowRoot = toShadowRoot(m_node); 353 if (InsertionPoint* insertionPoint = shadowRoot->assignedTo()) {353 if (InsertionPoint* insertionPoint = ScopeContentDistribution::assignedTo(shadowRoot)) { 354 354 m_node = insertionPoint; 355 355 m_isCrossingInsertionPoint = true; -
trunk/Source/WebCore/dom/ElementShadow.cpp
r139064 r139128 234 234 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot* root) 235 235 { 236 if ( root->hasElementShadow()) {236 if (ScopeContentDistribution::hasElementShadow(root)) { 237 237 for (Element* element = ElementTraversal::firstWithin(root); element; element = ElementTraversal::next(element)) { 238 238 if (ElementShadow* elementShadow = element->shadow()) { … … 243 243 } 244 244 245 if ( root->hasContentElement()) {245 if (ScopeContentDistribution::hasContentElement(root)) { 246 246 for (Element* element = ElementTraversal::firstWithin(root); element; element = ElementTraversal::next(element)) { 247 247 if (isHTMLContentElement(element)) { -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r138735 r139128 227 227 } 228 228 229 bool ShadowRoot::hasInsertionPoint() const230 {231 return hasShadowInsertionPoint() || hasContentElement();232 }233 234 229 bool ShadowRoot::applyAuthorStyles() const 235 230 { … … 285 280 286 281 if (ShadowRoot* root = host()->containingShadowRoot()) { 287 root-> registerElementShadow();282 root->ensureScopeDistribution()->registerElementShadow(); 288 283 m_registeredWithParentShadowRoot = true; 289 284 } … … 299 294 root = insertionPoint->containingShadowRoot(); 300 295 301 if (root )302 root-> unregisterElementShadow();296 if (root && root->scopeDistribution()) 297 root->scopeDistribution()->unregisterElementShadow(); 303 298 m_registeredWithParentShadowRoot = false; 304 299 } 305 300 306 301 DocumentFragment::removedFrom(insertionPoint); 307 }308 309 InsertionPoint* ShadowRoot::assignedTo() const310 {311 if (!distributionData())312 return 0;313 314 return distributionData()->insertionPointAssignedTo();315 }316 317 void ShadowRoot::setAssignedTo(InsertionPoint* insertionPoint)318 {319 ASSERT(!assignedTo() || !insertionPoint);320 ensureDistributionData()->setInsertionPointAssignedTo(insertionPoint);321 302 } 322 303 … … 327 308 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); 328 309 owner()->invalidateDistribution(); 329 }330 331 const Vector<RefPtr<InsertionPoint> >& ShadowRoot::insertionPointList()332 {333 typedef Vector<RefPtr<InsertionPoint> > InsertionPointVector;334 DEFINE_STATIC_LOCAL(InsertionPointVector, emptyVector, ());335 336 return distributionData() ? distributionData()->ensureInsertionPointList(this) : emptyVector;337 310 } 338 311 … … 350 323 } 351 324 352 inline ShadowRootContentDistributionData* ShadowRoot::ensureDistributionData()353 { 354 if (m_ distributionData)355 return m_ distributionData.get();356 357 m_ distributionData = adoptPtr(new ShadowRootContentDistributionData);358 return m_ distributionData.get();325 ScopeContentDistribution* ShadowRoot::ensureScopeDistribution() 326 { 327 if (m_scopeDistribution) 328 return m_scopeDistribution.get(); 329 330 m_scopeDistribution = adoptPtr(new ScopeContentDistribution); 331 return m_scopeDistribution.get(); 359 332 } 360 361 void ShadowRoot::registerInsertionPoint(InsertionPoint* point)362 {363 ensureDistributionData()->regiterInsertionPoint(this, point);364 }365 366 void ShadowRoot::unregisterInsertionPoint(InsertionPoint* point)367 {368 ensureDistributionData()->unregisterInsertionPoint(this, point);369 }370 371 bool ShadowRoot::hasShadowInsertionPoint() const372 {373 if (!distributionData())374 return false;375 376 return distributionData()->hasShadowElementChildren();377 }378 379 bool ShadowRoot::hasContentElement() const380 {381 if (!distributionData())382 return false;383 384 return distributionData()->hasContentElementChildren();385 }386 387 void ShadowRoot::registerElementShadow()388 {389 ensureDistributionData()->incrementNumberOfElementShadowChildren();390 }391 392 void ShadowRoot::unregisterElementShadow()393 {394 ASSERT(hasElementShadow());395 distributionData()->decrementNumberOfElementShadowChildren();396 }397 398 bool ShadowRoot::hasElementShadow() const399 {400 if (!distributionData())401 return false;402 403 return distributionData()->hasElementShadowChildren();404 }405 406 unsigned ShadowRoot::countElementShadow() const407 {408 if (!distributionData())409 return 0;410 411 return distributionData()->numberOfElementShadowChildren();412 }413 333 414 334 void ShadowRoot::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const … … 419 339 info.addMember(m_prev); 420 340 info.addMember(m_next); 421 info.addMember(m_ distributionData);422 } 423 424 } 341 info.addMember(m_scopeDistribution); 342 } 343 344 } -
trunk/Source/WebCore/dom/ShadowRoot.h
r138404 r139128 42 42 class ElementShadow; 43 43 class InsertionPoint; 44 class S hadowRootContentDistributionData;44 class ScopeContentDistribution; 45 45 46 46 class ShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> { … … 81 81 bool isOldest() const { return !olderShadowRoot(); } 82 82 83 bool hasInsertionPoint() const;84 85 83 virtual void attach(); 86 84 … … 88 86 virtual void removedFrom(ContainerNode*) OVERRIDE; 89 87 90 bool isUsedForRendering() const;91 InsertionPoint* assignedTo() const;92 void setAssignedTo(InsertionPoint*);93 94 bool hasShadowInsertionPoint() const;95 bool hasContentElement() const;96 97 void registerInsertionPoint(InsertionPoint*);98 void unregisterInsertionPoint(InsertionPoint*);99 100 void registerElementShadow();101 void unregisterElementShadow();102 bool hasElementShadow() const;103 unsigned countElementShadow() const;104 105 const Vector<RefPtr<InsertionPoint> >& insertionPointList();106 107 88 virtual void registerScopedHTMLStyleChild() OVERRIDE; 108 89 virtual void unregisterScopedHTMLStyleChild() OVERRIDE; 90 91 ScopeContentDistribution* scopeDistribution() { return m_scopeDistribution.get(); } 92 const ScopeContentDistribution* scopeDistribution() const { return m_scopeDistribution.get(); } 93 ScopeContentDistribution* ensureScopeDistribution(); 109 94 110 95 ShadowRootType type() const { return m_isAuthorShadowRoot ? AuthorShadowRoot : UserAgentShadowRoot; } … … 125 110 void setType(ShadowRootType type) { m_isAuthorShadowRoot = type == AuthorShadowRoot; } 126 111 127 ShadowRootContentDistributionData* distributionData() { return m_distributionData.get(); }128 const ShadowRootContentDistributionData* distributionData() const { return m_distributionData.get(); }129 ShadowRootContentDistributionData* ensureDistributionData();130 131 112 ShadowRoot* m_prev; 132 113 ShadowRoot* m_next; 133 OwnPtr<S hadowRootContentDistributionData> m_distributionData;114 OwnPtr<ScopeContentDistribution> m_scopeDistribution; 134 115 unsigned m_numberOfStyles : 28; 135 116 unsigned m_applyAuthorStyles : 1; … … 147 128 { 148 129 setParentOrHostNode(host); 149 }150 151 inline bool ShadowRoot::isUsedForRendering() const152 {153 return isYoungest() || assignedTo();154 130 } 155 131 -
trunk/Source/WebCore/html/shadow/ContentDistributor.cpp
r137717 r139128 77 77 78 78 79 S hadowRootContentDistributionData::ShadowRootContentDistributionData()79 ScopeContentDistribution::ScopeContentDistribution() 80 80 : m_insertionPointAssignedTo(0) 81 81 , m_numberOfShadowElementChildren(0) … … 86 86 } 87 87 88 void S hadowRootContentDistributionData::invalidateInsertionPointList()88 void ScopeContentDistribution::invalidateInsertionPointList() 89 89 { 90 90 m_insertionPointListIsValid = false; … … 92 92 } 93 93 94 const Vector<RefPtr<InsertionPoint> >& S hadowRootContentDistributionData::ensureInsertionPointList(ShadowRoot* shadowRoot)94 const Vector<RefPtr<InsertionPoint> >& ScopeContentDistribution::ensureInsertionPointList(ShadowRoot* shadowRoot) 95 95 { 96 96 if (m_insertionPointListIsValid) … … 100 100 ASSERT(m_insertionPointList.isEmpty()); 101 101 102 if (! shadowRoot->hasInsertionPoint())102 if (!hasInsertionPoint(shadowRoot)) 103 103 return m_insertionPointList; 104 104 … … 111 111 } 112 112 113 void S hadowRootContentDistributionData::regiterInsertionPoint(ShadowRoot* scope, InsertionPoint* point)113 void ScopeContentDistribution::registerInsertionPoint(ShadowRoot* scope, InsertionPoint* point) 114 114 { 115 115 switch (point->insertionPointType()) { … … 126 126 } 127 127 128 void S hadowRootContentDistributionData::unregisterInsertionPoint(ShadowRoot* scope, InsertionPoint* point)128 void ScopeContentDistribution::unregisterInsertionPoint(ShadowRoot* scope, InsertionPoint* point) 129 129 { 130 130 switch (point->insertionPointType()) { … … 144 144 } 145 145 146 bool ScopeContentDistribution::hasShadowElement(const ShadowRoot* holder) 147 { 148 if (!holder->scopeDistribution()) 149 return false; 150 151 return holder->scopeDistribution()->hasShadowElementChildren(); 152 } 153 154 bool ScopeContentDistribution::hasContentElement(const ShadowRoot* holder) 155 { 156 if (!holder->scopeDistribution()) 157 return false; 158 159 return holder->scopeDistribution()->hasContentElementChildren(); 160 } 161 162 unsigned ScopeContentDistribution::countElementShadow(const ShadowRoot* holder) 163 { 164 if (!holder->scopeDistribution()) 165 return 0; 166 167 return holder->scopeDistribution()->numberOfElementShadowChildren(); 168 } 169 170 bool ScopeContentDistribution::hasInsertionPoint(const ShadowRoot* holder) 171 { 172 return hasShadowElement(holder) || hasContentElement(holder); 173 } 174 175 InsertionPoint* ScopeContentDistribution::assignedTo(const ShadowRoot* holder) 176 { 177 if (!holder->scopeDistribution()) 178 return 0; 179 180 return holder->scopeDistribution()->insertionPointAssignedTo(); 181 } 146 182 147 183 ContentDistributor::ContentDistributor() … … 194 230 HTMLShadowElement* firstActiveShadowInsertionPoint = 0; 195 231 196 const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->insertionPointList(); 197 for (size_t i = 0; i < insertionPoints.size(); ++i) { 198 InsertionPoint* point = insertionPoints[i].get(); 199 if (!point->isActive()) 200 continue; 201 202 if (isHTMLShadowElement(point)) { 203 if (!firstActiveShadowInsertionPoint) 204 firstActiveShadowInsertionPoint = toHTMLShadowElement(point); 205 } else { 206 distributeSelectionsTo(point, pool, distributed); 207 if (ElementShadow* shadow = point->parentNode()->isElementNode() ? toElement(point->parentNode())->shadow() : 0) 208 shadow->invalidateDistribution(); 232 if (ScopeContentDistribution* scope = root->scopeDistribution()) { 233 const Vector<RefPtr<InsertionPoint> >& insertionPoints = scope->ensureInsertionPointList(root); 234 for (size_t i = 0; i < insertionPoints.size(); ++i) { 235 InsertionPoint* point = insertionPoints[i].get(); 236 if (!point->isActive()) 237 continue; 238 239 if (isHTMLShadowElement(point)) { 240 if (!firstActiveShadowInsertionPoint) 241 firstActiveShadowInsertionPoint = toHTMLShadowElement(point); 242 } else { 243 distributeSelectionsTo(point, pool, distributed); 244 if (ElementShadow* shadow = point->parentNode()->isElementNode() ? toElement(point->parentNode())->shadow() : 0) 245 shadow->invalidateDistribution(); 246 } 209 247 } 210 248 } … … 220 258 if (root->olderShadowRoot()) { 221 259 distributeNodeChildrenTo(shadowElement, root->olderShadowRoot()); 222 root->olderShadowRoot()-> setAssignedTo(shadowElement);260 root->olderShadowRoot()->ensureScopeDistribution()->setInsertionPointAssignedTo(shadowElement); 223 261 } else { 224 262 distributeSelectionsTo(shadowElement, pool, distributed); … … 235 273 236 274 for (ShadowRoot* root = host->youngestShadowRoot(); root; root = root->olderShadowRoot()) { 237 root->setAssignedTo(0); 238 const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->insertionPointList(); 239 for (size_t i = 0; i < insertionPoints.size(); ++i) { 240 needsReattach = needsReattach || true; 241 insertionPoints[i]->clearDistribution(); 275 if (ScopeContentDistribution* scope = root->scopeDistribution()) { 276 scope->setInsertionPointAssignedTo(0); 277 const Vector<RefPtr<InsertionPoint> >& insertionPoints = scope->ensureInsertionPointList(root); 278 for (size_t i = 0; i < insertionPoints.size(); ++i) { 279 needsReattach = needsReattach || true; 280 insertionPoints[i]->clearDistribution(); 281 } 242 282 } 243 283 } -
trunk/Source/WebCore/html/shadow/ContentDistributor.h
r137717 r139128 71 71 }; 72 72 73 class S hadowRootContentDistributionData{73 class ScopeContentDistribution { 74 74 public: 75 S hadowRootContentDistributionData();75 ScopeContentDistribution(); 76 76 77 77 InsertionPoint* insertionPointAssignedTo() const { return m_insertionPointAssignedTo; } 78 78 void setInsertionPointAssignedTo(InsertionPoint* insertionPoint) { m_insertionPointAssignedTo = insertionPoint; } 79 79 80 void regi terInsertionPoint(ShadowRoot*, InsertionPoint*);80 void registerInsertionPoint(ShadowRoot*, InsertionPoint*); 81 81 void unregisterInsertionPoint(ShadowRoot*, InsertionPoint*); 82 82 bool hasShadowElementChildren() const { return m_numberOfShadowElementChildren > 0; } 83 83 bool hasContentElementChildren() const { return m_numberOfContentElementChildren > 0; } 84 84 85 void incrementNumberOfElementShadowChildren() { ++m_numberOfElementShadowChildren; }86 void decrementNumberOfElementShadowChildren() { ASSERT(m_numberOfElementShadowChildren > 0); --m_numberOfElementShadowChildren; }85 void registerElementShadow() { ++m_numberOfElementShadowChildren; } 86 void unregisterElementShadow() { ASSERT(m_numberOfElementShadowChildren > 0); --m_numberOfElementShadowChildren; } 87 87 unsigned numberOfElementShadowChildren() const { return m_numberOfElementShadowChildren; } 88 88 bool hasElementShadowChildren() const { return m_numberOfElementShadowChildren > 0; } … … 90 90 void invalidateInsertionPointList(); 91 91 const Vector<RefPtr<InsertionPoint> >& ensureInsertionPointList(ShadowRoot*); 92 93 bool isUsedForRendering() const; 94 95 static bool hasShadowElement(const ShadowRoot*); 96 static bool hasContentElement(const ShadowRoot*); 97 static bool hasInsertionPoint(const ShadowRoot*); 98 static bool hasElementShadow(const ShadowRoot* holder) { return countElementShadow(holder); } 99 static unsigned countElementShadow(const ShadowRoot*); 100 static InsertionPoint* assignedTo(const ShadowRoot*); 92 101 93 102 private: -
trunk/Source/WebCore/html/shadow/HTMLShadowElement.cpp
r137429 r139128 74 74 75 75 ShadowRoot* older = toShadowRoot(treeScope()->rootNode())->olderShadowRoot(); 76 if (!older || older->type() != ShadowRoot::AuthorShadowRoot || older->assignedTo() != this)76 if (!older || older->type() != ShadowRoot::AuthorShadowRoot || ScopeContentDistribution::assignedTo(older) != this) 77 77 return 0; 78 78 -
trunk/Source/WebCore/html/shadow/InsertionPoint.cpp
r138923 r139128 136 136 if (isActive() && !m_registeredWithShadowRoot && insertionPoint->treeScope()->rootNode() == root) { 137 137 m_registeredWithShadowRoot = true; 138 root-> registerInsertionPoint(this);138 root->ensureScopeDistribution()->registerInsertionPoint(root, this); 139 139 } 140 140 } … … 161 161 ASSERT(root); 162 162 m_registeredWithShadowRoot = false; 163 root-> unregisterInsertionPoint(this);163 root->ensureScopeDistribution()->unregisterInsertionPoint(root, this); 164 164 } 165 165 … … 187 187 } 188 188 189 bool InsertionPoint::contains(const Node* node) const 190 { 191 return m_distribution.contains(const_cast<Node*>(node)) || (node->isShadowRoot() && ScopeContentDistribution::assignedTo(toShadowRoot(node)) == this); 192 } 193 194 InsertionPoint* resolveReprojection(const Node* projectedNode) 195 { 196 InsertionPoint* insertionPoint = 0; 197 const Node* current = projectedNode; 198 199 while (current) { 200 if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { 201 shadow->ensureDistribution(); 202 if (InsertionPoint* insertedTo = shadow->distributor().findInsertionPointFor(projectedNode)) { 203 current = insertedTo; 204 insertionPoint = insertedTo; 205 continue; 206 } 207 } 208 209 if (Node* parent = parentNodeForDistribution(current)) { 210 if (InsertionPoint* insertedTo = parent->isShadowRoot() ? ScopeContentDistribution::assignedTo(toShadowRoot(parent)) : 0) { 211 current = insertedTo; 212 insertionPoint = insertedTo; 213 continue; 214 } 215 } 216 217 break; 218 } 219 220 return insertionPoint; 221 } 222 189 223 } // namespace WebCore -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r137715 r139128 73 73 74 74 size_t indexOf(Node* node) const { return m_distribution.find(node); } 75 bool contains(const Node* node) const { return m_distribution.contains(const_cast<Node*>(node)) || (node->isShadowRoot() && toShadowRoot(node)->assignedTo() == this); }75 bool contains(const Node*) const; 76 76 size_t size() const { return m_distribution.size(); } 77 77 Node* at(size_t index) const { return m_distribution.at(index).get(); } … … 151 151 } 152 152 153 inline InsertionPoint* resolveReprojection(const Node* projectedNode) 154 { 155 InsertionPoint* insertionPoint = 0; 156 const Node* current = projectedNode; 157 158 while (current) { 159 if (ElementShadow* shadow = shadowOfParentForDistribution(current)) { 160 shadow->ensureDistribution(); 161 if (InsertionPoint* insertedTo = shadow->distributor().findInsertionPointFor(projectedNode)) { 162 current = insertedTo; 163 insertionPoint = insertedTo; 164 continue; 165 } 166 } 167 168 if (Node* parent = parentNodeForDistribution(current)) { 169 if (InsertionPoint* insertedTo = parent->isShadowRoot() ? toShadowRoot(parent)->assignedTo() : 0) { 170 current = insertedTo; 171 insertionPoint = insertedTo; 172 continue; 173 } 174 } 175 176 break; 177 } 178 179 return insertionPoint; 180 } 153 InsertionPoint* resolveReprojection(const Node*); 181 154 182 155 } // namespace WebCore -
trunk/Source/WebCore/testing/Internals.cpp
r139050 r139128 34 34 #include "ClientRectList.h" 35 35 #include "ComposedShadowTreeWalker.h" 36 #include "ContentDistributor.h" 36 37 #include "Cursor.h" 37 38 #include "DOMStringList.h" … … 439 440 { 440 441 if (root && root->isShadowRoot()) 441 return toShadowRoot(root)->hasShadowInsertionPoint();442 return ScopeContentDistribution::hasShadowElement(toShadowRoot(root)); 442 443 443 444 ec = INVALID_ACCESS_ERR; … … 448 449 { 449 450 if (root && root->isShadowRoot()) 450 return toShadowRoot(root)->hasContentElement();451 return ScopeContentDistribution::hasContentElement(toShadowRoot(root)); 451 452 452 453 ec = INVALID_ACCESS_ERR; … … 461 462 } 462 463 463 return toShadowRoot(root)->countElementShadow();464 return ScopeContentDistribution::countElementShadow(toShadowRoot(root)); 464 465 } 465 466 -
trunk/Source/WebKit/win/ChangeLog
r139078 r139128 1 2013-01-08 Hajime Morrita <morrita@google.com> 2 3 [Shadow DOM] Distribution related code on ShadowRoot should be minimized. 4 https://bugs.webkit.org/show_bug.cgi?id=106282 5 6 Reviewed by Dimitri Glazkov. 7 8 * WebKit.vcproj/WebKit.def.in: 9 1 10 2013-01-08 Mark Lam <mark.lam@apple.com> 2 11 -
trunk/Source/WebKit/win/WebKit.vcproj/WebKit.def.in
r138991 r139128 197 197 ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z 198 198 ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@@WTF@@ABV34@@Z 199 ?countElementShadow@ShadowRoot@WebCore@@QBEIXZ200 ?hasShadowInsertionPoint@ShadowRoot@WebCore@@QBE_NXZ201 ?hasContentElement@ShadowRoot@WebCore@@QBE_NXZ202 199 ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B 203 200 #if ENABLE(INSPECTOR) … … 589 586 ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z 590 587 ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@@WTF@@ABV34@@Z 591 ?countElementShadow@ShadowRoot@WebCore@@QBEIXZ592 ?hasShadowInsertionPoint@ShadowRoot@WebCore@@QBE_NXZ593 ?hasContentElement@ShadowRoot@WebCore@@QBE_NXZ594 588 ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B 595 589 #if ENABLE(INSPECTOR) … … 981 975 ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z 982 976 ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@@WTF@@ABV34@@Z 983 ?countElementShadow@ShadowRoot@WebCore@@QBEIXZ984 ?hasShadowInsertionPoint@ShadowRoot@WebCore@@QBE_NXZ985 ?hasContentElement@ShadowRoot@WebCore@@QBE_NXZ986 977 ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B 987 978 #if ENABLE(INSPECTOR) … … 1363 1354 ?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBE@Z 1364 1355 ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z 1356 ?hasShadowElement@ScopeContentDistribution@WebCore@@SA_NPBVShadowRoot@2@@Z 1357 ?hasContentElement@ScopeContentDistribution@WebCore@@SA_NPBVShadowRoot@2@@Z 1358 ?countElementShadow@ScopeContentDistribution@WebCore@@SAIPBVShadowRoot@2@@Z 1365 1359 ?find@StringImpl@WTF@@QAEIPAV12@I@Z 1366 1360 ?find@StringImpl@WTF@@QAEIPAV12@@Z … … 1373 1367 ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z 1374 1368 ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@@WTF@@ABV34@@Z 1375 ?countElementShadow@ShadowRoot@WebCore@@QBEIXZ1376 ?hasShadowInsertionPoint@ShadowRoot@WebCore@@QBE_NXZ1377 ?hasContentElement@ShadowRoot@WebCore@@QBE_NXZ1378 1369 ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B 1379 1370 #if ENABLE(INSPECTOR) -
trunk/Source/autotools/symbols.filter
r138991 r139128 50 50 _ZN7WebCore10ClientRectC1Ev; 51 51 _ZN7WebCore10ClientRectC1ERKNS_7IntRectE; 52 _ZNK7WebCore10ShadowRoot17hasContentElementEv;53 _ZNK7WebCore10ShadowRoot18countElementShadowEv;54 _ZNK7WebCore10ShadowRoot23hasShadowInsertionPointEv;55 52 _ZN7WebCore10ShadowRoot6createEPNS_7ElementERi; 56 53 _ZN7WebCore11EventTarget17toGeneratedStreamEv; … … 231 228 _ZN7WebCore21SerializedScriptValueC1ERN3WTF6VectorIhLm0EEE; 232 229 _ZN7WebCore21SerializedScriptValueD1Ev; 230 _ZN7WebCore24ScopeContentDistribution16hasShadowElementEPKNS_10ShadowRootE; 231 _ZN7WebCore24ScopeContentDistribution18countElementShadowEPKNS_10ShadowRootE; 232 _ZN7WebCore24ScopeContentDistribution17hasContentElementEPKNS_10ShadowRootE; 233 233 _ZN7WebCore16CSSParserContextC1EPNS_8DocumentERKNS_4KURLERKN3WTF6StringE; 234 234 _ZN7WebCore18StyleSheetContents11parseStringERKN3WTF6StringE;
Note: See TracChangeset
for help on using the changeset viewer.