Allow WebKit clients to specify a minimum effective width for layout.
[WebKit-https.git] / Tools / TestRunnerShared / UIScriptContext / UIScriptController.cpp
index 9ace202..e2d0535 100644 (file)
 #include "JSUIScriptController.h"
 #include "UIScriptContext.h"
 #include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/OpaqueJSString.h>
 
 namespace WTR {
 
+DeviceOrientation* toDeviceOrientation(JSContextRef context, JSValueRef value)
+{
+    static DeviceOrientation values[] = {
+        DeviceOrientation::Portrait,
+        DeviceOrientation::PortraitUpsideDown,
+        DeviceOrientation::LandscapeLeft,
+        DeviceOrientation::LandscapeRight
+    };
+
+    auto option = adopt(JSValueToStringCopy(context, value, nullptr));
+    if (option.get()->string() == "portrait")
+        return &values[0];
+        
+    if (option.get()->string() == "portrait-upsidedown")
+        return &values[1];
+        
+    if (option.get()->string() == "landscape-left")
+        return &values[2];
+        
+    if (option.get()->string() == "landscape-right")
+        return &values[3];
+        
+    return nullptr;
+}
+
 UIScriptController::UIScriptController(UIScriptContext& context)
     : m_context(&context)
 {
 }
 
+#if !PLATFORM(IOS_FAMILY)
+void UIScriptController::checkForOutstandingCallbacks()
+{
+}
+#endif
+
 void UIScriptController::contextDestroyed()
 {
     m_context = nullptr;
@@ -64,6 +96,14 @@ void simulateAccessibilitySettingsChangeNotification(JSValueRef)
 void UIScriptController::doAfterPresentationUpdate(JSValueRef)
 {
 }
+
+void UIScriptController::doAfterNextStablePresentationUpdate(JSValueRef)
+{
+}
+
+void UIScriptController::doAfterVisibleContentRectUpdate(JSValueRef)
+{
+}
 #endif
 
 void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback)
@@ -166,10 +206,23 @@ JSValueRef UIScriptController::didHideKeyboardCallback() const
 }
 
 #if !PLATFORM(COCOA)
+
 void UIScriptController::zoomToScale(double, JSValueRef)
 {
 }
 
+void UIScriptController::setViewScale(double)
+{
+}
+
+void UIScriptController::setMinimumEffectiveWidth(double)
+{
+}
+
+void UIScriptController::resignFirstResponder()
+{
+}
+
 void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef)
 {
 }
@@ -178,9 +231,28 @@ JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfac
 {
     return nullptr;
 }
-#endif
+    
+void UIScriptController::setDefaultCalendarType(JSStringRef calendarIdentifier)
+{
+}
+
+JSObjectRef UIScriptController::calendarType() const
+{
+    return nullptr;
+}
+
+void UIScriptController::toggleCapsLock(JSValueRef)
+{
+}
+
+#endif // !PLATFORM(COCOA)
+
+void UIScriptController::playBackEventStream(JSStringRef stream, JSValueRef callback)
+{
+    platformPlayBackEventStream(stream, callback);
+}
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
 void UIScriptController::touchDownAtPoint(long x, long y, long touchCount, JSValueRef)
 {
 }
@@ -225,32 +297,43 @@ void UIScriptController::sendEventStream(JSStringRef eventsJSON, JSValueRef call
 {
 }
 
+void UIScriptController::enterText(JSStringRef)
+{
+}
+
 void UIScriptController::typeCharacterUsingHardwareKeyboard(JSStringRef, JSValueRef)
 {
 }
 
-void UIScriptController::keyUpUsingHardwareKeyboard(JSStringRef, JSValueRef)
+void UIScriptController::keyDown(JSStringRef, JSValueRef)
 {
 }
 
-void UIScriptController::selectTextCandidateAtIndex(long, JSValueRef)
+void UIScriptController::dismissFormAccessoryView()
 {
 }
 
-void UIScriptController::waitForTextPredictionsViewAndSelectCandidateAtIndex(long, unsigned, float)
+void UIScriptController::setTimePickerValue(long, long)
 {
 }
 
-void UIScriptController::keyDownUsingHardwareKeyboard(JSStringRef, JSValueRef)
+void UIScriptController::selectFormAccessoryPickerRow(long)
 {
 }
 
-void UIScriptController::dismissFormAccessoryView()
+JSRetainPtr<JSStringRef> UIScriptController::textContentType() const
 {
+    return nullptr;
 }
 
-void UIScriptController::selectFormAccessoryPickerRow(long)
+JSRetainPtr<JSStringRef> UIScriptController::selectFormPopoverTitle() const
 {
+    return nullptr;
+}
+
+JSRetainPtr<JSStringRef> UIScriptController::formInputLabel() const
+{
+    return nullptr;
 }
 
 void UIScriptController::scrollToOffset(long x, long y)
@@ -273,6 +356,15 @@ void UIScriptController::keyboardAccessoryBarPrevious()
 {
 }
 
+void UIScriptController::applyAutocorrection(JSStringRef, JSStringRef, JSValueRef)
+{
+}
+
+bool UIScriptController::isShowingKeyboard() const
+{
+    return false;
+}
+
 double UIScriptController::zoomScale() const
 {
     return 1;
@@ -288,12 +380,12 @@ double UIScriptController::maximumZoomScale() const
     return 1;
 }
 
-Optional<bool> UIScriptController::stableStateOverride() const
+std::optional<bool> UIScriptController::stableStateOverride() const
 {
-    return Nullopt;
+    return std::nullopt;
 }
 
-void UIScriptController::setStableStateOverride(Optional<bool>)
+void UIScriptController::setStableStateOverride(std::optional<bool>)
 {
 }
 
@@ -302,11 +394,41 @@ JSObjectRef UIScriptController::contentVisibleRect() const
     return nullptr;
 }
 
