Title: [176527] trunk
Revision
176527
Author
[email protected]
Date
2014-11-24 16:10:17 -0800 (Mon, 24 Nov 2014)

Log Message

SimpleLineLayout::canUseFor() should iterate through RenderTexts to check if their content is eligible for simple line layout.
https://bugs.webkit.org/show_bug.cgi?id=139007

Reviewed by Antti Koivisto.

Source/WebCore:

Tests: fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html
       fast/text/simple-line-layout-multiple-renderers-with-float.html

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):

LayoutTests:

* fast/text/simple-line-layout-multiple-renderers-non-breaking-space-expected.html: Added.
* fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html: Added.
* fast/text/simple-line-layout-multiple-renderers-with-float-expected.html: Added.
* fast/text/simple-line-layout-multiple-renderers-with-float.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176526 => 176527)


--- trunk/LayoutTests/ChangeLog	2014-11-25 00:05:27 UTC (rev 176526)
+++ trunk/LayoutTests/ChangeLog	2014-11-25 00:10:17 UTC (rev 176527)
@@ -1,5 +1,17 @@
 2014-11-24  Zalan Bujtas  <[email protected]>
 
+        SimpleLineLayout::canUseFor() should iterate through RenderTexts to check if their content is eligible for simple line layout.
+        https://bugs.webkit.org/show_bug.cgi?id=139007
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/simple-line-layout-multiple-renderers-non-breaking-space-expected.html: Added.
+        * fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html: Added.
+        * fast/text/simple-line-layout-multiple-renderers-with-float-expected.html: Added.
+        * fast/text/simple-line-layout-multiple-renderers-with-float.html: Added.
+
+2014-11-24  Zalan Bujtas  <[email protected]>
+
         Simple line layout: fast/text/simple-lines-multiple-renderers test has the wrong content.
         https://bugs.webkit.org/show_bug.cgi?id=139036
 

Added: trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-non-breaking-space-expected.html (0 => 176527)


--- trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-non-breaking-space-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-non-breaking-space-expected.html	2014-11-25 00:10:17 UTC (rev 176527)
@@ -0,0 +1,15 @@
+<html>
+<head>
+<title>This tests that multiple text renderers with non-breaking space do not get simple line layouting.</title>
+</head>
+<body>
+<div id=container></div>
+<script>
+  if (window.internals)
+	internals.settings.setSimpleLineLayoutEnabled(false)
+
+  var container = document.getElementById("container");
+  container.appendChild(document.createTextNode("Quo usque tandem abutere, Catilina, patientia nostra?  quam diu etiam\n"));
+  container.appendChild(document.createTextNode("furor iste tuus nos eludet?\xA0quem ad finem sese effrenata iactabit\n"));
+</script>
+</body>

Added: trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html (0 => 176527)


--- trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html	2014-11-25 00:10:17 UTC (rev 176527)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>This tests that multiple text renderers with non-breaking space do not get simple line layouting.</title>
+</head>
+<body>
+<div id=container></div>
+<script>
+  var container = document.getElementById("container");
+  container.appendChild(document.createTextNode("Quo usque tandem abutere, Catilina, patientia nostra?  quam diu etiam\n"));
+  container.appendChild(document.createTextNode("furor iste tuus nos eludet?\xA0quem ad finem sese effrenata iactabit\n"));
+</script>
+</body>

Added: trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-with-float-expected.html (0 => 176527)


--- trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-with-float-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-with-float-expected.html	2014-11-25 00:10:17 UTC (rev 176527)
@@ -0,0 +1,38 @@
+<html>
+<head>  
+<title>This tests that multiple text renderers with floats when text needs special placing do not get simple line layouting.</title>
+<style type="text/css">
+ .container { width: 400px; }
+ .float { 
+ 	float: right; 
+ 	clear: right; 
+ 	border: 1px solid blue; 
+ 	width: 100px; 
+ 	height: 200px; 
+ 	}	
+ 
+ .wide { width:
+ 	400px; 
+   }
+
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="float">
+ </div>
+ <div class="float wide">
+ </div>
+  <p id=foo>
+  </p>
+  <script>
+    if (window.internals)
+      internals.settings.setSimpleLineLayoutEnabled(false)
+
+    var container = document.getElementById("foo");
+    container.appendChild(document.createTextNode("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore\n"));
+    container.appendChild(document.createTextNode("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. 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.\n"));
+  </script>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-with-float.html (0 => 176527)


--- trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-with-float.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-multiple-renderers-with-float.html	2014-11-25 00:10:17 UTC (rev 176527)
@@ -0,0 +1,35 @@
+<html>
+<head>  
+<title>This tests that multiple text renderers with floats when text needs special placing do not get simple line layouting.</title>
+<style type="text/css">
+ .container { width: 400px; }
+ .float { 
+ 	float: right; 
+ 	clear: right; 
+ 	border: 1px solid blue; 
+ 	width: 100px; 
+ 	height: 200px; 
+ 	}	
+ 
+ .wide { width:
+ 	400px; 
+   }
+
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="float">
+ </div>
+ <div class="float wide">
+ </div>
+  <p id=foo>
+  </p>
+  <script>
+    var container = document.getElementById("foo");
+    container.appendChild(document.createTextNode("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore\n"));
+    container.appendChild(document.createTextNode("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. 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.\n"));
+  </script>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (176526 => 176527)


--- trunk/Source/WebCore/ChangeLog	2014-11-25 00:05:27 UTC (rev 176526)
+++ trunk/Source/WebCore/ChangeLog	2014-11-25 00:10:17 UTC (rev 176527)
@@ -1,3 +1,16 @@
+2014-11-24  Zalan Bujtas  <[email protected]>
+
+        SimpleLineLayout::canUseFor() should iterate through RenderTexts to check if their content is eligible for simple line layout.
+        https://bugs.webkit.org/show_bug.cgi?id=139007
+
+        Reviewed by Antti Koivisto.
+
+        Tests: fast/text/simple-line-layout-multiple-renderers-non-breaking-space.html
+               fast/text/simple-line-layout-multiple-renderers-with-float.html
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseFor):
+
 2014-11-22  Sam Weinig  <[email protected]>
 
         Move the '-webkit-box-reflext' CSS property to the new StyleBuilder

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (176526 => 176527)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2014-11-25 00:05:27 UTC (rev 176526)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2014-11-25 00:10:17 UTC (rev 176527)
@@ -163,10 +163,13 @@
         return false;
     if (style.lineBreak() != LineBreakAuto)
         return false;
-    const RenderText& textRenderer = downcast<RenderText>(*flow.firstChild());
+
+    // We can't use the code path if any lines would need to be shifted below floats. This is because we don't keep per-line y coordinates.
     if (flow.containsFloats()) {
-        // We can't use the code path if any lines would need to be shifted below floats. This is because we don't keep per-line y coordinates.
-        float minimumWidthNeeded = textRenderer.minLogicalWidth();
+        float minimumWidthNeeded = std::numeric_limits<float>::max();
+        for (const auto& textRenderer : childrenOfType<RenderText>(flow))
+            minimumWidthNeeded = std::min(minimumWidthNeeded, textRenderer.minLogicalWidth());
+
         for (auto& floatRenderer : *flow.floatingObjectSet()) {
             ASSERT(floatRenderer);
             float availableWidth = flow.availableLogicalWidthForLine(floatRenderer->y(), false);
@@ -174,21 +177,21 @@
                 return false;
         }
     }
-    if (textRenderer.isCombineText() || textRenderer.isCounter() || textRenderer.isQuote() || textRenderer.isTextFragment()
-        || textRenderer.isSVGInlineText())
-        return false;
-    if (style.font().codePath(TextRun(textRenderer.text())) != Font::Simple)
-        return false;
     if (style.font().primaryFont()->isSVGFont())
         return false;
-
     // We assume that all lines have metrics based purely on the primary font.
     auto& primaryFontData = *style.font().primaryFont();
     if (primaryFontData.isLoading())
         return false;
-    if (!canUseForText(textRenderer, primaryFontData))
-        return false;
-
+    for (const auto& textRenderer : childrenOfType<RenderText>(flow)) {
+        if (textRenderer.isCombineText() || textRenderer.isCounter() || textRenderer.isQuote() || textRenderer.isTextFragment()
+            || textRenderer.isSVGInlineText())
+            return false;
+        if (style.font().codePath(TextRun(textRenderer.text())) != Font::Simple)
+            return false;
+        if (!canUseForText(textRenderer, primaryFontData))
+            return false;
+    }
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to