Bug 136564 - Use tracking areas instead of (SPI) mouse moved notifications, and follow flags changes with an event monitor
Summary: Use tracking areas instead of (SPI) mouse moved notifications, and follow fla...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Maciej Stachowiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-04 19:38 PDT by Maciej Stachowiak
Modified: 2014-09-05 11:33 PDT (History)
3 users (show)

See Also:


Attachments
Patch (15.96 KB, patch)
2014-09-04 19:49 PDT, Maciej Stachowiak
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 2014-09-04 19:38:43 PDT
Use tracking areas instead of (SPI) mouse moved notifications, and follow flags changes with an event monitor
Comment 1 Maciej Stachowiak 2014-09-04 19:49:10 PDT
Created attachment 237671 [details]
Patch
Comment 2 WebKit Commit Bot 2014-09-04 19:50:43 PDT
Attachment 237671 [details] did not pass style-queue:


ERROR: Source/WebKit/mac/WebView/WebHTMLView.mm:1780:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/WebKit/mac/WebView/WebHTMLView.mm:4216:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 mitz 2014-09-05 00:51:14 PDT
Comment on attachment 237671 [details]
Patch

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

> Source/WebKit/mac/ChangeLog:13
> +        * WebKit.order: Remove reference to obsolete call.

There’s no need to update this file.

> Source/WebKit/mac/WebView/WebHTMLView.mm:617
> +    id _flagsChangedEventMonitor;

Might be best to be consistent with the majority of ivars in this class and remove the underscore.

> Source/WebKit/mac/WebView/WebHTMLView.mm:1001
> +    NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved location:[[flagsChangedEvent window] mouseLocationOutsideOfEventStream]
> +        modifierFlags:[flagsChangedEvent modifierFlags] timestamp:[flagsChangedEvent timestamp] windowNumber:[flagsChangedEvent windowNumber]
> +        context:[flagsChangedEvent context] eventNumber:0 clickCount:0 pressure:0];
> +
> +    // Pretend it's a mouse move.
> +    [self mouseMoved:fakeEvent];

This code is just moving around, but if you wanted you could rewrite it with dot syntax for property access and remove the not-so-helpful comment.

> Source/WebKit/mac/WebView/WebHTMLView.mm:3152
> +            _private->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) 
> +            {

The opening brace for a block goes on the same line as the ^
Comment 4 Maciej Stachowiak 2014-09-05 01:01:48 PDT
Committed r173309: <http://trac.webkit.org/changeset/173309>
Comment 5 Maciej Stachowiak 2014-09-05 01:07:04 PDT
Landed with all suggested changes (except that I left in the removal from WebKit.order; I know it won't make any difference to the code but it makes it more convenient to not get false-positive search hits for removed symbols).
Comment 6 Daniel Bates 2014-09-05 11:16:51 PDT
Committed iOS build fix in <http://trac.webkit.org/changeset/173315>.
Comment 7 Daniel Bates 2014-09-05 11:33:58 PDT
Committed additional iOS build fixes in <http://trac.webkit.org/changeset/173316> and <http://trac.webkit.org/changeset/173317>.