Changeset 121131 in webkit
- Timestamp:
- Jun 24, 2012, 7:25:43 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
dom/NodeRenderingContext.cpp (modified) (10 diffs)
-
dom/NodeRenderingContext.h (modified) (4 diffs)
-
html/shadow/InsertionPoint.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121130 r121131 1 2012-06-24 MORITA Hajime <morrita@google.com> 2 3 NodeRenderingContext::AttachingPhase is redundant. 4 https://bugs.webkit.org/show_bug.cgi?id=79220 5 6 Reviewed by Dimitri Glazkov. 7 8 This change removes NodeRenderingContext::AttachingPhase and 9 NodeRenderingContext::m_phase respectively. The state originally 10 represented as m_phase is naturally encoded into other member variables. 11 12 NodeRenderingContext::m_visualParentShadow is also replaced, with 13 a local variable parentScope. 14 15 Basically, what NodeRenderingContext wants to know is the parent of 16 the composed shadow tree and an optional insertion point where the 17 node is distributed. Once these becomes clear, m_phase is no longer required. 18 It was rather a historical artifact. 19 20 No new tests. No behavioral change. 21 22 * dom/NodeRenderingContext.cpp: Replaced m_phase with implicit states. 23 (WebCore::NodeRenderingContext::NodeRenderingContext): 24 (WebCore::NodeRenderingContext::nextRenderer): 25 (WebCore::NodeRenderingContext::previousRenderer): 26 (WebCore::NodeRenderingContext::parentRenderer): 27 (WebCore::NodeRenderingContext::shouldCreateRenderer): 28 (WebCore::NodeRenderingContext::isOnEncapsulationBoundary): 29 (WebCore::NodeRenderingContext::isOnUpperEncapsulationBoundary): 30 * dom/NodeRenderingContext.h: 31 (NodeRenderingContext): 32 (WebCore::NodeRenderingContext::parentNodeForRenderingAndStyle): Removed an assert which checks m_phase. 33 (WebCore::NodeRenderingContext::resetStyleInheritance): Removed an assert which checks m_phase. 34 * html/shadow/InsertionPoint.h: 35 (WebCore::isInsertionPoint): Fix null case check. 36 (WebCore::isLowerEncapsulationBoundary): Renamed from isShadowBoundary() 37 1 38 2012-06-24 Antti Koivisto <antti@apple.com> 2 39 -
trunk/Source/WebCore/dom/NodeRenderingContext.cpp
r119799 r121131 53 53 54 54 NodeRenderingContext::NodeRenderingContext(Node* node) 55 : m_phase(AttachingNotInTree) 56 , m_node(node) 55 : m_node(node) 57 56 , m_parentNodeForRenderingAndStyle(0) 58 57 , m_resetStyleInheritance(false) 59 , m_visualParentShadow(0)60 58 , m_insertionPoint(0) 61 59 , m_style(0) … … 67 65 68 66 if (parent->isShadowRoot() && toShadowRoot(parent)->isYoungest()) { 69 m_phase = AttachingShadowChild;70 67 m_parentNodeForRenderingAndStyle = toShadowRoot(parent)->host(); 71 68 m_resetStyleInheritance = toShadowRoot(parent)->resetStyleInheritance(); … … 74 71 75 72 if (parent->isElementNode() || parent->isShadowRoot()) { 73 ElementShadow* parentShadow = 0; 74 76 75 if (parent->isElementNode()) 77 m_visualParentShadow = toElement(parent)->shadow();76 parentShadow = toElement(parent)->shadow(); 78 77 else if (parent->isShadowRoot()) 79 m_visualParentShadow = toShadowRoot(parent)->owner(); 80 81 if (m_visualParentShadow) { 82 m_visualParentShadow->ensureDistribution(); 83 84 if ((m_insertionPoint = m_visualParentShadow->insertionPointFor(m_node))) { 85 if (m_insertionPoint->shadowRoot()->isUsedForRendering()) { 86 m_phase = AttachingDistributed; 87 NodeRenderingContext insertionPointContext(m_insertionPoint); 78 parentShadow = toShadowRoot(parent)->owner(); 79 80 if (parentShadow) { 81 parentShadow->ensureDistribution(); 82 83 if (InsertionPoint* insertionPoint = parentShadow->insertionPointFor(m_node)) { 84 if (insertionPoint->shadowRoot()->isUsedForRendering()) { 85 NodeRenderingContext insertionPointContext(insertionPoint); 88 86 m_parentNodeForRenderingAndStyle = insertionPointContext.parentNodeForRenderingAndStyle(); 89 87 m_resetStyleInheritance = insertionPointContext.resetStyleInheritance(); 88 m_insertionPoint = insertionPoint; 90 89 return; 91 90 } 92 91 } 93 92 94 m_phase = AttachingNotDistributed;95 m_parentNodeForRenderingAndStyle = parent;96 93 return; 97 94 } 98 95 99 if (isShadowBoundary(parent)) { 100 ShadowRoot* parentShadowRoot = parent->shadowRoot(); 101 parentShadowRoot->owner()->ensureDistribution(); 102 103 if (!parentShadowRoot->isUsedForRendering()) { 104 m_phase = AttachingNotDistributed; 105 m_parentNodeForRenderingAndStyle = parent; 96 if (isLowerEncapsulationBoundary(parent)) { 97 ShadowRoot* parentScope = parent->shadowRoot(); 98 parentScope->owner()->ensureDistribution(); 99 100 // The shadow tree isn't part of composed tree. 101 if (!parentScope->isUsedForRendering()) 106 102 return; 107 } 108 103 104 // the parent insertion point doesn't need any fallback content. 109 105 if (toInsertionPoint(parent)->hasDistribution()) 110 m_phase = AttachingNotFallbacked; 111 else 112 m_phase = AttachingFallbacked; 106 return; 113 107 114 108 if (toInsertionPoint(parent)->isActive()) { 109 // Uses m_node as a fallback node of the insertion point. 115 110 NodeRenderingContext parentContext(parent); 116 111 m_parentNodeForRenderingAndStyle = parentContext.parentNodeForRenderingAndStyle(); 117 112 m_resetStyleInheritance = parentContext.resetStyleInheritance(); 118 } else 119 m_parentNodeForRenderingAndStyle = parent; 113 return; 114 } 115 116 // The insertion point isn't active thus behaves as a plain old element. 117 m_parentNodeForRenderingAndStyle = parent; 120 118 return; 121 119 } 122 120 } 123 121 124 m_phase = AttachingStraight;125 122 m_parentNodeForRenderingAndStyle = parent; 126 123 } 127 124 128 125 NodeRenderingContext::NodeRenderingContext(Node* node, RenderStyle* style) 129 : m_phase(Calculating) 130 , m_node(node) 126 : m_node(node) 131 127 , m_parentNodeForRenderingAndStyle(0) 132 128 , m_resetStyleInheritance(false) 133 , m_visualParentShadow(0)134 129 , m_insertionPoint(0) 135 130 , m_style(style) … … 242 237 RenderObject* NodeRenderingContext::nextRenderer() const 243 238 { 244 ASSERT(m_node->renderer() || m_phase != Calculating);245 239 if (RenderObject* renderer = m_node->renderer()) 246 240 return renderer->nextSibling(); … … 249 243 return m_parentFlowRenderer->nextRendererForNode(m_node); 250 244 251 if (m_ phase == AttachingDistributed) {245 if (m_insertionPoint) { 252 246 if (RenderObject* found = nextRendererOfInsertionPoint(m_insertionPoint, m_node)) 253 247 return found; … … 265 259 RenderObject* NodeRenderingContext::previousRenderer() const 266 260 { 267 ASSERT(m_node->renderer() || m_phase != Calculating);268 269 261 if (RenderObject* renderer = m_node->renderer()) 270 262 return renderer->previousSibling(); … … 273 265 return m_parentFlowRenderer->previousRendererForNode(m_node); 274 266 275 if (m_ phase == AttachingDistributed) {267 if (m_insertionPoint) { 276 268 if (RenderObject* found = previousRendererOfInsertionPoint(m_insertionPoint, m_node)) 277 269 return found; … … 286 278 RenderObject* NodeRenderingContext::parentRenderer() const 287 279 { 288 if (RenderObject* renderer = m_node->renderer()) { 289 ASSERT(m_phase == Calculating); 280 if (RenderObject* renderer = m_node->renderer()) 290 281 return renderer->parent(); 291 }292 293 282 if (m_parentFlowRenderer) 294 283 return m_parentFlowRenderer; 295 284 296 ASSERT(m_phase != Calculating);297 285 return m_parentNodeForRenderingAndStyle ? m_parentNodeForRenderingAndStyle->renderer() : 0; 298 286 } … … 300 288 bool NodeRenderingContext::shouldCreateRenderer() const 301 289 { 302 ASSERT(m_phase != Calculating); 303 ASSERT(parentNodeForRenderingAndStyle()); 304 305 if (m_phase == AttachingNotInTree || m_phase == AttachingNotDistributed || m_phase == AttachingNotFallbacked) 290 if (!m_parentNodeForRenderingAndStyle) 306 291 return false; 307 292 RenderObject* parentRenderer = this->parentRenderer(); … … 341 326 } 342 327 328 bool NodeRenderingContext::isOnEncapsulationBoundary() const 329 { 330 return isOnUpperEncapsulationBoundary() || isLowerEncapsulationBoundary(m_insertionPoint) || isLowerEncapsulationBoundary(m_node->parentNode()); 331 } 332 333 bool NodeRenderingContext::isOnUpperEncapsulationBoundary() const 334 { 335 return m_node->parentNode() && m_node->parentNode()->isShadowRoot(); 336 } 337 343 338 NodeRendererFactory::NodeRendererFactory(Node* node) 344 339 : m_context(node) -
trunk/Source/WebCore/dom/NodeRenderingContext.h
r119799 r121131 69 69 70 70 private: 71 enum AttachingPhase {72 Calculating,73 AttachingStraight,74 AttachingNotInTree,75 AttachingDistributed,76 AttachingNotDistributed,77 AttachingFallbacked,78 AttachingNotFallbacked,79 AttachingShadowChild,80 };81 82 AttachingPhase m_phase;83 71 Node* m_node; 84 72 ContainerNode* m_parentNodeForRenderingAndStyle; 85 73 bool m_resetStyleInheritance; 86 ElementShadow* m_visualParentShadow;87 74 InsertionPoint* m_insertionPoint; 88 75 RefPtr<RenderStyle> m_style; … … 98 85 inline ContainerNode* NodeRenderingContext::parentNodeForRenderingAndStyle() const 99 86 { 100 ASSERT(m_phase != Calculating);101 87 return m_parentNodeForRenderingAndStyle; 102 88 } … … 104 90 inline bool NodeRenderingContext::resetStyleInheritance() const 105 91 { 106 ASSERT(m_phase != Calculating);107 92 return m_resetStyleInheritance; 108 93 } … … 116 101 { 117 102 return m_insertionPoint; 118 }119 120 inline bool NodeRenderingContext::isOnEncapsulationBoundary() const121 {122 return (m_phase == AttachingDistributed123 || m_phase == AttachingShadowChild124 || m_phase == AttachingFallbacked);125 }126 127 inline bool NodeRenderingContext::isOnUpperEncapsulationBoundary() const128 {129 return m_phase == AttachingShadowChild;130 103 } 131 104 -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r121079 r121131 81 81 { 82 82 if (!node) 83 return true;83 return false; 84 84 85 85 if (node->isHTMLElement() && toHTMLElement(node)->isInsertionPoint()) … … 106 106 } 107 107 108 inline bool is ShadowBoundary(Node* node)108 inline bool isLowerEncapsulationBoundary(Node* node) 109 109 { 110 110 if (!isInsertionPoint(node))
Note:
See TracChangeset
for help on using the changeset viewer.