Title: [189058] trunk
Revision
189058
Author
[email protected]
Date
2015-08-27 14:39:20 -0700 (Thu, 27 Aug 2015)

Log Message

Simple line layout: Text jumps sometimes on naughty strings page
https://bugs.webkit.org/show_bug.cgi?id=148399
rdar://problem/22212568

Reviewed by Antti Koivisto.

The x position we set for tab characters during painting should
be the same as if it was set by the inline box tree painting.

Inline box tree computes the distance from the rootbox for each line
and sets this value as the xPos for the TextRun.
Currently simple line layout does not support cases where a line
would have an offset, so this value is always 0.

Source/WebCore:

Test: fast/text/whitespace/simple-line-layout-tab-position.html

* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):

LayoutTests:

* fast/text/whitespace/simple-line-layout-tab-position-expected.html: Added.
* fast/text/whitespace/simple-line-layout-tab-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (189057 => 189058)


--- trunk/LayoutTests/ChangeLog	2015-08-27 21:38:53 UTC (rev 189057)
+++ trunk/LayoutTests/ChangeLog	2015-08-27 21:39:20 UTC (rev 189058)
@@ -1,3 +1,22 @@
+2015-08-27  Zalan Bujtas  <[email protected]>
+
+        Simple line layout: Text jumps sometimes on naughty strings page
+        https://bugs.webkit.org/show_bug.cgi?id=148399
+        rdar://problem/22212568
+
+        Reviewed by Antti Koivisto.
+
+        The x position we set for tab characters during painting should
+        be the same as if it was set by the inline box tree painting.
+
+        Inline box tree computes the distance from the rootbox for each line
+        and sets this value as the xPos for the TextRun.
+        Currently simple line layout does not support cases where a line
+        would have an offset, so this value is always 0.
+
+        * fast/text/whitespace/simple-line-layout-tab-position-expected.html: Added.
+        * fast/text/whitespace/simple-line-layout-tab-position.html: Added.
+
 2015-08-27  Anders Carlsson  <[email protected]>
 
         REGRESSION (r188987): imported/mozilla/svg/filters/feConvolveMatrix-1.svg fails

Added: trunk/LayoutTests/fast/text/whitespace/simple-line-layout-tab-position-expected.html (0 => 189058)


--- trunk/LayoutTests/fast/text/whitespace/simple-line-layout-tab-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/whitespace/simple-line-layout-tab-position-expected.html	2015-08-27 21:39:20 UTC (rev 189058)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that simple line layout renderes tab positions properly</title>
+<script>
+  if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+<style>
+  body { 
+    margin: 0px; 
+  }
+
+  div {
+    padding-left: 10px;
+    font-size: 22px;
+    white-space: pre;
+  }
+</style>
+</head>
+<body>
+<div>	a	b	c	e	f	g	h	i	j	k</div>
+<div style="text-align: center">	a	b	c	e	f	g	h	i	j	k</div>
+<div style="text-align: right">	a	b	c	e	f	g	h	i	j	k</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/whitespace/simple-line-layout-tab-position.html (0 => 189058)


--- trunk/LayoutTests/fast/text/whitespace/simple-line-layout-tab-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/whitespace/simple-line-layout-tab-position.html	2015-08-27 21:39:20 UTC (rev 189058)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that simple line layout renderes tab positions properly</title>
+<style>
+  body { 
+    margin: 0px; 
+  }
+
+  div {
+    padding-left: 10px;
+    font-size: 22px;
+    white-space: pre;
+  }
+</style>
+</head>
+<body>
+<div>	a	b	c	e	f	g	h	i	j	k</div>
+<div style="text-align: center">	a	b	c	e	f	g	h	i	j	k</div>
+<div style="text-align: right">	a	b	c	e	f	g	h	i	j	k</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (189057 => 189058)


--- trunk/Source/WebCore/ChangeLog	2015-08-27 21:38:53 UTC (rev 189057)
+++ trunk/Source/WebCore/ChangeLog	2015-08-27 21:39:20 UTC (rev 189058)
@@ -1,3 +1,24 @@
+2015-08-27  Zalan Bujtas  <[email protected]>
+
+        Simple line layout: Text jumps sometimes on naughty strings page
+        https://bugs.webkit.org/show_bug.cgi?id=148399
+        rdar://problem/22212568
+
+        Reviewed by Antti Koivisto.
+
+        The x position we set for tab characters during painting should
+        be the same as if it was set by the inline box tree painting.
+
+        Inline box tree computes the distance from the rootbox for each line
+        and sets this value as the xPos for the TextRun.
+        Currently simple line layout does not support cases where a line
+        would have an offset, so this value is always 0.
+
+        Test: fast/text/whitespace/simple-line-layout-tab-position.html
+
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::paintFlow):
+
 2015-08-27  Alex Christensen  <[email protected]>
 
         Isolate Source directories in CMake build

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (189057 => 189058)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2015-08-27 21:38:53 UTC (rev 189057)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2015-08-27 21:39:20 UTC (rev 189058)
@@ -88,7 +88,8 @@
             continue;
         TextRun textRun(run.text());
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
-        textRun.setXPos(run.rect().x());
+        // x position indicates the line offset from the rootbox. It's always 0 in case of simple line layout.
+        textRun.setXPos(0);
         FloatPoint textOrigin = FloatPoint(rect.x() + paintOffset.x(), roundToDevicePixel(run.baselinePosition() + paintOffset.y(), deviceScaleFactor));
         context.drawText(font, textRun, textOrigin);
         if (debugBordersEnabled)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to