Bug 41339

Summary: unicode-range property only with a descending range causes a crash
Product: WebKit Reporter: Yuzo Fujishima <yuzo>
Component: CSSAssignee: Yuzo Fujishima <yuzo>
Status: RESOLVED FIXED    
Severity: Normal CC: hamaji, hayato, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Testcase -- causes a crash
none
Fix for Bug 41339 - unicode-range property only with a descending range causes
none
Addressed review comment. Test by JavaScript. mitz: review+

Description Yuzo Fujishima 2010-06-29 03:01:10 PDT
http://dev.w3.org/csswg/css3-fonts/#unicode-range-desc says:
    ... interval ranges that descend (e.g. U+400-32f) are invalid and omitted rather than treated as parse errors
    ... Without any valid ranges, the descriptor is omitted.

It follows that in the following example unicode-range must be omitted:
    @font-face {
        font-family: 'myfont';
        src: local('Arial');
        unicode-range: U+062-60;
    }

But as of r62096, opening a file containing the above rule results in a crash.
Comment 1 Yuzo Fujishima 2010-06-29 03:01:55 PDT
Created attachment 59998 [details]
Testcase -- causes a crash
Comment 2 Yuzo Fujishima 2010-06-29 04:42:31 PDT
Created attachment 60007 [details]
Fix for Bug 41339 - unicode-range property only with a descending range causes
Comment 3 mitz 2010-06-29 08:19:51 PDT
Comment on attachment 60007 [details]
Fix for Bug 41339 - unicode-range property only with a descending range causes

Can this be tested with a text-only test using getComputedStyle or the CSSOM?
Comment 4 Yuzo Fujishima 2010-06-29 23:00:25 PDT
Created attachment 60086 [details]
Addressed review comment. Test by JavaScript.
Comment 5 Yuzo Fujishima 2010-06-29 23:05:29 PDT
Hi, mitz,

Thank you for the review.

(In reply to comment #3)
> (From update of attachment 60007 [details])
> Can this be tested with a text-only test using getComputedStyle or the CSSOM?

I tried but I couldn't find a way to retrieve the actual font name.
(I can get 'myfont' but not 'Arial' in the above example).

Instead, I used a monospace font and compare the width of two spans.
I believe it is good enough for this test.
Comment 6 mitz 2010-06-29 23:11:08 PDT
(In reply to comment #5)
> Hi, mitz,
> 
> Thank you for the review.
> 
> (In reply to comment #3)
> > (From update of attachment 60007 [details] [details])
> > Can this be tested with a text-only test using getComputedStyle or the CSSOM?
> 
> I tried but I couldn't find a way to retrieve the actual font name.
> (I can get 'myfont' but not 'Arial' in the above example).

What I meant was to test the value of documents.styleSheets[0].rules[0].style.unicodeRange, but it looks like there’s insufficient support for unicodeRange values in WebKit’s CSSOM implementation.
Comment 7 Yuzo Fujishima 2010-06-29 23:47:43 PDT
Committed r62161: <http://trac.webkit.org/changeset/62161>