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

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

Issue 14146029: Fix textarea font autosizing oscillation when the number of lines exceeds 4. The proposed fix is no… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: autosize textareas by default Created 7 years, 8 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 static bool isAutosizingContainer(const RenderObject*); 73 static bool isAutosizingContainer(const RenderObject*);
74 static bool isNarrowDescendant(const RenderBlock*, TextAutosizingClusterInfo & parentClusterInfo); 74 static bool isNarrowDescendant(const RenderBlock*, TextAutosizingClusterInfo & parentClusterInfo);
75 static bool isWiderDescendant(const RenderBlock*, const TextAutosizingCluste rInfo& parentClusterInfo); 75 static bool isWiderDescendant(const RenderBlock*, const TextAutosizingCluste rInfo& parentClusterInfo);
76 static bool isIndependentDescendant(const RenderBlock*); 76 static bool isIndependentDescendant(const RenderBlock*);
77 static bool isAutosizingCluster(const RenderBlock*, TextAutosizingClusterInf o& parentClusterInfo); 77 static bool isAutosizingCluster(const RenderBlock*, TextAutosizingClusterInf o& parentClusterInfo);
78 78
79 static bool containerShouldBeAutosized(const RenderBlock* container); 79 static bool containerShouldBeAutosized(const RenderBlock* container);
80 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec tor<QualifiedName>& tags); 80 static bool containerContainsOneOfTags(const RenderBlock* cluster, const Vec tor<QualifiedName>& tags);
81 static bool containerIsRowOfLinks(const RenderObject* container); 81 static bool containerIsRowOfLinks(const RenderObject* container);
82 static bool containerIsTextArea(const RenderBlock* container);
82 static bool contentHeightIsConstrained(const RenderBlock* container); 83 static bool contentHeightIsConstrained(const RenderBlock* container);
83 static bool clusterShouldBeAutosized(TextAutosizingClusterInfo&, float block Width); 84 static bool clusterShouldBeAutosized(TextAutosizingClusterInfo&, float block Width);
84 static bool compositeClusterShouldBeAutosized(Vector<TextAutosizingClusterIn fo>&, float blockWidth); 85 static bool compositeClusterShouldBeAutosized(Vector<TextAutosizingClusterIn fo>&, float blockWidth);
85 static void measureDescendantTextWidth(const RenderBlock* container, TextAut osizingClusterInfo&, float minTextWidth, float& textWidth); 86 static void measureDescendantTextWidth(const RenderBlock* container, TextAut osizingClusterInfo&, float minTextWidth, float& textWidth);
86 87
87 // Use to traverse the tree of descendants, excluding descendants of contain ers (but returning the containers themselves). 88 // Use to traverse the tree of descendants, excluding descendants of contain ers (but returning the containers themselves).
88 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren derObject*, const RenderObject* stayWithin); 89 static RenderObject* nextInPreOrderSkippingDescendantsOfContainers(const Ren derObject*, const RenderObject* stayWithin);
89 90
90 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc k* cluster); 91 static const RenderBlock* findDeepestBlockContainingAllText(const RenderBloc k* cluster);
91 92
92 // Depending on the traversal direction specified, finds the first or the la st leaf text node child that doesn't 93 // Depending on the traversal direction specified, finds the first or the la st leaf text node child that doesn't
93 // belong to any cluster. 94 // belong to any cluster.
94 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject* , size_t& depth, TraversalDirection); 95 static const RenderObject* findFirstTextLeafNotInCluster(const RenderObject* , size_t& depth, TraversalDirection);
95 96
96 // Returns groups of narrow descendants of a given autosizing cluster. The g roups are combined 97 // Returns groups of narrow descendants of a given autosizing cluster. The g roups are combined
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698