Changeset 154327 in webkit
- Timestamp:
- Aug 20, 2013 8:27:41 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154326 r154327 1 2013-08-20 Antti Koivisto <antti@apple.com> 2 3 <https://webkit.org/b/120017> Remove NodeRenderingTraversal::ParentDetails 4 5 Reviewed by Andreas Kling. 6 7 Remove this oddly factored type that is used to optionally collect some data during ComposedShadowTreeWalker parent traversal. 8 9 Also removed support for reset-style-inheritance attribute in InsertionPoint. We don't use or expose it. 10 11 * css/StyleResolver.cpp: 12 (WebCore::StyleResolver::State::initForStyleResolve): 13 (WebCore::StyleResolver::styleForElement): 14 * css/StyleResolver.h: 15 (WebCore::StyleResolver::State::State): 16 (WebCore::StyleResolver::State::elementLinkState): 17 18 Remove m_distributedToInsertionPoint State field. We never hit the cases where it was used. 19 20 * dom/ComposedShadowTreeWalker.cpp: 21 (WebCore::ComposedShadowTreeWalker::traverseSiblingOrBackToInsertionPoint): 22 (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents): 23 (WebCore::ComposedShadowTreeWalker::traverseParent): 24 25 Return null instead of setting childWasOutOfComposition to details object. That's what would happen anyway in the caller. 26 27 (WebCore::ComposedShadowTreeWalker::traverseParentInCurrentTree): 28 (WebCore::ComposedShadowTreeWalker::traverseParentBackToShadowRootOrHost): 29 * dom/ComposedShadowTreeWalker.h: 30 * dom/Node.cpp: 31 (WebCore::Node::insertionParentForBinding): 32 * dom/NodeRenderingContext.cpp: 33 (WebCore::NodeRenderingContext::NodeRenderingContext): 34 (WebCore::NodeRenderingContext::isOnEncapsulationBoundary): 35 36 Make this look up InsertionPoint directly intead of relying it being populated in m_parentDetails. The function is used only in 37 a few non-performance critical places. 38 39 (WebCore::NodeRenderingContext::resetStyleInheritance): 40 41 Return parent ShadowRoots resetStyleInheritance() flag instead of using m_parentDetails. 42 43 * dom/NodeRenderingContext.h: 44 * dom/NodeRenderingTraversal.cpp: 45 (WebCore::NodeRenderingTraversal::parentSlow): 46 * dom/NodeRenderingTraversal.h: 47 (WebCore::NodeRenderingTraversal::parent): 48 49 Remove ParentDetails. 50 51 * html/HTMLAttributeNames.in: 52 * html/shadow/InsertionPoint.cpp: 53 54 Remove unused resetStyleInheritance attribute. 55 56 (WebCore::InsertionPoint::removedFrom): 57 (WebCore::findInsertionPointOf): 58 59 Renamed for clarity. 60 61 * html/shadow/InsertionPoint.h: 62 * testing/Internals.cpp: 63 (WebCore::Internals::includerFor): 64 1 65 2013-08-20 Antti Koivisto <antti@apple.com> 2 66 -
trunk/Source/WebCore/css/StyleResolver.cpp
r154299 r154327 434 434 parentStyle ? parentStyle : 435 435 m_parentNode ? m_parentNode->renderStyle() : 0; 436 m_distributedToInsertionPoint = context.insertionPoint();437 436 } else { 438 437 m_parentNode = 0; 439 438 m_parentStyle = parentStyle; 440 m_distributedToInsertionPoint = false;441 439 } 442 440 … … 810 808 initElement(element); 811 809 state.initForStyleResolve(document(), element, defaultParent, regionForStyling); 812 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint()) {810 if (sharingBehavior == AllowStyleSharing) { 813 811 RenderStyle* sharedStyle = locateSharedStyle(); 814 812 if (sharedStyle) { … … 824 822 state.setStyle(defaultStyleForElement()); 825 823 state.setParentStyle(RenderStyle::clone(state.style())); 826 }827 // contenteditable attribute (implemented by -webkit-user-modify) should828 // be propagated from shadow host to distributed node.829 if (state.distributedToInsertionPoint()) {830 if (Element* parent = element->parentElement()) {831 if (RenderStyle* styleOfShadowHost = parent->renderStyle())832 state.style()->setUserModify(styleOfShadowHost->userModify());833 }834 824 } 835 825 -
trunk/Source/WebCore/css/StyleResolver.h
r154133 r154327 416 416 , m_regionForStyling(0) 417 417 , m_elementLinkState(NotInsideLink) 418 , m_distributedToInsertionPoint(false)419 418 , m_elementAffectedByClassRules(false) 420 419 , m_applyPropertyToRegularStyle(true) … … 447 446 const RenderRegion* regionForStyling() const { return m_regionForStyling; } 448 447 EInsideLink elementLinkState() const { return m_elementLinkState; } 449 bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; }450 448 void setElementAffectedByClassRules(bool isAffected) { m_elementAffectedByClassRules = isAffected; } 451 449 bool elementAffectedByClassRules() const { return m_elementAffectedByClassRules; } … … 500 498 501 499 EInsideLink m_elementLinkState; 502 503 bool m_distributedToInsertionPoint;504 500 505 501 bool m_elementAffectedByClassRules; -
trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp
r154232 r154327 154 154 return traverseSiblingInCurrentTree(node, direction); 155 155 156 InsertionPoint* insertionPoint = resolveReprojection(node);156 InsertionPoint* insertionPoint = findInsertionPointOf(node); 157 157 if (!insertionPoint) 158 158 return traverseSiblingInCurrentTree(node, direction); … … 179 179 } 180 180 181 inline Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node , ParentTraversalDetails* details) const181 inline Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node) const 182 182 { 183 183 ASSERT(node); … … 186 186 const InsertionPoint* insertionPoint = toInsertionPoint(node); 187 187 return insertionPoint->hasDistribution() ? 0 : 188 insertionPoint->isActive() ? traverseParent(node , details) : const_cast<Node*>(node);188 insertionPoint->isActive() ? traverseParent(node) : const_cast<Node*>(node); 189 189 } 190 190 … … 198 198 // FIXME: Use an iterative algorithm so that it can be inlined. 199 199 // https://bugs.webkit.org/show_bug.cgi?id=90415 200 Node* ComposedShadowTreeWalker::traverseParent(const Node* node , ParentTraversalDetails* details) const200 Node* ComposedShadowTreeWalker::traverseParent(const Node* node) const 201 201 { 202 202 if (node->isPseudoElement()) … … 207 207 208 208 if (nodeCanBeDistributed(node)) { 209 if (InsertionPoint* insertionPoint = resolveReprojection(node)) { 210 if (details) 211 details->didTraverseInsertionPoint(insertionPoint); 212 return traverseParent(insertionPoint, details); 213 } 214 215 // The node is a non-distributed light child or older shadow's child. 216 if (details) 217 details->childWasOutOfComposition(); 218 } 219 return traverseParentInCurrentTree(node, details); 220 } 221 222 inline Node* ComposedShadowTreeWalker::traverseParentInCurrentTree(const Node* node, ParentTraversalDetails* details) const 209 if (InsertionPoint* insertionPoint = findInsertionPointOf(node)) 210 return traverseParent(insertionPoint); 211 return 0; 212 } 213 return traverseParentInCurrentTree(node); 214 } 215 216 inline Node* ComposedShadowTreeWalker::traverseParentInCurrentTree(const Node* node) const 223 217 { 224 218 if (Node* parent = node->parentNode()) 225 return parent->isShadowRoot() ? traverseParentBackToShadowRootOrHost(toShadowRoot(parent) , details) : traverseNodeEscapingFallbackContents(parent, details);226 return 0; 227 } 228 229 Node* ComposedShadowTreeWalker::traverseParentBackToShadowRootOrHost(const ShadowRoot* shadowRoot , ParentTraversalDetails* details) const219 return parent->isShadowRoot() ? traverseParentBackToShadowRootOrHost(toShadowRoot(parent)) : traverseNodeEscapingFallbackContents(parent); 220 return 0; 221 } 222 223 Node* ComposedShadowTreeWalker::traverseParentBackToShadowRootOrHost(const ShadowRoot* shadowRoot) const 230 224 { 231 225 ASSERT(shadowRoot); 232 226 233 if (canCrossUpperBoundary()) { 234 if (details) 235 details->didTraverseShadowRoot(shadowRoot); 227 if (canCrossUpperBoundary()) 236 228 return shadowRoot->hostElement(); 237 }238 229 239 230 return const_cast<ShadowRoot*>(shadowRoot); -
trunk/Source/WebCore/dom/ComposedShadowTreeWalker.h
r149549 r154327 41 41 class ComposedShadowTreeWalker { 42 42 public: 43 typedef NodeRenderingTraversal::ParentDetails ParentTraversalDetails;44 45 43 enum Policy { 46 44 CrossUpperBoundary, … … 72 70 void previous(); 73 71 74 Node* traverseParent(const Node* , ParentTraversalDetails* = 0) const;72 Node* traverseParent(const Node*) const; 75 73 76 74 private: 77 ComposedShadowTreeWalker(const Node*, ParentTraversalDetails*);78 79 75 enum TraversalDirection { 80 76 TraversalDirectionForward, … … 120 116 static Node* escapeFallbackContentElement(const Node*, TraversalDirection); 121 117 122 Node* traverseNodeEscapingFallbackContents(const Node* , ParentTraversalDetails* = 0) const;123 Node* traverseParentInCurrentTree(const Node* , ParentTraversalDetails* = 0) const;124 Node* traverseParentBackToShadowRootOrHost(const ShadowRoot* , ParentTraversalDetails* = 0) const;118 Node* traverseNodeEscapingFallbackContents(const Node*) const; 119 Node* traverseParentInCurrentTree(const Node*) const; 120 Node* traverseParentBackToShadowRootOrHost(const ShadowRoot*) const; 125 121 126 122 const Node* m_node; -
trunk/Source/WebCore/dom/Node.cpp
r154239 r154327 1040 1040 Node* Node::insertionParentForBinding() const 1041 1041 { 1042 return resolveReprojection(this);1042 return findInsertionPointOf(this); 1043 1043 } 1044 1044 -
trunk/Source/WebCore/dom/NodeRenderingContext.cpp
r154257 r154327 57 57 , m_parentFlowRenderer(0) 58 58 { 59 m_renderingParent = NodeRenderingTraversal::parent(node , &m_parentDetails);59 m_renderingParent = NodeRenderingTraversal::parent(node); 60 60 } 61 61 … … 73 73 , m_parentFlowRenderer(0) 74 74 { 75 m_renderingParent = NodeRenderingTraversal::parent(node , &m_parentDetails);75 m_renderingParent = NodeRenderingTraversal::parent(node); 76 76 } 77 77 … … 238 238 bool NodeRenderingContext::isOnEncapsulationBoundary() const 239 239 { 240 return isOnUpperEncapsulationBoundary() || isLowerEncapsulationBoundary(m_parentDetails.insertionPoint()) || isLowerEncapsulationBoundary(m_node->parentNode()); 240 return isOnUpperEncapsulationBoundary() 241 || isLowerEncapsulationBoundary(findInsertionPointOf(m_node)) 242 || isLowerEncapsulationBoundary(m_node->parentNode()); 241 243 } 242 244 … … 335 337 } 336 338 337 } 339 bool NodeRenderingContext::resetStyleInheritance() const 340 { 341 ContainerNode* parent = m_node->parentNode(); 342 return parent && parent->isShadowRoot() && toShadowRoot(parent)->resetStyleInheritance(); 343 } 344 345 } -
trunk/Source/WebCore/dom/NodeRenderingContext.h
r154257 r154327 60 60 RenderObject* nextRenderer() const; 61 61 RenderObject* previousRenderer() const; 62 InsertionPoint* insertionPoint() const;63 62 64 63 const RenderStyle* style() const; … … 74 73 Node* m_node; 75 74 ContainerNode* m_renderingParent; 76 NodeRenderingTraversal::ParentDetails m_parentDetails;77 75 RefPtr<RenderStyle> m_style; 78 76 RenderNamedFlowThread* m_parentFlowRenderer; … … 89 87 } 90 88 91 inline bool NodeRenderingContext::resetStyleInheritance() const92 {93 return m_parentDetails.resetStyleInheritance();94 }95 96 89 inline const RenderStyle* NodeRenderingContext::style() const 97 90 { … … 99 92 } 100 93 101 inline InsertionPoint* NodeRenderingContext::insertionPoint() const102 {103 return m_parentDetails.insertionPoint();104 }105 106 94 } // namespace WebCore 107 95 -
trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp
r139325 r154327 35 35 namespace NodeRenderingTraversal { 36 36 37 void ParentDetails::didTraverseInsertionPoint(InsertionPoint* insertionPoint) 38 { 39 if (!m_insertionPoint) { 40 m_insertionPoint = insertionPoint; 41 m_resetStyleInheritance = m_resetStyleInheritance || insertionPoint->resetStyleInheritance(); 42 } 43 } 44 45 void ParentDetails::didTraverseShadowRoot(const ShadowRoot* root) 46 { 47 m_resetStyleInheritance = m_resetStyleInheritance || root->resetStyleInheritance(); 48 } 49 50 ContainerNode* parentSlow(const Node* node, ParentDetails* details) 37 ContainerNode* parentSlow(const Node* node) 51 38 { 52 39 ComposedShadowTreeWalker walker(node, ComposedShadowTreeWalker::CrossUpperBoundary, ComposedShadowTreeWalker::CanStartFromShadowBoundary); 53 ContainerNode* found = toContainerNode(walker.traverseParent(walker.get(), details)); 54 return details->outOfComposition() ? 0 : found; 40 return toContainerNode(walker.traverseParent(walker.get())); 55 41 } 56 42 -
trunk/Source/WebCore/dom/NodeRenderingTraversal.h
r139325 r154327 36 36 namespace NodeRenderingTraversal { 37 37 38 class ParentDetails { 39 public: 40 ParentDetails() 41 : m_insertionPoint(0) 42 , m_resetStyleInheritance(false) 43 , m_outOfComposition(false) 44 { } 45 46 InsertionPoint* insertionPoint() const { return m_insertionPoint; } 47 bool resetStyleInheritance() const { return m_resetStyleInheritance; } 48 bool outOfComposition() const { return m_outOfComposition; } 49 50 void didTraverseInsertionPoint(InsertionPoint*); 51 void didTraverseShadowRoot(const ShadowRoot*); 52 void childWasOutOfComposition() { m_outOfComposition = true; } 53 54 bool operator==(const ParentDetails& other) 55 { 56 return m_insertionPoint == other.m_insertionPoint 57 && m_resetStyleInheritance == other.m_resetStyleInheritance 58 && m_outOfComposition == other.m_outOfComposition; 59 } 60 61 private: 62 InsertionPoint* m_insertionPoint; 63 bool m_resetStyleInheritance; 64 bool m_outOfComposition; 65 }; 66 67 ContainerNode* parent(const Node*, ParentDetails*); 68 ContainerNode* parentSlow(const Node*, ParentDetails*); 38 ContainerNode* parent(const Node*); 39 ContainerNode* parentSlow(const Node*); 69 40 Node* nextSibling(const Node*); 70 41 Node* nextSiblingSlow(const Node*); … … 77 48 Node* lastChildInScope(const Node*); 78 49 79 inline ContainerNode* parent(const Node* node , ParentDetails* details)50 inline ContainerNode* parent(const Node* node) 80 51 { 81 52 if (!node->needsShadowTreeWalker()) { 82 53 #ifndef NDEBUG 83 ParentDetails slowDetails; 84 ASSERT(node->parentNode() == parentSlow(node, &slowDetails)); 85 ASSERT(slowDetails == *details); 54 ASSERT(node->parentNode() == parentSlow(node)); 86 55 #endif 87 56 return node->parentNodeGuaranteedHostFree(); 88 57 } 89 58 90 return parentSlow(node , details);59 return parentSlow(node); 91 60 } 92 61 -
trunk/Source/WebCore/html/HTMLAttributeNames.in
r153624 r154327 284 284 rel 285 285 required 286 reset-style-inheritance287 286 results 288 287 rev -
trunk/Source/WebCore/html/shadow/InsertionPoint.cpp
r154257 r154327 148 148 HTMLElement::removedFrom(insertionPoint); 149 149 } 150 151 void InsertionPoint::parseAttribute(const QualifiedName& name, const AtomicString& value)152 {153 if (name == reset_style_inheritanceAttr) {154 if (!inDocument() || !attached() || !isActive())155 return;156 containingShadowRoot()->hostElement()->setNeedsStyleRecalc();157 } else158 HTMLElement::parseAttribute(name, value);159 }160 161 bool InsertionPoint::resetStyleInheritance() const162 {163 return fastHasAttribute(reset_style_inheritanceAttr);164 }165 166 void InsertionPoint::setResetStyleInheritance(bool value)167 {168 setBooleanAttribute(reset_style_inheritanceAttr, value);169 }170 150 171 151 Node* InsertionPoint::firstDistributed() const … … 209 189 } 210 190 211 InsertionPoint* resolveReprojection(const Node* projectedNode)191 InsertionPoint* findInsertionPointOf(const Node* projectedNode) 212 192 { 213 193 if (ShadowRoot* shadowRoot = shadowRootOfParentForDistribution(projectedNode)) { -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r154254 r154327 63 63 virtual Type insertionPointType() const { return InternalType; } 64 64 65 bool resetStyleInheritance() const;66 void setResetStyleInheritance(bool);67 68 65 virtual void willAttachRenderers() OVERRIDE; 69 66 virtual void willDetachRenderers() OVERRIDE; … … 82 79 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 83 80 virtual void removedFrom(ContainerNode*) OVERRIDE; 84 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;85 81 virtual bool isInsertionPointNode() const OVERRIDE { return true; } 86 82 … … 146 142 } 147 143 148 InsertionPoint* resolveReprojection(const Node*);144 InsertionPoint* findInsertionPointOf(const Node*); 149 145 150 146 } // namespace WebCore -
trunk/Source/WebCore/testing/Internals.cpp
r154286 r154327 669 669 } 670 670 671 Element* Internals::includerFor(Node* node, ExceptionCode& ec) 672 { 673 if (!node) { 674 ec = INVALID_ACCESS_ERR; 675 return 0; 676 } 677 678 return NodeRenderingContext(node).insertionPoint(); 671 Element* Internals::includerFor(Node*, ExceptionCode& ec) 672 { 673 ec = INVALID_ACCESS_ERR; 674 return 0; 679 675 } 680 676
Note: See TracChangeset
for help on using the changeset viewer.