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

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

Issue 11864024: Merge 139435 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/TextAutosizer.cpp
===================================================================
--- Source/WebCore/rendering/TextAutosizer.cpp (revision 139473)
+++ Source/WebCore/rendering/TextAutosizer.cpp (working copy)
@@ -216,11 +216,22 @@
// from the box's parent (we want to avoid having significantly different
// width blocks within a cluster, since the narrower blocks would end up
// larger than would otherwise be necessary).
- // Additionally, any containers that are wider than the |blockContainingAllText|
- // of their enclosing cluster also become clusters, since they need special
- // treatment due to their width.
+ // Additionally, any containers that are wider or at least 200px narrower than
+ // the |blockContainingAllText| of their enclosing cluster also become clusters,
+ // since they need special treatment due to their width.
ASSERT(isAutosizingContainer(renderer));
+ // Upper limit on the difference between the width of the parent block containing all
+ // text and that of a narrow child before the child becomes a cluster.
+ const float maxWidthDifference = 200;
+
+ if (parentBlockContainingAllText) {
+ float contentWidth = renderer->contentLogicalWidth();
+ float clusterTextWidth = parentBlockContainingAllText->contentLogicalWidth();
+ if (contentWidth > clusterTextWidth || (clusterTextWidth - contentWidth) > maxWidthDifference)
+ return true;
+ }
+
return renderer->isRenderView()
|| renderer->isFloating()
|| renderer->isOutOfFlowPositioned()
@@ -229,9 +240,7 @@
|| renderer->isFlexibleBoxIncludingDeprecated()
|| renderer->hasColumns()
|| renderer->containingBlock()->isHorizontalWritingMode() != renderer->isHorizontalWritingMode()
- || renderer->style()->isDisplayReplacedType()
- || (parentBlockContainingAllText
- && renderer->contentLogicalWidth() > parentBlockContainingAllText->contentLogicalWidth());
+ || renderer->style()->isDisplayReplacedType();
// FIXME: Tables need special handling to multiply all their columns by
// the same amount even if they're different widths; so do hasColumns()
// containers, and probably flexboxes...
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698