Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: Source/core/dom/shadow/ElementShadow.cpp

Issue 16951003: Fix broken AttachContext from r152289 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unwanted comments and passed context to Shadow DOM elements Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 oldRoot->setParentOrShadowHostNode(0); 71 oldRoot->setParentOrShadowHostNode(0);
72 oldRoot->setParentTreeScope(shadowHost->document()); 72 oldRoot->setParentTreeScope(shadowHost->document());
73 oldRoot->setPrev(0); 73 oldRoot->setPrev(0);
74 oldRoot->setNext(0); 74 oldRoot->setNext(0);
75 ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get()); 75 ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get());
76 } 76 }
77 77
78 m_distributor.invalidateDistribution(shadowHost); 78 m_distributor.invalidateDistribution(shadowHost);
79 } 79 }
80 80
81 void ElementShadow::attach() 81 void ElementShadow::attach(const Node::AttachContext& context)
82 { 82 {
83 ContentDistributor::ensureDistribution(youngestShadowRoot()); 83 ContentDistributor::ensureDistribution(youngestShadowRoot());
84 84
85 Node::AttachContext childrenContext(context);
86 childrenContext.resolvedStyle = 0;
87
85 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) { 88 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) {
86 if (!root->attached()) 89 if (!root->attached())
87 root->attach(); 90 root->attach(childrenContext);
88 } 91 }
89 } 92 }
90 93
91 void ElementShadow::detach() 94 void ElementShadow::detach(const Node::AttachContext& context)
92 { 95 {
96 Node::AttachContext childrenContext(context);
97 childrenContext.resolvedStyle = 0;
98
93 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) { 99 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) {
94 if (root->attached()) 100 if (root->attached())
95 root->detach(); 101 root->detach(childrenContext);
96 } 102 }
97 } 103 }
98 104
99 bool ElementShadow::childNeedsStyleRecalc() const 105 bool ElementShadow::childNeedsStyleRecalc() const
100 { 106 {
101 ASSERT(youngestShadowRoot()); 107 ASSERT(youngestShadowRoot());
102 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) 108 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root())
103 if (root->childNeedsStyleRecalc()) 109 if (root->childNeedsStyleRecalc())
104 return true; 110 return true;
105 111
(...skipping 30 matching lines...) Expand all
136 info.addMember(m_shadowRoots, "shadowRoots"); 142 info.addMember(m_shadowRoots, "shadowRoots");
137 ShadowRoot* shadowRoot = m_shadowRoots.head(); 143 ShadowRoot* shadowRoot = m_shadowRoots.head();
138 while (shadowRoot) { 144 while (shadowRoot) {
139 info.addMember(shadowRoot, "shadowRoot"); 145 info.addMember(shadowRoot, "shadowRoot");
140 shadowRoot = shadowRoot->next(); 146 shadowRoot = shadowRoot->next();
141 } 147 }
142 info.addMember(m_distributor, "distributor"); 148 info.addMember(m_distributor, "distributor");
143 } 149 }
144 150
145 } // namespace 151 } // namespace
OLDNEW
« Source/core/dom/shadow/ElementShadow.h ('K') | « Source/core/dom/shadow/ElementShadow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698