| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 public: | 46 public: |
| 47 static PassOwnPtr<TextAutosizer> create(Document* document) { return adoptPt
r(new TextAutosizer(document)); } | 47 static PassOwnPtr<TextAutosizer> create(Document* document) { return adoptPt
r(new TextAutosizer(document)); } |
| 48 | 48 |
| 49 virtual ~TextAutosizer(); | 49 virtual ~TextAutosizer(); |
| 50 | 50 |
| 51 bool processSubtree(RenderObject* layoutRoot); | 51 bool processSubtree(RenderObject* layoutRoot); |
| 52 void recalculateMultipliers(); | 52 void recalculateMultipliers(); |
| 53 | 53 |
| 54 static float computeAutosizedFontSize(float specifiedSize, float multiplier)
; | 54 static float computeAutosizedFontSize(float specifiedSize, float multiplier)
; |
| 55 | 55 |
| 56 private: | 56 public: |
| 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 float clusterMultiplier(WritingMode, const TextAutosizingWindowInfo&, float
textWidth) const; | 64 float clusterMultiplier(WritingMode, const TextAutosizingWindowInfo&, float
textWidth) const; |
| 65 | 65 |
| 66 void processClusterInternal(TextAutosizingClusterInfo&, RenderBlock* contain
er, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&, float multiplier
); | 66 void processClusterInternal(TextAutosizingClusterInfo&, RenderBlock* contain
er, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&, float multiplier
); |
| 67 void processCluster(TextAutosizingClusterInfo&, RenderBlock* container, Rend
erObject* subtreeRoot, const TextAutosizingWindowInfo&); | 67 void processCluster(TextAutosizingClusterInfo&, RenderBlock* container, Rend
erObject* subtreeRoot, const TextAutosizingWindowInfo&); |
| 68 void processCompositeCluster(Vector<TextAutosizingClusterInfo>&, const TextA
utosizingWindowInfo&); | 68 void processCompositeCluster(Vector<TextAutosizingClusterInfo>&, const TextA
utosizingWindowInfo&); |
| 69 void processContainer(float multiplier, RenderBlock* container, TextAutosizi
ngClusterInfo&, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&); | 69 void processContainer(float multiplier, RenderBlock* container, TextAutosizi
ngClusterInfo&, RenderObject* subtreeRoot, const TextAutosizingWindowInfo&); |
| 70 | 70 |
| 71 void setMultiplier(RenderObject*, float); | 71 void setMultiplier(RenderObject*, float); |
| 72 void setMultiplierForList(RenderObject* renderer, float multiplier); |
| 72 | 73 |
| 73 static bool isAutosizingContainer(const RenderObject*); | 74 static bool isAutosizingContainer(const RenderObject*); |
| 74 static bool isNarrowDescendant(const RenderBlock*, TextAutosizingClusterInfo
& parentClusterInfo); | 75 static bool isNarrowDescendant(const RenderBlock*, TextAutosizingClusterInfo
& parentClusterInfo); |
| 75 static bool isWiderDescendant(const RenderBlock*, const TextAutosizingCluste
rInfo& parentClusterInfo); | 76 static bool isWiderDescendant(const RenderBlock*, const TextAutosizingCluste
rInfo& parentClusterInfo); |
| 76 static bool isIndependentDescendant(const RenderBlock*); | 77 static bool isIndependentDescendant(const RenderBlock*); |
| 77 static bool isAutosizingCluster(const RenderBlock*, TextAutosizingClusterInf
o& parentClusterInfo); | 78 static bool isAutosizingCluster(const RenderBlock*, TextAutosizingClusterInf
o& parentClusterInfo); |
| 78 | 79 |
| 79 static bool containerShouldBeAutosized(const RenderBlock* container); | 80 static bool containerShouldBeAutosized(const RenderBlock* container); |
| 80 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec
tor<QualifiedName>& tags); | 81 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec
tor<QualifiedName>& tags); |
| 81 static bool containerIsRowOfLinks(const RenderObject* container); | 82 static bool containerIsRowOfLinks(const RenderObject* container); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 // by the difference between the width of the descendant and the width of th
e parent cluster's | 98 // by the difference between the width of the descendant and the width of th
e parent cluster's |
| 98 // |blockContainingAllText|. | 99 // |blockContainingAllText|. |
| 99 static void getNarrowDescendantsGroupedByWidth(const TextAutosizingClusterIn
fo& parentClusterInfo, Vector<Vector<TextAutosizingClusterInfo> >&); | 100 static void getNarrowDescendantsGroupedByWidth(const TextAutosizingClusterIn
fo& parentClusterInfo, Vector<Vector<TextAutosizingClusterInfo> >&); |
| 100 | 101 |
| 101 Document* m_document; | 102 Document* m_document; |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace WebCore | 105 } // namespace WebCore |
| 105 | 106 |
| 106 #endif // TextAutosizer_h | 107 #endif // TextAutosizer_h |
| OLD | NEW |