+JSObjectRef UIScriptController::textSelectionRangeRects() const
+{
+    return nullptr;
+}
+
+JSObjectRef UIScriptController::textSelectionCaretRect() const
+{
+    return nullptr;
+}
+
+JSObjectRef UIScriptController::selectionStartGrabberViewRect() const
+{
+    return nullptr;
+}
+
+JSObjectRef UIScriptController::selectionCaretViewRect() const
+{
+    return nullptr;
+}
+
 JSObjectRef UIScriptController::selectionRangeViewRects() const
 {
     return nullptr;
 }
 
+JSObjectRef UIScriptController::selectionEndGrabberViewRect() const
+{
+    return nullptr;
+}
+
+JSObjectRef UIScriptController::inputViewBounds() const
+{
+    return nullptr;
+}
+
 void UIScriptController::removeAllDynamicDictionaries()
 {
 }
@@ -316,6 +438,11 @@ JSRetainPtr<JSStringRef> UIScriptController::scrollingTreeAsText() const
     return nullptr;
 }
 
+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return nullptr;
+}
+
 void UIScriptController::platformSetDidStartFormControlInteractionCallback()
 {
 }
@@ -355,12 +482,102 @@ void UIScriptController::platformSetDidHideKeyboardCallback()
 void UIScriptController::platformClearAllCallbacks()
 {
 }
+
+void UIScriptController::retrieveSpeakSelectionContent(JSValueRef)
+{
+}
+
+JSRetainPtr<JSStringRef> UIScriptController::accessibilitySpeakSelectionContent() const
+{
+    return nullptr;
+}
+
+void UIScriptController::setSafeAreaInsets(double top, double right, double bottom, double left)
+{
+}
+
+void UIScriptController::drawSquareInEditableImage()
+{
+}
+
+long UIScriptController::numberOfStrokesInEditableImage()
+{
+    return 0;
+}
+
+JSObjectRef UIScriptController::attachmentInfo(JSStringRef)
+{
+    return nullptr;
+}
+
 #endif
 
+#if !PLATFORM(COCOA)
+
+void UIScriptController::simulateRotation(DeviceOrientation*, JSValueRef callback)
+{
+}
+
+void UIScriptController::simulateRotationLikeSafari(DeviceOrientation*, JSValueRef callback)
+{
+}
+
+void UIScriptController::findString(JSStringRef, unsigned long options, unsigned long maxCount)
+{
+}
+
+void UIScriptController::removeViewFromWindow(JSValueRef)
+{
+}
+
+void UIScriptController::addViewToWindow(JSValueRef)
+{
+}
+
+void UIScriptController::beginBackSwipe(JSValueRef callback)
+{
+}
+
+void UIScriptController::completeBackSwipe(JSValueRef callback)
+{
+}
+
+void UIScriptController::setShareSheetCompletesImmediatelyWithResolution(bool)
+{
+}
+
+bool UIScriptController::isShowingDataListSuggestions() const
+{
+    return false;
+}
+
+void UIScriptController::overridePreference(JSStringRef, JSStringRef)
+{
+}
+
+#endif // !PLATFORM(COCOA)
+
 #if !PLATFORM(MAC)
 
-void UIScriptController::insertText(JSStringRef, int, int)
+void UIScriptController::replaceTextAtRange(JSStringRef, int, int)
+{
+}
+
+void UIScriptController::platformPlayBackEventStream(JSStringRef, JSValueRef)
+{
+}
+
+void UIScriptController::firstResponderSuppressionForWebView(bool)
+{
+}
+
+void UIScriptController::makeWindowContentViewFirstResponder()
+{
+}
+
+bool UIScriptController::isWindowContentViewFirstResponder() const
 {
+    return false;
 }
 
 #endif