- Source/WebCore/ChangeLog +46 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2016-07-08  Enrica Casucci  <enrica@apple.com>
2
3
        Add synthetic click origin to WKNavigationAction.
4
        https://bugs.webkit.org/show_bug.cgi?id=159584
5
        rdar://problem/25610422
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Adding plumbing code to pass synthetic click type
10
        through WebCore.
11
12
        * dom/Element.cpp:
13
        (WebCore::Element::dispatchMouseEvent):
14
        (WebCore::Element::dispatchMouseForceWillBegin):
15
        * dom/MouseEvent.cpp:
16
        (WebCore::MouseEvent::create):
17
        (WebCore::MouseEvent::MouseEvent):
18
        (WebCore::MouseEvent::initMouseEvent):
19
        (WebCore::MouseEvent::cloneFor):
20
        * dom/MouseEvent.h:
21
        (WebCore::MouseEvent::createForBindings):
22
        (WebCore::MouseEvent::button):
23
        (WebCore::MouseEvent::syntheticClickType):
24
        (WebCore::MouseEvent::buttonDown):
25
        (WebCore::MouseEvent::setRelatedTarget):
26
        * dom/SimulatedClick.cpp:
27
        * dom/WheelEvent.cpp:
28
        (WebCore::WheelEvent::WheelEvent):
29
        * page/ContextMenuController.cpp:
30
        (WebCore::ContextMenuController::showContextMenuAt):
31
        * page/DragController.cpp:
32
        (WebCore::createMouseEvent):
33
        (WebCore::DragController::DragController):
34
        * page/EventHandler.cpp:
35
        (WebCore::EventHandler::dispatchDragEvent):
36
        (WebCore::EventHandler::sendContextMenuEventForKey):
37
        (WebCore::EventHandler::fakeMouseMoveEventTimerFired):
38
        * platform/PlatformMouseEvent.h:
39
        (WebCore::PlatformMouseEvent::PlatformMouseEvent):
40
        (WebCore::PlatformMouseEvent::clickCount):
41
        (WebCore::PlatformMouseEvent::modifierFlags):
42
        (WebCore::PlatformMouseEvent::force):
43
        (WebCore::PlatformMouseEvent::syntheticClickType):
44
        * replay/SerializationMethods.cpp:
45
        (JSC::EncodingTraits<PlatformMouseEvent>::decodeValue):
46
1
2016-07-08  Jeremy Jones  <jeremyj@apple.com>
47
2016-07-08  Jeremy Jones  <jeremyj@apple.com>
2
48
3
        Prevent fullscreen video dimension state from being reset after configuring.
49
        Prevent fullscreen video dimension state from being reset after configuring.
- Source/WebCore/dom/Element.cpp -2 / +2 lines
Lines 292-298 bool Element::dispatchMouseEvent(const P Source/WebCore/dom/Element.cpp_sec1
292
            mouseEvent->bubbles(), mouseEvent->cancelable(), mouseEvent->view(), mouseEvent->detail(),
292
            mouseEvent->bubbles(), mouseEvent->cancelable(), mouseEvent->view(), mouseEvent->detail(),
293
            mouseEvent->screenX(), mouseEvent->screenY(), mouseEvent->clientX(), mouseEvent->clientY(),
293
            mouseEvent->screenX(), mouseEvent->screenY(), mouseEvent->clientX(), mouseEvent->clientY(),
294
            mouseEvent->ctrlKey(), mouseEvent->altKey(), mouseEvent->shiftKey(), mouseEvent->metaKey(),
294
            mouseEvent->ctrlKey(), mouseEvent->altKey(), mouseEvent->shiftKey(), mouseEvent->metaKey(),
295
            mouseEvent->button(), relatedTarget);
295
            mouseEvent->button(), mouseEvent->syntheticClickType(), relatedTarget);
296
296
297
        if (mouseEvent->defaultHandled())
297
        if (mouseEvent->defaultHandled())
298
            doubleClickEvent->setDefaultHandled();
298
            doubleClickEvent->setDefaultHandled();
Lines 2359-2365 bool Element::dispatchMouseForceWillBegi Source/WebCore/dom/Element.cpp_sec2
2359
    if (!frame)
2359
    if (!frame)
2360
        return false;
2360
        return false;
2361
2361
2362
    PlatformMouseEvent platformMouseEvent(frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WTF::currentTime(), ForceAtClick);
2362
    PlatformMouseEvent platformMouseEvent(frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WTF::currentTime(), ForceAtClick, NoTap);
2363
    Ref<MouseEvent> mouseForceWillBeginEvent =  MouseEvent::create(eventNames().webkitmouseforcewillbeginEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
2363
    Ref<MouseEvent> mouseForceWillBeginEvent =  MouseEvent::create(eventNames().webkitmouseforcewillbeginEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
2364
    mouseForceWillBeginEvent->setTarget(this);
2364
    mouseForceWillBeginEvent->setTarget(this);
2365
    dispatchEvent(mouseForceWillBeginEvent);
2365
    dispatchEvent(mouseForceWillBeginEvent);
- Source/WebCore/dom/MouseEvent.cpp -9 / +13 lines
Lines 50-63 Ref<MouseEvent> MouseEvent::create(const Source/WebCore/dom/MouseEvent.cpp_sec1
50
        event.movementDelta().x(), event.movementDelta().y(),
50
        event.movementDelta().x(), event.movementDelta().y(),
51
#endif
51
#endif
52
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
52
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
53
        relatedTarget, event.force());
53
        relatedTarget, event.force(), event.syntheticClickType());
54
}
54
}
55
55
56
Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, AbstractView* view, int detail, int screenX, int screenY, int pageX, int pageY,
56
Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, AbstractView* view, int detail, int screenX, int screenY, int pageX, int pageY,
57
#if ENABLE(POINTER_LOCK)
57
#if ENABLE(POINTER_LOCK)
58
    int movementX, int movementY,
58
    int movementX, int movementY,
59
#endif
59
#endif
60
    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, PassRefPtr<EventTarget> relatedTarget, double force)
60
    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, PassRefPtr<EventTarget> relatedTarget, double force, unsigned short syntheticClickType)
61
61
62
{
62
{
63
    return MouseEvent::create(type, canBubble, cancelable, timestamp, view,
63
    return MouseEvent::create(type, canBubble, cancelable, timestamp, view,
Lines 65-90 Ref<MouseEvent> MouseEvent::create(const Source/WebCore/dom/MouseEvent.cpp_sec2
65
#if ENABLE(POINTER_LOCK)
65
#if ENABLE(POINTER_LOCK)
66
        movementX, movementY,
66
        movementX, movementY,
67
#endif
67
#endif
68
        ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, force, 0, false);
68
        ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, force, syntheticClickType, 0, false);
69
}
69
}
70
70
71
Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, AbstractView* view, int detail, int screenX, int screenY, int pageX, int pageY,
71
Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, AbstractView* view, int detail, int screenX, int screenY, int pageX, int pageY,
72
#if ENABLE(POINTER_LOCK)
72
#if ENABLE(POINTER_LOCK)
73
    int movementX, int movementY,
73
    int movementX, int movementY,
74
#endif
74
#endif
75
    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, PassRefPtr<EventTarget> relatedTarget, double force, PassRefPtr<DataTransfer> dataTransfer, bool isSimulated)
75
    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, PassRefPtr<EventTarget> relatedTarget, double force, unsigned short syntheticClickType, PassRefPtr<DataTransfer> dataTransfer, bool isSimulated)
76
{
76
{
77
    return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, view,
77
    return adoptRef(*new MouseEvent(type, canBubble, cancelable, timestamp, view,
78
        detail, screenX, screenY, pageX, pageY,
78
        detail, screenX, screenY, pageX, pageY,
79
#if ENABLE(POINTER_LOCK)
79
#if ENABLE(POINTER_LOCK)
80
        movementX, movementY,
80
        movementX, movementY,
81
#endif
81
#endif
82
        ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, force, dataTransfer, isSimulated));
82
        ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, force, syntheticClickType, dataTransfer, isSimulated));
83
}
83
}
84
84
85
Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, PassRefPtr<EventTarget> relatedTarget)
85
Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, PassRefPtr<EventTarget> relatedTarget)
86
{
86
{
87
    return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget));
87
    return adoptRef(*new MouseEvent(eventType, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, syntheticClickType, relatedTarget));
88
}
88
}
89
89
90
MouseEvent::MouseEvent()
90
MouseEvent::MouseEvent()
Lines 99-105 MouseEvent::MouseEvent(const AtomicStrin Source/WebCore/dom/MouseEvent.cpp_sec3
99
                       int movementX, int movementY,
99
                       int movementX, int movementY,
100
#endif
100
#endif
101
                       bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
101
                       bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
102
                       unsigned short button, PassRefPtr<EventTarget> relatedTarget, double force,
102
                       unsigned short button, PassRefPtr<EventTarget> relatedTarget, double force, unsigned short syntheticClickType,
103
                       PassRefPtr<DataTransfer> dataTransfer, bool isSimulated)
103
                       PassRefPtr<DataTransfer> dataTransfer, bool isSimulated)
