| OLD | NEW |
| 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 bool InsertionPoint::shouldUseFallbackElements() const | 128 bool InsertionPoint::shouldUseFallbackElements() const |
| 129 { | 129 { |
| 130 return isActive() && !hasDistribution(); | 130 return isActive() && !hasDistribution(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool InsertionPoint::canBeActive() const | 133 bool InsertionPoint::canBeActive() const |
| 134 { | 134 { |
| 135 if (!isInShadowTree()) | 135 if (!isInShadowTree()) |
| 136 return false; | 136 return false; |
| 137 bool foundShadowElementInAncestors = false; | |
| 138 bool thisIsContentHTMLElement = hasTagName(contentTag); | |
| 139 for (Node* node = parentNode(); node; node = node->parentNode()) { | 137 for (Node* node = parentNode(); node; node = node->parentNode()) { |
| 140 if (node->isInsertionPoint()) { | 138 if (node->isInsertionPoint()) |
| 141 // For HTMLContentElement, at most one HTMLShadowElement may appear
in its ancestors. | 139 return false; |
| 142 if (thisIsContentHTMLElement && node->hasTagName(shadowTag) && !foun
dShadowElementInAncestors) | |
| 143 foundShadowElementInAncestors = true; | |
| 144 else | |
| 145 return false; | |
| 146 } | |
| 147 } | 140 } |
| 148 return true; | 141 return true; |
| 149 } | 142 } |
| 150 | 143 |
| 151 bool InsertionPoint::isActive() const | 144 bool InsertionPoint::isActive() const |
| 152 { | 145 { |
| 153 if (!canBeActive()) | 146 if (!canBeActive()) |
| 154 return false; | 147 return false; |
| 155 ShadowRoot* shadowRoot = containingShadowRoot(); | 148 ShadowRoot* shadowRoot = containingShadowRoot(); |
| 156 ASSERT(shadowRoot); | 149 ASSERT(shadowRoot); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 if (!insertionPoints) | 300 if (!insertionPoints) |
| 308 return; | 301 return; |
| 309 for (size_t i = 0; i < insertionPoints->size(); ++i) | 302 for (size_t i = 0; i < insertionPoints->size(); ++i) |
| 310 results.append(insertionPoints->at(i).get()); | 303 results.append(insertionPoints->at(i).get()); |
| 311 ASSERT(current != insertionPoints->last().get()); | 304 ASSERT(current != insertionPoints->last().get()); |
| 312 current = insertionPoints->last().get(); | 305 current = insertionPoints->last().get(); |
| 313 } | 306 } |
| 314 } | 307 } |
| 315 | 308 |
| 316 } // namespace WebCore | 309 } // namespace WebCore |
| OLD | NEW |