| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 unsigned computeCompositeClusterHash(Vector<TextAutosizingClusterInfo>&); | 111 unsigned computeCompositeClusterHash(Vector<TextAutosizingClusterInfo>&); |
| 112 float computeMultiplier(Vector<TextAutosizingClusterInfo>&, const TextAutosi
zingWindowInfo&, float textWidth); | 112 float computeMultiplier(Vector<TextAutosizingClusterInfo>&, const TextAutosi
zingWindowInfo&, float textWidth); |
| 113 | 113 |
| 114 // Use to traverse the tree of descendants, excluding descendants of contain
ers (but returning the containers themselves). | 114 // Use to traverse the tree of descendants, excluding descendants of contain
ers (but returning the containers themselves). |
| 115 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren
derObject*, const RenderObject* stayWithin); | 115 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren
derObject*, const RenderObject* stayWithin); |
| 116 | 116 |
| 117 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc
k* cluster); | 117 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc
k* cluster); |
| 118 | 118 |
| 119 // Depending on the traversal direction specified, finds the first or the la
st leaf text node child that doesn't | 119 // Depending on the traversal direction specified, finds the first or the la
st leaf text node child that doesn't |
| 120 // belong to any cluster. | 120 // belong to any cluster. |
| 121 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject*
, size_t& depth, TraversalDirection); | 121 static const RenderObject* findFirstTextLeafNotInCluster(const RenderBlock*,
size_t& depth, TraversalDirection); |
| 122 | 122 |
| 123 // Returns groups of narrow descendants of a given autosizing cluster. The g
roups are combined | 123 // Returns groups of narrow descendants of a given autosizing cluster. The g
roups are combined |
| 124 // by the difference between the width of the descendant and the width of th
e parent cluster's | 124 // by the difference between the width of the descendant and the width of th
e parent cluster's |
| 125 // |blockContainingAllText|. | 125 // |blockContainingAllText|. |
| 126 static void getNarrowDescendantsGroupedByWidth(const TextAutosizingClusterIn
fo& parentClusterInfo, Vector<Vector<TextAutosizingClusterInfo> >&); | 126 static void getNarrowDescendantsGroupedByWidth(const TextAutosizingClusterIn
fo& parentClusterInfo, Vector<Vector<TextAutosizingClusterInfo> >&); |
| 127 | 127 |
| 128 void addNonAutosizedCluster(unsigned key, TextAutosizingClusterInfo& value); | 128 void addNonAutosizedCluster(unsigned key, TextAutosizingClusterInfo& value); |
| 129 void secondPassProcessStaleNonAutosizedClusters(); | 129 void secondPassProcessStaleNonAutosizedClusters(); |
| 130 void processStaleContainer(float multiplier, RenderBlock* cluster, TextAutos
izingClusterInfo&); | 130 void processStaleContainer(float multiplier, RenderBlock* cluster, TextAutos
izingClusterInfo&); |
| 131 | 131 |
| 132 Document* m_document; | 132 Document* m_document; |
| 133 | 133 |
| 134 HashMap<const RenderObject*, unsigned> m_hashCache; | 134 HashMap<const RenderObject*, unsigned> m_hashCache; |
| 135 | 135 |
| 136 // Mapping from all autosized (i.e. multiplier > 1) cluster hashes to their
respective multipliers. | 136 // Mapping from all autosized (i.e. multiplier > 1) cluster hashes to their
respective multipliers. |
| 137 HashMap<unsigned, float> m_hashToMultiplier; | 137 HashMap<unsigned, float> m_hashToMultiplier; |
| 138 Vector<unsigned> m_hashesToAutosizeSecondPass; | 138 Vector<unsigned> m_hashesToAutosizeSecondPass; |
| 139 | 139 |
| 140 // Mapping from a cluster hash to the corresponding cluster infos which have
not been autosized yet. | 140 // Mapping from a cluster hash to the corresponding cluster infos which have
not been autosized yet. |
| 141 HashMap<unsigned, OwnPtr<Vector<TextAutosizingClusterInfo> > > m_nonAutosize
dClusters; | 141 HashMap<unsigned, OwnPtr<Vector<TextAutosizingClusterInfo> > > m_nonAutosize
dClusters; |
| 142 | 142 |
| 143 bool m_previouslyAutosized; | 143 bool m_previouslyAutosized; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace WebCore | 146 } // namespace WebCore |
| 147 | 147 |
| 148 #endif // TextAutosizer_h | 148 #endif // TextAutosizer_h |
| OLD | NEW |