OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // This can happen with paginated overflow. | 129 // This can happen with paginated overflow. |
130 return; | 130 return; |
131 } | 131 } |
132 | 132 |
133 if (Cluster* cluster = maybeCreateCluster(block)) { | 133 if (Cluster* cluster = maybeCreateCluster(block)) { |
134 m_clusterStack.append(adoptPtr(cluster)); | 134 m_clusterStack.append(adoptPtr(cluster)); |
135 if (block->isTable()) | 135 if (block->isTable()) |
136 inflateTable(toRenderTable(block)); | 136 inflateTable(toRenderTable(block)); |
137 } | 137 } |
138 | 138 |
139 if (block->childrenInline()) | 139 if (block->childrenInline() && block->firstChild()) |
140 inflate(block); | 140 inflate(block); |
141 } | 141 } |
142 | 142 |
143 void FastTextAutosizer::inflateListItem(RenderListItem* listItem, RenderListMark
er* listItemMarker) | 143 void FastTextAutosizer::inflateListItem(RenderListItem* listItem, RenderListMark
er* listItemMarker) |
144 { | 144 { |
145 if (!enabled()) | 145 if (!enabled()) |
146 return; | 146 return; |
147 ASSERT(listItem && listItemMarker); | 147 ASSERT(listItem && listItemMarker); |
148 #ifndef NDEBUG | 148 #ifndef NDEBUG |
149 m_blocksThatHaveBegunLayout.add(listItem); | 149 m_blocksThatHaveBegunLayout.add(listItem); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 void FastTextAutosizer::endLayout(RenderBlock* block) | 197 void FastTextAutosizer::endLayout(RenderBlock* block) |
198 { | 198 { |
199 ASSERT(enabled()); | 199 ASSERT(enabled()); |
200 | 200 |
201 if (currentCluster()->m_root == block) | |
202 m_clusterStack.removeLast(); | |
203 | |
204 if (block == m_firstBlock) { | 201 if (block == m_firstBlock) { |
205 m_firstBlock = 0; | 202 m_firstBlock = 0; |
206 m_clusterStack.clear(); | 203 m_clusterStack.clear(); |
207 m_superclusters.clear(); | 204 m_superclusters.clear(); |
208 #ifndef NDEBUG | 205 #ifndef NDEBUG |
209 m_blocksThatHaveBegunLayout.clear(); | 206 m_blocksThatHaveBegunLayout.clear(); |
210 #endif | 207 #endif |
| 208 } else if (currentCluster()->m_root == block) { |
| 209 m_clusterStack.removeLast(); |
211 } | 210 } |
212 } | 211 } |
213 | 212 |
214 void FastTextAutosizer::inflate(RenderBlock* block) | 213 void FastTextAutosizer::inflate(RenderBlock* block) |
215 { | 214 { |
216 Cluster* cluster = currentCluster(); | 215 Cluster* cluster = currentCluster(); |
217 float multiplier = 0; | 216 float multiplier = 0; |
218 for (RenderObject* descendant = nextChildSkippingChildrenOfBlocks(block, blo
ck); descendant; descendant = nextChildSkippingChildrenOfBlocks(descendant, bloc
k)) { | 217 for (RenderObject* descendant = nextChildSkippingChildrenOfBlocks(block, blo
ck); descendant; descendant = nextChildSkippingChildrenOfBlocks(descendant, bloc
k)) { |
219 if (descendant->isText()) { | 218 if (descendant->isText()) { |
220 // We only calculate this multiplier on-demand to ensure the parent
block of this text | 219 // We only calculate this multiplier on-demand to ensure the parent
block of this text |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 696 } |
698 | 697 |
699 RenderObject* FastTextAutosizer::nextChildSkippingChildrenOfBlocks(const RenderO
bject* current, const RenderObject* stayWithin) | 698 RenderObject* FastTextAutosizer::nextChildSkippingChildrenOfBlocks(const RenderO
bject* current, const RenderObject* stayWithin) |
700 { | 699 { |
701 if (current == stayWithin || !current->isRenderBlock()) | 700 if (current == stayWithin || !current->isRenderBlock()) |
702 return current->nextInPreOrder(stayWithin); | 701 return current->nextInPreOrder(stayWithin); |
703 return current->nextInPreOrderAfterChildren(stayWithin); | 702 return current->nextInPreOrderAfterChildren(stayWithin); |
704 } | 703 } |
705 | 704 |
706 } // namespace WebCore | 705 } // namespace WebCore |
OLD | NEW |