Title: [222776] trunk
Revision
222776
Author
[email protected]
Date
2017-10-03 02:50:06 -0700 (Tue, 03 Oct 2017)

Log Message

REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
https://bugs.webkit.org/show_bug.cgi?id=177449

Reviewed by Chris Dumez.

Source/WebCore:

* platform/gtk/GtkUtilities.cpp:
(WebCore::wallTimeForEvent):
* platform/gtk/GtkUtilities.h:
(WebCore::wallTimeForEvent):
* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/gtk/PlatformMouseEventGtk.cpp:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
* platform/gtk/PlatformWheelEventGtk.cpp:
(WebCore::PlatformWheelEvent::PlatformWheelEvent):

Source/WebKit:

* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* Shared/wpe/WebEventFactory.cpp:
(WebKit::wallTimeForEventTime):
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebTouchEvent):

LayoutTests:

* platform/gtk/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (222775 => 222776)


--- trunk/LayoutTests/ChangeLog	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/LayoutTests/ChangeLog	2017-10-03 09:50:06 UTC (rev 222776)
@@ -1,3 +1,12 @@
+2017-10-03  Michael Catanzaro  <[email protected]>
+
+        REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=177449
+
+        Reviewed by Chris Dumez.
+
+        * platform/gtk/TestExpectations:
+
 2017-10-02  Wenson Hsieh  <[email protected]>
 
         REGRESSION(r222595): Intermittent crash while accessing DataTransferItemList

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (222775 => 222776)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2017-10-03 09:50:06 UTC (rev 222776)
@@ -3449,16 +3449,6 @@
 
 webkit.org/b/175662 inspector/canvas/recording-2d.html [ Failure ]
 
-webkit.org/b/177449 fast/forms/ValidityState-valueMissing-002.html [ Failure ]
-webkit.org/b/177449 fast/forms/listbox-selection-after-typeahead.html [ Failure ]
-webkit.org/b/177449 fast/forms/listbox-typeahead-scroll.html [ Failure ]
-webkit.org/b/177449 fast/forms/onchange-select-check-validity.html [ Failure ]
-webkit.org/b/177449 fast/forms/select-double-onchange.html [ Failure ]
-webkit.org/b/177449 fast/forms/select-script-onchange.html [ Failure ]
-webkit.org/b/177449 fast/forms/select/menulist-oninput-fired.html [ Failure ]
-webkit.org/b/177449 fast/forms/select/select-disabled.html [ Failure ]
-webkit.org/b/177449 fast/events/popup-when-select-change.html [ Timeout Crash ]
-
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of non-crashing, non-flaky tests failing
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/Source/WebCore/ChangeLog (222775 => 222776)


--- trunk/Source/WebCore/ChangeLog	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebCore/ChangeLog	2017-10-03 09:50:06 UTC (rev 222776)
@@ -1,3 +1,21 @@
+2017-10-03  Michael Catanzaro  <[email protected]>
+
+        REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=177449
+
+        Reviewed by Chris Dumez.
+
+        * platform/gtk/GtkUtilities.cpp:
+        (WebCore::wallTimeForEvent):
+        * platform/gtk/GtkUtilities.h:
+        (WebCore::wallTimeForEvent):
+        * platform/gtk/PlatformKeyboardEventGtk.cpp:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        * platform/gtk/PlatformMouseEventGtk.cpp:
+        (WebCore::PlatformMouseEvent::PlatformMouseEvent):
+        * platform/gtk/PlatformWheelEventGtk.cpp:
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+
 2017-10-03  Youenn Fablet  <[email protected]>
 
         Use vector map routine in WebCore CacheStorage implementation

Modified: trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp (222775 => 222776)


--- trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebCore/platform/gtk/GtkUtilities.cpp	2017-10-03 09:50:06 UTC (rev 222776)
@@ -54,6 +54,16 @@
     return widget && gtk_widget_is_toplevel(widget) && GTK_IS_WINDOW(widget) && !GTK_IS_OFFSCREEN_WINDOW(widget);
 }
 
