| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 for ( ; i < m_distribution.size(); ++i) | 85 for ( ; i < m_distribution.size(); ++i) |
| 86 m_distribution.at(i)->lazyReattachIfAttached(); | 86 m_distribution.at(i)->lazyReattachIfAttached(); |
| 87 | 87 |
| 88 for ( ; j < distribution.size(); ++j) | 88 for ( ; j < distribution.size(); ++j) |
| 89 distribution.at(j)->lazyReattachIfAttached(); | 89 distribution.at(j)->lazyReattachIfAttached(); |
| 90 | 90 |
| 91 m_distribution.swap(distribution); | 91 m_distribution.swap(distribution); |
| 92 m_distribution.shrinkToFit(); | 92 m_distribution.shrinkToFit(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void InsertionPoint::attach(const AttachContext& context) | 95 void InsertionPoint::attachDistribution(const AttachContext& context) |
| 96 { | 96 { |
| 97 // We need to attach the distribution here so that they're inserted in the r
ight order | 97 // We need to attach the distribution here so that they're inserted in the r
ight order |
| 98 // otherwise the n^2 protection inside RenderTreeBuilder will cause them to
be | 98 // otherwise the n^2 protection inside RenderTreeBuilder will cause them to
be |
| 99 // inserted in the wrong place later. This also lets distributed nodes benef
it from | 99 // inserted in the wrong place later. This also lets distributed nodes benef
it from |
| 100 // the n^2 protection. | 100 // the n^2 protection. |
| 101 for (size_t i = 0; i < m_distribution.size(); ++i) { | 101 for (size_t i = 0; i < m_distribution.size(); ++i) { |
| 102 if (m_distribution.at(i)->needsAttach()) | 102 if (m_distribution.at(i)->needsAttach()) |
| 103 m_distribution.at(i)->attach(context); | 103 m_distribution.at(i)->attach(context); |
| 104 } | 104 } |
| 105 | |
| 106 HTMLElement::attach(context); | |
| 107 } | 105 } |
| 108 | 106 |
| 109 void InsertionPoint::detach(const AttachContext& context) | 107 void InsertionPoint::detachDistribution(const AttachContext& context) |
| 110 { | 108 { |
| 111 for (size_t i = 0; i < m_distribution.size(); ++i) | 109 for (size_t i = 0; i < m_distribution.size(); ++i) |
| 112 m_distribution.at(i)->lazyReattachIfAttached(); | 110 m_distribution.at(i)->lazyReattachIfAttached(); |
| 113 | |
| 114 HTMLElement::detach(context); | |
| 115 } | 111 } |
| 116 | 112 |
| 117 void InsertionPoint::willRecalcStyle(StyleRecalcChange change) | 113 void InsertionPoint::willRecalcStyle(StyleRecalcChange change) |
| 118 { | 114 { |
| 119 if (change < Inherit) | 115 if (change < Inherit) |
| 120 return; | 116 return; |
| 121 for (size_t i = 0; i < m_distribution.size(); ++i) | 117 for (size_t i = 0; i < m_distribution.size(); ++i) |
| 122 m_distribution.at(i)->setNeedsStyleRecalc(SubtreeStyleChange); | 118 m_distribution.at(i)->setNeedsStyleRecalc(SubtreeStyleChange); |
| 123 } | 119 } |
| 124 | 120 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if (!insertionPoints) | 242 if (!insertionPoints) |
| 247 return; | 243 return; |
| 248 for (size_t i = 0; i < insertionPoints->size(); ++i) | 244 for (size_t i = 0; i < insertionPoints->size(); ++i) |
| 249 results.append(insertionPoints->at(i).get()); | 245 results.append(insertionPoints->at(i).get()); |
| 250 ASSERT(current != insertionPoints->last().get()); | 246 ASSERT(current != insertionPoints->last().get()); |
| 251 current = insertionPoints->last().get(); | 247 current = insertionPoints->last().get(); |
| 252 } | 248 } |
| 253 } | 249 } |
| 254 | 250 |
| 255 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |