Bug 69545 - Implement testRunner.dumpSelectionRect() in WebKitTestRunner
Summary: Implement testRunner.dumpSelectionRect() in WebKitTestRunner
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Raphael Kubo da Costa (:rakuco)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-06 11:34 PDT by Simon Fraser (smfr)
Modified: 2012-10-16 11:04 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.65 KB, patch)
2012-10-15 06:00 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Hopefully fix the mac build (8.93 KB, patch)
2012-10-15 06:31 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff
Patch (9.51 KB, patch)
2012-10-15 07:00 PDT, Raphael Kubo da Costa (:rakuco)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2011-10-06 11:34:53 PDT
layoutTestController.dumpSelectionRect() paints a red rectangle in the pixel result. This is not supported in WTR.
Comment 1 Raphael Kubo da Costa (:rakuco) 2012-10-15 06:00:25 PDT
Created attachment 168695 [details]
Patch
Comment 2 Build Bot 2012-10-15 06:09:17 PDT
Comment on attachment 168695 [details]
Patch

Attachment 168695 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14289635
Comment 3 Raphael Kubo da Costa (:rakuco) 2012-10-15 06:31:41 PDT
Created attachment 168700 [details]
Hopefully fix the mac build
Comment 4 Build Bot 2012-10-15 06:40:58 PDT
Comment on attachment 168700 [details]
Hopefully fix the mac build

Attachment 168700 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14291675
Comment 5 Raphael Kubo da Costa (:rakuco) 2012-10-15 07:00:02 PDT
Created attachment 168706 [details]
Patch
Comment 6 Simon Fraser (smfr) 2012-10-15 08:54:41 PDT
I think it would be better to do something more similar to what I did for repaint rects. You could add a method on Internals:

ClientRect internals.clientSelectionRect()

so that non-pixel tests can test the selection rect. Then you can fix WTR/DRT to paint this as an overlay, like repaints rects, if the testRunner flag is set.
Comment 7 Raphael Kubo da Costa (:rakuco) 2012-10-15 14:29:58 PDT
(In reply to comment #6)
> I think it would be better to do something more similar to what I did for repaint rects. You could add a method on Internals:
>
> ClientRect internals.clientSelectionRect()
>
> so that non-pixel tests can test the selection rect. Then you can fix WTR/DRT to paint this as an overlay, like repaints rects, if the testRunner flag is set.

We talked a bit on IRC and I am still unsure this is the best approach. For one, we have agreed that getting rid of dumpSelectionRect() in its current form so that non-pixel tests can use it is a reasonable goal for the longer term.

As for the current patch, there are a few possibilities, but all of them involve either writing more code or writing code that is port-specific:

 o Painting the overlay in the way the repaint rects overlay is painted. This means not using WebPageOverlay, but instead just writing port-specific code to do the painting in WTR.

 o Making paintRepaintRectOverlay more generic and manipulating the GraphicsContext from WTR. This would at least require exposing more API in WKGraphicsContext.

 o Use actual WebPageOverlays. If done from WTR, it would require exposing more overlay API so that we turn off fading animations and set things such as border color and thickness. If done from WebProcess, it would involve passing the selection and repaint rectangles and making the code differentiate between one and the other so that they are painted in different ways.

Is there a preference for one of these methods, or a better idea that wouldn't require a lot more code to achieve the same results?
Comment 8 Simon Fraser (smfr) 2012-10-16 10:42:00 PDT
Comment on attachment 168706 [details]
Patch

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

> Source/WebCore/WebCore.exp.in:853
> +__ZN7WebCore7makeRGBEiii

I don't see this being used; do you need it?
Comment 9 Raphael Kubo da Costa (:rakuco) 2012-10-16 10:46:51 PDT
(In reply to comment #8)
> (From update of attachment 168706 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=168706&action=review
> 
> > Source/WebCore/WebCore.exp.in:853
> > +__ZN7WebCore7makeRGBEiii
> 
> I don't see this being used; do you need it?

According to the logs in comment 2 and comment 4, yes.
Comment 10 Raphael Kubo da Costa (:rakuco) 2012-10-16 10:51:49 PDT
Comment on attachment 168706 [details]
Patch

Clearing flags on attachment: 168706

Committed r131476: <http://trac.webkit.org/changeset/131476>
Comment 11 Raphael Kubo da Costa (:rakuco) 2012-10-16 10:51:58 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Raphael Kubo da Costa (:rakuco) 2012-10-16 11:04:38 PDT
(In reply to comment #7)
> We talked a bit on IRC and I am still unsure this is the best approach. For one, we have agreed that getting rid of dumpSelectionRect() in its current form so that non-pixel tests can use it is a reasonable goal for the longer term.

File <https://bugs.webkit.org/show_bug.cgi?id=99480>.