| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ~LayoutScope() | 84 ~LayoutScope() |
| 85 { | 85 { |
| 86 if (m_textAutosizer) | 86 if (m_textAutosizer) |
| 87 m_textAutosizer->endLayout(m_block); | 87 m_textAutosizer->endLayout(m_block); |
| 88 } | 88 } |
| 89 private: | 89 private: |
| 90 FastTextAutosizer* m_textAutosizer; | 90 FastTextAutosizer* m_textAutosizer; |
| 91 RenderBlock* m_block; | 91 RenderBlock* m_block; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 private: | 94 //private: |
| 95 typedef HashSet<const RenderBlock*> BlockSet; | 95 typedef HashSet<const RenderBlock*> BlockSet; |
| 96 | 96 |
| 97 enum HasEnoughTextToAutosize { | 97 enum HasEnoughTextToAutosize { |
| 98 Unknown, | 98 Unknown, |
| 99 Yes, | 99 Yes, |
| 100 No | 100 No |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // A supercluster represents autosizing information about a set of two or | 103 // A supercluster represents autosizing information about a set of two or |
| 104 // more blocks that all have the same fingerprint. Clusters whose roots | 104 // more blocks that all have the same fingerprint. Clusters whose roots |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 // Fingerprints are computed during style recalc, for (some subset of) | 176 // Fingerprints are computed during style recalc, for (some subset of) |
| 177 // blocks that will become cluster roots. | 177 // blocks that will become cluster roots. |
| 178 class FingerprintMapper { | 178 class FingerprintMapper { |
| 179 public: | 179 public: |
| 180 void add(const RenderObject*, Fingerprint); | 180 void add(const RenderObject*, Fingerprint); |
| 181 void addTentativeClusterRoot(const RenderBlock*, Fingerprint); | 181 void addTentativeClusterRoot(const RenderBlock*, Fingerprint); |
| 182 void remove(const RenderObject*); | 182 void remove(const RenderObject*); |
| 183 Fingerprint get(const RenderObject*); | 183 Fingerprint get(const RenderObject*); |
| 184 BlockSet& getTentativeClusterRoots(Fingerprint); | 184 BlockSet& getTentativeClusterRoots(Fingerprint); |
| 185 private: | 185 //private: |
| 186 typedef HashMap<const RenderObject*, Fingerprint> FingerprintMap; | 186 typedef HashMap<const RenderObject*, Fingerprint> FingerprintMap; |
| 187 typedef HashMap<Fingerprint, OwnPtr<BlockSet> > ReverseFingerprintMap; | 187 typedef HashMap<Fingerprint, OwnPtr<BlockSet> > ReverseFingerprintMap; |
| 188 | 188 |
| 189 FingerprintMap m_fingerprints; | 189 FingerprintMap m_fingerprints; |
| 190 ReverseFingerprintMap m_blocksForFingerprint; | 190 ReverseFingerprintMap m_blocksForFingerprint; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 explicit FastTextAutosizer(const Document*); | 193 explicit FastTextAutosizer(const Document*); |
| 194 | 194 |
| 195 void beginLayout(RenderBlock*); | 195 void beginLayout(RenderBlock*); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // cluster root. Clusters whose roots share the same fingerprint use the | 247 // cluster root. Clusters whose roots share the same fingerprint use the |
| 248 // same multiplier. | 248 // same multiplier. |
| 249 SuperclusterMap m_superclusters; | 249 SuperclusterMap m_superclusters; |
| 250 ClusterStack m_clusterStack; | 250 ClusterStack m_clusterStack; |
| 251 FingerprintMapper m_fingerprintMapper; | 251 FingerprintMapper m_fingerprintMapper; |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 } // namespace WebCore | 254 } // namespace WebCore |
| 255 | 255 |
| 256 #endif // FastTextAutosizer_h | 256 #endif // FastTextAutosizer_h |
| OLD | NEW |