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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 return adoptPtr(new FastTextAutosizer(document)); | 60 return adoptPtr(new FastTextAutosizer(document)); |
61 } | 61 } |
62 | 62 |
63 void record(const RenderBlock*); | 63 void record(const RenderBlock*); |
64 void destroy(const RenderBlock*); | 64 void destroy(const RenderBlock*); |
65 void inflateListItem(RenderListItem*, RenderListMarker*); | 65 void inflateListItem(RenderListItem*, RenderListMarker*); |
66 | 66 |
67 class LayoutScope { | 67 class LayoutScope { |
68 public: | 68 public: |
69 explicit LayoutScope(Document& document, RenderBlock* block) | 69 explicit LayoutScope(Document& document, RenderBlock* block) |
| 70 : m_block(0) |
70 { | 71 { |
71 m_textAutosizer = document.fastTextAutosizer(); | 72 m_textAutosizer = document.fastTextAutosizer(); |
72 if (m_textAutosizer) { | 73 if (m_textAutosizer) { |
73 if (!m_textAutosizer->enabled()) { | 74 if (!m_textAutosizer->enabled()) { |
74 m_textAutosizer = 0; | 75 m_textAutosizer = 0; |
75 return; | 76 return; |
76 } | 77 } |
77 m_block = block; | 78 m_block = block; |
78 m_textAutosizer->beginLayout(m_block); | 79 m_textAutosizer->beginLayout(m_block); |
79 } else { | |
80 m_block = 0; | |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 ~LayoutScope() | 83 ~LayoutScope() |
85 { | 84 { |
86 if (m_textAutosizer) | 85 if (m_textAutosizer) |
87 m_textAutosizer->endLayout(m_block); | 86 m_textAutosizer->endLayout(m_block); |
88 } | 87 } |
89 private: | 88 private: |
90 FastTextAutosizer* m_textAutosizer; | 89 FastTextAutosizer* m_textAutosizer; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // cluster root. Clusters whose roots share the same fingerprint use the | 234 // cluster root. Clusters whose roots share the same fingerprint use the |
236 // same multiplier. | 235 // same multiplier. |
237 SuperclusterMap m_superclusters; | 236 SuperclusterMap m_superclusters; |
238 ClusterStack m_clusterStack; | 237 ClusterStack m_clusterStack; |
239 FingerprintMapper m_fingerprintMapper; | 238 FingerprintMapper m_fingerprintMapper; |
240 }; | 239 }; |
241 | 240 |
242 } // namespace WebCore | 241 } // namespace WebCore |
243 | 242 |
244 #endif // FastTextAutosizer_h | 243 #endif // FastTextAutosizer_h |
OLD | NEW |