Bug 111675

Summary: When we set word-wrap: break-word and xml:space="preserve" to svg text element, the text is collapsed.
Product: WebKit Reporter: Yuki Sekiguchi <yuki.sekiguchi>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, esprehn+autocc, leviw, ojan.autocc, pdr, schenney, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
reproduced html content
none
Patch
none
Patch none

Description Yuki Sekiguchi 2013-03-06 21:01:31 PST
Created attachment 191909 [details]
reproduced html content

In the attached content, the text "abc" is SVG text and it have xml:space="preserve" attribute and is specified word-wrap: break-word.
The text is collapsed.

In the following spec, SVG don't perform automatic line break or word wrapping.
http://www.w3.org/TR/SVG/text.html#Introduction
> SVG performs no automatic line breaking or word wrapping.

Therefore, I think the collapsing is illegal.
Firefox don't collapse the text.
Comment 1 Yuki Sekiguchi 2013-03-06 21:15:48 PST
Created attachment 191912 [details]
Patch
Comment 2 Stephen Chenney 2013-03-07 07:12:39 PST
Comment on attachment 191912 [details]
Patch

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

Mostly fine. I have one nit with the code and a request for greater testing.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:2841
> +                breakWords = breakAll = false;

I believe that WebKit style dictates that this be two lines, with one assignment on each line.

> LayoutTests/svg/text/preserve-break-word-expected.html:6
> +<text x="100" y="100" style="word-wrap: break-word">abcdef</text>

Can you remove the style on the <text>? As I understand your patch, the SVG should appear the same as something with no word-wrap defined.

> LayoutTests/svg/text/preserve-break-word.html:6
> +<text x="100" y="100" style="word-wrap: break-word"><tspan xml:space="preserve">abc</tspan>def</text>

Could you please provide 3 <text> nodes? One with word-wrap: break word, one with xml:space="preserve" and one with both (the line you have already is the one with both).
Comment 3 Yuki Sekiguchi 2013-03-07 20:31:33 PST
Created attachment 192137 [details]
Patch
Comment 4 Yuki Sekiguchi 2013-03-07 20:42:42 PST
Hi Stephen,
Thank you for reviewing.

(In reply to comment #2)
> > Source/WebCore/rendering/RenderBlockLineLayout.cpp:2841
> > +                breakWords = breakAll = false;
> 
> I believe that WebKit style dictates that this be two lines, with one assignment on each line.

OK. I understand it.

> > LayoutTests/svg/text/preserve-break-word-expected.html:6
> > +<text x="100" y="100" style="word-wrap: break-word">abcdef</text>
> 
> Can you remove the style on the <text>? As I understand your patch, the SVG should appear the same as something with no word-wrap defined.

Sorry. You are right.
Fixed.

> > LayoutTests/svg/text/preserve-break-word.html:6
> > +<text x="100" y="100" style="word-wrap: break-word"><tspan xml:space="preserve">abc</tspan>def</text>
> 
> Could you please provide 3 <text> nodes? One with word-wrap: break word, one with xml:space="preserve" and one with both (the line you have already is the one with both).

Added test case.
Comment 5 Stephen Chenney 2013-03-08 06:28:06 PST
Looks good. R=me.
Comment 6 WebKit Review Bot 2013-03-08 06:35:04 PST
Comment on attachment 192137 [details]
Patch

Clearing flags on attachment: 192137

Committed r145215: <http://trac.webkit.org/changeset/145215>
Comment 7 WebKit Review Bot 2013-03-08 06:35:07 PST
All reviewed patches have been landed.  Closing bug.