Bug 50204

Summary: REGRESSION(r72861): editing/selection/click-left-of-rtl-wrapping-text.html and modify-up-on-rtl-wrapping-text.html fail on all but Mac platform
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aroben, hyatt, mrobinson, ojan, ossy, tonikitoo, tony, tullio.lucena
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
fixes the tests
none
fixed more
ojan: review+
Patch none

Description Ryosuke Niwa 2010-11-29 20:16:55 PST
editing/selection/click-left-of-rtl-wrapping-text.html and modify-up-on-rtl-wrapping-text.html added by the r72861 fail on Gtk, Qt, Win, Chromium Win, and Chromium Linux platforms.

We need to fix the test.
Comment 1 Ryosuke Niwa 2010-11-29 22:52:13 PST
Created attachment 75108 [details]
fixes the tests
Comment 2 Ryosuke Niwa 2010-11-29 22:53:23 PST
I verified that new tests pass on Mac and Chromium Windows.  I'll really appreciate if someone could test my patch on Gtk, Qt, and other platforms.
Comment 3 Ojan Vafai 2010-11-30 08:07:34 PST
Comment on attachment 75108 [details]
fixes the tests

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

> LayoutTests/editing/selection/click-left-of-rtl-wrapping-text.html:30
> +    for (var i = 5; i == 5 || container.offsetHeight > heightOfLine * test.expected.length; i++)

I don't understand this for loop. i starts and 5 and checks for == 5 ?
Comment 4 Ryosuke Niwa 2010-11-30 11:01:29 PST
Comment on attachment 75108 [details]
fixes the tests

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

>> LayoutTests/editing/selection/click-left-of-rtl-wrapping-text.html:30
>> +    for (var i = 5; i == 5 || container.offsetHeight > heightOfLine * test.expected.length; i++)
> 
> I don't understand this for loop. i starts and 5 and checks for == 5 ?

This is a pseudo do-while.  I start at 5px and increase the width as long as the height is too big.  But the height is initially heightOfLine (which is shorter than heightOfLine * test.expected.length) so we need to this condition to set width to 5px first so that the height is larger than heightOfLine * test.expected.length.
Comment 5 Ryosuke Niwa 2010-11-30 12:51:56 PST
Created attachment 75184 [details]
fixed more
Comment 6 Ryosuke Niwa 2010-11-30 13:25:32 PST
(In reply to comment #5)
> Created an attachment (id=75184) [details]
> fixed more

New tests should pass on Mac, Chromium Windows, and GTK+.  We're currently blocked by Qt.  Hopefully this new patch do the magic on Qt as well.
Comment 7 Ojan Vafai 2010-11-30 13:29:34 PST
Comment on attachment 75184 [details]
fixed more

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

> LayoutTests/editing/selection/click-left-of-rtl-wrapping-text.html:35
> +    var heightOfLine = container.offsetHeight;
> +    var width = 5;
> +    do {
> +        container.style.width = width + 'px';
> +        width++;
> +    } while (container.offsetHeight > heightOfLine * test.expected.length);        
> +    container.style.width = (width + 1) + 'px';

Please add a comment here and in the test below explaining why you're doing this. Just the same thing you told me in person.
Comment 8 Antonio Gomes 2010-11-30 14:03:37 PST
(In reply to comment #6)
> (In reply to comment #5)
> > Created an attachment (id=75184) [details] [details]
> > fixed more
> 
> New tests should pass on Mac, Chromium Windows, and GTK+.  We're currently blocked by Qt.  Hopefully this new patch do the magic on Qt as well.

It is failing on my machine, but might work on the Bots (since there can be font differences here). Ossy?


--- /tmp/layout-test-results/editing/selection/modify-up-on-rtl-wrapping-text-expected.txt	2010-11-30 17:01:28.830294001 -0500
+++ /tmp/layout-test-results/editing/selection/modify-up-on-rtl-wrapping-text-actual.txt	2010-11-30 17:01:28.830294001 -0500
@@ -4,7 +4,7 @@
 PASS: on ך לכ, caret is at 2 after moving upwards once
 PASS: on ×› ×›×› ×›×›×›, caret is at 8 initially
 PASS: on ×› ×›×› ×›×›×›, caret is at 5 after moving upwards once
-PASS: on ×› ×›×› ×›×›×›, caret is at 2 after moving upwards twice
+FAIL: on ×› ×›×› ×›×›×›, caret is at 5 after moving upwards twice but expected at 8
 PASS: on ×’×› ×™×’×› ×™×’×› ×™×’×› ×™×’×›, caret is at 18 initially
 PASS: on ×’×› ×™×’×› ×™×’×› ×™×’×› ×™×’×›, caret is at 14 after moving upwards once
 PASS: on ×’×› ×™×’×› ×™×’×› ×™×’×› ×™×’×›, caret is at 10 after moving upwards twice
Comment 9 Ryosuke Niwa 2010-11-30 16:07:34 PST
Per discussion with Ossy on IRC, it turned out that Qt DRT has a bug.  The test passes on browser but fails on DRT.  I'll land this patch for now, and file a separate bug to fix Qt DRT.
Comment 10 Ryosuke Niwa 2010-11-30 16:32:19 PST
Thanks for the review, Ojan.  Will be landing and re-enabling tests on all platforms but Qt.
Comment 11 Ryosuke Niwa 2010-11-30 16:41:42 PST
Landed as http://trac.webkit.org/changeset/72977.

The followup for Qt platform is filed as the bug 50291.
Comment 12 Tullio Lucena 2012-10-04 14:56:23 PDT
Created attachment 167180 [details]
Patch

Unskipp test that is passing after change [1] in testfonts.

[1] https://gitorious.org/qtwebkit/testfonts/merge_requests/1
Comment 13 Eric Seidel (no email) 2012-10-08 16:16:34 PDT
Comment on attachment 167180 [details]
Patch

Cleared review? from attachment 167180 [details] so that this bug does not appear in http://webkit.org/pending-review.  If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).
Comment 14 Tullio Lucena 2012-10-09 10:42:32 PDT
(In reply to comment #13)
> (From update of attachment 167180 [details])
> Cleared review? from attachment 167180 [details] so that this bug does not appear in http://webkit.org/pending-review.  If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).

Sorry, it's my mistake.