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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 case PROCESSING_INSTRUCTION_NODE: | 154 case PROCESSING_INSTRUCTION_NODE: |
155 case COMMENT_NODE: | 155 case COMMENT_NODE: |
156 case TEXT_NODE: | 156 case TEXT_NODE: |
157 case CDATA_SECTION_NODE: | 157 case CDATA_SECTION_NODE: |
158 return true; | 158 return true; |
159 default: | 159 default: |
160 return false; | 160 return false; |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
| 164 InsertionPoint* ShadowRoot::shadowInsertionPoint() const |
| 165 { |
| 166 ASSERT(!owner()->needsDistributionRecalc()); |
| 167 if (isOldest()) |
| 168 return 0; |
| 169 return olderShadowRoot()->shadowInsertionPointOfYoungerShadowRoot(); |
| 170 } |
| 171 |
164 void ShadowRoot::recalcStyle(StyleRecalcChange change) | 172 void ShadowRoot::recalcStyle(StyleRecalcChange change) |
165 { | 173 { |
166 // ShadowRoot doesn't support custom callbacks. | 174 // ShadowRoot doesn't support custom callbacks. |
167 ASSERT(!hasCustomStyleCallbacks()); | 175 ASSERT(!hasCustomStyleCallbacks()); |
168 | 176 |
169 StyleResolver& styleResolver = document().ensureStyleResolver(); | 177 StyleResolver& styleResolver = document().ensureStyleResolver(); |
170 styleResolver.pushParentShadowRoot(*this); | 178 styleResolver.pushParentShadowRoot(*this); |
171 | 179 |
172 if (styleChangeType() >= SubtreeStyleChange) | 180 if (styleChangeType() >= SubtreeStyleChange) |
173 change = Force; | 181 change = Force; |
174 | 182 |
175 // There's no style to update so just calling recalcStyle means we're update
d. | 183 // There's no style to update so just calling recalcStyle means we're update
d. |
176 clearNeedsStyleRecalc(); | 184 clearNeedsStyleRecalc(); |
177 | 185 |
178 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl
e does. | 186 // FIXME: This doesn't handle :hover + div properly like Element::recalcStyl
e does. |
179 Text* lastTextNode = 0; | 187 Text* lastTextNode = 0; |
| 188 InsertionPoint* shadowInsertionPointInShadowTree = shadowInsertionPoint(); |
180 for (Node* child = lastChild(); child; child = child->previousSibling()) { | 189 for (Node* child = lastChild(); child; child = child->previousSibling()) { |
181 if (child->isTextNode()) { | 190 if (child->isTextNode()) { |
182 toText(child)->recalcTextStyle(change, lastTextNode); | 191 toText(child)->recalcTextStyle(change, lastTextNode); |
183 lastTextNode = toText(child); | 192 lastTextNode = toText(child); |
184 } else if (child->isElementNode()) { | 193 } else if (child->isElementNode()) { |
185 if (shouldRecalcStyle(change, child)) | 194 if (shouldRecalcStyle(change, child)) |
186 toElement(child)->recalcStyle(change, lastTextNode); | 195 toElement(child)->recalcStyle(change, lastTextNode, shadowInsert
ionPointInShadowTree); |
187 if (child->renderer()) | 196 if (child->renderer()) |
188 lastTextNode = 0; | 197 lastTextNode = 0; |
189 } | 198 } |
190 } | 199 } |
191 | 200 |
192 styleResolver.popParentShadowRoot(*this); | 201 styleResolver.popParentShadowRoot(*this); |
193 | 202 |
194 clearChildNeedsStyleRecalc(); | 203 clearChildNeedsStyleRecalc(); |
195 } | 204 } |
196 | 205 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 419 |
411 StyleSheetList* ShadowRoot::styleSheets() | 420 StyleSheetList* ShadowRoot::styleSheets() |
412 { | 421 { |
413 if (!ensureShadowRootRareData()->styleSheets()) | 422 if (!ensureShadowRootRareData()->styleSheets()) |
414 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 423 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
415 | 424 |
416 return m_shadowRootRareData->styleSheets(); | 425 return m_shadowRootRareData->styleSheets(); |
417 } | 426 } |
418 | 427 |
419 } | 428 } |
OLD | NEW |