@@ -140,6 +140,26 @@ - (void)windowWillClose:(NSNotification *)notification
140
140
return ;
141
141
}
142
142
143
+ // Font size delegates for menu items
144
+
145
+ #if defined(MAC_OS_VERSION_11_0) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
146
+ - (IBAction )fontSizeUp:(id )sender
147
+ {
148
+ if (@available (macos 11.0 , *)) {
149
+ CGFloat pageZoom = _webView.pageZoom + 0.25 ;
150
+ _webView.pageZoom = pageZoom > 3.0 ? 3.0 : pageZoom;
151
+ }
152
+ }
153
+
154
+ - (IBAction )fontSizeDown:(id )sender
155
+ {
156
+ if (@available (macos 11.0 , *)) {
157
+ CGFloat pageZoom = _webView.pageZoom - 0.25 ;
158
+ _webView.pageZoom = pageZoom < 0.25 ? 0.25 : pageZoom;
159
+ }
160
+ }
161
+ #endif
162
+
143
163
// WKNavigationDelegate methods
144
164
145
165
// / Tells web view how to handle links and navigation. Current behavior is
@@ -149,14 +169,21 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
149
169
NSURLRequest *request = navigationAction.request ;
150
170
NSURL *requestURL = request.URL ;
151
171
152
- if ([requestURL isEqual: _whatsNewURL]) {
172
+ if ([requestURL.scheme isEqual: _whatsNewURL.scheme] &&
173
+ [requestURL.host isEqual: _whatsNewURL.host] &&
174
+ [requestURL.port isEqual: _whatsNewURL.port] &&
175
+ [requestURL.path isEqual: _whatsNewURL.path] &&
176
+ [requestURL.query isEqual: _whatsNewURL.query])
177
+ {
178
+ // Only allow if everything except for fragment is the same (which
179
+ // we allow so that table of contents anchor links would work).
153
180
decisionHandler (WKNavigationActionPolicyAllow );
154
181
}
155
182
else {
156
183
// We want to open any links in the release notes with a browser instead.
157
184
decisionHandler (WKNavigationActionPolicyCancel );
158
185
159
- if ([request.URL .scheme isEqualToString: @" https" ]) {
186
+ if ([requestURL .scheme isEqualToString: @" https" ]) {
160
187
// Just try to be sane and only open https:// urls. There should be
161
188
// no reason why the release notes should contain other schemes and it
162
189
// would be an indication something is wrong or malicious (e.g. file:
0 commit comments