Title: [135553] trunk
Revision
135553
Author
commit-qu...@webkit.org
Date
2012-11-22 18:54:10 -0800 (Thu, 22 Nov 2012)

Log Message

Text Autosizing: Improve handling of nested comments on reddit.com
https://bugs.webkit.org/show_bug.cgi?id=102409

Patch by John Mellor <joh...@chromium.org> on 2012-11-22
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

No longer consider overflow != visible as requiring an independent
cluster. Some sites (e.g. reddit.com) wrap ordinary blocks (such as
comments) in overflow:hidden or overflow:auto, for various reasons
(like allowing it to be scrollable, or clipping an element that sticks
out). These reasons are not sufficient justification for a new cluster.

On reddit.com this means that comments will all get the same multiplier,
rather than being independently assigned a variety of multipliers based
on how much text each comment contains (etc), which significantly
improves the look.

Test: fast/text-autosizing/cluster-narrow-in-wide-ohidden.html

* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::isAutosizingCluster):

LayoutTests:

Added test to confirm that overflow:hidden no longer triggers a cluster.

* fast/text-autosizing/cluster-narrow-in-wide-ohidden-expected.html: Added.
* fast/text-autosizing/cluster-narrow-in-wide-ohidden.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (135552 => 135553)


--- trunk/LayoutTests/ChangeLog	2012-11-23 02:38:54 UTC (rev 135552)
+++ trunk/LayoutTests/ChangeLog	2012-11-23 02:54:10 UTC (rev 135553)
@@ -1,3 +1,15 @@
+2012-11-22  John Mellor  <joh...@chromium.org>
+
+        Text Autosizing: Improve handling of nested comments on reddit.com
+        https://bugs.webkit.org/show_bug.cgi?id=102409
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added test to confirm that overflow:hidden no longer triggers a cluster.
+
+        * fast/text-autosizing/cluster-narrow-in-wide-ohidden-expected.html: Added.
+        * fast/text-autosizing/cluster-narrow-in-wide-ohidden.html: Added.
+
 2012-11-22  Stephen Chenney  <schen...@chromium.org>
 
         Test expectations update after enabling Skia changes.

Added: trunk/LayoutTests/fast/text-autosizing/cluster-narrow-in-wide-ohidden-expected.html (0 => 135553)


--- trunk/LayoutTests/fast/text-autosizing/cluster-narrow-in-wide-ohidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text-autosizing/cluster-narrow-in-wide-ohidden-expected.html	2012-11-23 02:54:10 UTC (rev 135553)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+
+<meta name="viewport" content="width=800">
+<style>
+html { font-size: 16px; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
+</style>
+
+</head>
+<body>
+
+<div style="width: 400px; overflow: hidden; font-size: 2.5rem">
+    This text should be autosized to 40px computed font size (16 * 800/320), since the overflow:hidden does not cause this to be a new cluster, so it is part of the 800px wide root cluster.
+</div>
+
+<div style="font-size: 2.5rem">
+    This text should similarly be autosized to 40px.<br>
+    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/fast/text-autosizing/cluster-narrow-in-wide-ohidden.html (0 => 135553)


--- trunk/LayoutTests/fast/text-autosizing/cluster-narrow-in-wide-ohidden.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text-autosizing/cluster-narrow-in-wide-ohidden.html	2012-11-23 02:54:10 UTC (rev 135553)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+
+<meta name="viewport" content="width=800">
+<style>
+html { font-size: 16px; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
+</style>
+
+<script>
+if (window.internals) {
+    window.internals.settings.setTextAutosizingEnabled(true);
+    window.internals.settings.setTextAutosizingWindowSizeOverride(320, 480);
+} else if (window.console && console.warn) {
+    console.warn("This test depends on the Text Autosizing setting being true, so run it in DumpRenderTree, or manually enable Text Autosizing, and either use a mobile device with 320px device-width (like Nexus S or iPhone), or define HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP.");
+}
+</script>
+
+</head>
+<body>
+
+<div style="width: 400px; overflow: hidden">
+    This text should be autosized to 40px computed font size (16 * 800/320), since the overflow:hidden does not cause this to be a new cluster, so it is part of the 800px wide root cluster.
+</div>
+
+<div>
+    This text should similarly be autosized to 40px.<br>
+    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (135552 => 135553)


--- trunk/Source/WebCore/ChangeLog	2012-11-23 02:38:54 UTC (rev 135552)
+++ trunk/Source/WebCore/ChangeLog	2012-11-23 02:54:10 UTC (rev 135553)
@@ -1,3 +1,26 @@
+2012-11-22  John Mellor  <joh...@chromium.org>
+
+        Text Autosizing: Improve handling of nested comments on reddit.com
+        https://bugs.webkit.org/show_bug.cgi?id=102409
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        No longer consider overflow != visible as requiring an independent
+        cluster. Some sites (e.g. reddit.com) wrap ordinary blocks (such as
+        comments) in overflow:hidden or overflow:auto, for various reasons
+        (like allowing it to be scrollable, or clipping an element that sticks
+        out). These reasons are not sufficient justification for a new cluster.
+
+        On reddit.com this means that comments will all get the same multiplier,
+        rather than being independently assigned a variety of multipliers based
+        on how much text each comment contains (etc), which significantly
+        improves the look.
+
+        Test: fast/text-autosizing/cluster-narrow-in-wide-ohidden.html
+
+        * rendering/TextAutosizer.cpp:
+        (WebCore::TextAutosizer::isAutosizingCluster):
+
 2012-11-22  Pravin D  <pravind....@gmail.com>
 
         max-height property not respected in case of tables

Modified: trunk/Source/WebCore/rendering/TextAutosizer.cpp (135552 => 135553)


--- trunk/Source/WebCore/rendering/TextAutosizer.cpp	2012-11-23 02:38:54 UTC (rev 135552)
+++ trunk/Source/WebCore/rendering/TextAutosizer.cpp	2012-11-23 02:54:10 UTC (rev 135553)
@@ -235,8 +235,6 @@
         || renderer->isTableCaption()
         || renderer->isFlexibleBoxIncludingDeprecated()
         || renderer->hasColumns()
-        || renderer->style()->overflowX() != OVISIBLE
-        || renderer->style()->overflowY() != OVISIBLE
         || renderer->containingBlock()->isHorizontalWritingMode() != renderer->isHorizontalWritingMode();
     // FIXME: Tables need special handling to multiply all their columns by
     // the same amount even if they're different widths; so do hasColumns()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to