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 10 matching lines...) Expand all Loading... |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef TextAutosizer_h | 26 #ifndef TextAutosizer_h |
27 #define TextAutosizer_h | 27 #define TextAutosizer_h |
28 | 28 |
29 #if ENABLE(TEXT_AUTOSIZING) | 29 #if ENABLE(TEXT_AUTOSIZING) |
30 | 30 |
| 31 #include "HTMLNames.h" |
31 #include <wtf/Noncopyable.h> | 32 #include <wtf/Noncopyable.h> |
32 #include <wtf/PassOwnPtr.h> | 33 #include <wtf/PassOwnPtr.h> |
33 | 34 |
34 namespace WebCore { | 35 namespace WebCore { |
35 | 36 |
36 class Document; | 37 class Document; |
37 class RenderBlock; | 38 class RenderBlock; |
38 class RenderObject; | 39 class RenderObject; |
39 class RenderText; | 40 class RenderText; |
40 struct TextAutosizingWindowInfo; | 41 struct TextAutosizingWindowInfo; |
(...skipping 21 matching lines...) Expand all Loading... |
62 void processCluster(RenderBlock* cluster, RenderBlock* container, RenderObje
ct* subtreeRoot, const TextAutosizingWindowInfo&); | 63 void processCluster(RenderBlock* cluster, RenderBlock* container, RenderObje
ct* subtreeRoot, const TextAutosizingWindowInfo&); |
63 void processContainer(float multiplier, RenderBlock* container, const Render
Block* blockContainingAllText, RenderObject* subtreeRoot, const TextAutosizingWi
ndowInfo&); | 64 void processContainer(float multiplier, RenderBlock* container, const Render
Block* blockContainingAllText, RenderObject* subtreeRoot, const TextAutosizingWi
ndowInfo&); |
64 | 65 |
65 void setMultiplier(RenderObject*, float); | 66 void setMultiplier(RenderObject*, float); |
66 | 67 |
67 static bool isAutosizingContainer(const RenderObject*); | 68 static bool isAutosizingContainer(const RenderObject*); |
68 static bool isAutosizingCluster(const RenderBlock*, const RenderBlock* paren
tBlockContainingAllText); | 69 static bool isAutosizingCluster(const RenderBlock*, const RenderBlock* paren
tBlockContainingAllText); |
69 static bool isAutosizingCluster(const RenderObject*); | 70 static bool isAutosizingCluster(const RenderObject*); |
70 | 71 |
71 static bool containerShouldBeAutosized(const RenderBlock* container); | 72 static bool containerShouldBeAutosized(const RenderBlock* container); |
| 73 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec
tor<QualifiedName>& tags); |
| 74 static bool contentHeightIsConstrained(const RenderBlock* container); |
72 static bool clusterShouldBeAutosized(const RenderBlock* blockContainingAllTe
xt, float blockWidth); | 75 static bool clusterShouldBeAutosized(const RenderBlock* blockContainingAllTe
xt, float blockWidth); |
73 static void measureDescendantTextWidth(const RenderBlock* container, const R
enderBlock* blockContainingAllText, float minTextWidth, float& textWidth); | 76 static void measureDescendantTextWidth(const RenderBlock* container, const R
enderBlock* blockContainingAllText, float minTextWidth, float& textWidth); |
74 | 77 |
75 // Use to traverse the tree of descendants, excluding descendants of contain
ers (but returning the containers themselves). | 78 // Use to traverse the tree of descendants, excluding descendants of contain
ers (but returning the containers themselves). |
76 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren
derObject*, const RenderObject* stayWithin); | 79 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren
derObject*, const RenderObject* stayWithin); |
77 | 80 |
78 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc
k* cluster); | 81 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc
k* cluster); |
79 | 82 |
80 // Depending on the traversal direction specified, finds the first or the la
st leaf text node child that doesn't | 83 // Depending on the traversal direction specified, finds the first or the la
st leaf text node child that doesn't |
81 // belong to any cluster. | 84 // belong to any cluster. |
82 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject*
, size_t& depth, TraversalDirection); | 85 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject*
, size_t& depth, TraversalDirection); |
83 | 86 |
84 Document* m_document; | 87 Document* m_document; |
85 }; | 88 }; |
86 | 89 |
87 } // namespace WebCore | 90 } // namespace WebCore |
88 | 91 |
89 #endif // ENABLE(TEXT_AUTOSIZING) | 92 #endif // ENABLE(TEXT_AUTOSIZING) |
90 | 93 |
91 #endif // TextAutosizer_h | 94 #endif // TextAutosizer_h |
OLD | NEW |