+template<>
+WallTime wallTimeForEvent(const GdkEvent* event)
+{
+    // This works if and only if the X server or Wayland compositor happens to
+    // be using CLOCK_MONOTONIC for its monotonic time, and so long as
+    // g_get_monotonic_time() continues to do so as well, and so long as
+    // WTF::MonotonicTime continues to use g_get_monotonic_time().
+    return MonotonicTime::fromRawSeconds(gdk_event_get_time(event) / 1000.).approximateWallTime();
+}
+
 #if ENABLE(DEVELOPER_MODE)
 static CString topLevelPath()
 {

Modified: trunk/Source/WebCore/platform/gtk/GtkUtilities.h (222775 => 222776)


--- trunk/Source/WebCore/platform/gtk/GtkUtilities.h	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebCore/platform/gtk/GtkUtilities.h	2017-10-03 09:50:06 UTC (rev 222776)
@@ -19,6 +19,8 @@
 #ifndef GtkUtilities_h 
 #define GtkUtilities_h 
 
+#include <wtf/MonotonicTime.h>
+#include <wtf/WallTime.h>
 #include <wtf/text/CString.h>
 
 namespace WebCore {
@@ -28,6 +30,12 @@
 IntPoint convertWidgetPointToScreenPoint(GtkWidget*, const IntPoint&);
 bool widgetIsOnscreenToplevelWindow(GtkWidget*);
 
+template<typename GdkEventType>
+WallTime wallTimeForEvent(const GdkEventType* event) { return MonotonicTime::fromRawSeconds(event->time / 1000.).approximateWallTime(); }
+
+template<>
+WallTime wallTimeForEvent(const GdkEvent*);
+
 #if ENABLE(DEVELOPER_MODE)
 CString webkitBuildDirectory();
 #endif

Modified: trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp (222775 => 222776)


--- trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp	2017-10-03 09:50:06 UTC (rev 222776)
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "PlatformKeyboardEvent.h"
 
+#include "GtkUtilities.h"
 #include "GtkVersioning.h"
 #include "NotImplemented.h"
 #include "TextEncoding.h"
@@ -1259,7 +1260,7 @@
 
 // Keep this in sync with the other platform event constructors
 PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event, const CompositionResults& compositionResults)
-    : PlatformEvent(eventTypeForGdkKeyEvent(event), modifiersForGdkKeyEvent(event), WallTime::now())
+    : PlatformEvent(eventTypeForGdkKeyEvent(event), modifiersForGdkKeyEvent(event), wallTimeForEvent(event))
     , m_text(compositionResults.simpleString.length() ? compositionResults.simpleString : singleCharacterString(event->keyval))
     , m_unmodifiedText(m_text)
     , m_key(keyValueForGdkKeyCode(event->keyval))

Modified: trunk/Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp (222775 => 222776)


--- trunk/Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp	2017-10-03 09:50:06 UTC (rev 222776)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "PlatformMouseEvent.h"
 
+#include "GtkUtilities.h"
 #include "PlatformKeyboardEvent.h"
 #include <gdk/gdk.h>
 #include <wtf/Assertions.h>
@@ -38,7 +39,7 @@
 // Keep this in sync with the other platform event constructors
 PlatformMouseEvent::PlatformMouseEvent(GdkEventButton* event)
 {
-    m_timestamp = WallTime::fromRawSeconds(event->time);
+    m_timestamp = wallTimeForEvent(event);
     m_position = IntPoint((int)event->x, (int)event->y);
     m_globalPosition = IntPoint((int)event->x_root, (int)event->y_root);
     m_button = NoButton;
@@ -87,7 +88,7 @@
 
 PlatformMouseEvent::PlatformMouseEvent(GdkEventMotion* motion)
 {
-    m_timestamp = WallTime::fromRawSeconds(motion->time);
+    m_timestamp = wallTimeForEvent(motion);
     m_position = IntPoint((int)motion->x, (int)motion->y);
     m_globalPosition = IntPoint((int)motion->x_root, (int)motion->y_root);
     m_button = NoButton;

Modified: trunk/Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp (222775 => 222776)


--- trunk/Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp	2017-10-03 09:50:06 UTC (rev 222776)
@@ -29,6 +29,7 @@
 #include "PlatformWheelEvent.h"
 
 #include "FloatPoint.h"
+#include "GtkUtilities.h"
 #include "PlatformKeyboardEvent.h"
 #include "Scrollbar.h"
 #include <gdk/gdk.h>
@@ -43,7 +44,7 @@
     static const float delta = 1;
 
     m_type = PlatformEvent::Wheel;
-    m_timestamp = WallTime::now();
+    m_timestamp = wallTimeForEvent(event);
 
     if (event->state & GDK_SHIFT_MASK)
         m_modifiers |= Modifier::ShiftKey;

Modified: trunk/Source/WebKit/ChangeLog (222775 => 222776)


--- trunk/Source/WebKit/ChangeLog	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebKit/ChangeLog	2017-10-03 09:50:06 UTC (rev 222776)
@@ -1,3 +1,22 @@
+2017-10-03  Michael Catanzaro  <[email protected]>
+
+        REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
+        https://bugs.webkit.org/show_bug.cgi?id=177449
+
+        Reviewed by Chris Dumez.
+
+        * Shared/gtk/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebMouseEvent):
+        (WebKit::WebEventFactory::createWebWheelEvent):
+        (WebKit::WebEventFactory::createWebKeyboardEvent):
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * Shared/wpe/WebEventFactory.cpp:
+        (WebKit::wallTimeForEventTime):
+        (WebKit::WebEventFactory::createWebKeyboardEvent):
+        (WebKit::WebEventFactory::createWebMouseEvent):
+        (WebKit::WebEventFactory::createWebWheelEvent):
+        (WebKit::WebEventFactory::createWebTouchEvent):
+
 2017-10-03  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] WebProcess should run cleanup on quit to release resources

Modified: trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp (222775 => 222776)


--- trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebKit/Shared/gtk/WebEventFactory.cpp	2017-10-03 09:50:06 UTC (rev 222776)
@@ -31,6 +31,7 @@
 #include "PlatformKeyboardEvent.h"
 #include "Scrollbar.h"
 #include "WindowsKeyboardCodes.h"
+#include <WebCore/GtkUtilities.h>
 #include <WebCore/GtkVersioning.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkkeysyms.h>
@@ -132,15 +133,15 @@
     }
 
     return WebMouseEvent(type,
-                         buttonForEvent(event),
-                         IntPoint(x, y),
-                         IntPoint(xRoot, yRoot),
-                         0 /* deltaX */,
-                         0 /* deltaY */,
-                         0 /* deltaZ */,
-                         currentClickCount,
-                         modifiersForEvent(event),
-                         WallTime::fromRawSeconds(gdk_event_get_time(event)));
+        buttonForEvent(event),
+        IntPoint(x, y),
+        IntPoint(xRoot, yRoot),
+        0 /* deltaX */,
+        0 /* deltaY */,
+        0 /* deltaZ */,
+        currentClickCount,
+        modifiersForEvent(event),
+        wallTimeForEvent(event));
 }
 
 WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event)
