OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
40 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
41 #include "wtf/text/AtomicStringHash.h" | 41 #include "wtf/text/AtomicStringHash.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 class Document; | 45 class Document; |
46 class RenderBlock; | 46 class RenderBlock; |
| 47 class RenderListItem; |
| 48 class RenderListMarker; |
47 | 49 |
48 // Single-pass text autosizer (work in progress). Works in two stages: | 50 // Single-pass text autosizer (work in progress). Works in two stages: |
49 // (1) record information about page elements during style recalc | 51 // (1) record information about page elements during style recalc |
50 // (2) inflate sizes during layout | 52 // (2) inflate sizes during layout |
51 // See: http://tinyurl.com/chromium-fast-autosizer | 53 // See: http://tinyurl.com/chromium-fast-autosizer |
52 | 54 |
53 class FastTextAutosizer FINAL { | 55 class FastTextAutosizer FINAL { |
54 WTF_MAKE_NONCOPYABLE(FastTextAutosizer); | 56 WTF_MAKE_NONCOPYABLE(FastTextAutosizer); |
55 | 57 |
56 public: | 58 public: |
57 static PassOwnPtr<FastTextAutosizer> create(const Document* document) | 59 static PassOwnPtr<FastTextAutosizer> create(const Document* document) |
58 { | 60 { |
59 return adoptPtr(new FastTextAutosizer(document)); | 61 return adoptPtr(new FastTextAutosizer(document)); |
60 } | 62 } |
61 | 63 |
62 void record(const RenderBlock*); | 64 void record(const RenderBlock*); |
63 void destroy(const RenderBlock*); | 65 void destroy(const RenderBlock*); |
64 | 66 |
65 void beginLayout(RenderBlock*); | 67 void beginLayout(RenderBlock*); |
66 void endLayout(RenderBlock*); | 68 void endLayout(RenderBlock*); |
67 | 69 |
| 70 void inflateListItem(RenderListItem*, RenderListMarker*); |
| 71 |
68 private: | 72 private: |
69 struct Cluster { | 73 struct Cluster { |
70 explicit Cluster(const RenderBlock* root, bool autosize, Cluster* parent
) | 74 explicit Cluster(const RenderBlock* root, bool autosize, Cluster* parent
) |
71 : m_root(root) | 75 : m_root(root) |
72 , m_deepestBlockContainingAllText(0) | 76 , m_deepestBlockContainingAllText(0) |
73 , m_parent(parent) | 77 , m_parent(parent) |
74 , m_autosize(autosize) | 78 , m_autosize(autosize) |
75 , m_multiplier(0) | 79 , m_multiplier(0) |
76 , m_textLength(-1) | 80 , m_textLength(-1) |
77 { | 81 { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // cluster root. Clusters whose roots share the same fingerprint use the | 162 // cluster root. Clusters whose roots share the same fingerprint use the |
159 // same multiplier. | 163 // same multiplier. |
160 ClusterMap m_clusters; | 164 ClusterMap m_clusters; |
161 ClusterStack m_clusterStack; | 165 ClusterStack m_clusterStack; |
162 FingerprintMapper m_fingerprintMapper; | 166 FingerprintMapper m_fingerprintMapper; |
163 }; | 167 }; |
164 | 168 |
165 } // namespace WebCore | 169 } // namespace WebCore |
166 | 170 |
167 #endif // FastTextAutosizer_h | 171 #endif // FastTextAutosizer_h |
OLD | NEW |