Changeset 142534 in webkit
- Timestamp:
- Feb 11, 2013 3:48:51 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142533 r142534 1 2013-02-11 Anton Vayvod <avayvod@chromium.org> 2 3 [Text Autosizing] Collect narrow descendants and process them separately. Refactoring for 4 a change to follow. 5 https://bugs.webkit.org/show_bug.cgi?id=109054 6 7 Preparational change to combine narrow descendants of the same autosizing cluster into 8 groups by the width difference between the descendant and the block containing all text of 9 the parent autosizing cluster. The groups will be autosized with the same multiplier. 10 11 For example, on sites with a sidebar, sometimes the paragraphs next to the sidebar will have 12 a large margin individually applied (via a CSS selector), causing them all to individually 13 appear narrower than their enclosing blockContainingAllText. Rather than making each of 14 these paragraphs into a separate cluster, we eventually want to be able to merge them back 15 together into one (or a few) descendant clusters. 16 17 Reviewed by Julien Chaffraix. 18 19 No behavioral changes thus no new tests or test changes. 20 21 * rendering/TextAutosizer.cpp: 22 (TextAutosizingClusterInfo): Vector of narrow descendants. 23 (WebCore::TextAutosizer::processCluster): Process narrow descendants separately. 24 (WebCore::TextAutosizer::processContainer): 25 26 Remember narrow descendants of the parent cluster for later processing. 27 1 28 2013-02-11 Enrica Casucci <enrica@apple.com> 2 29 -
trunk/Source/WebCore/rendering/TextAutosizer.cpp
r142367 r142534 38 38 #include <algorithm> 39 39 #include <wtf/StdLibExtras.h> 40 #include <wtf/Vector.h> 40 41 41 42 namespace WebCore { … … 48 49 }; 49 50 51 // Represents cluster related data. Instances should not persist between calls to processSubtree. 50 52 struct TextAutosizingClusterInfo { 51 53 explicit TextAutosizingClusterInfo(RenderBlock* root) … … 62 64 // text and that of a narrow child before the child becomes a separate cluster. 63 65 float maxAllowedDifferenceFromTextWidth; 66 67 // Descendants of the cluster that are narrower than the block containing all text and must be 68 // processed together. 69 Vector<TextAutosizingClusterInfo> narrowDescendants; 64 70 }; 65 71 … … 151 157 152 158 processContainer(multiplier, container, clusterInfo, subtreeRoot, windowInfo); 159 160 Vector<TextAutosizingClusterInfo>& narrowDescendants = clusterInfo.narrowDescendants; 161 for (size_t i = 0; i < narrowDescendants.size(); ++i) { 162 TextAutosizingClusterInfo& descendantClusterInfo = narrowDescendants[i]; 163 processCluster(descendantClusterInfo, descendantClusterInfo.root, descendantClusterInfo.root, windowInfo); 164 } 153 165 } 154 166 … … 169 181 } else if (isAutosizingContainer(descendant)) { 170 182 RenderBlock* descendantBlock = toRenderBlock(descendant); 171 if (isAutosizingCluster(descendantBlock, clusterInfo)) {172 TextAutosizingClusterInfo descendantClusterInfo(descendantBlock);183 TextAutosizingClusterInfo descendantClusterInfo(descendantBlock); 184 if (isWiderDescendant(descendantBlock, clusterInfo) || isIndependentDescendant(descendantBlock)) 173 185 processCluster(descendantClusterInfo, descendantBlock, descendantBlock, windowInfo); 186 else if (isNarrowDescendant(descendantBlock, clusterInfo)) { 187 // Narrow descendants are processed together later to be able to apply the same multiplier 188 // to each of them if necessary. 189 clusterInfo.narrowDescendants.append(descendantClusterInfo); 174 190 } else 175 191 processContainer(multiplier, descendantBlock, clusterInfo, descendantBlock, windowInfo);
Note: See TracChangeset
for help on using the changeset viewer.