| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 ASSERT(!hasCustomStyleCallbacks()); | 164 ASSERT(!hasCustomStyleCallbacks()); |
| 165 | 165 |
| 166 StyleResolver* styleResolver = document().styleResolver(); | 166 StyleResolver* styleResolver = document().styleResolver(); |
| 167 styleResolver->pushParentShadowRoot(*this); | 167 styleResolver->pushParentShadowRoot(*this); |
| 168 | 168 |
| 169 if (!attached()) { | 169 if (!attached()) { |
| 170 attach(); | 170 attach(); |
| 171 return; | 171 return; |
| 172 } | 172 } |
| 173 | 173 |
| 174 // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll ne
ed | 174 // When we're set to scheduleRenderTreeCreation we'll have a SubtreeStyleCha
nge and we'll need |
| 175 // to promote the change to a Force for all our descendants so they get a | 175 // to promote the change to a Force for all our descendants so they get a |
| 176 // recalc and will attach. | 176 // recalc and will attach. |
| 177 if (styleChangeType() >= SubtreeStyleChange) | 177 if (styleChangeType() >= SubtreeStyleChange) |
| 178 change = Force; | 178 change = Force; |
| 179 | 179 |
| 180 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl
e does. | 180 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl
e does. |
| 181 bool forceReattachOfAnyWhitespaceSibling = false; | 181 bool forceReattachOfAnyWhitespaceSibling = false; |
| 182 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 182 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 183 bool didReattach = false; | 183 bool didReattach = false; |
| 184 | 184 |
| 185 if (child->renderer()) | 185 if (child->renderer()) |
| 186 forceReattachOfAnyWhitespaceSibling = false; | 186 forceReattachOfAnyWhitespaceSibling = false; |
| 187 | 187 |
| 188 if (child->isTextNode()) { | 188 if (child->isTextNode()) { |
| 189 if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOn
lyWhitespace()) | 189 if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOn
lyWhitespace()) |
| 190 child->reattach(); | 190 child->recreateRenderTree(); |
| 191 else | 191 else |
| 192 didReattach = toText(child)->recalcTextStyle(change); | 192 didReattach = toText(child)->recalcTextStyle(change); |
| 193 } else if (child->isElementNode() && shouldRecalcStyle(change, child)) { | 193 } else if (child->isElementNode() && shouldRecalcStyle(change, child)) { |
| 194 didReattach = toElement(child)->recalcStyle(change); | 194 didReattach = toElement(child)->recalcStyle(change); |
| 195 } | 195 } |
| 196 | 196 |
| 197 forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyW
hitespaceSibling; | 197 forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyW
hitespaceSibling; |
| 198 } | 198 } |
| 199 | 199 |
| 200 styleResolver->popParentShadowRoot(*this); | 200 styleResolver->popParentShadowRoot(*this); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (value == m_resetStyleInheritance) | 244 if (value == m_resetStyleInheritance) |
| 245 return; | 245 return; |
| 246 | 246 |
| 247 m_resetStyleInheritance = value; | 247 m_resetStyleInheritance = value; |
| 248 if (!isActive()) | 248 if (!isActive()) |
| 249 return; | 249 return; |
| 250 | 250 |
| 251 setNeedsStyleRecalc(); | 251 setNeedsStyleRecalc(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void ShadowRoot::attach(const AttachContext& context) | 254 void ShadowRoot::createRenderTree(const AttachContext& context) |
| 255 { | 255 { |
| 256 StyleResolver* styleResolver = document().styleResolver(); | 256 StyleResolver* styleResolver = document().styleResolver(); |
| 257 styleResolver->pushParentShadowRoot(*this); | 257 styleResolver->pushParentShadowRoot(*this); |
| 258 DocumentFragment::attach(context); | 258 DocumentFragment::createRenderTree(context); |
| 259 styleResolver->popParentShadowRoot(*this); | 259 styleResolver->popParentShadowRoot(*this); |
| 260 } | 260 } |
| 261 | 261 |
| 262 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser
tionPoint) | 262 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser
tionPoint) |
| 263 { | 263 { |
| 264 DocumentFragment::insertedInto(insertionPoint); | 264 DocumentFragment::insertedInto(insertionPoint); |
| 265 | 265 |
| 266 if (!insertionPoint->inDocument() || !isOldest()) | 266 if (!insertionPoint->inDocument() || !isOldest()) |
| 267 return InsertionDone; | 267 return InsertionDone; |
| 268 | 268 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (element->isInsertionPoint()) | 405 if (element->isInsertionPoint()) |
| 406 insertionPoints.append(toInsertionPoint(element)); | 406 insertionPoints.append(toInsertionPoint(element)); |
| 407 } | 407 } |
| 408 | 408 |
| 409 ensureShadowRootRareData()->setChildInsertionPoints(insertionPoints); | 409 ensureShadowRootRareData()->setChildInsertionPoints(insertionPoints); |
| 410 | 410 |
| 411 return m_shadowRootRareData->childInsertionPoints(); | 411 return m_shadowRootRareData->childInsertionPoints(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } | 414 } |
| OLD | NEW |