104
    : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, view, detail, IntPoint(screenX, screenY),
104
    : MouseRelatedEvent(eventType, canBubble, cancelable, timestamp, view, detail, IntPoint(screenX, screenY),
105
                        IntPoint(pageX, pageY),
105
                        IntPoint(pageX, pageY),
Lines 108-113 MouseEvent::MouseEvent(const AtomicStrin Source/WebCore/dom/MouseEvent.cpp_sec4
108
#endif
108
#endif
109
                        ctrlKey, altKey, shiftKey, metaKey, isSimulated)
109
                        ctrlKey, altKey, shiftKey, metaKey, isSimulated)
110
    , m_button(button == (unsigned short)-1 ? 0 : button)
110
    , m_button(button == (unsigned short)-1 ? 0 : button)
111
    , m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
111
    , m_buttonDown(button != (unsigned short)-1)
112
    , m_buttonDown(button != (unsigned short)-1)
112
    , m_relatedTarget(relatedTarget)
113
    , m_relatedTarget(relatedTarget)
113
    , m_force(force)
114
    , m_force(force)
Lines 115-127 MouseEvent::MouseEvent(const AtomicStrin Source/WebCore/dom/MouseEvent.cpp_sec5
115
{
116
{
116
}
117
}
117
118
118
MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, PassRefPtr<EventTarget> relatedTarget)
119
MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, PassRefPtr<EventTarget> relatedTarget)
119
    : MouseRelatedEvent(eventType, canBubble, cancelable, WTF::currentTime(), view, detail, IntPoint(screenX, screenY), IntPoint(0, 0),
120
    : MouseRelatedEvent(eventType, canBubble, cancelable, WTF::currentTime(), view, detail, IntPoint(screenX, screenY), IntPoint(0, 0),
120
#if ENABLE(POINTER_LOCK)
121
#if ENABLE(POINTER_LOCK)
121
        IntPoint(0, 0),
122
        IntPoint(0, 0),
122
#endif
123
#endif
123
        ctrlKey, altKey, shiftKey, metaKey, false)
124
        ctrlKey, altKey, shiftKey, metaKey, false)
124
    , m_button(button == (unsigned short)-1 ? 0 : button)
125
    , m_button(button == (unsigned short)-1 ? 0 : button)
126
    , m_syntheticClickType(button == (unsigned short)-1 ? 0 : syntheticClickType)
125
    , m_buttonDown(button != (unsigned short)-1)
127
    , m_buttonDown(button != (unsigned short)-1)
126
    , m_relatedTarget(relatedTarget)
128
    , m_relatedTarget(relatedTarget)
127
{
129
{
Lines 158-163 void MouseEvent::initMouseEvent(const At Source/WebCore/dom/MouseEvent.cpp_sec6
158
    m_shiftKey = shiftKey;
160
    m_shiftKey = shiftKey;
159
    m_metaKey = metaKey;
161
    m_metaKey = metaKey;
160
    m_button = button == (unsigned short)-1 ? 0 : button;
162
    m_button = button == (unsigned short)-1 ? 0 : button;
163
    m_syntheticClickType = 0;
161
    m_buttonDown = button != (unsigned short)-1;
164
    m_buttonDown = button != (unsigned short)-1;
162
    m_relatedTarget = relatedTarget;
165
    m_relatedTarget = relatedTarget;
163
166
Lines 250-255 Ref<Event> MouseEvent::cloneFor(HTMLIFra Source/WebCore/dom/MouseEvent.cpp_sec7
250
        frameView ? adjustedClientY(clientY(), iframe, frameView) : 0,
253
        frameView ? adjustedClientY(clientY(), iframe, frameView) : 0,
251
        ctrlKey(), altKey(), shiftKey(), metaKey(),
254
        ctrlKey(), altKey(), shiftKey(), metaKey(),
252
        button(),
255
        button(),
256
        syntheticClickType(),
253
        // Nullifies relatedTarget.
257
        // Nullifies relatedTarget.
254
        0);
258
        0);
255
    clonedMouseEvent->setForce(force());
259
    clonedMouseEvent->setForce(force());
- Source/WebCore/dom/MouseEvent.h -5 / +7 lines
Lines 46-52 public: Source/WebCore/dom/MouseEvent.h_sec1
46
        int movementX, int movementY,
46
        int movementX, int movementY,
47
#endif
47
#endif
48
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
48
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
49
        PassRefPtr<EventTarget> relatedTarget, double force);
49
        PassRefPtr<EventTarget> relatedTarget, double force, unsigned short syntheticClickType);
50
50
51
    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, AbstractView*,
51
    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, AbstractView*,
52
        int detail, int screenX, int screenY, int pageX, int pageY,
52
        int detail, int screenX, int screenY, int pageX, int pageY,
Lines 54-67 public: Source/WebCore/dom/MouseEvent.h_sec2
54
        int movementX, int movementY,
54
        int movementX, int movementY,
55
#endif
55
#endif
56
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
56
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
57
        PassRefPtr<EventTarget> relatedTarget, double force, PassRefPtr<DataTransfer>, bool isSimulated = false);
57
        PassRefPtr<EventTarget> relatedTarget, double force, unsigned short syntheticClickType, PassRefPtr<DataTransfer>, bool isSimulated = false);
58
58
59
    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, AbstractView*, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget);
59
    WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& eventType, AbstractView*, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget);
60
60
61
    static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView*,
61
    static Ref<MouseEvent> create(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView*,
62
        int detail, int screenX, int screenY, int clientX, int clientY,
62
        int detail, int screenX, int screenY, int clientX, int clientY,
63
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
63
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
64
        unsigned short button, PassRefPtr<EventTarget> relatedTarget);
64
        unsigned short button, unsigned short syntheticClickType, PassRefPtr<EventTarget> relatedTarget);
65
65
66
    static Ref<MouseEvent> createForBindings()
66
    static Ref<MouseEvent> createForBindings()
67
    {
67
    {
Lines 80-85 public: Source/WebCore/dom/MouseEvent.h_sec3
80
    // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
80
    // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
81
    // but we will match the standard DOM.
81
    // but we will match the standard DOM.
82
    unsigned short button() const { return m_button; }
82
    unsigned short button() const { return m_button; }
83
    unsigned short syntheticClickType() const { return m_syntheticClickType; }
83
    bool buttonDown() const { return m_buttonDown; }
84
    bool buttonDown() const { return m_buttonDown; }
84
    EventTarget* relatedTarget() const final { return m_relatedTarget.get(); }
85
    EventTarget* relatedTarget() const final { return m_relatedTarget.get(); }
85
    void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
86
    void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
Lines 110-121 protected: Source/WebCore/dom/MouseEvent.h_sec4
110
        int movementX, int movementY,
111
        int movementX, int movementY,
111
#endif
112
#endif
112
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
113
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
113
        PassRefPtr<EventTarget> relatedTarget, double force, PassRefPtr<DataTransfer>, bool isSimulated);
114
        PassRefPtr<EventTarget> relatedTarget, double force, unsigned short syntheticClickType, PassRefPtr<DataTransfer>, bool isSimulated);
114
115
115
    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
116
    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
116
        int detail, int screenX, int screenY, int clientX, int clientY,
117
        int detail, int screenX, int screenY, int clientX, int clientY,
117
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
118
        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
118
        unsigned short button, PassRefPtr<EventTarget> relatedTarget);
119
        unsigned short button, unsigned short syntheticClickType, PassRefPtr<EventTarget> relatedTarget);
119
120
120
    MouseEvent(const AtomicString& type, const MouseEventInit&);
121
    MouseEvent(const AtomicString& type, const MouseEventInit&);
121
122
Lines 125-130 protected: Source/WebCore/dom/MouseEvent.h_sec5
125
126
126
private:
127
private:
127
    unsigned short m_button;
128
    unsigned short m_button;
129
    unsigned short m_syntheticClickType;
128
    bool m_buttonDown;
130
    bool m_buttonDown;
129
    RefPtr<EventTarget> m_relatedTarget;
131
    RefPtr<EventTarget> m_relatedTarget;
130
    double m_force { 0 };
132
    double m_force { 0 };
- Source/WebCore/dom/SimulatedClick.cpp -1 / +1 lines
Lines 49-55 private: Source/WebCore/dom/SimulatedClick.cpp_sec1
49
#if ENABLE(POINTER_LOCK)
49
#if ENABLE(POINTER_LOCK)
50
                     0, 0,
50
                     0, 0,
51
#endif
51
#endif
52
                     false, false, false, false, 0, 0, 0, 0, true)
52
                     false, false, false, false, 0, 0, 0, 0, 0, true)
53
    {
53
    {
54
        if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
54
        if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEvent.get())) {
55
            m_ctrlKey = keyStateEvent->ctrlKey();
55
            m_ctrlKey = keyStateEvent->ctrlKey();
- Source/WebCore/dom/WheelEvent.cpp -1 / +1 lines
Lines 70-76 WheelEvent::WheelEvent(const PlatformWhe Source/WebCore/dom/WheelEvent.cpp_sec1
70
#if ENABLE(POINTER_LOCK)
70
#if ENABLE(POINTER_LOCK)
71
                , 0, 0
71
                , 0, 0
72
#endif
72
#endif
73
                , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, 0, 0, false)
73
                , event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), 0, 0, 0, 0, 0, false)
