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

Side by Side Diff: Source/core/rendering/FastTextAutosizer.h

Issue 145003009: Autosize list markers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tot
Patch Set: Address review comments. Created 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 { 58 {
59 return adoptPtr(new FastTextAutosizer(document)); 59 return adoptPtr(new FastTextAutosizer(document));
60 } 60 }
61 61
62 void record(const RenderBlock*); 62 void record(const RenderBlock*);
63 void destroy(const RenderBlock*); 63 void destroy(const RenderBlock*);
64 64
65 void beginLayout(RenderBlock*); 65 void beginLayout(RenderBlock*);
66 void endLayout(RenderBlock*); 66 void endLayout(RenderBlock*);
67 67
68 void inflateListItem(RenderBlock*, RenderObject*);
69
68 private: 70 private:
69 struct Cluster { 71 struct Cluster {
70 explicit Cluster(const RenderBlock* root, bool autosize, Cluster* parent ) 72 explicit Cluster(const RenderBlock* root, bool autosize, Cluster* parent )
71 : m_root(root) 73 : m_root(root)
72 , m_parent(parent) 74 , m_parent(parent)
73 , m_autosize(autosize) 75 , m_autosize(autosize)
74 , m_multiplier(0) 76 , m_multiplier(0)
75 , m_textLength(-1) 77 , m_textLength(-1)
76 { 78 {
77 } 79 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void inflate(RenderBlock*); 121 void inflate(RenderBlock*);
120 bool enabled(); 122 bool enabled();
121 void prepareRenderViewInfo(RenderView*); 123 void prepareRenderViewInfo(RenderView*);
122 bool isFingerprintingCandidate(const RenderBlock*); 124 bool isFingerprintingCandidate(const RenderBlock*);
123 bool clusterHasEnoughTextToAutosize(Cluster*); 125 bool clusterHasEnoughTextToAutosize(Cluster*);
124 float textLength(Cluster*); 126 float textLength(Cluster*);
125 AtomicString computeFingerprint(const RenderBlock*); 127 AtomicString computeFingerprint(const RenderBlock*);
126 Cluster* maybeGetOrCreateCluster(const RenderBlock*); 128 Cluster* maybeGetOrCreateCluster(const RenderBlock*);
127 Cluster* addSupercluster(AtomicString, const RenderBlock*); 129 Cluster* addSupercluster(AtomicString, const RenderBlock*);
128 const RenderBlock* deepestCommonAncestor(BlockSet&); 130 const RenderBlock* deepestCommonAncestor(BlockSet&);
129 float clusterMultiplier(Cluster*); 131 float clusterMultiplier(Cluster*, const RenderBlock* forceInclude = 0);
130 void applyMultiplier(RenderObject*, float); 132 void applyMultiplier(RenderObject*, float);
131 133
132 Cluster* currentCluster() const; 134 Cluster* currentCluster() const;
133 135
134 RenderObject* nextChildSkippingChildrenOfBlocks(const RenderObject*, const R enderObject*); 136 RenderObject* nextChildSkippingChildrenOfBlocks(const RenderObject*, const R enderObject*);
135 const RenderBlock* findDeepestBlockContainingAllText(const RenderBlock*); 137 const RenderBlock* findDeepestBlockContainingAllText(const RenderBlock*, con st RenderBlock* forceInclude = 0);
136 // Returns the first text leaf that is in the current cluster and not in a d escendent cluster. 138 // Returns the first text leaf that is in the current cluster and not in a d escendent cluster.
137 // The TraversalDirection controls whether we return the first or the last t ext leaf. 139 // The TraversalDirection controls whether we return the first or the last t ext leaf.
138 const RenderObject* findTextLeaf(const RenderObject*, size_t&, TextLeafSearc h); 140 const RenderObject* findTextLeaf(const RenderObject*, size_t&, TextLeafSearc h);
139 141
140 const Document* m_document; 142 const Document* m_document;
141 int m_frameWidth; // Frame width in density-independent pixels (DIPs). 143 int m_frameWidth; // Frame width in density-independent pixels (DIPs).
142 int m_layoutWidth; // Layout width in CSS pixels. 144 int m_layoutWidth; // Layout width in CSS pixels.
143 float m_baseMultiplier; // Includes accessibility font scale factor and devi ce scale adjustment. 145 float m_baseMultiplier; // Includes accessibility font scale factor and devi ce scale adjustment.
144 #ifndef NDEBUG 146 #ifndef NDEBUG
145 bool m_renderViewInfoPrepared; 147 bool m_renderViewInfoPrepared;
146 BlockSet m_blocksThatHaveBegunLayout; // Used to ensure we don't compute pro perties of a block before beginLayout() is called on it. 148 BlockSet m_blocksThatHaveBegunLayout; // Used to ensure we don't compute pro perties of a block before beginLayout() is called on it.
147 #endif 149 #endif
148 150
149 // Clusters are created and destroyed during layout. The map key is the 151 // Clusters are created and destroyed during layout. The map key is the
150 // cluster root. Clusters whose roots share the same fingerprint use the 152 // cluster root. Clusters whose roots share the same fingerprint use the
151 // same multiplier. 153 // same multiplier.
152 ClusterMap m_clusters; 154 ClusterMap m_clusters;
153 ClusterStack m_clusterStack; 155 ClusterStack m_clusterStack;
154 FingerprintMapper m_fingerprintMapper; 156 FingerprintMapper m_fingerprintMapper;
155 }; 157 };
156 158
157 } // namespace WebCore 159 } // namespace WebCore
158 160
159 #endif // FastTextAutosizer_h 161 #endif // FastTextAutosizer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698