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

Unified Diff: Source/core/rendering/TextAutosizer.cpp

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: fix include 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/TextAutosizer.cpp
diff --git a/Source/core/rendering/TextAutosizer.cpp b/Source/core/rendering/TextAutosizer.cpp
index 6fd64b6f333e69ad97f40c075fee6f03a8277bd6..287a82701bc675069b5d1c890af5ec469d32d58e 100644
--- a/Source/core/rendering/TextAutosizer.cpp
+++ b/Source/core/rendering/TextAutosizer.cpp
@@ -375,6 +375,9 @@ bool TextAutosizer::containerShouldBeAutosized(const RenderBlock* container)
if (containerIsRowOfLinks(container))
return false;
+ if (containerIsTextArea(container))
+ return false;
+
// Don't autosize block-level text that can't wrap (as it's likely to
// expand sideways and break the page's layout).
if (!container->style()->autoWrap())
@@ -438,6 +441,14 @@ bool TextAutosizer::containerIsRowOfLinks(const RenderObject* container)
return (linkCount >= 3);
}
+bool TextAutosizer::containerIsTextArea(const RenderBlock* container)
+{
+ // Don't autosize textareas to prevent annoying oscillation when the entered texts exceeds
+ // 4 lines and the text inside the area suddenly gets boosted.
+ const RenderObject* parentBlock = (container->parent()) ? container->parent() : container;
+ return parentBlock->isTextArea();
+}
+
bool TextAutosizer::contentHeightIsConstrained(const RenderBlock* container)
{
// FIXME: Propagate constrainedness down the tree, to avoid inefficiently walking back up from each box.

Powered by Google App Engine
This is Rietveld 408576698