Index: Source/core/rendering/FastTextAutosizer.h |
diff --git a/Source/core/rendering/FastTextAutosizer.h b/Source/core/rendering/FastTextAutosizer.h |
index 9b54f9e95287f1491a3486ddd9c51ea2d43c0c64..411407a7f6d50e8a1085a5c11fe4888fcdd452c0 100644 |
--- a/Source/core/rendering/FastTextAutosizer.h |
+++ b/Source/core/rendering/FastTextAutosizer.h |
@@ -70,18 +70,34 @@ public: |
void inflateListItem(RenderListItem*, RenderListMarker*); |
private: |
+ typedef HashSet<const RenderBlock*> BlockSet; |
+ |
+ struct Supercluster { |
pdr.
2014/02/06 22:03:27
Can you add a comment here describing what supercl
skobes
2014/02/06 23:55:50
Done.
|
+ explicit Supercluster(const BlockSet* roots) |
+ : m_roots(roots) |
+ , m_multiplier(0) |
+ , m_anyClusterHasEnoughText(false) |
+ { |
+ } |
+ |
+ const BlockSet* const m_roots; |
+ float m_multiplier; |
+ bool m_anyClusterHasEnoughText; |
+ }; |
+ |
struct Cluster { |
- explicit Cluster(const RenderBlock* root, bool autosize, Cluster* parent) |
+ explicit Cluster(const RenderBlock* root, bool autosize, Cluster* parent, Supercluster* supercluster = 0) |
: m_root(root) |
, m_deepestBlockContainingAllText(0) |
, m_parent(parent) |
, m_autosize(autosize) |
, m_multiplier(0) |
, m_textLength(-1) |
+ , m_supercluster(supercluster) |
{ |
} |
- const RenderBlock* m_root; |
+ const RenderBlock* const m_root; |
// The deepest block containing all text is computed lazily (see: |
// deepestBlockContainingAllText). A value of 0 indicates the value has not been computed yet. |
const RenderBlock* m_deepestBlockContainingAllText; |
@@ -95,6 +111,8 @@ private: |
// Text length is computed lazily (see: textLength). This is an approximation and characters |
// are assumed to be 1em wide. Negative values indicate the length has not been computed. |
int m_textLength; |
+ // A set of blocks that are similar to this block. |
+ Supercluster* m_supercluster; |
}; |
enum TextLeafSearch { |
@@ -102,9 +120,8 @@ private: |
Last |
}; |
- typedef HashSet<const RenderBlock*> BlockSet; |
- typedef HashMap<const RenderBlock*, OwnPtr<Cluster> > ClusterMap; |
- typedef Vector<Cluster*> ClusterStack; |
+ typedef HashMap<AtomicString, OwnPtr<Supercluster> > SuperclusterMap; |
+ typedef Vector<OwnPtr<Cluster> > ClusterStack; |
// Fingerprints are computed during style recalc, for (some subset of) |
// blocks that will become cluster roots. |
@@ -131,10 +148,12 @@ private: |
bool clusterHasEnoughTextToAutosize(Cluster*); |
float textLength(Cluster*); |
AtomicString computeFingerprint(const RenderBlock*); |
- Cluster* maybeGetOrCreateCluster(const RenderBlock*); |
- Cluster* addSupercluster(AtomicString, const RenderBlock*); |
+ Cluster* maybeCreateCluster(const RenderBlock*); |
+ Supercluster* getSupercluster(const RenderBlock*); |
const RenderBlock* deepestCommonAncestor(BlockSet&); |
float clusterMultiplier(Cluster*); |
+ float superclusterMultiplier(Supercluster*); |
+ float multiplierFromBlock(const RenderBlock*); |
void applyMultiplier(RenderObject*, float); |
bool mightBeWiderOrNarrowerDescendant(const RenderBlock*); |
bool isWiderDescendant(Cluster*); |
@@ -162,7 +181,7 @@ private: |
// Clusters are created and destroyed during layout. The map key is the |
// cluster root. Clusters whose roots share the same fingerprint use the |
// same multiplier. |
- ClusterMap m_clusters; |
+ SuperclusterMap m_superclusters; |
ClusterStack m_clusterStack; |
FingerprintMapper m_fingerprintMapper; |
}; |