Title: [192564] trunk
Revision
192564
Author
za...@apple.com
Date
2015-11-17 19:00:43 -0800 (Tue, 17 Nov 2015)

Log Message

Simple line layout: Add letter-spacing support.
https://bugs.webkit.org/show_bug.cgi?id=151362

Reviewed by Antti Koivisto.

This enables us to use simple line layout on letter-spacing content.
(fixme: webkit.org/b/151368 -> Repaint rect is not computed correctly when negative letter-spacing applied)

Source/WebCore:

Test: fast/text/simple-line-letterspacing.html

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForStyle):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow): RenderLineBoxList tests vertical intersection only.
* rendering/SimpleLineLayoutTextFragmentIterator.cpp:
(WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):

LayoutTests:

* fast/text/simple-line-letterspacing-expected.html: Added.
* fast/text/simple-line-letterspacing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192563 => 192564)


--- trunk/LayoutTests/ChangeLog	2015-11-18 01:54:47 UTC (rev 192563)
+++ trunk/LayoutTests/ChangeLog	2015-11-18 03:00:43 UTC (rev 192564)
@@ -1,3 +1,16 @@
+2015-11-17  Zalan Bujtas  <za...@apple.com>
+
+        Simple line layout: Add letter-spacing support.
+        https://bugs.webkit.org/show_bug.cgi?id=151362
+
+        Reviewed by Antti Koivisto.
+
+        This enables us to use simple line layout on letter-spacing content.
+        (fixme: webkit.org/b/151368 -> Repaint rect is not computed correctly when negative letter-spacing applied)
+
+        * fast/text/simple-line-letterspacing-expected.html: Added.
+        * fast/text/simple-line-letterspacing.html: Added.
+
 2015-11-17  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking storage/indexeddb/modern/get-index-failures.html as flaky on mac-wk1

Added: trunk/LayoutTests/fast/text/simple-line-letterspacing-expected.html (0 => 192564)


--- trunk/LayoutTests/fast/text/simple-line-letterspacing-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-letterspacing-expected.html	2015-11-18 03:00:43 UTC (rev 192564)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>This tests that simple line layout renders letter-spacing properly.</title>
+<style>
+	div {
+		margin: 10px;
+	}
+</style>
+</head>
+<body>
+<script>
+if (window.internals)
+	internals.settings.setSimpleLineLayoutEnabled(false);
+for (var i = -10; i < 10; ++i) {
+    var element = document.createElement("div");
+    element.innerText = "foobar";
+    element.style.letterSpacing = i;
+	document.body.appendChild(element);
+}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/simple-line-letterspacing.html (0 => 192564)


--- trunk/LayoutTests/fast/text/simple-line-letterspacing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-letterspacing.html	2015-11-18 03:00:43 UTC (rev 192564)
@@ -0,0 +1,20 @@
+<html>
+<head>
+<title>This tests that simple line layout renders letter-spacing properly.</title>
+<style>
+	div {
+		margin: 10px;
+	}
+</style>
+</head>
+<body>
+<script>
+for (var i = -10; i < 10; ++i) {
+    var element = document.createElement("div");
+    element.innerText = "foobar";
+    element.style.letterSpacing = i;
+	document.body.appendChild(element);
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (192563 => 192564)


--- trunk/Source/WebCore/ChangeLog	2015-11-18 01:54:47 UTC (rev 192563)
+++ trunk/Source/WebCore/ChangeLog	2015-11-18 03:00:43 UTC (rev 192564)
@@ -1,3 +1,22 @@
+2015-11-17  Zalan Bujtas  <za...@apple.com>
+
+        Simple line layout: Add letter-spacing support.
+        https://bugs.webkit.org/show_bug.cgi?id=151362
+
+        Reviewed by Antti Koivisto.
+
+        This enables us to use simple line layout on letter-spacing content.
+        (fixme: webkit.org/b/151368 -> Repaint rect is not computed correctly when negative letter-spacing applied)
+
+        Test: fast/text/simple-line-letterspacing.html
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForStyle):
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::paintFlow): RenderLineBoxList tests vertical intersection only. 
+        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
+        (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
+
 2015-11-17  Per Arne Vollan  <pe...@outlook.com>
 
         [WinCairo][MediaFoundation] Current playback time is not shown.

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (192563 => 192564)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2015-11-18 01:54:47 UTC (rev 192563)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2015-11-18 03:00:43 UTC (rev 192564)
@@ -122,7 +122,7 @@
         return false;
     if (!style.textIndent().isZero())
         return false;
-    if (!style.wordSpacing().isZero() || style.letterSpacing())
+    if (!style.wordSpacing().isZero())
         return false;
     if (!style.isLeftToRightDirection())
         return false;

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (192563 => 192564)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2015-11-18 01:54:47 UTC (rev 192563)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2015-11-18 03:00:43 UTC (rev 192564)
@@ -86,10 +86,14 @@
     float strokeOverflow = ceilf(flow.style().textStrokeWidth());
     float deviceScaleFactor = flow.document().deviceScaleFactor();
     for (const auto& run : resolver.rangeForRect(paintRect)) {
+        if (run.start() == run.end())
+            continue;
+
         FloatRect rect = run.rect();
         rect.inflate(strokeOverflow);
-        if (!rect.intersects(paintRect) || run.start() == run.end())
+        if (paintRect.y() > rect.maxY() || paintRect.maxY() < rect.y())
             continue;
+
         TextRun textRun(run.text());
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         // x position indicates the line offset from the rootbox. It's always 0 in case of simple line layout.

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (192563 => 192564)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2015-11-18 01:54:47 UTC (rev 192563)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2015-11-18 03:00:43 UTC (rev 192564)
@@ -208,7 +208,7 @@
     float width = m_style.font.width(run);
     if (measureWithEndSpace)
         width -= m_style.spaceWidth;
-    return width;
+    return std::max<float>(0, width);
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to