Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: Source/WebCore/rendering/TextAutosizer.h

Issue 12326104: Merge 142866 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 static float computeAutosizedFontSize(float specifiedSize, float multiplier) ; 54 static float computeAutosizedFontSize(float specifiedSize, float multiplier) ;
55 55
56 private: 56 private:
57 enum TraversalDirection { 57 enum TraversalDirection {
58 FirstToLast, 58 FirstToLast,
59 LastToFirst 59 LastToFirst
60 }; 60 };
61 61
62 explicit TextAutosizer(Document*); 62 explicit TextAutosizer(Document*);
63 63
64 void processClusterInternal(TextAutosizingClusterInfo&, RenderBlock* contain er, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&, float textWidth, bool shouldBeAutosized);
64 void processCluster(TextAutosizingClusterInfo&, RenderBlock* container, Rend erObject* subtreeRoot, const TextAutosizingWindowInfo&); 65 void processCluster(TextAutosizingClusterInfo&, RenderBlock* container, Rend erObject* subtreeRoot, const TextAutosizingWindowInfo&);
66 void processCompositeCluster(Vector<TextAutosizingClusterInfo>&, const TextA utosizingWindowInfo&);
65 void processContainer(float multiplier, RenderBlock* container, TextAutosizi ngClusterInfo&, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&); 67 void processContainer(float multiplier, RenderBlock* container, TextAutosizi ngClusterInfo&, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&);
66 68
67 void setMultiplier(RenderObject*, float); 69 void setMultiplier(RenderObject*, float);
68 70
69 static bool isAutosizingContainer(const RenderObject*); 71 static bool isAutosizingContainer(const RenderObject*);
70 static bool isNarrowDescendant(const RenderBlock*, TextAutosizingClusterInfo & parentClusterInfo); 72 static bool isNarrowDescendant(const RenderBlock*, TextAutosizingClusterInfo & parentClusterInfo);
71 static bool isWiderDescendant(const RenderBlock*, const TextAutosizingCluste rInfo& parentClusterInfo); 73 static bool isWiderDescendant(const RenderBlock*, const TextAutosizingCluste rInfo& parentClusterInfo);
72 static bool isIndependentDescendant(const RenderBlock*); 74 static bool isIndependentDescendant(const RenderBlock*);
73 static bool isAutosizingCluster(const RenderBlock*, TextAutosizingClusterInf o& parentClusterInfo); 75 static bool isAutosizingCluster(const RenderBlock*, TextAutosizingClusterInf o& parentClusterInfo);
74 76
75 static bool containerShouldBeAutosized(const RenderBlock* container); 77 static bool containerShouldBeAutosized(const RenderBlock* container);
76 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec tor<QualifiedName>& tags); 78 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec tor<QualifiedName>& tags);
77 static bool containerIsRowOfLinks(const RenderObject* container); 79 static bool containerIsRowOfLinks(const RenderObject* container);
78 static bool contentHeightIsConstrained(const RenderBlock* container); 80 static bool contentHeightIsConstrained(const RenderBlock* container);
79 static bool clusterShouldBeAutosized(TextAutosizingClusterInfo&, float block Width); 81 static bool clusterShouldBeAutosized(TextAutosizingClusterInfo&, float block Width);
82 static bool compositeClusterShouldBeAutosized(Vector<TextAutosizingClusterIn fo>&, float blockWidth);
80 static void measureDescendantTextWidth(const RenderBlock* container, TextAut osizingClusterInfo&, float minTextWidth, float& textWidth); 83 static void measureDescendantTextWidth(const RenderBlock* container, TextAut osizingClusterInfo&, float minTextWidth, float& textWidth);
81 84
82 // Use to traverse the tree of descendants, excluding descendants of contain ers (but returning the containers themselves). 85 // Use to traverse the tree of descendants, excluding descendants of contain ers (but returning the containers themselves).
83 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren derObject*, const RenderObject* stayWithin); 86 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren derObject*, const RenderObject* stayWithin);
84 87
85 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc k* cluster); 88 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc k* cluster);
86 89
87 // Depending on the traversal direction specified, finds the first or the la st leaf text node child that doesn't 90 // Depending on the traversal direction specified, finds the first or the la st leaf text node child that doesn't
88 // belong to any cluster. 91 // belong to any cluster.
89 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject* , size_t& depth, TraversalDirection); 92 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject* , size_t& depth, TraversalDirection);
90 93
91 Document* m_document; 94 Document* m_document;
92 }; 95 };
93 96
94 } // namespace WebCore 97 } // namespace WebCore
95 98
96 #endif // ENABLE(TEXT_AUTOSIZING) 99 #endif // ENABLE(TEXT_AUTOSIZING)
97 100
98 #endif // TextAutosizer_h 101 #endif // TextAutosizer_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/text-autosizing/narrow-descendants-combined-expected.html ('k') | Source/WebCore/rendering/TextAutosizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698