Changeset 109718 in webkit
- Timestamp:
- Mar 5, 2012 12:22:33 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r109716 r109718 1 2012-03-05 Shinya Kawanaka <shinyak@chromium.org> 2 3 Refactoring: Move HTMLContentElement::attach to InsertionPoint::attach. 4 https://bugs.webkit.org/show_bug.cgi?id=80243 5 6 Reviewed by Hajime Morita. 7 8 Since the current code in HTMLContentElement::attach() will be used for coming <shadow> 9 elements, it is natural that InsertionPoint::attach() has such code. 10 11 No new tests, no change in behavior. 12 13 * html/shadow/HTMLContentElement.cpp: 14 * html/shadow/HTMLContentElement.h: 15 (HTMLContentElement): 16 * html/shadow/InsertionPoint.cpp: 17 (WebCore::InsertionPoint::attach): 18 (WebCore): 19 (WebCore::InsertionPoint::detach): 20 * html/shadow/InsertionPoint.h: 21 (InsertionPoint): 22 1 23 2012-03-05 Adam Barth <abarth@webkit.org> 2 24 -
trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp
r109313 r109718 69 69 } 70 70 71 void HTMLContentElement::attach()72 {73 ShadowRoot* root = toShadowRoot(shadowTreeRootNode());74 75 // Before calling StyledElement::attach, selector must be calculated.76 if (root) {77 HTMLContentSelector* selector = root->tree()->ensureSelector();78 selector->unselect(&m_selections);79 selector->select(this, &m_selections);80 }81 82 InsertionPoint::attach();83 84 if (root) {85 for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next())86 selection->node()->attach();87 }88 }89 90 void HTMLContentElement::detach()91 {92 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {93 if (HTMLContentSelector* selector = root->tree()->selector())94 selector->unselect(&m_selections);95 96 // When content element is detached, shadow tree should be recreated to re-calculate selector for97 // other insertion points.98 root->tree()->setNeedsReattachHostChildrenAndShadow();99 }100 101 ASSERT(m_selections.isEmpty());102 InsertionPoint::detach();103 }104 105 71 const AtomicString& HTMLContentElement::select() const 106 72 { -
trunk/Source/WebCore/html/shadow/HTMLContentElement.h
r109313 r109718 45 45 46 46 virtual ~HTMLContentElement(); 47 virtual void attach();48 virtual void detach();49 47 50 48 const AtomicString& select() const; -
trunk/Source/WebCore/html/shadow/InsertionPoint.cpp
r109179 r109718 33 33 34 34 #include "ShadowRoot.h" 35 #include "ShadowTree.h" 35 36 36 37 namespace WebCore { … … 44 45 InsertionPoint::~InsertionPoint() 45 46 { 47 } 48 49 void InsertionPoint::attach() 50 { 51 ShadowRoot* root = toShadowRoot(shadowTreeRootNode()); 52 53 if (root) { 54 HTMLContentSelector* selector = root->tree()->ensureSelector(); 55 selector->unselect(&m_selections); 56 selector->select(this, &m_selections); 57 } 58 59 HTMLElement::attach(); 60 61 if (root) { 62 for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next()) 63 selection->node()->attach(); 64 } 65 } 66 67 void InsertionPoint::detach() 68 { 69 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 70 if (HTMLContentSelector* selector = root->tree()->selector()) 71 selector->unselect(&m_selections); 72 73 // When shadow element is detached, shadow tree should be recreated to re-calculate selector for 74 // other insertion points. 75 root->tree()->setNeedsReattachHostChildrenAndShadow(); 76 } 77 78 ASSERT(m_selections.isEmpty()); 79 HTMLElement::detach(); 46 80 } 47 81 -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r109313 r109718 48 48 virtual const AtomicString& select() const = 0; 49 49 50 virtual void attach(); 51 virtual void detach(); 52 50 53 protected: 51 54 InsertionPoint(const QualifiedName&, Document*);
Note: See TracChangeset
for help on using the changeset viewer.