@@ -210,7 +211,7 @@
         momentumPhase,
         WebWheelEvent::ScrollByPixelWheelEvent,
         modifiersForEvent(event),
-        WallTime::fromRawSeconds(gdk_event_get_time(event)));
+        wallTimeForEvent(event));
 }
 
 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event, const WebCore::CompositionResults& compositionResults, Vector<String>&& commands)
@@ -227,7 +228,7 @@
         WTFMove(commands),
         isGdkKeyCodeFromKeyPad(event->key.keyval),
         modifiersForEvent(event),
-        WallTime::fromRawSeconds(gdk_event_get_time(event)));
+        wallTimeForEvent(event));
 }
 
 #if ENABLE(TOUCH_EVENTS)
@@ -249,7 +250,7 @@
         ASSERT_NOT_REACHED();
     }
 
-    return WebTouchEvent(type, WTFMove(touchPoints), modifiersForEvent(event), WallTime::fromRawSeconds(gdk_event_get_time(event)));
+    return WebTouchEvent(type, WTFMove(touchPoints), modifiersForEvent(event), wallTimeForEvent(event));
 #else
     return WebTouchEvent();
 #endif // GTK_API_VERSION_2

Modified: trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp (222775 => 222776)


--- trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp	2017-10-03 09:43:47 UTC (rev 222775)
+++ trunk/Source/WebKit/Shared/wpe/WebEventFactory.cpp	2017-10-03 09:50:06 UTC (rev 222776)
@@ -72,6 +72,16 @@
     return String::format("U+%04X", event->unicode);
 }
 
+WallTime wallTimeForEventTime(uint64_t timestamp)
+{
+    // This works if and only if the WPE backend uses CLOCK_MONOTONIC for its
+    // event timestamps, and so long as g_get_monotonic_time() continues to do
+    // so as well, and so long as WTF::MonotonicTime continues to use
+    // g_get_monotonic_time(). It also assumes the event timestamp is in
+    // milliseconds.
+    return MonotonicTime::fromRawSeconds(timestamp / 1000.).approximateWallTime();
+}
+
 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(struct wpe_input_keyboard_event* event)
 {
     String singleCharacterString = singleCharacterStringForKeyEvent(event);
@@ -81,7 +91,7 @@
         singleCharacterString, singleCharacterString, identifierString,
         wpe_input_windows_key_code_for_key_event(wpe_input_key_mapper_get_singleton(), event),
         event->keyCode, 0, false, false, false,
-        modifiersForEvent(event), WallTime::fromRawSeconds(event->time));
+        modifiersForEvent(event), wallTimeForEventTime(event->time));
 }
 
 WebMouseEvent WebEventFactory::createWebMouseEvent(struct wpe_input_pointer_event* event, float deviceScaleFactor)
@@ -119,7 +129,7 @@
     WebCore::IntPoint position(event->x, event->y);
     position.scale(1 / deviceScaleFactor);
     return WebMouseEvent(type, button, position, position,
-        0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), WallTime::fromRawSeconds(event->time));
+        0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), wallTimeForEventTime(event->time));
 }
 
 WebWheelEvent WebEventFactory::createWebWheelEvent(struct wpe_input_axis_event* event, float deviceScaleFactor)
@@ -154,7 +164,7 @@
     WebCore::IntPoint position(event->x, event->y);
     position.scale(1 / deviceScaleFactor);
     return WebWheelEvent(WebEvent::Wheel, position, position,
-        delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, static_cast<WebEvent::Modifiers>(0), WallTime::fromRawSeconds(event->time));
+        delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, static_cast<WebEvent::Modifiers>(0), wallTimeForEventTime(event->time));
 }
 
 static WebKit::WebPlatformTouchPoint::TouchPointState stateForTouchPoint(int mainEventId, const struct wpe_input_touch_event_raw* point)
@@ -209,7 +219,7 @@
                 pointCoordinates, pointCoordinates));
     }
 
-    return WebTouchEvent(type, WTFMove(touchPoints), WebEvent::Modifiers(0), WallTime::fromRawSeconds(event->time));
+    return WebTouchEvent(type, WTFMove(touchPoints), WebEvent::Modifiers(0), wallTimeForEventTime(event->time));
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to