Bug 59267 - Add single column mode to results.html
Summary: Add single column mode to results.html
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-22 18:31 PDT by Ryosuke Niwa
Modified: 2011-05-23 15:57 PDT (History)
3 users (show)

See Also:


Attachments
implements single column mode (12.15 KB, patch)
2011-04-22 18:44 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
reveted unintended change (11.91 KB, patch)
2011-04-22 18:47 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed per Ojan's comments (11.90 KB, patch)
2011-04-27 15:01 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed results.html test (12.08 KB, patch)
2011-04-27 15:07 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2011-04-22 18:31:59 PDT
Add a new mode where each box has width:100% rather than width: 800px. Also embed each text file into a pre so that iframe doesn't occupy a lot of space when the text file contains little text.
Comment 1 Ryosuke Niwa 2011-04-22 18:44:24 PDT
Created attachment 90826 [details]
implements single column mode
Comment 2 Ryosuke Niwa 2011-04-22 18:47:24 PDT
Created attachment 90827 [details]
reveted unintended change
Comment 3 Ojan Vafai 2011-04-22 19:42:39 PDT
Comment on attachment 90827 [details]
reveted unintended change

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

> LayoutTests/ChangeLog:10
> +        have 100% width as supposed to 800px.

s/supposed/opposed

> LayoutTests/ChangeLog:15
> +        (runTests.runTest.):
> +        (runTests.runTest):
> +        ():

you can delete these. they're just noise.

> LayoutTests/fast/harness/results.html:53
> +.single-column-mode .results-row iframe {

This can just be ".single-column-mode iframe {"

> LayoutTests/fast/harness/results.html:202
> +        var r = new XMLHttpRequest();

s/r/request or s/r/xhr.

> LayoutTests/fast/harness/results.html:213
> +            container.lastChild.innerText = r.responseText;

s/innerText/textContent

> LayoutTests/fast/harness/results.html:216
> +            r.open('GET', src + '?format=txt', true);

You can move the "src + '?format=txt'" into a variable since it's done in two places.

> LayoutTests/fast/harness/results.html:218
> +        } catch (exception) {

You can remove this try/catch if you just don't show the text box in the situations where there would be an exception.

> LayoutTests/fast/harness/results.html:305
> +function reexpandExpectations()

s/reexpand/convert

> LayoutTests/fast/harness/results.html:312
> +            if (expandLink.textContent != '+') {

How about moving this if-check outside of the async. No need to queue up a function that's not going to do anything. Also, you can also check that the src has a ".txt" in it since we only need to convert the txt results.

> LayoutTests/fast/harness/results.html:316
> +                // FIXME: this is inefficient; implement actual conversion.
> +                var result = parentOfType(expandLink, 'tbody').querySelector('.results-row');
> +                result.parentNode.removeChild(result);
> +                expandExpectations(expandLink);

If you factor out the code that creates the result element from appendResultIframe into a function call, you should be able to just create the new result and replaceChild (https://developer.mozilla.org/En/DOM/Node.replaceChild).

You can get all the children that need replacing with document.querySelectorAll('.results-row [src*=".txt"]').

> LayoutTests/fast/harness/results.html:653
> +    html += '<label><input class="single-column" type=checkbox onchange="reexpandExpectations()">Single column</label>';

You shouldn't show this checkbox if we're loading this in a file: url in Chrome given that it doesn't work in that case.

> LayoutTests/fast/harness/resources/results-test.js:312
> +        // Single column mode is initially tunred off

typo: turned

Also, this comment isn't really useful.
Comment 4 Ryosuke Niwa 2011-04-22 20:12:37 PDT
Comment on attachment 90827 [details]
reveted unintended change

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

>> LayoutTests/fast/harness/results.html:653
>> +    html += '<label><input class="single-column" type=checkbox onchange="reexpandExpectations()">Single column</label>';
> 
> You shouldn't show this checkbox if we're loading this in a file: url in Chrome given that it doesn't work in that case.

How do we detect that?
Comment 5 Ojan Vafai 2011-04-22 20:42:22 PDT
(In reply to comment #4)
> (From update of attachment 90827 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=90827&action=review
> 
> >> LayoutTests/fast/harness/results.html:653
> >> +    html += '<label><input class="single-column" type=checkbox onchange="reexpandExpectations()">Single column</label>';
> > 
> > You shouldn't show this checkbox if we're loading this in a file: url in Chrome given that it doesn't work in that case.
> 
> How do we detect that?

I think checking the userAgent is fine for now. Could also try doing an XHR, but it's lame to always do a network request for this.

Long-term, it might make sense to add something to the platform to feature detect file access from file urls. abarth, wdyt?
Comment 6 Ryosuke Niwa 2011-04-27 14:23:49 PDT
Thanks for the review!  I've addressed most of your comments.

(In reply to comment #3)
> > LayoutTests/fast/harness/results.html:316
> > +                // FIXME: this is inefficient; implement actual conversion.
> > +                var result = parentOfType(expandLink, 'tbody').querySelector('.results-row');
> > +                result.parentNode.removeChild(result);
> > +                expandExpectations(expandLink);
> 
> If you factor out the code that creates the result element from appendResultIframe into a function call, you should be able to just create the new result and replaceChild (https://developer.mozilla.org/En/DOM/Node.replaceChild).
> 
> You can get all the children that need replacing with document.querySelectorAll('.results-row [src*=".txt"]').

While it's nice to do at some point, I'd stick with the current approach for now.
Comment 7 Ryosuke Niwa 2011-04-27 15:01:23 PDT
Created attachment 91354 [details]
Fixed per Ojan's comments
Comment 8 Ryosuke Niwa 2011-04-27 15:07:55 PDT
Created attachment 91355 [details]
Fixed results.html test
Comment 9 Ojan Vafai 2011-04-28 14:18:10 PDT
(In reply to comment #6)
> (In reply to comment #3)
> > > LayoutTests/fast/harness/results.html:316
> > > +                // FIXME: this is inefficient; implement actual conversion.
> > > +                var result = parentOfType(expandLink, 'tbody').querySelector('.results-row');
> > > +                result.parentNode.removeChild(result);
> > > +                expandExpectations(expandLink);
> > 
> > If you factor out the code that creates the result element from appendResultIframe into a function call, you should be able to just create the new result and replaceChild (https://developer.mozilla.org/En/DOM/Node.replaceChild).
> > 
> > You can get all the children that need replacing with document.querySelectorAll('.results-row [src*=".txt"]').
> 
> While it's nice to do at some point, I'd stick with the current approach for now.

Have you tried the current approach with 50-100 failing tests? It would be super slow.

The change from the current code to one that only replaces the elements it needs to replace seems very small to me. Am I missing something?
Comment 10 Eric Seidel (no email) 2011-05-23 15:51:05 PDT
Ojan, could you please review?  This has been up for nearly a month.
Comment 11 Ryosuke Niwa 2011-05-23 15:56:30 PDT
Comment on attachment 91355 [details]
Fixed results.html test

I'm sure this is out of date now.
Comment 12 Ryosuke Niwa 2011-05-23 15:57:36 PDT
Too many other things to work on.  Will file a new bug if needed.