Bug 17475

Summary: Error with line break inside ?» pair of characters.
Product: WebKit Reporter: Dmitriy Kubyshkin <grassator>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor CC: ap, jacob.h.page, mitz, mwp1
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
URL: http://www.artgorbunov.ru/bb/soviet/20071213/
Attachments:
Description Flags
test case
none
updated test case
none
Change rules for allowing a line break after a question mark darin: review+

Description Dmitriy Kubyshkin 2008-02-21 08:57:30 PST
Every punctuation symbol excluding '?' works fine in pair with '&raquo;', but pair ?&raquo; can break into two lines if there isn't enough space in block so ? stays one line and &raquo; moved to the next line.
Comment 1 Alexey Proskuryakov 2008-02-21 23:24:59 PST
Created attachment 19274 [details]
test case
Comment 2 Alexey Proskuryakov 2008-02-21 23:25:44 PST
Confirmed with r30421.
Comment 3 mitz 2008-02-22 08:50:32 PST
To match WinIE, WebKit always allows lines to break after a question mark.
Comment 4 Alexey Proskuryakov 2008-02-22 13:39:19 PST
Created attachment 19281 [details]
updated test case

Made the test case work with IE, which didn't respect div width in the original one. I do not see any special behavior for question marks in IE7 here.
Comment 5 mitz 2008-02-22 15:46:49 PST
(In reply to comment #4)
> Created an attachment (id=19281) [edit]
> updated test case
> 
> Made the test case work with IE, which didn't respect div width in the original
> one. I do not see any special behavior for question marks in IE7 here.

Interesting! If I replace the quotation mark with a plain Latin letter then IE7 does wrap after the question mark. Apparently IE's behavior is more complex than WebKit's approximation.
Comment 6 mitz 2008-05-21 18:13:44 PDT
*** Bug 19174 has been marked as a duplicate of this bug. ***
Comment 7 mitz 2008-05-21 18:14:19 PDT
Bug 19174 was about the same issue with a question mark followed by a double quotation mark: ?"
Comment 8 mitz 2010-01-23 16:49:00 PST
<rdar://problem/7573493>
Comment 9 mitz 2010-01-25 15:10:36 PST
Created attachment 47371 [details]
Change rules for allowing a line break after a question mark
Comment 10 Darin Adler 2010-01-25 17:32:06 PST
Comment on attachment 47371 [details]
Change rules for allowing a line break after a question mark

> +static const unsigned char internetExplorerBreaksBetweenQuestionMarkAnd[] = {

I think it would be better to have a size of 0x80 on this array definition.

I think it's a bit curious to name this array with a verb as if it was a function. A mathematical way of thinking about an array. Programmers tend to think of them as objects instead.

> +        // Internet Explorer allows breaking afer a question mark preceding one of a subset of
> +        // characters in ASCII. For characters outside ASCII, defer to the Unicode algorithm by returning false.

This comment should somehow state that the array is used for enhanced speed as well as to match IE. If all we cared about was matching IE, then the code could say just:

    case '?':
        return nextCh == '|';

>          case '?':
> +            return nextCh <= 0x7f && internetExplorerBreaksBetweenQuestionMarkAnd[nextCh];

I prefer capital hex, myself. It would be nice if the check here was more tied to the size of the array.

r=me
Comment 11 mitz 2010-01-25 22:01:14 PST
Fixed in <http://trac.webkit.org/projects/webkit/changeset/53839>.
Comment 12 Alexey Proskuryakov 2010-02-11 12:23:08 PST
*** Bug 34807 has been marked as a duplicate of this bug. ***