Title: [185256] trunk
Revision
185256
Author
[email protected]
Date
2015-06-05 11:26:07 -0700 (Fri, 05 Jun 2015)

Log Message

Underlines too close in vertical Chinese text.
https://bugs.webkit.org/show_bug.cgi?id=145651
<rdar://problem/11105920>

Reviewed by Simon Fraser.

Source/WebCore:

Added fast/text/decorations-vertical-underline.html

* style/InlineTextBoxStyle.cpp:
(WebCore::computeUnderlineOffset):
Make sure the to map text-underline-position: auto to under when a line has an ideographic baseline.

LayoutTests:

* fast/text/decorations-vertical-underline-expected.html: Added.
* fast/text/decorations-vertical-underline.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185255 => 185256)


--- trunk/LayoutTests/ChangeLog	2015-06-05 18:11:32 UTC (rev 185255)
+++ trunk/LayoutTests/ChangeLog	2015-06-05 18:26:07 UTC (rev 185256)
@@ -1,3 +1,14 @@
+2015-06-05  David Hyatt  <[email protected]>
+
+        Underlines too close in vertical Chinese text.
+        https://bugs.webkit.org/show_bug.cgi?id=145651
+        <rdar://problem/11105920>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/decorations-vertical-underline-expected.html: Added.
+        * fast/text/decorations-vertical-underline.html: Added.
+
 2015-06-05  Said Abou-Hallawa  <[email protected]>
 
         Layout test http/tests/misc/acid3.html times out on Yosemite WK2 Debug.

Added: trunk/LayoutTests/fast/text/decorations-vertical-underline-expected.html (0 => 185256)


--- trunk/LayoutTests/fast/text/decorations-vertical-underline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/decorations-vertical-underline-expected.html	2015-06-05 18:26:07 UTC (rev 185256)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ibooks="http://apple.com/ibooks/html-extensions" xmlns:epub="http://www.idpf.org/2007/ops">
+<head>
+<title>Underline Test</title>
+<style>
+p{
+margin:0
+}
+body {
+-webkit-writing-mode:vertical-rl;
+}
+</style>
+</head>
+<body>
+<p>「向見論治道書,其間欲仿井田之意</p>
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/text/decorations-vertical-underline.html (0 => 185256)


--- trunk/LayoutTests/fast/text/decorations-vertical-underline.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/decorations-vertical-underline.html	2015-06-05 18:26:07 UTC (rev 185256)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ibooks="http://apple.com/ibooks/html-extensions" xmlns:epub="http://www.idpf.org/2007/ops">
+<head>
+<title>Underline Test</title>
+<style>
+p{
+text-decoration: underline; margin:0
+}
+body {
+-webkit-writing-mode:vertical-rl;
+}
+</style>
+</head>
+<body>
+<p>「向見論治道書,其間欲仿井田之意</p>
+<p style="margin-right:-2px; position:relative;background-color:white; width:10px"></p>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (185255 => 185256)


--- trunk/Source/WebCore/ChangeLog	2015-06-05 18:11:32 UTC (rev 185255)
+++ trunk/Source/WebCore/ChangeLog	2015-06-05 18:26:07 UTC (rev 185256)
@@ -1,3 +1,17 @@
+2015-06-04  David Hyatt  <[email protected]>
+
+        Underlines too close in vertical Chinese text.
+        https://bugs.webkit.org/show_bug.cgi?id=145651
+        <rdar://problem/11105920>
+
+        Reviewed by Simon Fraser.
+
+        Added fast/text/decorations-vertical-underline.html
+
+        * style/InlineTextBoxStyle.cpp:
+        (WebCore::computeUnderlineOffset):
+        Make sure the to map text-underline-position: auto to under when a line has an ideographic baseline.
+
 2015-06-05  Carlos Alberto Lopez Perez  <[email protected]>
 
         [GTK] [Wayland] The MiniBrowser crashes inside Weston.

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (185255 => 185256)


--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2015-06-05 18:11:32 UTC (rev 185255)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2015-06-05 18:26:07 UTC (rev 185256)
@@ -36,12 +36,20 @@
 {
     // This represents the gap between the baseline and the closest edge of the underline.
     int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.0));
-
-    // According to the specification TextUnderlinePositionAuto should default to 'alphabetic' for horizontal text
-    // and to 'under Left' for vertical text (e.g. japanese). We support only horizontal text for now.
-    switch (underlinePosition) {
+    
+    // FIXME: The code for visual overflow detection passes in a null inline text box. This means it is now
+    // broken for the case where auto needs to behave like "under".
+    
+    // According to the specification TextUnderlinePositionAuto should avoid drawing through glyphs in
+    // scripts where it would not be appropriate (e.g., ideographs).
+    // Strictly speaking this can occur whenever the line contains ideographs
+    // even if it is horizontal, but detecting this has performance implications. For now we only work with
+    // vertical text, since we already determined the baseline type to be ideographic in that
+    // case.
+    TextUnderlinePosition resolvedUnderlinePosition = underlinePosition == TextUnderlinePositionAuto && inlineTextBox && inlineTextBox->root().baselineType() == IdeographicBaseline ? TextUnderlinePositionUnder : TextUnderlinePositionAlphabetic;
+    
+    switch (resolvedUnderlinePosition) {
     case TextUnderlinePositionAlphabetic:
-    case TextUnderlinePositionAuto:
         return fontMetrics.ascent() + gap;
     case TextUnderlinePositionUnder: {
         ASSERT(inlineTextBox);
@@ -61,6 +69,8 @@
         }
         return inlineTextBox->logicalHeight() + gap + std::max<float>(offset, 0);
     }
+    case TextUnderlinePositionAuto:
+        ASSERT_NOT_REACHED();
     }
 
     ASSERT_NOT_REACHED();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to