| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 { | 147 { |
| 148 if (!canBeActive()) | 148 if (!canBeActive()) |
| 149 return false; | 149 return false; |
| 150 ShadowRoot* shadowRoot = containingShadowRoot(); | 150 ShadowRoot* shadowRoot = containingShadowRoot(); |
| 151 if (!shadowRoot) | 151 if (!shadowRoot) |
| 152 return false; | 152 return false; |
| 153 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount(
) <= 1) | 153 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount(
) <= 1) |
| 154 return true; | 154 return true; |
| 155 | 155 |
| 156 // Slow path only when there are more than one shadow elements in a shadow t
ree. That should be a rare case. | 156 // Slow path only when there are more than one shadow elements in a shadow t
ree. That should be a rare case. |
| 157 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> >& insertionPoints
= shadowRoot->descendantInsertionPoints(); | 157 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& insertionPoints
= shadowRoot->descendantInsertionPoints(); |
| 158 for (size_t i = 0; i < insertionPoints.size(); ++i) { | 158 for (size_t i = 0; i < insertionPoints.size(); ++i) { |
| 159 InsertionPoint* point = insertionPoints[i].get(); | 159 InsertionPoint* point = insertionPoints[i].get(); |
| 160 if (isHTMLShadowElement(*point)) | 160 if (isHTMLShadowElement(*point)) |
| 161 return point == this; | 161 return point == this; |
| 162 } | 162 } |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool InsertionPoint::isShadowInsertionPoint() const | 166 bool InsertionPoint::isShadowInsertionPoint() const |
| 167 { | 167 { |
| 168 return isHTMLShadowElement(*this) && isActive(); | 168 return isHTMLShadowElement(*this) && isActive(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool InsertionPoint::isContentInsertionPoint() const | 171 bool InsertionPoint::isContentInsertionPoint() const |
| 172 { | 172 { |
| 173 return isHTMLContentElement(*this) && isActive(); | 173 return isHTMLContentElement(*this) && isActive(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 PassRefPtrWillBeRawPtr<StaticNodeList> InsertionPoint::getDistributedNodes() | 176 PassRefPtrWillBeRawPtr<StaticNodeList> InsertionPoint::getDistributedNodes() |
| 177 { | 177 { |
| 178 updateDistribution(); | 178 updateDistribution(); |
| 179 | 179 |
| 180 WillBeHeapVector<RefPtrWillBeMember<Node> > nodes; | 180 WillBeHeapVector<RefPtrWillBeMember<Node>> nodes; |
| 181 nodes.reserveInitialCapacity(m_distribution.size()); | 181 nodes.reserveInitialCapacity(m_distribution.size()); |
| 182 for (size_t i = 0; i < m_distribution.size(); ++i) | 182 for (size_t i = 0; i < m_distribution.size(); ++i) |
| 183 nodes.uncheckedAppend(m_distribution.at(i)); | 183 nodes.uncheckedAppend(m_distribution.at(i)); |
| 184 | 184 |
| 185 return StaticNodeList::adopt(nodes); | 185 return StaticNodeList::adopt(nodes); |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool InsertionPoint::layoutObjectIsNeeded(const LayoutStyle& style) | 188 bool InsertionPoint::layoutObjectIsNeeded(const LayoutStyle& style) |
| 189 { | 189 { |
| 190 return !isActive() && HTMLElement::layoutObjectIsNeeded(style); | 190 return !isActive() && HTMLElement::layoutObjectIsNeeded(style); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if (!insertionPoints) | 287 if (!insertionPoints) |
| 288 return; | 288 return; |
| 289 for (size_t i = 0; i < insertionPoints->size(); ++i) | 289 for (size_t i = 0; i < insertionPoints->size(); ++i) |
| 290 results.append(insertionPoints->at(i).get()); | 290 results.append(insertionPoints->at(i).get()); |
| 291 ASSERT(current != insertionPoints->last().get()); | 291 ASSERT(current != insertionPoints->last().get()); |
| 292 current = insertionPoints->last().get(); | 292 current = insertionPoints->last().get(); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace blink | 296 } // namespace blink |
| OLD | NEW |