| 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_parent(parent) | 76 , m_parent(parent) |
| 73 , m_autosize(autosize) | 77 , m_autosize(autosize) |
| 74 , m_multiplier(0) | 78 , m_multiplier(0) |
| 75 , m_textLength(-1) | 79 , m_textLength(-1) |
| 76 { | 80 { |
| 77 } | 81 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // cluster root. Clusters whose roots share the same fingerprint use the | 154 // cluster root. Clusters whose roots share the same fingerprint use the |
| 151 // same multiplier. | 155 // same multiplier. |
| 152 ClusterMap m_clusters; | 156 ClusterMap m_clusters; |
| 153 ClusterStack m_clusterStack; | 157 ClusterStack m_clusterStack; |
| 154 FingerprintMapper m_fingerprintMapper; | 158 FingerprintMapper m_fingerprintMapper; |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 } // namespace WebCore | 161 } // namespace WebCore |
| 158 | 162 |
| 159 #endif // FastTextAutosizer_h | 163 #endif // FastTextAutosizer_h |
| OLD | NEW |