Chromium Code Reviews| Index: Source/core/rendering/FastTextAutosizer.h |
| diff --git a/Source/core/rendering/FastTextAutosizer.h b/Source/core/rendering/FastTextAutosizer.h |
| index ebe41c6825f2166162af9b869c537de344db0f57..6e3eaabdf151ed46c0bcc021315c57ed6c711750 100644 |
| --- a/Source/core/rendering/FastTextAutosizer.h |
| +++ b/Source/core/rendering/FastTextAutosizer.h |
| @@ -58,51 +58,58 @@ public: |
| return adoptPtr(new FastTextAutosizer(document)); |
| } |
| - void prepareForLayout(); |
| - |
| void record(RenderBlock*); |
| void destroy(RenderBlock*); |
| + |
| + void beginLayout(RenderBlock*); |
| void inflate(RenderBlock*); |
| + void endLayout(RenderBlock*); |
| private: |
| - // FIXME(crbug.com/327811): make a proper API for this class. |
| struct Cluster { |
| - explicit Cluster(AtomicString fingerprint) |
| - : m_fingerprint(fingerprint) |
| - , m_multiplier(0) |
| + explicit Cluster(RenderBlock* root, float multiplier) |
| + : m_root(root) |
| + , m_multiplier(multiplier) |
| { |
| } |
| - |
| - AtomicString m_fingerprint; |
| - WTF::HashSet<RenderBlock*> m_blocks; |
| + RenderBlock* m_root; |
| float m_multiplier; |
| - const RenderObject* m_clusterRoot; |
| - |
| - void addBlock(RenderBlock* block) |
| - { |
| - m_blocks.add(block); |
| - setNeedsClusterRecalc(); |
| - } |
| - |
| - void setNeedsClusterRecalc() { m_multiplier = 0; m_clusterRoot = 0; } |
| - bool needsClusterRecalc() const { return !m_clusterRoot || m_multiplier <= 0; } |
| }; |
| explicit FastTextAutosizer(Document*); |
| - bool updateWindowWidth(); |
| - |
| - AtomicString fingerprint(const RenderBlock*); |
| - void recalcClusterIfNeeded(Cluster*); |
| - |
| - int m_windowWidth; |
| + bool enabled(); |
| + void prepareWindowInfo(RenderView*); |
| + bool shouldBeClusterRoot(RenderBlock*); |
| + bool clusterWantsAutosizing(RenderBlock*); |
| + AtomicString computeFingerprint(RenderBlock*); |
| + Cluster* getCluster(RenderBlock*); |
| + Cluster* createCluster(RenderBlock*); |
| + Cluster* addSupercluster(WTF::HashSet<RenderBlock*>&, RenderBlock*); |
|
pdr.
2013/12/21 01:46:57
Nit: addSuperCluster (camel case)
skobes
2014/01/07 03:12:37
I'm not a fan of this capitalization unless it som
|
| + RenderBlock* deepestCommonAncestor(WTF::HashSet<RenderBlock*>&); |
| + float computeMultiplier(RenderBlock*); |
| + void applyMultiplier(RenderObject*, float); |
| + |
| + typedef WTF::HashSet<RenderBlock*> BlockSet; |
| + typedef WTF::HashMap<RenderBlock*, AtomicString> FingerprintMap; |
| + typedef WTF::HashMap<AtomicString, OwnPtr<BlockSet> > ReverseFingerprintMap; |
| + typedef WTF::HashMap<RenderBlock*, OwnPtr<Cluster> > ClusterMap; |
| + typedef WTF::Vector<Cluster*> ClusterStack; |
| Document* m_document; |
| - |
| - typedef WTF::HashMap<const RenderBlock*, Cluster*> BlockToClusterMap; |
| - typedef WTF::HashMap<AtomicString, OwnPtr<Cluster> > FingerprintToClusterMap; |
| - BlockToClusterMap m_clusterForBlock; |
| - FingerprintToClusterMap m_clusterForFingerprint; |
| + int m_windowWidth; // Frame width in density-independent pixels (DIPs). |
| + int m_layoutWidth; // Layout width in CSS pixels. |
| + |
| + // Fingerprints are computed during style recalc, for (some subset of) |
| + // blocks that will become cluster roots. |
| + FingerprintMap m_fingerprints; |
| + ReverseFingerprintMap m_blocksForFingerprint; |
| + |
| + // 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; |
|
pdr.
2013/12/21 01:46:57
Is this needed?
skobes
2014/01/07 03:12:37
Yes, this actually owns the Cluster objects.
|
| + ClusterStack m_clusterStack; |
| }; |
| } // namespace WebCore |