74
    , m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier)
74
    , m_wheelDelta(event.wheelTicksX() * TickMultiplier, event.wheelTicksY() * TickMultiplier)
75
    , m_deltaX(-event.deltaX())
75
    , m_deltaX(-event.deltaX())
76
    , m_deltaY(-event.deltaY())
76
    , m_deltaY(-event.deltaY())
- Source/WebCore/page/ContextMenuController.cpp -1 / +1 lines
Lines 1434-1440 void ContextMenuController::showContextM Source/WebCore/page/ContextMenuController.cpp_sec1
1434
    clearContextMenu();
1434
    clearContextMenu();
1435
    
1435
    
1436
    // Simulate a click in the middle of the accessibility object.
1436
    // Simulate a click in the middle of the accessibility object.
1437
    PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), ForceAtClick);
1437
    PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), ForceAtClick, NoTap);
1438
    frame->eventHandler().handleMousePressEvent(mouseEvent);
1438
    frame->eventHandler().handleMousePressEvent(mouseEvent);
1439
    bool handled = frame->eventHandler().sendContextMenuEvent(mouseEvent);
1439
    bool handled = frame->eventHandler().sendContextMenuEvent(mouseEvent);
1440
    if (handled)
1440
    if (handled)
- Source/WebCore/page/DragController.cpp -1 / +1 lines
Lines 105-111 static PlatformMouseEvent createMouseEve Source/WebCore/page/DragController.cpp_sec1
105
105
106
    return PlatformMouseEvent(dragData.clientPosition(), dragData.globalPosition(),
106
    return PlatformMouseEvent(dragData.clientPosition(), dragData.globalPosition(),
107
                              LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,
107
                              LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,
108
                              metaKey, currentTime(), ForceAtClick);
108
                              metaKey, currentTime(), ForceAtClick, NoTap);
109
}
109
}
110
110
111
DragController::DragController(Page& page, DragClient& client)
111
DragController::DragController(Page& page, DragClient& client)
- Source/WebCore/page/EventHandler.cpp -3 / +3 lines
Lines 2131-2137 bool EventHandler::dispatchDragEvent(con Source/WebCore/page/EventHandler.cpp_sec1
2131
        event.movementDelta().x(), event.movementDelta().y(),
2131
        event.movementDelta().x(), event.movementDelta().y(),
2132
#endif
2132
#endif
2133
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
2133
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
2134
        0, 0, event.force(), dataTransfer);
2134
        0, 0, event.force(), NoTap, dataTransfer);
2135
2135
2136
    dragTarget.dispatchEvent(me);
2136
    dragTarget.dispatchEvent(me);
2137
    return me->defaultPrevented();
2137
    return me->defaultPrevented();
Lines 2853-2859 bool EventHandler::sendContextMenuEventF Source/WebCore/page/EventHandler.cpp_sec2
2853
    PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2853
    PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2854
#endif
2854
#endif
2855
2855
2856
    PlatformMouseEvent platformMouseEvent(position, globalPosition, RightButton, eventType, 1, false, false, false, false, WTF::currentTime(), ForceAtClick);
2856
    PlatformMouseEvent platformMouseEvent(position, globalPosition, RightButton, eventType, 1, false, false, false, false, WTF::currentTime(), ForceAtClick, NoTap);
2857
2857
2858
    return !dispatchMouseEvent(eventNames().contextmenuEvent, targetNode, true, 0, platformMouseEvent, false);
2858
    return !dispatchMouseEvent(eventNames().contextmenuEvent, targetNode, true, 0, platformMouseEvent, false);
2859
}
2859
}
Lines 2935-2941 void EventHandler::fakeMouseMoveEventTim Source/WebCore/page/EventHandler.cpp_sec3
2935
    bool altKey;
2935
    bool altKey;
2936
    bool metaKey;
2936
    bool metaKey;
2937
    PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
2937
    PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
2938
    PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownMouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime(), 0);
2938
    PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownMouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime(), 0, NoTap);
2939
    mouseMoved(fakeMouseMoveEvent);
2939
    mouseMoved(fakeMouseMoveEvent);
2940
}
2940
}
2941
#endif // !ENABLE(IOS_TOUCH_EVENTS)
2941
#endif // !ENABLE(IOS_TOUCH_EVENTS)
- Source/WebCore/platform/PlatformMouseEvent.h -2 / +5 lines
Lines 48-53 const double ForceAtForceClick = 2; Source/WebCore/platform/PlatformMouseEvent.h_sec1
48
48
49
    // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
49
    // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
50
    enum MouseButton : int8_t { NoButton = -1, LeftButton, MiddleButton, RightButton };
50
    enum MouseButton : int8_t { NoButton = -1, LeftButton, MiddleButton, RightButton };
51
    enum SyntheticClickType : int8_t { NoTap, OneFingerTap, TwoFingerTap };
51
52
52
    class PlatformMouseEvent : public PlatformEvent {
53
    class PlatformMouseEvent : public PlatformEvent {
53
    public:
54
    public:
Lines 66-72 const double ForceAtForceClick = 2; Source/WebCore/platform/PlatformMouseEvent.h_sec2
66
        }
67
        }
67
68
68
        PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type,
69
        PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type,
69
                           int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp, double force)
70
                           int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp, double force, SyntheticClickType syntheticClickType)
70
            : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
71
            : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
71
            , m_position(position)
72
            , m_position(position)
72
            , m_globalPosition(globalPosition)
73
            , m_globalPosition(globalPosition)
Lines 74-79 const double ForceAtForceClick = 2; Source/WebCore/platform/PlatformMouseEvent.h_sec3
74
            , m_clickCount(clickCount)
75
            , m_clickCount(clickCount)
75
            , m_modifierFlags(0)
76
            , m_modifierFlags(0)
76
            , m_force(force)
77
            , m_force(force)
78
            , m_syntheticClickType(syntheticClickType)
77
#if PLATFORM(MAC)
79
#if PLATFORM(MAC)
78
            , m_eventNumber(0)
80
            , m_eventNumber(0)
79
            , m_menuTypeForEvent(0)
81
            , m_menuTypeForEvent(0)
Lines 93-99 const double ForceAtForceClick = 2; Source/WebCore/platform/PlatformMouseEvent.h_sec4
93
        int clickCount() const { return m_clickCount; }
95
        int clickCount() const { return m_clickCount; }
94
        unsigned modifierFlags() const { return m_modifierFlags; }
96
        unsigned modifierFlags() const { return m_modifierFlags; }
95
        double force() const { return m_force; }
97
        double force() const { return m_force; }
96
        
98
        SyntheticClickType syntheticClickType() const { return m_syntheticClickType; }
97
99
98
#if PLATFORM(GTK) 
100
#if PLATFORM(GTK) 
99
        explicit PlatformMouseEvent(GdkEventButton*);
101
        explicit PlatformMouseEvent(GdkEventButton*);
Lines 129-134 const double ForceAtForceClick = 2; Source/WebCore/platform/PlatformMouseEvent.h_sec5
129
        int m_clickCount;
131
        int m_clickCount;
130
        unsigned m_modifierFlags;
132
        unsigned m_modifierFlags;
131
        double m_force { 0 };
133
        double m_force { 0 };
134
        SyntheticClickType m_syntheticClickType { NoTap };
132
135
133
#if PLATFORM(MAC)
136
#if PLATFORM(MAC)
134
        int m_eventNumber;
137
        int m_eventNumber;
- Source/WebCore/replay/SerializationMethods.cpp -1 / +1 lines
Lines 338-344 bool EncodingTraits<PlatformMouseEvent>: Source/WebCore/replay/SerializationMethods.cpp_sec1
338
    input = std::make_unique<PlatformMouseEvent>(IntPoint(positionX, positionY),
338
    input = std::make_unique<PlatformMouseEvent>(IntPoint(positionX, positionY),
339
        IntPoint(globalPositionX, globalPositionY),
339
        IntPoint(globalPositionX, globalPositionY),
340
        button, type, clickCount,
340
        button, type, clickCount,
341
        shiftKey, ctrlKey, altKey, metaKey, timestamp, force);
341
        shiftKey, ctrlKey, altKey, metaKey, timestamp, force, WebCore::NoTap);
342
    return true;
342
    return true;
343
}
343
}
344
344
- Source/WebKit2/ChangeLog +86 lines
Lines 1-3 Source/WebKit2/ChangeLog_sec1
1
2016-07-08  Enrica Casucci  <enrica@apple.com>
2
3
        Add synthetic click origin to WKNavigationAction.
4
        https://bugs.webkit.org/show_bug.cgi?id=159584
5
        rdar://problem/25610422
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Adds a private property to WKNavigationAction to retrieve
10
        the origin of the synthetic click.
11
12
        * Shared/NavigationActionData.cpp:
13
        (WebKit::NavigationActionData::encode):
14
        (WebKit::NavigationActionData::decode):
15
        * Shared/NavigationActionData.h:
