Changeset 245788 in webkit
- Timestamp:
- May 27, 2019 1:34:35 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245784 r245788 1 2019-05-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Touch support is reported even when the device doesn't have a touch screen 4 https://bugs.webkit.org/show_bug.cgi?id=139681 5 6 Reviewed by Michael Catanzaro. 7 8 Remove expectations for tests that are passing now. 9 10 * platform/gtk/TestExpectations: 11 1 12 2019-05-26 John Wilander <wilander@apple.com> 2 13 -
trunk/LayoutTests/platform/gtk/TestExpectations
r245623 r245788 821 821 webkit.org/b/141423 fast/css/getComputedStyle/computed-style-font.html [ Failure ] 822 822 823 #Pointer and hover media queries.824 webkit.org/b/141466 fast/media/mq-any-hover-matchMedia.html [ Failure ]825 webkit.org/b/141466 fast/media/mq-any-hover-styling.html [ Failure ]826 webkit.org/b/141466 fast/media/mq-any-pointer-matchMedia.html [ Failure ]827 webkit.org/b/141466 fast/media/mq-any-pointer-styling.html [ Failure ]828 webkit.org/b/141466 fast/media/mq-hover-matchMedia.html [ Failure ]829 webkit.org/b/141466 fast/media/mq-hover-styling.html [ Failure ]830 webkit.org/b/141466 fast/media/mq-pointer-matchMedia.html [ Failure ]831 webkit.org/b/141466 fast/media/mq-pointer-styling.html [ Failure ]832 webkit.org/b/141466 fast/media/mq-pointer.html [ Failure ]833 834 823 webkit.org/b/116259 http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html [ Failure ] 835 824 -
trunk/Source/WebCore/ChangeLog
r245787 r245788 1 2019-05-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Touch support is reported even when the device doesn't have a touch screen 4 https://bugs.webkit.org/show_bug.cgi?id=139681 5 6 Reviewed by Michael Catanzaro. 7 8 Add screenHasTouchDevice() and screenIsTouchPrimaryInputDevice() to PlatformScreen and use it to decide whether 9 to expose touch events functionality or not. 10 11 * bindings/js/WebCoreBuiltinNames.h: 12 * css/MediaQueryEvaluator.cpp: 13 (WebCore::hoverEvaluate): Use screenIsTouchPrimaryInputDevice() when touch events are enabled at build time. 14 (WebCore::anyHoverEvaluate): Use screenHasTouchDevice() when touch events are enabled at build time. 15 (WebCore::pointerEvaluate): Use screenIsTouchPrimaryInputDevice() when touch events are enabled at build time. 16 (WebCore::anyPointerEvaluate): Use screenHasTouchDevice() when touch events are enabled at build time. 17 * dom/GlobalEventHandlers.idl: Make touch event attributes enabled at runtime. 18 * page/RuntimeEnabledFeatures.cpp: 19 (WebCore::RuntimeEnabledFeatures::touchEventsEnabled const): Return whether touch events are enabled. 20 * page/RuntimeEnabledFeatures.h: 21 (WebCore::RuntimeEnabledFeatures::setTouchEventsEnabled): Force touch events to be enabled or disabled. 22 * platform/PlatformScreen.h: 23 (WebCore::screenHasTouchDevice): Just return true when touch events are enabled at build time for non-gtk ports. 24 (WebCore::screenIsTouchPrimaryInputDevice): Ditto. 25 * platform/gtk/PlatformScreenGtk.cpp: 26 (WebCore::screenHasTouchDevice): 27 (WebCore::screenIsTouchPrimaryInputDevice): 28 (WebCore::isTouchDevice): 29 (WebCore::deviceAddedCallback): 30 (WebCore::deviceRemovedCallback): 31 1 32 2019-05-26 Simon Fraser <simon.fraser@apple.com> 2 33 -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r244856 r245788 277 277 macro(mediaStreamTrackConstraints) \ 278 278 macro(openDatabase) \ 279 macro(ontouchcancel) \ 280 macro(ontouchend) \ 281 macro(ontouchmove) \ 282 macro(ontouchstart) \ 283 macro(ontouchforcechange) \ 279 284 macro(onvrdisplayactivate) \ 280 285 macro(onvrdisplayblur) \ -
trunk/Source/WebCore/css/MediaQueryEvaluator.cpp
r240892 r245788 694 694 if (!is<CSSPrimitiveValue>(value)) { 695 695 #if ENABLE(TOUCH_EVENTS) 696 return false;696 return !screenIsTouchPrimaryInputDevice(); 697 697 #else 698 698 return true; … … 702 702 auto keyword = downcast<CSSPrimitiveValue>(*value).valueID(); 703 703 #if ENABLE(TOUCH_EVENTS) 704 return keyword == CSSValueNone; 704 if (screenIsTouchPrimaryInputDevice()) 705 return keyword == CSSValueNone; 706 #endif 707 return keyword == CSSValueHover; 708 } 709 710 static bool anyHoverEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame&, MediaFeaturePrefix) 711 { 712 if (!is<CSSPrimitiveValue>(value)) { 713 #if ENABLE(TOUCH_EVENTS) 714 return !screenHasTouchDevice(); 705 715 #else 706 return keyword == CSSValueHover; 707 #endif 708 } 709 710 static bool anyHoverEvaluate(CSSValue* value, const CSSToLengthConversionData& cssToLengthConversionData, Frame& frame, MediaFeaturePrefix prefix) 711 { 712 return hoverEvaluate(value, cssToLengthConversionData, frame, prefix); 713 } 714 715 static bool pointerEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame&, MediaFeaturePrefix) 716 { 717 if (!is<CSSPrimitiveValue>(value)) 718 return true; 716 return true; 717 #endif 718 } 719 719 720 720 auto keyword = downcast<CSSPrimitiveValue>(*value).valueID(); 721 721 #if ENABLE(TOUCH_EVENTS) 722 return keyword == CSSValueCoarse; 723 #else 722 if (screenHasTouchDevice()) 723 return keyword == CSSValueNone; 724 #endif 725 return keyword == CSSValueHover; 726 } 727 728 static bool pointerEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame&, MediaFeaturePrefix) 729 { 730 if (!is<CSSPrimitiveValue>(value)) 731 return true; 732 733 auto keyword = downcast<CSSPrimitiveValue>(*value).valueID(); 734 #if ENABLE(TOUCH_EVENTS) 735 if (screenIsTouchPrimaryInputDevice()) 736 return keyword == CSSValueCoarse; 737 #endif 724 738 return keyword == CSSValueFine; 725 #endif 726 } 727 728 static bool anyPointerEvaluate(CSSValue* value, const CSSToLengthConversionData& cssToLengthConversionData, Frame& frame, MediaFeaturePrefix prefix) 729 { 730 return pointerEvaluate(value, cssToLengthConversionData, frame, prefix); 739 } 740 741 static bool anyPointerEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame&, MediaFeaturePrefix) 742 { 743 if (!is<CSSPrimitiveValue>(value)) 744 return true; 745 746 auto keyword = downcast<CSSPrimitiveValue>(*value).valueID(); 747 #if ENABLE(TOUCH_EVENTS) 748 if (screenHasTouchDevice()) 749 return keyword == CSSValueCoarse; 750 #endif 751 return keyword == CSSValueFine; 731 752 } 732 753 -
trunk/Source/WebCore/dom/GlobalEventHandlers.idl
r244421 r245788 124 124 [NotEnumerable] attribute EventHandler onsearch; 125 125 [NotEnumerable] attribute EventHandler onwheel; 126 [NotEnumerable, Conditional=TOUCH_EVENTS ] attribute EventHandler ontouchcancel;127 [NotEnumerable, Conditional=TOUCH_EVENTS ] attribute EventHandler ontouchend;128 [NotEnumerable, Conditional=TOUCH_EVENTS ] attribute EventHandler ontouchmove;129 [NotEnumerable, Conditional=TOUCH_EVENTS ] attribute EventHandler ontouchstart;130 [NotEnumerable, Conditional=TOUCH_EVENTS ] attribute EventHandler ontouchforcechange;126 [NotEnumerable, Conditional=TOUCH_EVENTS, EnabledAtRuntime=TouchEvents] attribute EventHandler ontouchcancel; 127 [NotEnumerable, Conditional=TOUCH_EVENTS, EnabledAtRuntime=TouchEvents] attribute EventHandler ontouchend; 128 [NotEnumerable, Conditional=TOUCH_EVENTS, EnabledAtRuntime=TouchEvents] attribute EventHandler ontouchmove; 129 [NotEnumerable, Conditional=TOUCH_EVENTS, EnabledAtRuntime=TouchEvents] attribute EventHandler ontouchstart; 130 [NotEnumerable, Conditional=TOUCH_EVENTS, EnabledAtRuntime=TouchEvents] attribute EventHandler ontouchforcechange; 131 131 [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcechanged; 132 132 [NotEnumerable, Conditional=MOUSE_FORCE_EVENTS] attribute EventHandler onwebkitmouseforcedown; -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp
r237262 r245788 34 34 35 35 #include "MediaPlayer.h" 36 #include "PlatformScreen.h" 36 37 #include <JavaScriptCore/Options.h> 37 38 #include <wtf/NeverDestroyed.h> … … 64 65 } 65 66 67 #if ENABLE(TOUCH_EVENTS) 68 bool RuntimeEnabledFeatures::touchEventsEnabled() const 69 { 70 return m_touchEventsEnabled.valueOr(screenHasTouchDevice()); 71 } 72 #endif 73 66 74 } // namespace WebCore -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.h
r245491 r245788 348 348 bool mouseEventsSimulationEnabled() const { return m_mouseEventsSimulationEnabled; } 349 349 void setMouseEventsSimulationEnabled(bool isEnabled) { m_mouseEventsSimulationEnabled = isEnabled; } 350 bool touchEventsEnabled() const; 351 void setTouchEventsEnabled(bool isEnabled) { m_touchEventsEnabled = isEnabled; } 350 352 #endif 351 353 … … 532 534 #if ENABLE(TOUCH_EVENTS) 533 535 bool m_mouseEventsSimulationEnabled { false }; 536 Optional<bool> m_touchEventsEnabled; 534 537 #endif 535 538 -
trunk/Source/WebCore/platform/PlatformScreen.h
r237266 r245788 123 123 #endif 124 124 125 #if ENABLE(TOUCH_EVENTS) 126 #if PLATFORM(GTK) || PLATFORM(WPE) 127 bool screenHasTouchDevice(); 128 bool screenIsTouchPrimaryInputDevice(); 129 #else 130 bool screenHasTouchDevice() { return true; } 131 bool screenIsTouchPrimaryInputDevice() { return true; } 132 #endif 133 #endif 134 125 135 } // namespace WebCore -
trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
r224872 r245788 42 42 #include <gtk/gtk.h> 43 43 #include <wtf/HashMap.h> 44 #include <wtf/HashSet.h> 44 45 #include <wtf/NeverDestroyed.h> 46 #include <wtf/glib/GUniquePtr.h> 45 47 46 48 namespace WebCore { … … 196 198 } 197 199 200 #if ENABLE(TOUCH_EVENTS) 201 #ifdef GTK_API_VERSION_2 202 bool screenHasTouchDevice() 203 { 204 return false; 205 } 206 207 bool screenIsTouchPrimaryInputDevice() 208 { 209 return false; 210 } 211 #else // GTK_API_VERSION_2 212 #if !GTK_CHECK_VERSION(3, 20, 0) 213 static void deviceAddedCallback(GdkDeviceManager*, GdkDevice*); 214 static void deviceRemovedCallback(GdkDeviceManager*, GdkDevice*); 215 216 static HashSet<GdkDevice*>& touchDevices() 217 { 218 static LazyNeverDestroyed<HashSet<GdkDevice*>> touchDeviceSet; 219 static std::once_flag onceKey; 220 std::call_once(onceKey, [] { 221 touchDeviceSet.construct(); 222 223 auto* display = gdk_display_get_default(); 224 if (!display) 225 return; 226 227 auto* deviceManager = gdk_display_get_device_manager(display); 228 if (!deviceManager) 229 return; 230 231 GUniquePtr<GList> devices(gdk_device_manager_list_devices(deviceManager, GDK_DEVICE_TYPE_SLAVE)); 232 for (GList* it = devices.get(); it; it = g_list_next(it)) { 233 auto* device = GDK_DEVICE(it->data); 234 if (gdk_device_get_source(device) == GDK_SOURCE_TOUCHSCREEN) 235 touchDeviceSet->add(device); 236 } 237 238 g_signal_connect(deviceManager, "device-added", G_CALLBACK(deviceAddedCallback), nullptr); 239 g_signal_connect(deviceManager, "device-removed", G_CALLBACK(deviceRemovedCallback), nullptr); 240 }); 241 242 return touchDeviceSet; 243 } 244 245 static inline bool isTouchDevice(GdkDevice* device) 246 { 247 return gdk_device_get_device_type(device) == GDK_DEVICE_TYPE_SLAVE && gdk_device_get_source(device) == GDK_SOURCE_TOUCHSCREEN; 248 } 249 250 static void deviceAddedCallback(GdkDeviceManager*, GdkDevice* device) 251 { 252 if (!isTouchDevice(device)) 253 return; 254 255 ASSERT(!touchDevices().contains(device)); 256 touchDevices().add(device); 257 } 258 259 static void deviceRemovedCallback(GdkDeviceManager*, GdkDevice* device) 260 { 261 if (!isTouchDevice(device)) 262 return; 263 264 ASSERT(touchDevices().contains(device)); 265 touchDevices().remove(device); 266 } 267 #endif // !GTK_CHECK_VERSION(3, 20, 0) 268 269 bool screenHasTouchDevice() 270 { 271 #if GTK_CHECK_VERSION(3, 20, 0) 272 auto* display = gdk_display_get_default(); 273 if (!display) 274 return true; 275 276 auto* seat = gdk_display_get_default_seat(display); 277 return seat ? gdk_seat_get_capabilities(seat) & GDK_SEAT_CAPABILITY_TOUCH : true; 278 #else 279 return !touchDevices().isEmpty(); 280 #endif 281 } 282 283 bool screenIsTouchPrimaryInputDevice() 284 { 285 auto* display = gdk_display_get_default(); 286 if (!display) 287 return true; 288 289 #if GTK_CHECK_VERSION(3, 20, 0) 290 auto* seat = gdk_display_get_default_seat(display); 291 if (!seat) 292 return true; 293 294 auto* device = gdk_seat_get_pointer(seat); 295 #else 296 auto* deviceManager = gdk_display_get_device_manager(display); 297 if (!deviceManager) 298 return true; 299 300 auto* device = gdk_device_manager_get_client_pointer(deviceManager); 301 #endif 302 303 return device ? gdk_device_get_source(device) == GDK_SOURCE_TOUCHSCREEN : true; 304 } 305 #endif // !GTK_API_VERSION_2 306 #endif // ENABLE(TOUCH_EVENTS) 307 198 308 } // namespace WebCore -
trunk/Source/WebCore/platform/wpe/PlatformScreenWPE.cpp
r239670 r245788 87 87 } 88 88 89 #if ENABLE(TOUCH_EVENTS) 90 bool screenHasTouchDevice() 91 { 92 return true; 93 } 94 95 bool screenIsTouchPrimaryInputDevice() 96 { 97 return true; 98 } 99 #endif 100 89 101 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.