Title: [241125] trunk/Source/WebKit
Revision
241125
Author
[email protected]
Date
2019-02-07 10:24:42 -0800 (Thu, 07 Feb 2019)

Log Message

Digital crown should scroll safe browsing warning on watchOS
https://bugs.webkit.org/show_bug.cgi?id=194363
<rdar://problem/47348124>

Reviewed by Wenson Hsieh.

* UIProcess/Cocoa/WKSafeBrowsingWarning.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
(-[WKSafeBrowsingWarning addContent]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241124 => 241125)


--- trunk/Source/WebKit/ChangeLog	2019-02-07 18:22:12 UTC (rev 241124)
+++ trunk/Source/WebKit/ChangeLog	2019-02-07 18:24:42 UTC (rev 241125)
@@ -1,5 +1,18 @@
 2019-02-07  Alex Christensen  <[email protected]>
 
+        Digital crown should scroll safe browsing warning on watchOS
+        https://bugs.webkit.org/show_bug.cgi?id=194363
+        <rdar://problem/47348124>
+
+        Reviewed by Wenson Hsieh.
+
+        * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
+        * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
+        (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
+        (-[WKSafeBrowsingWarning addContent]):
+
+2019-02-07  Alex Christensen  <[email protected]>
+
         Shrink and hyphenate safe browsing warning text on watchOS
         https://bugs.webkit.org/show_bug.cgi?id=194361
         <rdar://problem/47466549>

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h (241124 => 241125)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h	2019-02-07 18:22:12 UTC (rev 241124)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h	2019-02-07 18:24:42 UTC (rev 241125)
@@ -57,6 +57,9 @@
     RefPtr<const WebKit::SafeBrowsingWarning> _warning;
     WeakObjCPtr<WKSafeBrowsingTextView> _details;
     WeakObjCPtr<ViewType> _box;
+#if PLATFORM(WATCHOS)
+    WeakObjCPtr<UIResponder> _previousFirstResponder;
+#endif
 }
 
 - (instancetype)initWithFrame:(RectType)frame safeBrowsingWarning:(const WebKit::SafeBrowsingWarning&)warning completionHandler:(CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, URL>&&)>&&)completionHandler;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (241124 => 241125)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm	2019-02-07 18:22:12 UTC (rev 241124)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm	2019-02-07 18:24:42 UTC (rev 241125)
@@ -33,6 +33,11 @@
 #import <wtf/BlockPtr.h>
 #import <wtf/Language.h>
 
+#if PLATFORM(WATCHOS)
+#import "UIKitSPI.h"
+#import <PepperUICore/UIScrollView+PUICAdditionsPrivate.h>
+#endif
+
 constexpr CGFloat exclamationPointSize = 30;
 constexpr CGFloat boxCornerRadius = 6;
 #if HAVE(SAFE_BROWSING)
@@ -274,12 +279,22 @@
         completionHandler(WebKit::ContinueUnsafeLoad::Yes);
         return nil;
     }
-    _completionHandler = WTFMove(completionHandler);
+    _completionHandler = [weakSelf = WeakObjCPtr<WKSafeBrowsingWarning>(self), completionHandler = WTFMove(completionHandler)] (Variant<WebKit::ContinueUnsafeLoad, URL>&& result) mutable {
+#if PLATFORM(WATCHOS)
+        if (auto strongSelf = weakSelf.get())
+            [strongSelf.get()->_previousFirstResponder becomeFirstResponder];
+#endif
+        completionHandler(WTFMove(result));
+    };
     _warning = makeRef(warning);
     setBackground(self, colorForItem(WarningItem::Background, self));
 #if PLATFORM(MAC)
     [self addContent];
 #endif
+
+#if PLATFORM(WATCHOS)
+    self.crownInputScrollDirection = PUICCrownInputScrollDirectionVertical;
+#endif
     return self;
 }
 
@@ -368,6 +383,11 @@
     [self updateContentSize];
 #endif
 #endif
+    
+#if PLATFORM(WATCHOS)
+    self->_previousFirstResponder = [self firstResponder];
+    [self becomeFirstResponder];
+#endif
 }
 
 - (void)showDetailsClicked
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to