16
        * Shared/WebEvent.h:
17
        (WebKit::WebMouseEvent::button):
18
        (WebKit::WebMouseEvent::menuTypeForEvent):
19
        (WebKit::WebMouseEvent::force):
20
        (WebKit::WebMouseEvent::syntheticClickType):
21
        * Shared/WebMouseEvent.cpp:
22
        (WebKit::WebMouseEvent::WebMouseEvent):
23
        (WebKit::WebMouseEvent::encode):
24
        (WebKit::WebMouseEvent::decode):
25
        * Shared/mac/WebEventFactory.mm:
26
        (WebKit::WebEventFactory::createWebMouseEvent):
27
        (WebKit::WebEventFactory::createWebWheelEvent):
28
        * UIProcess/API/APINavigationAction.h:
29
        * UIProcess/API/Cocoa/WKNavigationAction.mm:
30
        (toWKNavigationType):
31
        (toWKSyntheticClickType):
32
        (-[WKNavigationAction description]):
33
        (-[WKNavigationAction sourceFrame]):
34
        (-[WKNavigationAction request]):
35
        (-[WKNavigationAction _syntheticClickType]):
36
        (-[WKNavigationAction modifierFlags]):
37
        * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
38
        * UIProcess/WebPageProxy.h:
39
        * UIProcess/ios/WKContentViewInteraction.mm:
40
        (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
41
        (-[WKContentView _longPressRecognized:]):
42
        * UIProcess/ios/WebPageProxyIOS.mm:
43
        (WebKit::WebPageProxy::getSelectionContext):
44
        (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
45
        (WebKit::WebPageProxy::selectWithTwoTouches):
46
        * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
47
        (WebKit::mouseButtonForMouseEvent):
48
        (WebKit::syntheticClickTypeForMouseEvent):
49
        (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
50
        (WebKit::InjectedBundleNavigationAction::mouseButtonForNavigationAction):
51
        (WebKit::InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction):
52
        (WebKit::InjectedBundleNavigationAction::create):
53
        (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
54
        * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
55
        (WebKit::InjectedBundleNavigationAction::navigationType):
56
        (WebKit::InjectedBundleNavigationAction::modifiers):
57
        (WebKit::InjectedBundleNavigationAction::mouseButton):
58
        (WebKit::InjectedBundleNavigationAction::hitTestResult):
59
        (WebKit::InjectedBundleNavigationAction::formElement):
60
        (WebKit::InjectedBundleNavigationAction::syntheticClickType):
61
        (WebKit::InjectedBundleNavigationAction::shouldOpenExternalURLs):
62
        (WebKit::InjectedBundleNavigationAction::shouldTryAppLinks):
63
        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
64
        (WebKit::WebChromeClient::createWindow):
65
        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
66
        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
67
        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
68
        * WebProcess/WebPage/WebPage.cpp:
69
        (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
70
        (WebKit::WebPage::contextMenuAtPointInWindow):
71
        (WebKit::WebPage::dragEnded):
72
        (WebKit::WebPage::simulateMouseDown):
73
        (WebKit::WebPage::simulateMouseUp):
74
        (WebKit::WebPage::simulateMouseMotion):
75
        (WebKit::WebPage::setCompositionForTesting):
76
        * WebProcess/WebPage/WebPage.h:
77
        * WebProcess/WebPage/WebPage.messages.in:
78
        * WebProcess/WebPage/ios/WebPageIOS.mm:
79
        (WebKit::WebPage::handleSyntheticClick):
80
        (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
81
        (WebKit::WebPage::completeSyntheticClick):
82
        (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
83
        (WebKit::WebPage::handleTwoFingerTapAtPoint):
84
        (WebKit::WebPage::potentialTapAtPosition):
85
        (WebKit::WebPage::inspectorNodeSearchMovedToPosition):
86
1
2016-07-07  Andy Estes  <aestes@apple.com>
87
2016-07-07  Andy Estes  <aestes@apple.com>
2
88
3
        [Content Filtering] Load blocked pages more like other error pages are loaded
89
        [Content Filtering] Load blocked pages more like other error pages are loaded
- Source/WebKit2/Shared/NavigationActionData.cpp +3 lines
Lines 39-44 void NavigationActionData::encode(IPC::A Source/WebKit2/Shared/NavigationActionData.cpp_sec1
39
    encoder.encodeEnum(navigationType);
39
    encoder.encodeEnum(navigationType);
40
    encoder.encodeEnum(modifiers);
40
    encoder.encodeEnum(modifiers);
41
    encoder.encodeEnum(mouseButton);
41
    encoder.encodeEnum(mouseButton);
42
    encoder.encodeEnum(syntheticClickType);
42
    encoder << isProcessingUserGesture;
43
    encoder << isProcessingUserGesture;
43
    encoder << canHandleRequest;
44
    encoder << canHandleRequest;
44
    encoder.encodeEnum(shouldOpenExternalURLsPolicy);
45
    encoder.encodeEnum(shouldOpenExternalURLsPolicy);
Lines 53-58 bool NavigationActionData::decode(IPC::A Source/WebKit2/Shared/NavigationActionData.cpp_sec2
53
        return false;
54
        return false;
54
    if (!decoder.decodeEnum(result.mouseButton))
55
    if (!decoder.decodeEnum(result.mouseButton))
55
        return false;
56
        return false;
57
    if (!decoder.decodeEnum(result.syntheticClickType))
58
        return false;
56
    if (!decoder.decode(result.isProcessingUserGesture))
59
    if (!decoder.decode(result.isProcessingUserGesture))
57
        return false;
60
        return false;
58
    if (!decoder.decode(result.canHandleRequest))
61
    if (!decoder.decode(result.canHandleRequest))
- Source/WebKit2/Shared/NavigationActionData.h +1 lines
Lines 43-48 struct NavigationActionData { Source/WebKit2/Shared/NavigationActionData.h_sec1
43
    WebCore::NavigationType navigationType { WebCore::NavigationType::Other };
43
    WebCore::NavigationType navigationType { WebCore::NavigationType::Other };
44
    WebEvent::Modifiers modifiers { };
44
    WebEvent::Modifiers modifiers { };
45
    WebMouseEvent::Button mouseButton { WebMouseEvent::NoButton };
45
    WebMouseEvent::Button mouseButton { WebMouseEvent::NoButton };
46
    WebMouseEvent::SyntheticClickType syntheticClickType { WebMouseEvent::NoTap };
46
    bool isProcessingUserGesture { false };
47
    bool isProcessingUserGesture { false };
47
    bool canHandleRequest { false };
48
    bool canHandleRequest { false };
48
    WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
49
    WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
- Source/WebKit2/Shared/WebEvent.h -2 / +6 lines
Lines 130-141 public: Source/WebKit2/Shared/WebEvent.h_sec1
130
        RightButton
130
        RightButton
131
    };
131
    };
132
132
133
    enum SyntheticClickType { NoTap, OneFingerTap, TwoFingerTap };
134
133
    WebMouseEvent();
135
    WebMouseEvent();
134
136
135
#if PLATFORM(MAC)
137
#if PLATFORM(MAC)
136
    WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, double force, int eventNumber = -1, int menuType = 0);
138
    WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
137
#else
139
#else
138
    WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, double force = 0);
140
    WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, double force = 0, SyntheticClickType = NoTap);
139
#endif
141
#endif
140
142
141
    Button button() const { return static_cast<Button>(m_button); }
143
    Button button() const { return static_cast<Button>(m_button); }
Lines 150-155 public: Source/WebKit2/Shared/WebEvent.h_sec2
150
    int32_t menuTypeForEvent() const { return m_menuTypeForEvent; }
152
    int32_t menuTypeForEvent() const { return m_menuTypeForEvent; }
151
#endif
153
#endif
152
    double force() const { return m_force; }
154
    double force() const { return m_force; }
155
    SyntheticClickType syntheticClickType() const { return static_cast<SyntheticClickType>(m_syntheticClickType); }
153
156
154
    void encode(IPC::ArgumentEncoder&) const;
157
    void encode(IPC::ArgumentEncoder&) const;
155
    static bool decode(IPC::ArgumentDecoder&, WebMouseEvent&);
158
    static bool decode(IPC::ArgumentDecoder&, WebMouseEvent&);
Lines 169-174 private: Source/WebKit2/Shared/WebEvent.h_sec3
169
    int32_t m_menuTypeForEvent;
172
    int32_t m_menuTypeForEvent;
170
#endif
173
#endif
171
    double m_force { 0 };
174
    double m_force { 0 };
175
    uint32_t m_syntheticClickType { NoTap };
172
};
176
};
173
177
174
// FIXME: Move this class to its own header file.
178
// FIXME: Move this class to its own header file.
- Source/WebKit2/Shared/WebMouseEvent.cpp -2 / +7 lines
Lines 48-56 WebMouseEvent::WebMouseEvent() Source/WebKit2/Shared/WebMouseEvent.cpp_sec1
48
}
48
}
49
49
50
#if PLATFORM(MAC)
50
#if PLATFORM(MAC)
51
WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, double force, int eventNumber, int menuType)
51
WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
52
#else
52
#else
53
WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, double force)
53
WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, double force, SyntheticClickType syntheticClickType)
54
#endif
54
#endif
55
    : WebEvent(type, modifiers, timestamp)
