Changeset 88908 in webkit
- Timestamp:
- Jun 14, 2011 11:24:15 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r88905 r88908 1 2011-06-09 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 ShadowContentElement should detach its inclusions before attaching them. 6 https://bugs.webkit.org/show_bug.cgi?id=62428 7 8 - On ShadowContentElement::attach(), changed inclusion attach scheme 9 from per-node reattach() to detach()-all-and-attach()-them. This 10 eliminates attach() order problems which ShadowContentElement 11 possibly has. 12 - Changed ShadowContentElement to have m_inclusions as a member variable, 13 which will be used by upcoming changes. 14 - Moved attach() code from ShadowContentSelector to ShadowContentElement 15 because the element now owns the inclusion list. 16 17 No new tests. No visible behavioral change yet. 18 19 * dom/ShadowContentElement.cpp: 20 (WebCore::ShadowContentElement::attach): 21 (WebCore::ShadowContentElement::detach): Added. 22 * dom/ShadowContentElement.h: 23 (WebCore::ShadowContentElement::inclusionAt): Added. 24 (WebCore::ShadowContentElement::inclusionCount): Added. 25 (WebCore::toShadowContentElement): 26 * dom/ShadowContentSelector.cpp: Removed attachChildrenFor() 27 (WebCore::ShadowContentSelector::selectInclusion): Extracted from attachChildrenFor() 28 (WebCore::ShadowContentSelector::willAttachContentFor): Extracted from attachChildrenFor() 29 (WebCore::ShadowContentSelector::didAttachContent): Extracted from attachChildrenFor() 30 (WebCore::ShadowContentSelector::activeElement): 31 * dom/ShadowContentSelector.h: 32 1 33 2011-06-14 David Kilzer <ddkilzer@apple.com> 2 34 -
trunk/Source/WebCore/dom/ShadowContentElement.cpp
r86726 r88908 35 35 { 36 36 ASSERT(!firstChild()); // Currently doesn't support any light child. 37 Element::attach(); 38 if (ShadowContentSelector* selector = ShadowContentSelector::currentInstance()) 39 selector->attachChildrenFor(this); 37 StyledElement::attach(); 38 if (ShadowContentSelector* selector = ShadowContentSelector::currentInstance()) { 39 selector->willAttachContentFor(this); 40 selector->selectInclusion(m_inclusions); 41 for (size_t i = 0; i < m_inclusions.size(); ++i) 42 m_inclusions[i]->detach(); 43 for (size_t i = 0; i < m_inclusions.size(); ++i) 44 m_inclusions[i]->attach(); 45 selector->didAttachContent(); 46 } 47 } 48 49 void ShadowContentElement::detach() 50 { 51 m_inclusions.clear(); 52 StyledElement::detach(); 40 53 } 41 54 -
trunk/Source/WebCore/dom/ShadowContentElement.h
r88476 r88908 48 48 virtual bool shouldInclude(Node*) = 0; 49 49 virtual void attach(); 50 virtual void detach(); 51 52 Node* inclusionAt(size_t) const; 53 size_t inclusionCount() const; 50 54 51 55 private: … … 53 57 virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } 54 58 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; } 59 60 Vector<RefPtr<Node> > m_inclusions; 55 61 }; 62 63 inline Node* ShadowContentElement::inclusionAt(size_t index) const 64 { 65 return m_inclusions.at(index).get(); 66 } 67 68 inline size_t ShadowContentElement::inclusionCount() const 69 { 70 return m_inclusions.size(); 71 } 72 73 inline ShadowContentElement* toShadowContentElement(Node* node) 74 { 75 ASSERT(!node || node->isContentElement()); 76 return static_cast<ShadowContentElement*>(node); 77 } 56 78 57 79 } -
trunk/Source/WebCore/dom/ShadowContentSelector.cpp
r87123 r88908 52 52 } 53 53 54 void ShadowContentSelector:: attachChildrenFor(ShadowContentElement* contentElement)54 void ShadowContentSelector::selectInclusion(Vector<RefPtr<Node> >& inclusions) 55 55 { 56 m_activeElement = contentElement;56 inclusions.clear(); 57 57 58 58 for (size_t i = 0; i < m_children.size(); ++i) { … … 60 60 if (!child) 61 61 continue; 62 if (! contentElement->shouldInclude(child))62 if (!m_activeElement->shouldInclude(child)) 63 63 continue; 64 64 65 child->reattach();65 inclusions.append(child); 66 66 m_children[i] = 0; 67 67 } 68 } 68 69 70 void ShadowContentSelector::willAttachContentFor(ShadowContentElement* element) 71 { 72 ASSERT(!m_activeElement); 73 m_activeElement = element; 74 } 75 76 void ShadowContentSelector::didAttachContent() 77 { 78 ASSERT(m_activeElement); 69 79 m_activeElement = 0; 70 80 } 71 81 82 Element* ShadowContentSelector::activeElement() const 83 { 84 return m_activeElement; 72 85 } 86 87 } -
trunk/Source/WebCore/dom/ShadowContentSelector.h
r86726 r88908 48 48 ~ShadowContentSelector(); 49 49 50 void attachChildrenFor(ShadowContentElement*); 50 void willAttachContentFor(ShadowContentElement*); 51 void didAttachContent(); 52 void selectInclusion(Vector<RefPtr<Node> >& inclusions); 53 51 54 ShadowRoot* shadowRoot() const { return m_shadowRoot; } 52 Element* activeElement() const { return m_activeElement; }55 Element* activeElement() const; 53 56 54 57 static ShadowContentSelector* currentInstance() { return s_currentInstance; } … … 57 60 ShadowContentSelector* m_parent; 58 61 ShadowRoot* m_shadowRoot; 59 Element* m_activeElement;62 ShadowContentElement* m_activeElement; 60 63 Vector<RefPtr<Node> > m_children; 61 64
Note: See TracChangeset
for help on using the changeset viewer.