Bug 17475 - Error with line break inside ?» pair of characters.
Summary: Error with line break inside ?» pair of characters.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Minor
Assignee: Nobody
URL: http://www.artgorbunov.ru/bb/soviet/2...
Keywords: InRadar
: 19174 34807 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-21 08:57 PST by Dmitriy Kubyshkin
Modified: 2010-02-11 12:23 PST (History)
4 users (show)

See Also:


Attachments
test case (311 bytes, text/html)
2008-02-21 23:24 PST, Alexey Proskuryakov
no flags Details
updated test case (357 bytes, text/html)
2008-02-22 13:39 PST, Alexey Proskuryakov
no flags Details
Change rules for allowing a line break after a question mark (46.97 KB, patch)
2010-01-25 15:10 PST, mitz
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitriy Kubyshkin 2008-02-21 08:57:30 PST
Every punctuation symbol excluding '?' works fine in pair with '»', but pair ?» can break into two lines if there isn't enough space in block so ? stays one line and » 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. ***