55
    : WebEvent(type, modifiers, timestamp)
56
    , m_button(button)
56
    , m_button(button)
Lines 65-70 WebMouseEvent::WebMouseEvent(Type type, Source/WebKit2/Shared/WebMouseEvent.cpp_sec2
65
    , m_menuTypeForEvent(menuType)
65
    , m_menuTypeForEvent(menuType)
66
#endif
66
#endif
67
    , m_force(force)
67
    , m_force(force)
68
    , m_syntheticClickType(syntheticClickType)
68
{
69
{
69
    ASSERT(isMouseEventType(type));
70
    ASSERT(isMouseEventType(type));
70
}
71
}
Lines 85-90 void WebMouseEvent::encode(IPC::Argument Source/WebKit2/Shared/WebMouseEvent.cpp_sec3
85
    encoder << m_menuTypeForEvent;
86
    encoder << m_menuTypeForEvent;
86
#endif
87
#endif
87
    encoder << m_force;
88
    encoder << m_force;
89
    encoder << m_syntheticClickType;
88
}
90
}
89
91
90
bool WebMouseEvent::decode(IPC::ArgumentDecoder& decoder, WebMouseEvent& result)
92
bool WebMouseEvent::decode(IPC::ArgumentDecoder& decoder, WebMouseEvent& result)
Lines 115-120 bool WebMouseEvent::decode(IPC::Argument Source/WebKit2/Shared/WebMouseEvent.cpp_sec4
115
    if (!decoder.decode(result.m_force))
117
    if (!decoder.decode(result.m_force))
116
        return false;
118
        return false;
117
119
120
    if (!decoder.decode(result.m_syntheticClickType))
121
        return false;
122
118
    return true;
123
    return true;
119
}
124
}
120
125
- Source/WebKit2/Shared/mac/WebEventFactory.mm -1 / +1 lines
Lines 405-411 WebMouseEvent WebEventFactory::createWeb Source/WebKit2/Shared/mac/WebEventFactory.mm_sec1
405
    force = pressure + stage;
405
    force = pressure + stage;
406
#endif
406
#endif
407
407
408
    return WebMouseEvent(type, button, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, eventNumber, menuTypeForEvent);
408
    return WebMouseEvent(type, button, IntPoint(position), IntPoint(globalPosition), deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp, force, WebMouseEvent::SyntheticClickType::NoTap, eventNumber, menuTypeForEvent);
409
}
409
}
410
410
411
WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windowView)
411
WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windowView)
- Source/WebKit2/UIProcess/WebPageProxy.h -1 / +1 lines
Lines 520-526 public: Source/WebKit2/UIProcess/WebPageProxy.h_sec1
520
    void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
520
    void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
521
    void contentSizeCategoryDidChange(const String& contentSizeCategory);
521
    void contentSizeCategoryDidChange(const String& contentSizeCategory);
522
    void getSelectionContext(std::function<void(const String&, const String&, const String&, CallbackBase::Error)>);
522
    void getSelectionContext(std::function<void(const String&, const String&, const String&, CallbackBase::Error)>);
523
    void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, std::function<void(const String&, CallbackBase::Error)>);
523
    void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
524
    void updateForceAlwaysUserScalable();
524
    void updateForceAlwaysUserScalable();
525
#endif
525
#endif
526
#if ENABLE(DATA_DETECTION)
526
#if ENABLE(DATA_DETECTION)
- Source/WebKit2/UIProcess/API/APINavigationAction.h +1 lines
Lines 62-67 public: Source/WebKit2/UIProcess/API/APINavigationAction.h_sec1
62
    WebCore::NavigationType navigationType() const { return m_navigationActionData.navigationType; }
62
    WebCore::NavigationType navigationType() const { return m_navigationActionData.navigationType; }
63
    WebKit::WebEvent::Modifiers modifiers() const { return m_navigationActionData.modifiers; }
63
    WebKit::WebEvent::Modifiers modifiers() const { return m_navigationActionData.modifiers; }
64
    WebKit::WebMouseEvent::Button mouseButton() const { return m_navigationActionData.mouseButton; }
64
    WebKit::WebMouseEvent::Button mouseButton() const { return m_navigationActionData.mouseButton; }
65
    WebKit::WebMouseEvent::SyntheticClickType syntheticClickType() const { return m_navigationActionData.syntheticClickType; }
65
    bool isProcessingUserGesture() const { return m_navigationActionData.isProcessingUserGesture; }
66
    bool isProcessingUserGesture() const { return m_navigationActionData.isProcessingUserGesture; }
66
    bool canHandleRequest() const { return m_navigationActionData.canHandleRequest; }
67
    bool canHandleRequest() const { return m_navigationActionData.canHandleRequest; }
67
    bool shouldOpenExternalSchemes() const { return m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow || m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes; }
68
    bool shouldOpenExternalSchemes() const { return m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow || m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes; }
- Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm -2 / +21 lines
Lines 55-60 static WKNavigationType toWKNavigationTy Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm_sec1
55
    return WKNavigationTypeOther;
55
    return WKNavigationTypeOther;
56
}
56
}
57
57
58
static WKSyntheticClickType toWKSyntheticClickType(WebKit::WebMouseEvent::SyntheticClickType syntheticClickType)
59
{
60
    switch (syntheticClickType) {
61
    case WebKit::WebMouseEvent::NoTap:
62
        return WKSyntheticClickTypeNoTap;
63
    case WebKit::WebMouseEvent::OneFingerTap:
64
        return WKSyntheticClickTypeOneFingerTap;
65
    case WebKit::WebMouseEvent::TwoFingerTap:
66
        return WKSyntheticClickTypeTwoFingerTap;
67
    }
68
    ASSERT_NOT_REACHED();
69
    return WKSyntheticClickTypeNoTap;
70
}
71
58
#if PLATFORM(MAC)
72
#if PLATFORM(MAC)
59
73
60
// FIXME: This really belongs in WebEventFactory.
74
// FIXME: This really belongs in WebEventFactory.
Lines 108-115 - (void)dealloc Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm_sec2
108
122
109
- (NSString *)description
123
- (NSString *)description
110
{
124
{
111
    return [NSString stringWithFormat:@"<%@: %p; navigationType = %ld; request = %@; sourceFrame = %@; targetFrame = %@>", NSStringFromClass(self.class), self,
125
    return [NSString stringWithFormat:@"<%@: %p; navigationType = %ld; syntheticClickType = %ld; request = %@; sourceFrame = %@; targetFrame = %@>", NSStringFromClass(self.class), self,
112
        (long)self.navigationType, self.request, self.sourceFrame, self.targetFrame];
126
        (long)self.navigationType, (long)self._syntheticClickType, self.request, self.sourceFrame, self.targetFrame];
113
}
127
}
114
128
115
- (WKFrameInfo *)sourceFrame
129
- (WKFrameInfo *)sourceFrame
Lines 136-141 - (NSURLRequest *)request Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm_sec3
136
    return _navigationAction->request().nsURLRequest(WebCore::DoNotUpdateHTTPBody);
150
    return _navigationAction->request().nsURLRequest(WebCore::DoNotUpdateHTTPBody);
