Bug 129395 - Web Replay: capture and replay mouse events
Summary: Web Replay: capture and replay mouse events
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: BJ Burg
URL:
Keywords:
Depends on: 127921 128782 129692
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-26 14:33 PST by BJ Burg
Modified: 2014-03-24 08:44 PDT (History)
8 users (show)

See Also:


Attachments
the patch (no tests yet) (23.27 KB, patch)
2014-03-16 15:03 PDT, BJ Burg
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 (496.46 KB, application/zip)
2014-03-16 16:13 PDT, Build Bot
no flags Details
revised patch with test. (36.15 KB, patch)
2014-03-20 12:39 PDT, BJ Burg
joepeck: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2014-02-26 14:33:43 PST
Patch forthcoming
Comment 1 BJ Burg 2014-03-16 12:16:19 PDT
Splitting this into separate patches for mouse, keyboard, wheel, and scroll. The latter two require support elsewhere in WebCore.
Comment 2 BJ Burg 2014-03-16 15:03:21 PDT
Created attachment 226862 [details]
the patch (no tests yet)
Comment 3 WebKit Commit Bot 2014-03-16 15:04:17 PDT
Attachment 226862 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/PlatformMouseEvent.h:47:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/replay/SerializationMethods.cpp:57:  _key is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 2 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Build Bot 2014-03-16 16:13:12 PDT
Comment on attachment 226862 [details]
the patch (no tests yet)

Attachment 226862 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5953556595081216

New failing tests:
mathml/wbr-in-mroot-crash.html
Comment 5 Build Bot 2014-03-16 16:13:16 PDT
Created attachment 226866 [details]
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-10  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 6 BJ Burg 2014-03-16 16:28:04 PDT
(In reply to comment #4)
> (From update of attachment 226862 [details])
> Attachment 226862 [details] did not pass mac-wk2-ews (mac-wk2):
> Output: http://webkit-queues.appspot.com/results/5953556595081216
> 
> New failing tests:
> mathml/wbr-in-mroot-crash.html

This is unrelated.
Comment 7 BJ Burg 2014-03-16 16:29:06 PDT
Regarding the windows build failure, it seems to have trouble finding operator== for MouseButton when it has an explicit storage type. Not sure how to fix.
Comment 8 Joseph Pecoraro 2014-03-17 10:36:52 PDT
Comment on attachment 226862 [details]
the patch (no tests yet)

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

> Source/WebCore/replay/SerializationMethods.cpp:54
> +    _encodedValue.put<_type>(ASCIILiteral("_key"), _value)

I don't think this does what you think it does. This always uses the key "_key".

test:

    #include <stdio.h>
    #define MACRO(_key) "_key"
    int main() {
        printf(">>> macro: %s\n", MACRO(test));
        return 0;
    }

outputs:

    >>> macro: _key

I think you should avoid the quotes in the macro entirely, and instead put them at the macro call site. I think that would be easier to read, and see that, "positionX" is a string key and not a variable.

> Source/WebCore/replay/SerializationMethods.cpp:59
> +#define DECODE_SCALAR_TYPE_WITH_KEY(_encodedValue, _type, _key) \
> +    _type _key; \
> +    if (!_encodedValue.get<_type>(ASCIILiteral("_key"), _key)) \
> +        return false

Likewise. Yes, there will be some duplication (key and variable name), but I think that is fine. If you really want to avoid the duplication then I think you can do:

    ...(ASCIILiteral("" #_key), _key)

> Source/WebCore/replay/UserInputBridge.cpp:52
> +    do { \
> +    if (inputSource == InputSource::User && m_state == UserInputBridge::State::Replaying) \
> +        return true; \
> +    } while (false)

Style: Weird indentation. And would this really be an unexpected input, or just an ignored input while replaying?
Comment 9 BJ Burg 2014-03-20 11:21:19 PDT
Comment on attachment 226862 [details]
the patch (no tests yet)

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

>> Source/WebCore/replay/SerializationMethods.cpp:59
>> +        return false
> 
> Likewise. Yes, there will be some duplication (key and variable name), but I think that is fine. If you really want to avoid the duplication then I think you can do:
> 
>     ...(ASCIILiteral("" #_key), _key)

Just #_key should suffice to quote the token.

>> Source/WebCore/replay/UserInputBridge.cpp:52
>> +    } while (false)
> 
> Style: Weird indentation. And would this really be an unexpected input, or just an ignored input while replaying?

The fact that it's unexpected means we should ignore it.
Comment 10 Joseph Pecoraro 2014-03-20 11:45:28 PDT
(In reply to comment #9)
> >> Source/WebCore/replay/UserInputBridge.cpp:52
> >> +    } while (false)
> > 
> > Style: Weird indentation. And would this really be an unexpected input, or just an ignored input while replaying?
> 
> The fact that it's unexpected means we should ignore it.

But its not unexpected. Its realistically possible, and if it happens we just ignore it. It is not unexpected that the user might click on the page during a replay. I just find the word "unexpected" here to inaccurate.
Comment 11 Joseph Pecoraro 2014-03-20 11:45:50 PDT
to be*
Comment 12 BJ Burg 2014-03-20 12:39:03 PDT
Created attachment 227320 [details]
revised patch with test.
Comment 13 Joseph Pecoraro 2014-03-20 14:15:45 PDT
Comment on attachment 227320 [details]
revised patch with test.

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

r=me

> ManualTests/inspector/replay-mouse-events.html:44
> +    var block = createBlock(hex_md5(JSON.stringify(obj)));
> +    block.textContent = glyphForType(event.type);
> +    var blocksContainer = document.getElementById("blocks");
> +    blocksContainer.appendChild(block);
> +    
> +    var hashLabel = document.getElementById("hash");
> +    hash.textContent = hex_md5(JSON.stringify(dumpedEvents));

Nit: Probably should be indented.

> ManualTests/inspector/replay-mouse-events.html:80
> +    </style>

Nit: Probably should match indentation of <style>.
Comment 14 BJ Burg 2014-03-24 08:44:41 PDT
Committed <http://trac.webkit.org/changeset/166006>