Chromium Code Reviews| Index: Source/core/layout/TextAutosizer.cpp |
| diff --git a/Source/core/layout/TextAutosizer.cpp b/Source/core/layout/TextAutosizer.cpp |
| index df61cc09e5580bb6d575768d6a6483137771df93..b2c19d5f397c7171755c0758e27ce39b3796fcc9 100644 |
| --- a/Source/core/layout/TextAutosizer.cpp |
| +++ b/Source/core/layout/TextAutosizer.cpp |
| @@ -143,13 +143,17 @@ static bool isPotentialClusterRoot(const LayoutObject* layoutObject) |
| { |
| // "Potential cluster roots" are the smallest unit for which we can |
| // enable/disable text autosizing. |
| + // - Must have children. |
| + // An exception is made for LayoutView which should create a root to |
| + // maintain consistency with documents that have no child nodes but may |
| + // still have LayoutObject children. |
| // - Must not be inline, as different multipliers on one line looks terrible. |
| // Exceptions are inline-block and alike elements (inline-table, -webkit-inline-*), |
| // as they often contain entire multi-line columns of text. |
| // - Must not be normal list items, as items in the same list should look |
| // consistent, unless they are floating or position:absolute/fixed. |
| Node* node = layoutObject->generatingNode(); |
| - if (node && !node->hasChildren()) |
| + if (node && !node->hasChildren() && !layoutObject->isLayoutView()) |
|
mstensho (USE GERRIT)
2015/08/24 10:55:10
Not really a problem with your change here, but I
pdr.
2015/08/24 17:43:28
That's a good question and it's non-obvious.
The
skobes
2015/08/24 17:47:57
The LayoutView is special because it needs to be a
mstensho (USE GERRIT)
2015/08/24 17:51:49
So it's actually called during layout tree buildin
skobes
2015/08/24 17:57:37
It's called during layout. If I'm reading the bug
|
| return false; |
| if (!layoutObject->isLayoutBlock()) |
| return false; |
| @@ -315,7 +319,7 @@ void TextAutosizer::destroy(const LayoutBlock* block) |
| // LayoutBlock with a fingerprint was destroyed during layout. |
| // Clear the cluster stack and the supercluster map to avoid stale pointers. |
| // Speculative fix for http://crbug.com/369485. |
| - m_firstBlockToBeginLayout = 0; |
| + m_firstBlockToBeginLayout = nullptr; |
| m_clusterStack.clear(); |
| m_superclusters.clear(); |
| } |
| @@ -362,9 +366,13 @@ void TextAutosizer::beginLayout(LayoutBlock* block) |
| if (prepareForLayout(block) == StopLayout) |
| return; |
| + ASSERT(!m_clusterStack.isEmpty() || block->isLayoutView()); |
| + |
| if (Cluster* cluster = maybeCreateCluster(block)) |
| m_clusterStack.append(adoptPtr(cluster)); |
| + ASSERT(!m_clusterStack.isEmpty()); |
| + |
| // Cells in auto-layout tables are handled separately by inflateAutoTable. |
| bool isAutoTableCell = block->isTableCell() && !toLayoutTableCell(block)->table()->style()->isFixedTableLayout(); |
| if (!isAutoTableCell && !m_clusterStack.isEmpty()) |
| @@ -404,7 +412,7 @@ void TextAutosizer::endLayout(LayoutBlock* block) |
| ASSERT(shouldHandleLayout()); |
| if (block == m_firstBlockToBeginLayout) { |
| - m_firstBlockToBeginLayout = 0; |
| + m_firstBlockToBeginLayout = nullptr; |
| m_clusterStack.clear(); |
| m_superclusters.clear(); |
| m_stylesRetainedDuringLayout.clear(); |