137
}
151
}
138
152
153
- (WKSyntheticClickType)_syntheticClickType
154
{
155
    return toWKSyntheticClickType(_navigationAction->syntheticClickType());
156
}
157
139
#if PLATFORM(MAC)
158
#if PLATFORM(MAC)
140
- (NSEventModifierFlags)modifierFlags
159
- (NSEventModifierFlags)modifierFlags
141
{
160
{
- Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h +8 lines
Lines 27-32 Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h_sec1
27
27
28
#if WK_API_ENABLED
28
#if WK_API_ENABLED
29
29
30
typedef NS_ENUM(NSInteger, WKSyntheticClickType) {
31
    WKSyntheticClickTypeNoTap,
32
    WKSyntheticClickTypeOneFingerTap,
33
    WKSyntheticClickTypeTwoFingerTap
34
} WK_API_AVAILABLE(macosx(NA), ios(10.0));
35
30
@interface WKNavigationAction (WKPrivate)
36
@interface WKNavigationAction (WKPrivate)
31
37
32
@property (nonatomic, readonly) NSURL *_originalURL;
38
@property (nonatomic, readonly) NSURL *_originalURL;
Lines 37-42 Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h_sec2
37
43
38
@property (nonatomic, readonly) BOOL _shouldOpenExternalURLs WK_API_DEPRECATED("use _shouldOpenExternalSchemes and _shouldOpenAppLinks", macosx(10.11, 10.11), ios(9.0, 9.0));
44
@property (nonatomic, readonly) BOOL _shouldOpenExternalURLs WK_API_DEPRECATED("use _shouldOpenExternalSchemes and _shouldOpenAppLinks", macosx(10.11, 10.11), ios(9.0, 9.0));
39
45
46
@property (nonatomic, readonly) WKSyntheticClickType _syntheticClickType WK_API_AVAILABLE(macosx(NA), ios(10.0));
47
40
@end
48
@end
41
49
42
#endif
50
#endif
- Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm -14 / +2 lines
Lines 1369-1389 - (void)_highlightLongPressRecognized:(U Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm_sec1
1369
1369
1370
- (void)_twoFingerSingleTapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer
1370
- (void)_twoFingerSingleTapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer
1371
{
1371
{
1372
    _page->tapHighlightAtPosition(gestureRecognizer.centroid, ++_latestTapID);
1373
    _isTapHighlightIDValid = YES;
1372
    _isTapHighlightIDValid = YES;
1374
    RetainPtr<WKContentView> view = self;
1373
    _isExpectingFastSingleTapCommit = YES;
1375
    WKWebView *webView = _webView;
1374
    _page->handleTwoFingerTapAtPoint(roundedIntPoint(gestureRecognizer.centroid), ++_latestTapID);
1376
    _page->handleTwoFingerTapAtPoint(roundedIntPoint(gestureRecognizer.centroid), [view, webView](const String& string, CallbackBase::Error error) {
1377
        if (error != CallbackBase::Error::None)
1378
            return;
1379
        if (!string.isEmpty()) {
1380
            id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([webView UIDelegate]);
1381
            if ([uiDelegate respondsToSelector:@selector(_webView:alternateActionForURL:)])
1382
                [uiDelegate _webView:webView alternateActionForURL:[NSURL _web_URLWithWTFString:string]];
1383
            [view _finishInteraction];
1384
        } else
1385
            [view _cancelInteraction];
1386
    });
1387
}
1375
}
1388
1376
1389
- (void)_longPressRecognized:(UILongPressGestureRecognizer *)gestureRecognizer
1377
- (void)_longPressRecognized:(UILongPressGestureRecognizer *)gestureRecognizer
- Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm -8 / +2 lines
Lines 565-579 void WebPageProxy::getSelectionContext(s Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm_sec1
565
    m_process->send(Messages::WebPage::GetSelectionContext(callbackID), m_pageID);
565
    m_process->send(Messages::WebPage::GetSelectionContext(callbackID), m_pageID);
566
}
566
}
567
567
568
void WebPageProxy::handleTwoFingerTapAtPoint(const WebCore::IntPoint& point, std::function<void(const String&, CallbackBase::Error)> callbackFunction)
568
void WebPageProxy::handleTwoFingerTapAtPoint(const WebCore::IntPoint& point, uint64_t requestID)
569
{
569
{
570
    if (!isValid()) {
570
    process().send(Messages::WebPage::HandleTwoFingerTapAtPoint(point, requestID), m_pageID);
571
        callbackFunction(String(), CallbackBase::Error::Unknown);
572
        return;
573
    }
574
    
575
    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
576
    process().send(Messages::WebPage::HandleTwoFingerTapAtPoint(point, callbackID), m_pageID);
577
}
571
}
578
572
579
void WebPageProxy::selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, std::function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)> callbackFunction)
573
void WebPageProxy::selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, std::function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)> callbackFunction)
- Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp +16 lines
Lines 58-63 static WebMouseEvent::Button mouseButton Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp_sec1
58
    return static_cast<WebMouseEvent::Button>(mouseEvent->button());
58
    return static_cast<WebMouseEvent::Button>(mouseEvent->button());
59
}
59
}
60
60
61
static WebMouseEvent::SyntheticClickType syntheticClickTypeForMouseEvent(const MouseEvent* mouseEvent)
62
{
63
    if (!mouseEvent)
64
        return WebMouseEvent::NoTap;
65
    
66
    if (!mouseEvent->buttonDown() || !mouseEvent->isTrusted())
67
        return WebMouseEvent::NoTap;
68
    
69
    return static_cast<WebMouseEvent::SyntheticClickType>(mouseEvent->syntheticClickType());
70
}
71
61
WebEvent::Modifiers InjectedBundleNavigationAction::modifiersForNavigationAction(const NavigationAction& navigationAction)
72
WebEvent::Modifiers InjectedBundleNavigationAction::modifiersForNavigationAction(const NavigationAction& navigationAction)
62
{
73
{
63
    uint32_t modifiers = 0;
74
    uint32_t modifiers = 0;
Lines 81-86 WebMouseEvent::Button InjectedBundleNavi Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp_sec2
81
    return mouseButtonForMouseEvent(mouseEventForNavigationAction(navigationAction));
92
    return mouseButtonForMouseEvent(mouseEventForNavigationAction(navigationAction));
82
}
93
}
83
94
95
WebMouseEvent::SyntheticClickType InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction(const NavigationAction& navigationAction)
96
{
97
    return syntheticClickTypeForMouseEvent(mouseEventForNavigationAction(navigationAction));
98
}
84
99
85
Ref<InjectedBundleNavigationAction> InjectedBundleNavigationAction::create(WebFrame* frame, const NavigationAction& action, PassRefPtr<FormState> formState)
100
Ref<InjectedBundleNavigationAction> InjectedBundleNavigationAction::create(WebFrame* frame, const NavigationAction& action, PassRefPtr<FormState> formState)
86
{
101
{
Lines 98-103 InjectedBundleNavigationAction::Injected Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp_sec3
98
    if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) {
113
    if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) {
99
        m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler().hitTestResultAtPoint(mouseEvent->absoluteLocation()));
114
        m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler().hitTestResultAtPoint(mouseEvent->absoluteLocation()));
100
        m_mouseButton   = mouseButtonForMouseEvent(mouseEvent);
115
        m_mouseButton   = mouseButtonForMouseEvent(mouseEvent);
116
        m_syntheticClickType = syntheticClickTypeForNavigationAction(navigationAction);
101
    }
117
    }
102
118
103
    RefPtr<FormState> formState = prpFormState;
119
    RefPtr<FormState> formState = prpFormState;
- Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h +3 lines
Lines 49-60 public: Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h_sec1
49
49
50
    static WebEvent::Modifiers modifiersForNavigationAction(const WebCore::NavigationAction&);
50
    static WebEvent::Modifiers modifiersForNavigationAction(const WebCore::NavigationAction&);
51
    static WebMouseEvent::Button mouseButtonForNavigationAction(const WebCore::NavigationAction&);
51
    static WebMouseEvent::Button mouseButtonForNavigationAction(const WebCore::NavigationAction&);
52
    static WebMouseEvent::SyntheticClickType syntheticClickTypeForNavigationAction(const WebCore::NavigationAction&);
52
53
53
    WebCore::NavigationType navigationType() const { return m_navigationType; }
54
    WebCore::NavigationType navigationType() const { return m_navigationType; }
54
    WebEvent::Modifiers modifiers() const { return m_modifiers; }
55
    WebEvent::Modifiers modifiers() const { return m_modifiers; }
55
    WebMouseEvent::Button mouseButton() const { return m_mouseButton; }
56
    WebMouseEvent::Button mouseButton() const { return m_mouseButton; }
56
    InjectedBundleHitTestResult* hitTestResult() const { return m_hitTestResult.get(); }
57
    InjectedBundleHitTestResult* hitTestResult() const { return m_hitTestResult.get(); }
57
    InjectedBundleNodeHandle* formElement() const { return m_formElement.get(); }
58
    InjectedBundleNodeHandle* formElement() const { return m_formElement.get(); }
59
    WebMouseEvent::SyntheticClickType syntheticClickType() const { return m_syntheticClickType; }
58
60
59
    bool shouldOpenExternalURLs() const { return m_shouldOpenExternalURLs; }
61
    bool shouldOpenExternalURLs() const { return m_shouldOpenExternalURLs; }
60
    bool shouldTryAppLinks() const { return m_shouldTryAppLinks; }
62
    bool shouldTryAppLinks() const { return m_shouldTryAppLinks; }
Lines 66-71 private: Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h_sec2
66
    WebCore::NavigationType m_navigationType;
68
    WebCore::NavigationType m_navigationType;
67
    WebEvent::Modifiers m_modifiers;
69
    WebEvent::Modifiers m_modifiers;
68
    WebMouseEvent::Button m_mouseButton;
70
    WebMouseEvent::Button m_mouseButton;
71
    WebMouseEvent::SyntheticClickType m_syntheticClickType;
69
    RefPtr<InjectedBundleHitTestResult> m_hitTestResult;
72
    RefPtr<InjectedBundleHitTestResult> m_hitTestResult;
70
    RefPtr<InjectedBundleNodeHandle> m_formElement;
73
    RefPtr<InjectedBundleNodeHandle> m_formElement;
71
    AtomicString m_downloadAttribute;
74
    AtomicString m_downloadAttribute;
- Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +1 lines
Lines 220-225 Page* WebChromeClient::createWindow(Fram Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp_sec1
220
    navigationActionData.navigationType = navigationAction.type();
220
    navigationActionData.navigationType = navigationAction.type();
221
    navigationActionData.modifiers = InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction);
221
    navigationActionData.modifiers = InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction);
222
    navigationActionData.mouseButton = InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction);
222
    navigationActionData.mouseButton = InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction);
223
    navigationActionData.syntheticClickType = InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction(navigationAction);
223
    navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
224
    navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
