Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: Source/core/rendering/FastTextAutosizer.cpp

Issue 145003009: Autosize list markers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tot
Patch Set: Update TestExpectations. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/FastTextAutosizer.h ('k') | Source/core/rendering/RenderListItem.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/FastTextAutosizer.cpp
diff --git a/Source/core/rendering/FastTextAutosizer.cpp b/Source/core/rendering/FastTextAutosizer.cpp
index 67af9964492e2bab099d41c2ffe2ceef3775e8ce..68fd7effedc044c0991ba10a67419411c41cc50b 100644
--- a/Source/core/rendering/FastTextAutosizer.cpp
+++ b/Source/core/rendering/FastTextAutosizer.cpp
@@ -38,6 +38,8 @@
#include "core/page/Page.h"
#include "core/rendering/InlineIterator.h"
#include "core/rendering/RenderBlock.h"
+#include "core/rendering/RenderListItem.h"
+#include "core/rendering/RenderListMarker.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/TextAutosizer.h"
@@ -95,6 +97,28 @@ void FastTextAutosizer::beginLayout(RenderBlock* block)
inflate(block);
}
+void FastTextAutosizer::inflateListItem(RenderListItem* listItem, RenderListMarker* listItemMarker)
+{
+ if (!enabled())
+ return;
+#ifndef NDEBUG
+ m_blocksThatHaveBegunLayout.add(listItem);
+#endif
+
+ Cluster* cluster = currentCluster();
+ // FIXME: Why is this check needed?
+ if (!cluster)
+ return;
+
+ // 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(cluster);
+
+ applyMultiplier(listItem, multiplier);
+ applyMultiplier(listItemMarker, multiplier);
+}
+
void FastTextAutosizer::endLayout(RenderBlock* block)
{
if (!enabled())
@@ -302,6 +326,7 @@ 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;
}
@@ -354,6 +379,11 @@ const RenderBlock* FastTextAutosizer::deepestBlockContainingAllText(Cluster* clu
const RenderObject* FastTextAutosizer::findTextLeaf(const RenderObject* parent, size_t& depth, TextLeafSearch firstOrLast)
{
+ // List items are treated as text due to the marker.
+ // The actual renderer for the marker (RenderListMarker) may not be in the tree yet since it is added during layout.
+ if (parent->isListItem())
+ return parent;
+
if (parent->isEmpty())
return parent->isText() ? parent : 0;
« no previous file with comments | « Source/core/rendering/FastTextAutosizer.h ('k') | Source/core/rendering/RenderListItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698