| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 for ( ; j < distributedNodes.size(); ++j) | 91 for ( ; j < distributedNodes.size(); ++j) |
| 92 distributedNodes.at(j)->lazyReattachIfAttached(); | 92 distributedNodes.at(j)->lazyReattachIfAttached(); |
| 93 | 93 |
| 94 m_distributedNodes.swap(distributedNodes); | 94 m_distributedNodes.swap(distributedNodes); |
| 95 // Deallocate a Vector and a HashMap explicitly so that | 95 // Deallocate a Vector and a HashMap explicitly so that |
| 96 // Oilpan can recycle them without an intervening GC. | 96 // Oilpan can recycle them without an intervening GC. |
| 97 distributedNodes.clear(); | 97 distributedNodes.clear(); |
| 98 m_distributedNodes.shrinkToFit(); | 98 m_distributedNodes.shrinkToFit(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void InsertionPoint::attach(const AttachContext& context) | 101 void InsertionPoint::attachLayoutTree(const AttachContext& context) |
| 102 { | 102 { |
| 103 // We need to attach the distribution here so that they're inserted in the r
ight order | 103 // We need to attach the distribution here so that they're inserted in the r
ight order |
| 104 // otherwise the n^2 protection inside LayoutTreeBuilder will cause them to
be | 104 // otherwise the n^2 protection inside LayoutTreeBuilder will cause them to
be |
| 105 // inserted in the wrong place later. This also lets distributed nodes benef
it from | 105 // inserted in the wrong place later. This also lets distributed nodes benef
it from |
| 106 // the n^2 protection. | 106 // the n^2 protection. |
| 107 for (size_t i = 0; i < m_distributedNodes.size(); ++i) { | 107 for (size_t i = 0; i < m_distributedNodes.size(); ++i) { |
| 108 if (m_distributedNodes.at(i)->needsAttach()) | 108 if (m_distributedNodes.at(i)->needsAttach()) |
| 109 m_distributedNodes.at(i)->attach(context); | 109 m_distributedNodes.at(i)->attachLayoutTree(context); |
| 110 } | 110 } |
| 111 | 111 |
| 112 HTMLElement::attach(context); | 112 HTMLElement::attachLayoutTree(context); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void InsertionPoint::detach(const AttachContext& context) | 115 void InsertionPoint::detach(const AttachContext& context) |
| 116 { | 116 { |
| 117 for (size_t i = 0; i < m_distributedNodes.size(); ++i) | 117 for (size_t i = 0; i < m_distributedNodes.size(); ++i) |
| 118 m_distributedNodes.at(i)->lazyReattachIfAttached(); | 118 m_distributedNodes.at(i)->lazyReattachIfAttached(); |
| 119 | 119 |
| 120 HTMLElement::detach(context); | 120 HTMLElement::detach(context); |
| 121 } | 121 } |
| 122 | 122 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (!insertionPoints) | 285 if (!insertionPoints) |
| 286 return; | 286 return; |
| 287 for (size_t i = 0; i < insertionPoints->size(); ++i) | 287 for (size_t i = 0; i < insertionPoints->size(); ++i) |
| 288 results.append(insertionPoints->at(i).get()); | 288 results.append(insertionPoints->at(i).get()); |
| 289 DCHECK_NE(current, insertionPoints->last().get()); | 289 DCHECK_NE(current, insertionPoints->last().get()); |
| 290 current = insertionPoints->last().get(); | 290 current = insertionPoints->last().get(); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |