Diff
Modified: trunk/Source/WebCore/ChangeLog (182555 => 182556)
--- trunk/Source/WebCore/ChangeLog 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebCore/ChangeLog 2015-04-08 18:25:25 UTC (rev 182556)
@@ -1,3 +1,27 @@
+2015-04-08 Beth Dakin <[email protected]>
+
+ Force events should not require preventDefault in order to fire
+ https://bugs.webkit.org/show_bug.cgi?id=143503
+ -and corresponding-
+ rdar://problem/20458916
+
+ Reviewed by Tim Horton.
+
+ Since these events will fire whether or not preventDefault was set on the
+ willBegin event, we should make sure we only send them when there are registered
+ event listeners. These are new events, so we don’t want to spam the vast majority
+ of web content that doesn’t use them yet.
+ * dom/Document.cpp:
+ (WebCore::Document::addListenerTypeIfNeeded):
+ * dom/Document.h:
+ * dom/Element.cpp:
+ (WebCore::Element::dispatchMouseForceWillBegin):
+ (WebCore::Element::dispatchMouseForceChanged):
+ (WebCore::Element::dispatchMouseForceDown):
+ (WebCore::Element::dispatchMouseForceUp):
+ (WebCore::Element::dispatchMouseForceClick):
+ (WebCore::Element::dispatchMouseForceCancelled):
+
2015-04-08 Jer Noble <[email protected]>
[Mac][WebAudio] Update the AVAudioMix in the AudioSourceProviderAVFObjC when the list of enabled audio tracks change.
Modified: trunk/Source/WebCore/dom/Document.cpp (182555 => 182556)
--- trunk/Source/WebCore/dom/Document.cpp 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebCore/dom/Document.cpp 2015-04-08 18:25:25 UTC (rev 182556)
@@ -3999,6 +3999,18 @@
addListenerType(BEFORELOAD_LISTENER);
else if (eventType == eventNames().scrollEvent)
addListenerType(SCROLL_LISTENER);
+ else if (eventType == eventNames().webkitmouseforcewillbeginEvent)
+ addListenerType(FORCEWILLBEGIN_LISTENER);
+ else if (eventType == eventNames().webkitmouseforcechangedEvent)
+ addListenerType(FORCECHANGED_LISTENER);
+ else if (eventType == eventNames().webkitmouseforcedownEvent)
+ addListenerType(FORCEDOWN_LISTENER);
+ else if (eventType == eventNames().webkitmouseforceupEvent)
+ addListenerType(FORCEUP_LISTENER);
+ else if (eventType == eventNames().webkitmouseforceclickEvent)
+ addListenerType(FORCECLICK_LISTENER);
+ else if (eventType == eventNames().webkitmouseforcecancelledEvent)
+ addListenerType(FORCECANCELLED_LISTENER);
}
CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&)
Modified: trunk/Source/WebCore/dom/Document.h (182555 => 182556)
--- trunk/Source/WebCore/dom/Document.h 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebCore/dom/Document.h 2015-04-08 18:25:25 UTC (rev 182556)
@@ -770,8 +770,13 @@
ANIMATIONITERATION_LISTENER = 1 << 9,
TRANSITIONEND_LISTENER = 1 << 10,
BEFORELOAD_LISTENER = 1 << 11,
- SCROLL_LISTENER = 1 << 12
- // 3 bits remaining
+ SCROLL_LISTENER = 1 << 12,
+ FORCEWILLBEGIN_LISTENER = 1 << 13,
+ FORCECHANGED_LISTENER = 1 << 14,
+ FORCEDOWN_LISTENER = 1 << 15,
+ FORCEUP_LISTENER = 1 << 16,
+ FORCECLICK_LISTENER = 1 << 17,
+ FORCECANCELLED_LISTENER = 1 << 18
};
bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
@@ -1400,7 +1405,7 @@
HashSet<NodeIterator*> m_nodeIterators;
HashSet<Range*> m_ranges;
- unsigned short m_listenerTypes;
+ unsigned m_listenerTypes;
MutationObserverOptions m_mutationObserverTypes;
Modified: trunk/Source/WebCore/dom/Element.cpp (182555 => 182556)
--- trunk/Source/WebCore/dom/Element.cpp 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebCore/dom/Element.cpp 2015-04-08 18:25:25 UTC (rev 182556)
@@ -2237,6 +2237,9 @@
#if ENABLE(MOUSE_FORCE_EVENTS)
bool Element::dispatchMouseForceWillBegin()
{
+ if (!document().hasListenerType(Document::FORCEWILLBEGIN_LISTENER))
+ return false;
+
Frame* frame = document().frame();
if (!frame)
return false;
@@ -2253,6 +2256,9 @@
void Element::dispatchMouseForceChanged(float force, const PlatformMouseEvent& platformMouseEvent)
{
+ if (!document().hasListenerType(Document::FORCECHANGED_LISTENER))
+ return;
+
RefPtr<WebKitMouseForceEvent> mouseForceChangedEvent = WebKitMouseForceEvent::create(eventNames().webkitmouseforcechangedEvent, force, platformMouseEvent, document().defaultView());
mouseForceChangedEvent->setTarget(this);
dispatchEvent(mouseForceChangedEvent);
@@ -2260,6 +2266,9 @@
void Element::dispatchMouseForceDown(const PlatformMouseEvent& platformMouseEvent)
{
+ if (!document().hasListenerType(Document::FORCEDOWN_LISTENER))
+ return;
+
RefPtr<Event> mouseForceDownEvent = WebKitMouseForceEvent::create(eventNames().webkitmouseforcedownEvent, 1, platformMouseEvent, document().defaultView());
mouseForceDownEvent->setTarget(this);
dispatchEvent(mouseForceDownEvent);
@@ -2267,6 +2276,9 @@
void Element::dispatchMouseForceUp(const PlatformMouseEvent& platformMouseEvent)
{
+ if (!document().hasListenerType(Document::FORCEUP_LISTENER))
+ return;
+
RefPtr<Event> mouseForceUpEvent = WebKitMouseForceEvent::create(eventNames().webkitmouseforceupEvent, 1, platformMouseEvent, document().defaultView());
mouseForceUpEvent->setTarget(this);
dispatchEvent(mouseForceUpEvent);
@@ -2274,6 +2286,9 @@
void Element::dispatchMouseForceClick(const PlatformMouseEvent& platformMouseEvent)
{
+ if (!document().hasListenerType(Document::FORCECLICK_LISTENER))
+ return;
+
RefPtr<Event> mouseForceClickEvent = WebKitMouseForceEvent::create(eventNames().webkitmouseforceclickEvent, 1, platformMouseEvent, document().defaultView());
mouseForceClickEvent->setTarget(this);
dispatchEvent(mouseForceClickEvent);
@@ -2281,6 +2296,9 @@
void Element::dispatchMouseForceCancelled(const PlatformMouseEvent& platformMouseEvent)
{
+ if (!document().hasListenerType(Document::FORCECANCELLED_LISTENER))
+ return;
+
RefPtr<Event> mouseForceCancelledEvent = WebKitMouseForceEvent::create(eventNames().webkitmouseforcecancelledEvent, 0, platformMouseEvent, document().defaultView());
mouseForceCancelledEvent->setTarget(this);
dispatchEvent(mouseForceCancelledEvent);
Modified: trunk/Source/WebKit2/ChangeLog (182555 => 182556)
--- trunk/Source/WebKit2/ChangeLog 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebKit2/ChangeLog 2015-04-08 18:25:25 UTC (rev 182556)
@@ -1,3 +1,22 @@
+2015-04-08 Beth Dakin <[email protected]>
+
+ Force events should not require preventDefault in order to fire
+ https://bugs.webkit.org/show_bug.cgi?id=143503
+ -and corresponding-
+ rdar://problem/20458916
+
+ Reviewed by Tim Horton.
+
+ We no longer need m_lastActionMenuHitTestPreventsDefault since we’ll always
+ dispatch the events to Element.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performActionMenuHitTestAtLocation):
+ (WebKit::WebPage::inputDeviceForceDidChange):
+ (WebKit::WebPage::immediateActionDidCancel):
+
2015-04-08 Enrica Casucci <[email protected]>
Calling makeFirstResponder on WKWebView doesn't work.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (182555 => 182556)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-04-08 18:25:25 UTC (rev 182556)
@@ -340,9 +340,6 @@
#if ENABLE(WEBGL)
, m_systemWebGLPolicy(WebGLAllowCreation)
#endif
-#if PLATFORM(MAC)
- , m_lastActionMenuHitTestPreventsDefault(false)
-#endif
, m_mainFrameProgressCompleted(false)
, m_shouldDispatchFakeMouseMoveEvents(true)
{
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (182555 => 182556)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-04-08 18:25:25 UTC (rev 182556)
@@ -1348,7 +1348,6 @@
RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
WebCore::HitTestResult m_lastActionMenuHitTestResult;
RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
- bool m_lastActionMenuHitTestPreventsDefault;
int m_lastForceStage { 0 };
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (182555 => 182556)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2015-04-08 18:12:56 UTC (rev 182555)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2015-04-08 18:25:25 UTC (rev 182556)
@@ -1024,13 +1024,13 @@
IntPoint locationInContentCoordinates = mainFrame.view()->rootViewToContents(roundedIntPoint(locationInViewCooordinates));
HitTestResult hitTestResult = mainFrame.eventHandler().hitTestResultAtPoint(locationInContentCoordinates);
- m_lastActionMenuHitTestPreventsDefault = false;
+ bool actionMenuHitTestPreventsDefault = false;
Element* element = hitTestResult.innerElement();
if (forImmediateAction) {
mainFrame.eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
if (element)
- m_lastActionMenuHitTestPreventsDefault = element->dispatchMouseForceWillBegin();
+ actionMenuHitTestPreventsDefault = element->dispatchMouseForceWillBegin();
}
WebHitTestResult::Data actionMenuResult(hitTestResult);
@@ -1116,7 +1116,7 @@
RefPtr<API::Object> userData;
injectedBundleContextMenuClient().prepareForActionMenu(*this, hitTestResult, userData);
- send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult, forImmediateAction, m_lastActionMenuHitTestPreventsDefault, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult, forImmediateAction, actionMenuHitTestPreventsDefault, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
PassRefPtr<WebCore::Range> WebPage::lookupTextAtLocation(FloatPoint locationInViewCooordinates, NSDictionary **options)
@@ -1160,9 +1160,6 @@
if (!element)
return;
- if (!m_lastActionMenuHitTestPreventsDefault)
- return;
-
float overallForce = stage < 1 ? force : force + stage - 1;
element->dispatchMouseForceChanged(overallForce, m_page->mainFrame().eventHandler().lastMouseDownEvent());
@@ -1189,9 +1186,6 @@
if (!element)
return;
- if (!m_lastActionMenuHitTestPreventsDefault)
- return;
-
element->dispatchMouseForceCancelled(m_page->mainFrame().eventHandler().lastMouseDownEvent());
}