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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (!canBeActive()) | 150 if (!canBeActive()) |
151 return false; | 151 return false; |
152 ShadowRoot* shadowRoot = containingShadowRoot(); | 152 ShadowRoot* shadowRoot = containingShadowRoot(); |
153 DCHECK(shadowRoot); | 153 DCHECK(shadowRoot); |
154 if (!isHTMLShadowElement(*this) || | 154 if (!isHTMLShadowElement(*this) || |
155 shadowRoot->descendantShadowElementCount() <= 1) | 155 shadowRoot->descendantShadowElementCount() <= 1) |
156 return true; | 156 return true; |
157 | 157 |
158 // Slow path only when there are more than one shadow elements in a shadow | 158 // Slow path only when there are more than one shadow elements in a shadow |
159 // tree. That should be a rare case. | 159 // tree. That should be a rare case. |
160 const HeapVector<Member<InsertionPoint>>& insertionPoints = | 160 for (const auto& point : shadowRoot->descendantInsertionPoints()) { |
161 shadowRoot->descendantInsertionPoints(); | |
162 for (size_t i = 0; i < insertionPoints.size(); ++i) { | |
163 InsertionPoint* point = insertionPoints[i].get(); | |
164 if (isHTMLShadowElement(*point)) | 161 if (isHTMLShadowElement(*point)) |
165 return point == this; | 162 return point == this; |
166 } | 163 } |
167 return true; | 164 return true; |
168 } | 165 } |
169 | 166 |
170 bool InsertionPoint::isShadowInsertionPoint() const { | 167 bool InsertionPoint::isShadowInsertionPoint() const { |
171 return isHTMLShadowElement(*this) && isActive(); | 168 return isHTMLShadowElement(*this) && isActive(); |
172 } | 169 } |
173 | 170 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (!insertionPoints) | 293 if (!insertionPoints) |
297 return; | 294 return; |
298 for (size_t i = 0; i < insertionPoints->size(); ++i) | 295 for (size_t i = 0; i < insertionPoints->size(); ++i) |
299 results.append(insertionPoints->at(i).get()); | 296 results.append(insertionPoints->at(i).get()); |
300 DCHECK_NE(current, insertionPoints->back().get()); | 297 DCHECK_NE(current, insertionPoints->back().get()); |
301 current = insertionPoints->back().get(); | 298 current = insertionPoints->back().get(); |
302 } | 299 } |
303 } | 300 } |
304 | 301 |
305 } // namespace blink | 302 } // namespace blink |
OLD | NEW |