224
    navigationActionData.canHandleRequest = m_page->canHandleRequest(request.resourceRequest());
225
    navigationActionData.canHandleRequest = m_page->canHandleRequest(request.resourceRequest());
225
    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
226
    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
- Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +2 lines
Lines 726-731 void WebFrameLoaderClient::dispatchDecid Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp_sec1
726
    navigationActionData.navigationType = action->navigationType();
726
    navigationActionData.navigationType = action->navigationType();
727
    navigationActionData.modifiers = action->modifiers();
727
    navigationActionData.modifiers = action->modifiers();
728
    navigationActionData.mouseButton = action->mouseButton();
728
    navigationActionData.mouseButton = action->mouseButton();
729
    navigationActionData.syntheticClickType = action->syntheticClickType();
729
    navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
730
    navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
730
    navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
731
    navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
731
    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
732
    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
Lines 792-797 void WebFrameLoaderClient::dispatchDecid Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp_sec2
792
    navigationActionData.navigationType = action->navigationType();
793
    navigationActionData.navigationType = action->navigationType();
793
    navigationActionData.modifiers = action->modifiers();
794
    navigationActionData.modifiers = action->modifiers();
794
    navigationActionData.mouseButton = action->mouseButton();
795
    navigationActionData.mouseButton = action->mouseButton();
796
    navigationActionData.syntheticClickType = action->syntheticClickType();
795
    navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
797
    navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
796
    navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
798
    navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
797
    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
799
    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
- Source/WebKit2/WebProcess/WebPage/WebPage.cpp -6 / +6 lines
Lines 1240-1246 void WebPage::navigateToPDFLinkWithSimul Source/WebKit2/WebProcess/WebPage/WebPage.cpp_sec1
1240
#if ENABLE(POINTER_LOCK)
1240
#if ENABLE(POINTER_LOCK)
1241
        0, 0,
1241
        0, 0,
1242
#endif
1242
#endif
1243
        false, false, false, false, 0, nullptr, 0, nullptr);
1243
        false, false, false, false, 0, nullptr, 0, WebCore::NoTap, nullptr);
1244
1244
1245
    mainFrame->loader().urlSelected(mainFrameDocument->completeURL(url), emptyString(), mouseEvent.get(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
1245
    mainFrame->loader().urlSelected(mainFrameDocument->completeURL(url), emptyString(), mouseEvent.get(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
1246
}
1246
}
Lines 2026-2032 WebContextMenu* WebPage::contextMenuAtPo Source/WebKit2/WebProcess/WebPage/WebPage.cpp_sec2
2026
    corePage()->contextMenuController().clearContextMenu();
2026
    corePage()->contextMenuController().clearContextMenu();
2027
    
2027
    
2028
    // Simulate a mouse click to generate the correct menu.
2028
    // Simulate a mouse click to generate the correct menu.
2029
    PlatformMouseEvent mouseEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick);
2029
    PlatformMouseEvent mouseEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
2030
    bool handled = corePage()->userInputBridge().handleContextMenuEvent(mouseEvent, &corePage()->mainFrame());
2030
    bool handled = corePage()->userInputBridge().handleContextMenuEvent(mouseEvent, &corePage()->mainFrame());
2031
    if (!handled)
2031
    if (!handled)
2032
        return 0;
2032
        return 0;
Lines 3443-3449 void WebPage::dragEnded(WebCore::IntPoin Source/WebKit2/WebProcess/WebPage/WebPage.cpp_sec3
3443
    if (!view)
3443
    if (!view)
3444
        return;
3444
        return;
3445
    // FIXME: These are fake modifier keys here, but they should be real ones instead.
3445
    // FIXME: These are fake modifier keys here, but they should be real ones instead.
3446
    PlatformMouseEvent event(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0);
3446
    PlatformMouseEvent event(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, WebCore::NoTap);
3447
    m_page->mainFrame().eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
3447
    m_page->mainFrame().eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
3448
}
3448
}
3449
3449
Lines 4396-4412 void WebPage::handleAlternativeTextUIRes Source/WebKit2/WebProcess/WebPage/WebPage.cpp_sec4
4396
4396
4397
void WebPage::simulateMouseDown(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, double time)
4397
void WebPage::simulateMouseDown(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, double time)
4398
{
4398
{
4399
    mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick));
4399
    mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
4400
}
4400
}
4401
4401
4402
void WebPage::simulateMouseUp(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, double time)
4402
void WebPage::simulateMouseUp(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, double time)
4403
{
4403
{
4404
    mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick));
4404
    mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
4405
}
4405
}
4406
4406
4407
void WebPage::simulateMouseMotion(WebCore::IntPoint position, double time)
4407
void WebPage::simulateMouseMotion(WebCore::IntPoint position, double time)
4408
{
4408
{
4409
    mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0));
4409
    mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
4410
}
4410
}
4411
4411
4412
void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)
4412
void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length)
- Source/WebKit2/WebProcess/WebPage/WebPage.h -2 / +3 lines
Lines 60-65 Source/WebKit2/WebProcess/WebPage/WebPage.h_sec1
60
#include <WebCore/Page.h>
60
#include <WebCore/Page.h>
61
#include <WebCore/PageOverlay.h>
61
#include <WebCore/PageOverlay.h>
62
#include <WebCore/PageVisibilityState.h>
62
#include <WebCore/PageVisibilityState.h>
63
#include <WebCore/PlatformMouseEvent.h>
63
#include <WebCore/ScrollTypes.h>
64
#include <WebCore/ScrollTypes.h>
64
#include <WebCore/TextChecking.h>
65
#include <WebCore/TextChecking.h>
65
#include <WebCore/TextIndicator.h>
66
#include <WebCore/TextIndicator.h>
Lines 560-566 public: Source/WebKit2/WebProcess/WebPage/WebPage.h_sec2
560
    WebCore::IntRect rectForElementAtInteractionLocation();
561
    WebCore::IntRect rectForElementAtInteractionLocation();
561
    void updateSelectionAppearance();
562
    void updateSelectionAppearance();
562
    void getSelectionContext(uint64_t callbackID);
563
    void getSelectionContext(uint64_t callbackID);
563
    void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t callbackID);
564
    void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
564
#if ENABLE(IOS_TOUCH_EVENTS)
565
#if ENABLE(IOS_TOUCH_EVENTS)
565
    void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
566
    void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
566
#endif
567
#endif
Lines 977-983 private: Source/WebKit2/WebProcess/WebPage/WebPage.h_sec3
977
    void getAssistedNodeInformation(AssistedNodeInformation&);
978
    void getAssistedNodeInformation(AssistedNodeInformation&);
978
    void platformInitializeAccessibility();
979
    void platformInitializeAccessibility();
979
    void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
980
    void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
980
    void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
981
    void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, WebCore::SyntheticClickType);
981
    void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
982
    void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
982
    void resetTextAutosizing();
983
    void resetTextAutosizing();
983
    WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithAssistedNode);
984
    WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithAssistedNode);
- Source/WebKit2/WebProcess/WebPage/WebPage.messages.in -1 / +1 lines
Lines 96-102 messages -> WebPage LegacyReceiver { Source/WebKit2/WebProcess/WebPage/WebPage.messages.in_sec1
96
    ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
96
    ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
97
    GetSelectionContext(uint64_t callbackID)
97
    GetSelectionContext(uint64_t callbackID)
98
    SetAllowsMediaDocumentInlinePlayback(bool allows)
98
    SetAllowsMediaDocumentInlinePlayback(bool allows)
99
    HandleTwoFingerTapAtPoint(WebCore::IntPoint point, uint64_t callbackID)
99
    HandleTwoFingerTapAtPoint(WebCore::IntPoint point, uint64_t requestID)
100
    UpdateForceAlwaysUserScalable()
100
    UpdateForceAlwaysUserScalable()
101
#endif
101
#endif
102
102
- Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm -13 / +18 lines
Lines 527-533 void WebPage::handleSyntheticClick(Node* Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm_sec1
527
527
528
    WKBeginObservingContentChanges(true);
528
    WKBeginObservingContentChanges(true);
529
529
530
    mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0, WebCore::ForceAtClick));
530
    mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0, WebCore::ForceAtClick, WebCore::NoTap));
531
    mainframe.document()->updateStyleIfNeeded();
531
    mainframe.document()->updateStyleIfNeeded();
532
532
533
    WKStopObservingContentChanges();
533
    WKStopObservingContentChanges();
Lines 545-551 void WebPage::handleSyntheticClick(Node* Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm_sec2
545
        m_pendingSyntheticClickLocation = location;
545
        m_pendingSyntheticClickLocation = location;
546
        return;
546
        return;
547
    case WKContentNoChange:
547
    case WKContentNoChange:
548
        completeSyntheticClick(nodeRespondingToClick, location);
548
        completeSyntheticClick(nodeRespondingToClick, location, WebCore::OneFingerTap);
549
        return;
549
        return;
550
    }
550
    }
551
    ASSERT_NOT_REACHED();
551
    ASSERT_NOT_REACHED();
Lines 557-569 void WebPage::completePendingSyntheticCl Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm_sec3
557
        return;
