Bug 104631 - Emphasis mark is printed after inline-block with justify
Summary: Emphasis mark is printed after inline-block with justify
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-10 22:01 PST by Yuki Sekiguchi
Modified: 2012-12-19 18:46 PST (History)
6 users (show)

See Also:


Attachments
Reproducing content (287 bytes, text/html)
2012-12-10 22:01 PST, Yuki Sekiguchi
no flags Details
Patch (7.78 KB, patch)
2012-12-10 23:44 PST, Yuki Sekiguchi
no flags Details | Formatted Diff | Diff
Update TestExpectations (8.46 KB, patch)
2012-12-11 21:20 PST, Yuki Sekiguchi
no flags Details | Formatted Diff | Diff
Patch (9.55 KB, patch)
2012-12-13 18:39 PST, Yuki Sekiguchi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuki Sekiguchi 2012-12-10 22:01:39 PST
Created attachment 178714 [details]
Reproducing content

There is illegal emphasis mark before "あ" or after empty inline-block in attached content.
It should not be printed.
Comment 1 Yuki Sekiguchi 2012-12-10 23:44:24 PST
Created attachment 178730 [details]
Patch
Comment 2 WebKit Review Bot 2012-12-11 01:55:57 PST
Comment on attachment 178730 [details]
Patch

Attachment 178730 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15278019

New failing tests:
fast/inline/justify-emphasis-inline-box.html
Comment 3 WebKit Review Bot 2012-12-11 02:57:19 PST
Comment on attachment 178730 [details]
Patch

Attachment 178730 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15257580

New failing tests:
fast/inline/justify-emphasis-inline-box.html
Comment 4 Yuki Sekiguchi 2012-12-11 21:20:05 PST
Created attachment 178957 [details]
Update TestExpectations
Comment 5 Dean Jackson 2012-12-12 17:38:57 PST
Comment on attachment 178957 [details]
Update TestExpectations

View in context: https://bugs.webkit.org/attachment.cgi?id=178957&action=review

Some grammar changes. This is my first review of text layout, so I'm quite nervous and I hope I don't break anything :(

> Source/WebCore/ChangeLog:8
> +        Fix emphasis mark is printed after inline-block with justify.

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

> Source/WebCore/ChangeLog:14
> +        If an inline-block is expanded, a space is added after inline-block.
> +        Emphasis mark is drawn over the space for the expand.
> +
> +        When an emphasis mark is drawn, check the charactor is the space.
> +        If so, don't draw emphasis mark.

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

> Source/WebCore/platform/graphics/WidthIterator.cpp:228
> +                                    glyphBuffer->add(0, fontData, m_expansionPerOpportunity);

I wonder if we should have a special name for a null glyph, or a glyph we don't care about?

> LayoutTests/ChangeLog:8
> +        Test that draw emphasis mark to justified inline box and text.

-> Test that emphasis marks are not drawn incorrectly in justified text with inline boxes.
Comment 6 Yuki Sekiguchi 2012-12-13 18:39:22 PST
Created attachment 179397 [details]
Patch
Comment 7 Yuki Sekiguchi 2012-12-13 18:42:23 PST
(In reply to comment #5)

Thank you for reviewing.

> > Source/WebCore/ChangeLog:8
> > +        Fix emphasis mark is printed after inline-block with justify.
> 
> -> "Do not print an emphasis mark after an inline-block when justified."

Fixed.

> > Source/WebCore/ChangeLog:14
> > +        If an inline-block is expanded, a space is added after inline-block.
> > +        Emphasis mark is drawn over the space for the expand.
> > +
> > +        When an emphasis mark is drawn, check the charactor is the space.
> > +        If so, don't draw emphasis mark.
> 
> -> "If an inline-block is expanded, it has a space appended to it. This space should not have any emphasis marks drawn."

Fixed.

> > Source/WebCore/platform/graphics/WidthIterator.cpp:228
> > +                                    glyphBuffer->add(0, fontData, m_expansionPerOpportunity);
> 
> I wonder if we should have a special name for a null glyph, or a glyph we don't care about?

I think zero width space is better than a null glyph.
Therefore, I change the fix to use zero width space glyph.

> > LayoutTests/ChangeLog:8
> > +        Test that draw emphasis mark to justified inline box and text.
> 
> -> Test that emphasis marks are not drawn incorrectly in justified text with inline boxes.

Fixed.
Comment 8 Yuki Sekiguchi 2012-12-13 18:45:34 PST
Hi Dean.
Could you review this?
Comment 9 WebKit Review Bot 2012-12-14 15:53:03 PST
Comment on attachment 179397 [details]
Patch

Clearing flags on attachment: 179397

Committed r137786: <http://trac.webkit.org/changeset/137786>
Comment 10 WebKit Review Bot 2012-12-14 15:53:06 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Yuki Sekiguchi 2012-12-16 16:12:55 PST
Thank you for reviewing and committing!
Comment 12 Roger Fong 2012-12-18 15:44:16 PST
Hello,
fast/inline/justify-emphasis-inline-box.html fails on Win7.
Results here: http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r137786%20(30937)/fast/inline/justify-emphasis-inline-box-pretty-diff.html

Similar results on the EFL port. The results were rebaselined there. 
Are these results expected on these ports?
Thx
Comment 13 Dean Jackson 2012-12-18 16:12:52 PST
Roger,

I think it needs rebaseline.
Comment 14 Roger Fong 2012-12-18 17:00:04 PST
Aight sure, just concerned that the difference in the diffs is 185 pixels and that there was no explanation about why that was the right thing to do on the EFL port...
Comment 15 Dean Jackson 2012-12-19 10:45:47 PST
(In reply to comment #14)
> Aight sure, just concerned that the difference in the diffs is 185 pixels and that there was no explanation about why that was the right thing to do on the EFL port...

I think the change looks bigger than it really is because there is enough extra space now to make sure the emphasis mark is on the next line.
Comment 16 Yuki Sekiguchi 2012-12-19 18:46:45 PST
Hmm...
I watched test results on Mac, Windows and Linux.
The justification is occurred on Mac, but it isn't occurred on Windows and Linux.
This behavior is changed by Font::canExpandAroundIdeographsInComplexText() implementation.

If your port returns true from canExpandAroundIdeographsInComplexText(), this bug is reproduced and the result width is 200px.
If your port returns false, this bug is NOT reproduced and the result width is about 18px(depend on Japanese font).

Safari for Windows should be about 18px, because win/FontWin.cpp returns false.

I don't know which directory ELF port use.
If it use harfbuzz/FontHarfBuzz.cpp, it returns false, so the width should be about 18px.