Chromium Code Reviews| Index: Source/core/rendering/TextAutosizer.cpp |
| diff --git a/Source/core/rendering/TextAutosizer.cpp b/Source/core/rendering/TextAutosizer.cpp |
| index 6fd64b6f333e69ad97f40c075fee6f03a8277bd6..3c5abae998930dabaf28d2c36e5bd21acf758f96 100644 |
| --- a/Source/core/rendering/TextAutosizer.cpp |
| +++ b/Source/core/rendering/TextAutosizer.cpp |
| @@ -364,7 +364,8 @@ bool TextAutosizer::isAutosizingCluster(const RenderBlock* renderer, TextAutosiz |
| return isNarrowDescendant(renderer, parentClusterInfo) |
| || isWiderDescendant(renderer, parentClusterInfo) |
| - || isIndependentDescendant(renderer); |
| + || isIndependentDescendant(renderer) |
| + || containerIsTextArea(renderer); |
|
johnme
2013/04/29 11:11:26
Please add this as a condition in isIndependentDes
timvolodine
2013/04/29 17:59:13
Done.
|
| } |
| bool TextAutosizer::containerShouldBeAutosized(const RenderBlock* container) |
| @@ -438,6 +439,11 @@ bool TextAutosizer::containerIsRowOfLinks(const RenderObject* container) |
| return (linkCount >= 3); |
| } |
| +bool TextAutosizer::containerIsTextArea(const RenderBlock* container) |
|
johnme
2013/04/29 11:11:26
Nit: This method is so simple, that you might as w
timvolodine
2013/04/29 17:59:13
Done.
|
| +{ |
| + return container->isTextArea(); |
| +} |
| + |
| bool TextAutosizer::contentHeightIsConstrained(const RenderBlock* container) |
| { |
| // FIXME: Propagate constrainedness down the tree, to avoid inefficiently walking back up from each box. |
| @@ -476,6 +482,11 @@ bool TextAutosizer::compositeClusterShouldBeAutosized(Vector<TextAutosizingClust |
| // if a cluster contains very few lines of text then it's ok to have to zoom |
| // in and pan from side to side to read each line, since if there are very |
| // few lines of text you'll only need to pan across once or twice. |
| + // |
| + // An exception to the 4 lines of text are the textarea clusters, which are |
| + // always autosized by default (i.e. threated as if they contain more than 4 |
| + // lines of text). This is to ensure that the text does not suddenly gets |
|
johnme
2013/04/29 11:11:26
Nit: s/gets/get/
timvolodine
2013/04/29 17:59:13
Done.
|
| + // autosized when the user enters more than 4 lines of text. |
| float totalTextWidth = 0; |
| const float minLinesOfText = 4; |
| float minTextWidth = blockWidth * minLinesOfText; |
| @@ -483,6 +494,8 @@ bool TextAutosizer::compositeClusterShouldBeAutosized(Vector<TextAutosizingClust |
| measureDescendantTextWidth(clusterInfos[i].blockContainingAllText, clusterInfos[i], minTextWidth, totalTextWidth); |
| if (totalTextWidth >= minTextWidth) |
| return true; |
| + if (containerIsTextArea(clusterInfos[i].root)) |
|
johnme
2013/04/29 11:11:26
Nit: would be nice to move this check to the start
timvolodine
2013/04/29 17:59:13
Done.
|
| + return true; |
| } |
| return false; |
| } |