557
        return;
558
    // Only dispatch the click if the document didn't get changed by any timers started by the move event.
558
    // Only dispatch the click if the document didn't get changed by any timers started by the move event.
559
    if (WKObservedContentChange() == WKContentNoChange)
559
    if (WKObservedContentChange() == WKContentNoChange)
560
        completeSyntheticClick(m_pendingSyntheticClickNode.get(), m_pendingSyntheticClickLocation);
560
        completeSyntheticClick(m_pendingSyntheticClickNode.get(), m_pendingSyntheticClickLocation, WebCore::OneFingerTap);
561
561
562
    m_pendingSyntheticClickNode = nullptr;
562
    m_pendingSyntheticClickNode = nullptr;
563
    m_pendingSyntheticClickLocation = FloatPoint();
563
    m_pendingSyntheticClickLocation = FloatPoint();
564
}
564
}
565
565
566
void WebPage::completeSyntheticClick(Node* nodeRespondingToClick, const WebCore::FloatPoint& location)
566
void WebPage::completeSyntheticClick(Node* nodeRespondingToClick, const WebCore::FloatPoint& location, SyntheticClickType syntheticClickType)
567
{
567
{
568
    IntPoint roundedAdjustedPoint = roundedIntPoint(location);
568
    IntPoint roundedAdjustedPoint = roundedIntPoint(location);
569
    Frame& mainframe = m_page->mainFrame();
569
    Frame& mainframe = m_page->mainFrame();
Lines 574-581 void WebPage::completeSyntheticClick(Nod Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm_sec4
574
574
575
    bool tapWasHandled = false;
575
    bool tapWasHandled = false;
576
    m_lastInteractionLocation = roundedAdjustedPoint;
576
    m_lastInteractionLocation = roundedAdjustedPoint;
577
    tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, 0, WebCore::ForceAtClick));
577
    tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, 0, WebCore::ForceAtClick, syntheticClickType));
578
    tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, 0, WebCore::ForceAtClick));
578
    tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, 0, WebCore::ForceAtClick, syntheticClickType));
579
579
580
    RefPtr<Frame> newFocusedFrame = m_page->focusController().focusedFrame();
580
    RefPtr<Frame> newFocusedFrame = m_page->focusController().focusedFrame();
581
    RefPtr<Element> newFocusedElement = newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr;
581
    RefPtr<Element> newFocusedElement = newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr;
Lines 647-661 void WebPage::sendTapHighlightForNodeIfN Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm_sec5
647
#endif
647
#endif
648
}
648
}
649
649
650
void WebPage::handleTwoFingerTapAtPoint(const WebCore::IntPoint& point, uint64_t callbackID)
650
void WebPage::handleTwoFingerTapAtPoint(const WebCore::IntPoint& point, uint64_t requestID)
651
{
651
{
652
    FloatPoint adjustedPoint;
652
    FloatPoint adjustedPoint;
653
    Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint);
653
    Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint);
654
    Element* element = (nodeRespondingToClick && is<Element>(*nodeRespondingToClick)) ? downcast<Element>(nodeRespondingToClick) : nullptr;
654
    if (!nodeRespondingToClick || !nodeRespondingToClick->renderer()) {
655
    String url;
655
        send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(adjustedPoint)));
656
    if (element && element->isLink())
656
        return;
657
        url = [(NSURL *)element->document().completeURL(stripLeadingAndTrailingHTMLSpaces(element->getAttribute(HTMLNames::hrefAttr))) absoluteString];
657
    }
658
    send(Messages::WebPageProxy::StringCallback(url, callbackID));
658
    sendTapHighlightForNodeIfNecessary(requestID, nodeRespondingToClick);
659
    if (is<Element>(*nodeRespondingToClick) && DataDetection::shouldCancelDefaultAction(downcast<Element>(*nodeRespondingToClick))) {
660
        requestPositionInformation(roundedIntPoint(adjustedPoint));
661
        send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(adjustedPoint)));
662
    } else
663
        completeSyntheticClick(nodeRespondingToClick, adjustedPoint, WebCore::TwoFingerTap);
659
}
664
}
660
665
661
void WebPage::potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint& position)
666
void WebPage::potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint& position)
Lines 732-738 void WebPage::inspectorNodeSearchMovedTo Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm_sec6
732
    IntPoint adjustedPoint = roundedIntPoint(position);
737
    IntPoint adjustedPoint = roundedIntPoint(position);
733
    Frame& mainframe = m_page->mainFrame();
738
    Frame& mainframe = m_page->mainFrame();
734
739
735
    mainframe.eventHandler().mouseMoved(PlatformMouseEvent(adjustedPoint, adjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0, 0));
740
    mainframe.eventHandler().mouseMoved(PlatformMouseEvent(adjustedPoint, adjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0, 0, WebCore::NoTap));
736
    mainframe.document()->updateStyleIfNeeded();
741
    mainframe.document()->updateStyleIfNeeded();
737
}
742
}
738
743
- Source/WebKit/ios/ChangeLog +11 lines
Lines 1-3 Source/WebKit/ios/ChangeLog_sec1
1
2016-07-08  Enrica Casucci  <enrica@apple.com>
2
3
        Add synthetic click origin to WKNavigationAction.
4
        https://bugs.webkit.org/show_bug.cgi?id=159584
5
        rdar://problem/25610422
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * WebView/WebPDFViewPlaceholder.mm:
10
        (-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):
11
1
2016-06-23  Alex Christensen  <achristensen@webkit.org>
12
2016-06-23  Alex Christensen  <achristensen@webkit.org>
2
13
3
        Remove unused didCancelAuthenticationChallenge
14
        Remove unused didCancelAuthenticationChallenge
- Source/WebKit/ios/WebView/WebPDFViewPlaceholder.mm -1 / +1 lines
Lines 471-477 - (void)simulateClickOnLinkToURL:(NSURL Source/WebKit/ios/WebView/WebPDFViewPlaceholder.mm_sec1
471
#if ENABLE(POINTER_LOCK)
471
#if ENABLE(POINTER_LOCK)
472
        0, 0,
472
        0, 0,
473
#endif
473
#endif
474
        false, false, false, false, 0, 0, 0, 0, true);
474
        false, false, false, false, 0, 0, 0, 0, 0, true);
475
475
476
    // Call to the frame loader because this is where our security checks are made.
476
    // Call to the frame loader because this is where our security checks are made.
477
    Frame* frame = core([_dataSource webFrame]);
477
    Frame* frame = core([_dataSource webFrame]);
- Source/WebKit/mac/ChangeLog +13 lines
Lines 1-3 Source/WebKit/mac/ChangeLog_sec1
1
2016-07-08  Enrica Casucci  <enrica@apple.com>
2
3
        Add synthetic click origin to WKNavigationAction.
4
        https://bugs.webkit.org/show_bug.cgi?id=159584
5
        rdar://problem/25610422
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * WebView/WebFrame.mm:
10
        (-[WebFrame _dragSourceEndedAt:operation:]):
11
        * WebView/WebPDFView.mm:
12
        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
13
1
2016-07-07  Andy Estes  <aestes@apple.com>
14
2016-07-07  Andy Estes  <aestes@apple.com>
2
15
3
        [Content Filtering] Load blocked pages more like other error pages are loaded
16
        [Content Filtering] Load blocked pages more like other error pages are loaded
- Source/WebKit/mac/WebView/WebFrame.mm -1 / +1 lines
Lines 977-983 - (void)_dragSourceEndedAt:(NSPoint)wind Source/WebKit/mac/WebView/WebFrame.mm_sec1
977
        return;
977
        return;
978
    // FIXME: These are fake modifier keys here, but they should be real ones instead.
978
    // FIXME: These are fake modifier keys here, but they should be real ones instead.
979
    PlatformMouseEvent event(IntPoint(windowLoc), IntPoint(globalPoint(windowLoc, [view->platformWidget() window])),
979
    PlatformMouseEvent event(IntPoint(windowLoc), IntPoint(globalPoint(windowLoc, [view->platformWidget() window])),
980
        LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick);
980
                             LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
981
    _private->coreFrame->eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
981
    _private->coreFrame->eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
982
}
982
}
983
#endif
983
#endif
- Source/WebKit/mac/WebView/WebPDFView.mm -1 / +1 lines
Lines 1042-1048 - (void)PDFViewWillClickOnLink:(PDFView Source/WebKit/mac/WebView/WebPDFView.mm_sec1
1042
            [nsEvent modifierFlags] & NSShiftKeyMask,
1042
            [nsEvent modifierFlags] & NSShiftKeyMask,
1043
            [nsEvent modifierFlags] & NSCommandKeyMask,
1043
            [nsEvent modifierFlags] & NSCommandKeyMask,
1044
#pragma clang diagnostic pop
1044
#pragma clang diagnostic pop
1045
            button, 0, WebCore::ForceAtClick, 0, true);
1045
            button, 0, WebCore::ForceAtClick, 0, 0, true);
1046
    }
1046
    }
1047
1047
1048
    // Call to the frame loader because this is where our security checks are made.
1048
    // Call to the frame loader because this is where our security checks are made.

Return to Bug 159584