Bug 148409 - Layout Test platform/mac/fast/events/content-inset-hit-testing-in-frame.html is flaky
Summary: Layout Test platform/mac/fast/events/content-inset-hit-testing-in-frame.html ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-24 18:22 PDT by Tim Horton
Modified: 2015-08-26 11:18 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.63 KB, patch)
2015-08-25 15:23 PDT, Tim Horton
bdakin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2015-08-24 18:22:49 PDT
The following layout test is flaky on Mac WK1

platform/mac/fast/events/content-inset-hit-testing-in-frame.html
Comment 1 Tim Horton 2015-08-24 18:23:40 PDT
I'm looking at this.

In the bad case, we hit the iframe, but not the div inside it (we hit the body instead).
Comment 2 Tim Horton 2015-08-24 18:38:57 PDT
Hmm. Render tree dumps for each hit test are exactly the same, we just hit a different node...
Comment 3 Tim Horton 2015-08-24 18:41:16 PDT
Reproduces if you reduce your machine to 1 core, load it (with some while(1)s), and "run-webkit-tests -1 --repeat-each=100000 platform/mac/fast/events/content-inset-hit-testing-in-frame.html".
Comment 4 Tim Horton 2015-08-24 18:44:49 PDT
The hit test *request* point is different (off by the topContentInset):

bad case: 20 120
good case: 20 20

why is that racy, though?
Comment 5 Tim Horton 2015-08-24 18:47:29 PDT
setTopContentInset does a layout, and the layout isn't wrong (as evidenced by the render tree dumps being identical)... it's the point mapping that's wrong. I'm not sure where topContentInset gets applied to incoming points, though. Will have to find that.
Comment 6 Tim Horton 2015-08-24 18:55:51 PDT
We do a view->windowToContents() (in EventHandler's documentPointForWindowPoint) and are returned a lie.
Comment 7 Tim Horton 2015-08-25 11:20:24 PDT
OK! In the bad case, the scrollOffset.y() = 100 (the top content inset). In the good case it's 0 (as it should be). Not sure why it takes time for the scrollOffset to adjust to the TCI change. Will continue investigating.
Comment 8 Tim Horton 2015-08-25 11:31:49 PDT
scrollPositionChangedViaPlatformWidgetImpl is happening too late in the bad case.
Comment 9 Tim Horton 2015-08-25 11:40:57 PDT
(In reply to comment #8)
> scrollPositionChangedViaPlatformWidgetImpl is happening too late in the bad
> case.

In the good case, we get it underneath the layout that setTopContentInset does (like you'd expect). In the bad case, we get it much later, under [NSView viewWillDraw] stuff...
Comment 10 Tim Horton 2015-08-25 13:39:20 PDT
And it looks like this is happening because we have scrollbars forced off until after the test runs (when they should be enabled as soon as we set a top content inset)
Comment 11 Tim Horton 2015-08-25 15:23:22 PDT
Created attachment 259890 [details]
Patch
Comment 12 Tim Horton 2015-08-25 15:25:02 PDT
This is admittedly pretty icky, and I haven't managed to make a test app to demonstrate the underlying problem.
Comment 13 Tim Horton 2015-08-25 15:52:54 PDT
Comment on attachment 259890 [details]
Patch

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

> Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm:629
> +    [super setContentInsets:edgeInsets];

Mavericks doesn't have this, need an ifdef.
Comment 14 Tim Horton 2015-08-26 11:18:43 PDT
http://trac.webkit.org/changeset/188971