Emphasis mark is printed after inline-block with justify
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 23:52:00 +0000 (23:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 23:52:00 +0000 (23:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104631

Patch by Yuki Sekiguchi <yuki.sekiguchi@access-company.com> on 2012-12-14
Reviewed by Dean Jackson.

Source/WebCore:

Do not print an emphasis mark after an inline-block when justified.

If an inline-block is expanded, it has a space appended to it.
This space should not have any emphasis marks drawn.

Test: fast/inline/justify-emphasis-inline-box.html

* platform/graphics/SimpleFontData.h:
(WebCore::SimpleFontData::zeroWidthSpaceGlyph): Add getter method to get zero width space glyph.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal): We use zero width space for the extra space not to draw emphasis marks.

LayoutTests:

Test that emphasis marks are not drawn incorrectly in justified text with inline boxes.

* fast/inline/justify-emphasis-inline-box.html: Added.
* platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.png: Added.
* platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.txt: Added.
* platform/mac/fast/inline/justify-emphasis-inline-box-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137786 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/inline/justify-emphasis-inline-box.html [new file with mode: 0644]
LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/fast/inline/justify-emphasis-inline-box-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/SimpleFontData.h
Source/WebCore/platform/graphics/WidthIterator.cpp

index 9d2545f..005f14d 100644 (file)
@@ -1,3 +1,17 @@
+2012-12-14  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
+
+        Emphasis mark is printed after inline-block with justify
+        https://bugs.webkit.org/show_bug.cgi?id=104631
+
+        Reviewed by Dean Jackson.
+
+        Test that emphasis marks are not drawn incorrectly in justified text with inline boxes.
+
+        * fast/inline/justify-emphasis-inline-box.html: Added.
+        * platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.png: Added.
+        * platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.txt: Added.
+        * platform/mac/fast/inline/justify-emphasis-inline-box-expected.txt: Added.
+
 2012-12-14  Beth Dakin  <bdakin@apple.com>
 
         Updating these results again since this failing test has started failing in a new 
diff --git a/LayoutTests/fast/inline/justify-emphasis-inline-box.html b/LayoutTests/fast/inline/justify-emphasis-inline-box.html
new file mode 100644 (file)
index 0000000..26d526d
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<!-- There should be no emphasis mark at the top of first line(span's position). -->
+<div style="text-align:justify;-webkit-text-emphasis-style: dot filled; width: 200px; font-family: Ahem">
+<span style="display: inline-block"></span>恂aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+</div>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.png b/LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.png
new file mode 100644 (file)
index 0000000..ba11497
Binary files /dev/null and b/LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.png differ
diff --git a/LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.txt b/LayoutTests/platform/chromium-mac/fast/inline/justify-emphasis-inline-box-expected.txt
new file mode 100644 (file)
index 0000000..a9007d7
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x64
+  RenderBlock {HTML} at (0,0) size 800x64
+    RenderBody {BODY} at (8,8) size 784x48
+      RenderBlock {DIV} at (0,0) size 200x48
+        RenderBlock {SPAN} at (0,21) size 0x0
+        RenderText {#text} at (0,8) size 512x40
+          text run at (0,8) width 200: "\x{3042}"
+          text run at (0,32) width 512: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
index bdb08d3..557be63 100644 (file)
@@ -4237,3 +4237,6 @@ webkit.org/b/104834 [ MountainLion ] fast/css/nested-rounded-corners.html [ Fail
 webkit.org/b/104848 [ Linux XP SnowLeopard Lion Release ] fast/frames/sandboxed-iframe-attribute-parsing.html [ Pass Failure ]
 webkit.org/b/104848 [ SnowLeopard Debug ] fast/frames/sandboxed-iframe-attribute-parsing.html [ Pass Failure ]
 webkit.org/b/104848 [ Release ] fast/frames/sandboxed-iframe-parsing-space-characters.html [ Pass Failure ]
+
+# New test
+webkit.org/b/104631 fast/inline/justify-emphasis-inline-box.html [ Missing ]
diff --git a/LayoutTests/platform/mac/fast/inline/justify-emphasis-inline-box-expected.txt b/LayoutTests/platform/mac/fast/inline/justify-emphasis-inline-box-expected.txt
new file mode 100644 (file)
index 0000000..a9007d7
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x64
+  RenderBlock {HTML} at (0,0) size 800x64
+    RenderBody {BODY} at (8,8) size 784x48
+      RenderBlock {DIV} at (0,0) size 200x48
+        RenderBlock {SPAN} at (0,21) size 0x0
+        RenderText {#text} at (0,8) size 512x40
+          text run at (0,8) width 200: "\x{3042}"
+          text run at (0,32) width 512: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
index ca1e884..ce2617d 100644 (file)
@@ -1,3 +1,22 @@
+2012-12-14  Yuki Sekiguchi  <yuki.sekiguchi@access-company.com>
+
+        Emphasis mark is printed after inline-block with justify
+        https://bugs.webkit.org/show_bug.cgi?id=104631
+
+        Reviewed by Dean Jackson.
+
+        Do not print an emphasis mark after an inline-block when justified.
+
+        If an inline-block is expanded, it has a space appended to it.
+        This space should not have any emphasis marks drawn.
+
+        Test: fast/inline/justify-emphasis-inline-box.html
+
+        * platform/graphics/SimpleFontData.h:
+        (WebCore::SimpleFontData::zeroWidthSpaceGlyph): Add getter method to get zero width space glyph.
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::advanceInternal): We use zero width space for the extra space not to draw emphasis marks.
+
 2012-12-14  Jer Noble  <jer.noble@apple.com>
 
         Unreviewed bug fix after r137782.
index 93726b7..41f8015 100644 (file)
@@ -157,6 +157,7 @@ public:
 
     Glyph spaceGlyph() const { return m_spaceGlyph; }
     void setSpaceGlyph(Glyph spaceGlyph) { m_spaceGlyph = spaceGlyph; }
+    Glyph zeroWidthSpaceGlyph() const { return m_zeroWidthSpaceGlyph; }
     void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spaceGlyph; }
     bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthSpaceGlyph && glyph; }
 
index 96600c7..027bfe6 100644 (file)
@@ -223,9 +223,12 @@ inline unsigned WidthIterator::advanceInternal(TextIterator& textIterator, Glyph
                         float expansionAtThisOpportunity = !m_run.applyWordRounding() ? m_expansionPerOpportunity : roundf(previousExpansion) - roundf(m_expansion);
                         m_runWidthSoFar += expansionAtThisOpportunity;
                         if (glyphBuffer) {
-                            if (glyphBuffer->isEmpty())
-                                glyphBuffer->add(fontData->spaceGlyph(), fontData, expansionAtThisOpportunity);
-                            else
+                            if (glyphBuffer->isEmpty()) {
+                                if (m_forTextEmphasis)
+                                    glyphBuffer->add(fontData->zeroWidthSpaceGlyph(), fontData, m_expansionPerOpportunity);
+                                else
+                                    glyphBuffer->add(fontData->spaceGlyph(), fontData, expansionAtThisOpportunity);
+                            } else
                                 glyphBuffer->expandLastAdvance(expansionAtThisOpportunity);
                         }
                         previousExpansion = m_expansion;