Changeset 109864 in webkit
- Timestamp:
- Mar 5, 2012 10:59:02 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r109861 r109864 1 2012-03-05 Shinya Kawanaka <shinyak@chromium.org> 2 3 InsertionPoint::attach should be consistent with Element. 4 https://bugs.webkit.org/show_bug.cgi?id=80373 5 6 Reviewed by Hajime Morita. 7 8 This patch is preparation for coming <shadow> patches. 9 10 InsertionPoint used to attach fallback elements before attaching distributed elements. 11 To be consistent with Element::attach behavior, attaching distributed elements first is 12 natural, because Element attaches a shadow tree first. 13 14 Also, this patch extracts a few methods form InsretionPoint::attach() and detach() 15 to keep code clean. They will become messy without this refactoring when adding 16 <shadow> patch. 17 18 No new tests. Should be covered by existing tests. 19 20 * html/shadow/InsertionPoint.cpp: 21 (WebCore::InsertionPoint::attach): 22 (WebCore::InsertionPoint::detach): 23 (WebCore::InsertionPoint::distributeHostChildren): 24 (WebCore): 25 (WebCore::InsertionPoint::clearDistribution): 26 (WebCore::InsertionPoint::attachDistributedNode): 27 * html/shadow/InsertionPoint.h: 28 (InsertionPoint): 29 1 30 2012-03-05 Adam Barth <abarth@webkit.org> 2 31 -
trunk/Source/WebCore/html/shadow/InsertionPoint.cpp
r109718 r109864 49 49 void InsertionPoint::attach() 50 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); 51 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 52 distributeHostChildren(root->tree()); 53 attachDistributedNode(); 57 54 } 58 55 59 56 HTMLElement::attach(); 60 61 if (root) {62 for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next())63 selection->node()->attach();64 }65 57 } 66 58 … … 68 60 { 69 61 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 70 if (HTMLContentSelector* selector = root->tree()->selector())71 selector->unselect(&m_selections);62 ShadowTree* tree = root->tree(); 63 clearDistribution(tree); 72 64 73 65 // When shadow element is detached, shadow tree should be recreated to re-calculate selector for 74 66 // other insertion points. 75 root->tree()->setNeedsReattachHostChildrenAndShadow();67 tree->setNeedsReattachHostChildrenAndShadow(); 76 68 } 77 69 … … 92 84 } 93 85 86 inline void InsertionPoint::distributeHostChildren(ShadowTree* tree) 87 { 88 HTMLContentSelector* selector = tree->ensureSelector(); 89 selector->unselect(&m_selections); 90 selector->select(this, &m_selections); 91 } 92 93 inline void InsertionPoint::clearDistribution(ShadowTree* tree) 94 { 95 if (HTMLContentSelector* selector = tree->selector()) 96 selector->unselect(&m_selections); 97 } 98 99 inline void InsertionPoint::attachDistributedNode() 100 { 101 for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next()) 102 selection->node()->attach(); 103 } 104 94 105 } // namespace WebCore -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r109718 r109864 55 55 virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE; 56 56 57 private: 58 void distributeHostChildren(ShadowTree*); 59 void clearDistribution(ShadowTree*); 60 void attachDistributedNode(); 61 57 62 HTMLContentSelectionList m_selections; 58 63 };
Note: See TracChangeset
for help on using the changeset viewer.