Index: Source/core/rendering/FastTextAutosizer.cpp |
diff --git a/Source/core/rendering/FastTextAutosizer.cpp b/Source/core/rendering/FastTextAutosizer.cpp |
index 58c860cfccbaada09658da31a96483203f7d201e..04694e00f2dc9dc4c146a5c78b1ff301504ec3bc 100644 |
--- a/Source/core/rendering/FastTextAutosizer.cpp |
+++ b/Source/core/rendering/FastTextAutosizer.cpp |
@@ -97,6 +97,23 @@ void FastTextAutosizer::beginLayout(RenderBlock* block) |
inflate(block); |
} |
+void FastTextAutosizer::inflateListItem(RenderBlock* listItem, RenderObject* listItemMarker) |
+{ |
+ ASSERT(listItem->isListItem()); |
+ ASSERT(listItemMarker->isListMarker()); |
+ |
+ if (!enabled()) |
+ return; |
+ |
pdr.
2014/01/28 04:50:47
currentCluster() can be null here. Probably want t
skobes
2014/01/29 00:13:29
Done, with FIXME to investigate further.
|
+ // Force the LI to be inside the DBCAT when computing the multiplier. |
+ // This guarantees that the DBCAT has entered layout, so we can ask for its width. |
+ // It also makes sense because the list marker is autosized like a text node. |
+ float multiplier = clusterMultiplier(currentCluster(), listItem); |
pdr.
2014/01/28 04:50:47
I like the idea here except for passing listItem i
skobes
2014/01/29 00:13:29
Fixed.
|
+ |
+ applyMultiplier(listItem, multiplier); |
+ applyMultiplier(listItemMarker, multiplier); |
+} |
+ |
void FastTextAutosizer::endLayout(RenderBlock* block) |
{ |
if (!enabled()) |
@@ -277,15 +294,16 @@ const RenderBlock* FastTextAutosizer::deepestCommonAncestor(BlockSet& blocks) |
return 0; |
} |
-float FastTextAutosizer::clusterMultiplier(Cluster* cluster) |
+float FastTextAutosizer::clusterMultiplier(Cluster* cluster, const RenderBlock* forceInclude) |
{ |
#ifndef NDEBUG |
ASSERT(m_renderViewInfoPrepared); |
#endif |
if (!cluster->m_multiplier) { |
if (TextAutosizer::isIndependentDescendant(cluster->m_root)) { |
- if (clusterHasEnoughTextToAutosize(cluster)) { |
- const RenderBlock* deepestBlockContainingAllText = findDeepestBlockContainingAllText(cluster->m_root); |
+ bool enoughText = clusterHasEnoughTextToAutosize(cluster); |
+ if (enoughText) { |
+ const RenderBlock* deepestBlockContainingAllText = findDeepestBlockContainingAllText(cluster->m_root, forceInclude); |
#ifndef NDEBUG |
// This ensures the deepest block containing all text has a valid contentLogicalWidth. |
ASSERT(m_blocksThatHaveBegunLayout.contains(deepestBlockContainingAllText)); |
@@ -301,12 +319,13 @@ float FastTextAutosizer::clusterMultiplier(Cluster* cluster) |
cluster->m_multiplier = cluster->m_parent ? clusterMultiplier(cluster->m_parent) : 1.0f; |
} |
} |
+ ASSERT(cluster->m_multiplier); |
return cluster->m_multiplier; |
} |
// FIXME: Refactor this to look more like FastTextAutosizer::deepestCommonAncestor. This is copied |
// from TextAutosizer::findDeepestBlockContainingAllText. |
-const RenderBlock* FastTextAutosizer::findDeepestBlockContainingAllText(const RenderBlock* root) |
+const RenderBlock* FastTextAutosizer::findDeepestBlockContainingAllText(const RenderBlock* root, const RenderBlock* forceInclude) |
{ |
size_t firstDepth = 0; |
const RenderObject* firstTextLeaf = findTextLeaf(root, firstDepth, First); |
@@ -345,6 +364,15 @@ const RenderBlock* FastTextAutosizer::findDeepestBlockContainingAllText(const Re |
const RenderBlock* containingBlock = firstNode->containingBlock(); |
ASSERT(containingBlock->isDescendantOf(root)); |
+ if (forceInclude && !forceInclude->isDescendantOf(containingBlock)) { |
+ ASSERT(forceInclude->isDescendantOf(root)); |
+ |
+ BlockSet blockSet; |
+ blockSet.add(containingBlock); |
+ blockSet.add(forceInclude); |
+ return deepestCommonAncestor(blockSet); |
+ } |
+ |
return containingBlock; |
} |