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

Unified Diff: Source/WebCore/rendering/TextAutosizer.cpp

Issue 12315083: Merge 142534 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/TextAutosizer.cpp
===================================================================
--- Source/WebCore/rendering/TextAutosizer.cpp (revision 143927)
+++ Source/WebCore/rendering/TextAutosizer.cpp (working copy)
@@ -37,6 +37,7 @@
#include <algorithm>
#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
namespace WebCore {
@@ -47,6 +48,7 @@
IntSize minLayoutSize;
};
+// Represents cluster related data. Instances should not persist between calls to processSubtree.
struct TextAutosizingClusterInfo {
explicit TextAutosizingClusterInfo(RenderBlock* root)
: root(root)
@@ -61,6 +63,10 @@
// Upper limit on the difference between the width of the cluster's block containing all
// text and that of a narrow child before the child becomes a separate cluster.
float maxAllowedDifferenceFromTextWidth;
+
+ // Descendants of the cluster that are narrower than the block containing all text and must be
+ // processed together.
+ Vector<TextAutosizingClusterInfo> narrowDescendants;
};
@@ -150,6 +156,12 @@
}
processContainer(multiplier, container, clusterInfo, subtreeRoot, windowInfo);
+
+ Vector<TextAutosizingClusterInfo>& narrowDescendants = clusterInfo.narrowDescendants;
+ for (size_t i = 0; i < narrowDescendants.size(); ++i) {
+ TextAutosizingClusterInfo& descendantClusterInfo = narrowDescendants[i];
+ processCluster(descendantClusterInfo, descendantClusterInfo.root, descendantClusterInfo.root, windowInfo);
+ }
}
void TextAutosizer::processContainer(float multiplier, RenderBlock* container, TextAutosizingClusterInfo& clusterInfo, RenderObject* subtreeRoot, const TextAutosizingWindowInfo& windowInfo)
@@ -168,9 +180,13 @@
// FIXME: Increase list marker size proportionately.
} else if (isAutosizingContainer(descendant)) {
RenderBlock* descendantBlock = toRenderBlock(descendant);
- if (isAutosizingCluster(descendantBlock, clusterInfo)) {
- TextAutosizingClusterInfo descendantClusterInfo(descendantBlock);
+ TextAutosizingClusterInfo descendantClusterInfo(descendantBlock);
+ if (isWiderDescendant(descendantBlock, clusterInfo) || isIndependentDescendant(descendantBlock))
processCluster(descendantClusterInfo, descendantBlock, descendantBlock, windowInfo);
+ else if (isNarrowDescendant(descendantBlock, clusterInfo)) {
+ // Narrow descendants are processed together later to be able to apply the same multiplier
+ // to each of them if necessary.
+ clusterInfo.narrowDescendants.append(descendantClusterInfo);
} else
processContainer(multiplier, descendantBlock, clusterInfo, descendantBlock, windowInfo);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698