Move off of internal SDK, copy webkit spis from opensource
This commit is contained in:
@@ -779,11 +779,7 @@ extension BrowserViewController: UITextFieldDelegate
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
override func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
func textFieldDidEndEditing(_ textField: UITextField) {
|
||||
if !changingFocusToAutocompleteController {
|
||||
autocompleteViewController.view.isHidden = true
|
||||
|
||||
@@ -103,9 +103,16 @@ class DocumentControlItemView: UIControl
|
||||
separatorView.isHidden = !drawsBottomSeparator
|
||||
}
|
||||
|
||||
override func setTracking(_ tracking: Bool) {
|
||||
super.setTracking(tracking)
|
||||
highlightView.isHidden = !tracking
|
||||
override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
super.beginTracking(touch, with: event)
|
||||
highlightView.isHidden = false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
super.endTracking(touch, with: event)
|
||||
highlightView.isHidden = true
|
||||
}
|
||||
|
||||
public func title(_ title: String) -> Self {
|
||||
|
||||
@@ -41,7 +41,7 @@ class FindOnPageViewController: UIViewController, _WKFindDelegate
|
||||
|
||||
findOnPageView.textField.addAction(UIAction(handler: { [unowned self] _ in
|
||||
self.findString = findOnPageView.textField.text
|
||||
webView?._find(self.findString, options: self.findOptions, maxCount: Int(self.maxCount))
|
||||
webView?._find(self.findString, options: self.findOptions, maxCount: UInt(self.maxCount))
|
||||
}), for: .editingChanged)
|
||||
|
||||
findOnPageView.prevResultButton.addAction(UIAction(handler: { [unowned self] _ in
|
||||
@@ -82,24 +82,20 @@ class FindOnPageViewController: UIViewController, _WKFindDelegate
|
||||
|
||||
@objc
|
||||
override func findNext(_ sender: Any?) {
|
||||
webView?._find(self.findString, options: self.findOptions, maxCount: Int(self.maxCount))
|
||||
webView?._find(self.findString, options: self.findOptions, maxCount: UInt(self.maxCount))
|
||||
}
|
||||
|
||||
@objc
|
||||
override func findPrevious(_ sender: Any?) {
|
||||
let options: _WKFindOptions = self.findOptions.union(.backwards)
|
||||
webView?._find(self.findString, options: options, maxCount: Int(self.maxCount))
|
||||
webView?._find(self.findString, options: options, maxCount: UInt(self.maxCount))
|
||||
}
|
||||
|
||||
func _webView(_ webView: WKWebView!, didFailToFind string: String!) {
|
||||
// ??
|
||||
}
|
||||
|
||||
private func _webView(_ webView: WKWebView!, didCountMatches matches: UInt, for string: String!) {
|
||||
// TODO: Update a label
|
||||
}
|
||||
|
||||
private func _webView(_ webView: WKWebView!, didFindMatches matches: UInt, for string: String!, withMatch matchIndex: Int) {
|
||||
|
||||
internal func _webView(_ webView: WKWebView!, didFindMatches matches: UInt, for string: String!, withMatch matchIndex: Int) {
|
||||
findOnPageView.nextResultButton.isEnabled = matches > 0
|
||||
findOnPageView.prevResultButton.isEnabled = matches > 0
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import UIKit_Private.UIKeyCommand_Private
|
||||
|
||||
@objc
|
||||
protocol ShortcutResponder: AnyObject {
|
||||
@@ -170,14 +169,14 @@ public class KeyboardShortcuts {
|
||||
modifiers: [.alternate], input: "x",
|
||||
title: "Raise Script Policy Restriction",
|
||||
action: #selector(ShortcutResponder.raiseScriptPolicyRestriction)
|
||||
)._nonRepeatable(),
|
||||
),
|
||||
|
||||
// Lower Script Policy Restriction
|
||||
UIKeyCommand(
|
||||
modifiers: [.alternate], input: "c",
|
||||
title: "Lower Script Policy Restriction",
|
||||
action: #selector(ShortcutResponder.lowerScriptPolicyRestriction)
|
||||
)._nonRepeatable(),
|
||||
),
|
||||
])
|
||||
].removeNulls()
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#import "SBRProcessBundleBridge.h"
|
||||
#import "SBRScriptPolicy.h"
|
||||
|
||||
#import "WebKitDefines.h"
|
||||
|
||||
// SPI
|
||||
#import <UIKit/UITextField_Private.h>
|
||||
#import <WebKit/WKWebViewPrivate.h>
|
||||
#import <WebKit/_WKFindDelegate.h>
|
||||
|
||||
|
||||
19
App/Supporting Files/WebKitDefines.h
Normal file
19
App/Supporting Files/WebKitDefines.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// WebKitDefines.h
|
||||
// SBrowser
|
||||
//
|
||||
// Created by James Magahern on 4/11/25.
|
||||
//
|
||||
|
||||
#ifndef WebKitDefines_h
|
||||
#define WebKitDefines_h
|
||||
|
||||
#define WK_API_AVAILABLE(...)
|
||||
#define WK_API_UNAVAILABLE(...)
|
||||
#define WK_CLASS_AVAILABLE(...) __attribute__((visibility("default"))) WK_API_AVAILABLE(__VA_ARGS__)
|
||||
#define WK_API_DEPRECATED(_message, ...) __attribute__((deprecated(_message)))
|
||||
#define WK_API_DEPRECATED_WITH_REPLACEMENT(_replacement, ...) __attribute__((deprecated("use " #_replacement)))
|
||||
#define WK_CLASS_DEPRECATED_WITH_REPLACEMENT(_replacement, ...) __attribute__((visibility("default"))) __attribute__((deprecated("use " #_replacement)))
|
||||
|
||||
|
||||
#endif /* WebKitDefines_h */
|
||||
@@ -6,7 +6,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import QuartzCore_Private
|
||||
|
||||
class SecurityIndicatorView: UIView
|
||||
{
|
||||
@@ -70,7 +69,7 @@ class TitlebarView: UIView
|
||||
addSubview(separatorView)
|
||||
|
||||
separatorView.backgroundColor = UIColor(white: 1.0, alpha: 0.20)
|
||||
separatorView.layer.compositingFilter = kCAFilterPlusL
|
||||
separatorView.layer.compositingFilter = "kCAFilterPlusL"
|
||||
|
||||
titleLabelView.textColor = .white
|
||||
titleLabelView.layer.shadowColor = UIColor.black.cgColor
|
||||
|
||||
@@ -183,7 +183,7 @@ class URLBar: ReliefButton
|
||||
|
||||
controlsView.autoresizingMask = []
|
||||
controlsView.clearButton.addAction(.init(handler: { [textField] _ in
|
||||
textField.clearText()
|
||||
textField.text = ""
|
||||
}), for: .primaryActionTriggered)
|
||||
|
||||
controlsView.autocorrectButton.addAction(.init(handler: { [unowned self] _ in
|
||||
|
||||
@@ -33,14 +33,14 @@ extension CGRect
|
||||
|
||||
public func centeredY(inRect: CGRect) -> CGRect {
|
||||
var rect = self
|
||||
rect.origin.y = CGRound(inRect.origin.y + (inRect.height - rect.height) / 2.0)
|
||||
rect.origin.y = (inRect.origin.y + (inRect.height - rect.height) / 2.0).rounded()
|
||||
|
||||
return rect
|
||||
}
|
||||
|
||||
public func centeredX(inRect: CGRect) -> CGRect {
|
||||
var rect = self
|
||||
rect.origin.x = CGRound(inRect.origin.x + (inRect.width - rect.width) / 2.0)
|
||||
rect.origin.x = (inRect.origin.x + (inRect.width - rect.width) / 2.0).rounded()
|
||||
|
||||
return rect
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user