[Libreoffice-commits] online.git: 2 commits - ios/Mobile loleaflet/src

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 11 14:38:19 UTC 2019


 ios/Mobile/DocumentViewController.mm     |   11 ++++++++++-
 loleaflet/src/layer/AnnotationManager.js |    8 ++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 07b6d7ee5e4ac9562e976ac652c20501d336e447
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Jun 11 17:02:57 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Jun 11 17:33:54 2019 +0300

    Avoid unhandled exception
    
    Change-Id: I2a168a79f334ca5048a85f98350aaa5c08bd1ad8

diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index eba39f4ef..2217f1db1 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -818,6 +818,14 @@ L.AnnotationManager = L.Class.extend({
 			};
 		}
 
+		// What if this._initialLayoutData is still undefined when we get here? (I.e. if
+		// contentWrapperClass.length == 0.) No idea. Using
+		// this._initialLayoutData.menuWidth below will lead to an unhandled exception.
+		// Maybe best to just return then? Somebody who understands the code could fix this
+		// better, perhaps.
+		if (this._initialLayoutData === undefined)
+			return;
+
 		var menuClass = $('.loleaflet-annotation-menu');
 		if ((this._initialLayoutData.menuWidth === undefined) && menuClass.length > 0) {
 			this._initialLayoutData.menuWidth = parseInt(menuClass.css('width'));
commit d1087aec26c60a0b5a5c6c998d1634d5dbff5910
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Jun 11 17:18:39 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Jun 11 17:33:48 2019 +0300

    Prevent the user from zooming the WebView
    
    Does not fix tdf#125383, though. The WebView still can become zoomed
    by manipulating a tunnelled dialog as described in the bug report's
    comments.
    
    Change-Id: I9af8d826c58e2065e54b42bc35f74436b0d34a90

diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm
index dc61ef23c..6f1891b35 100644
--- a/ios/Mobile/DocumentViewController.mm
+++ b/ios/Mobile/DocumentViewController.mm
@@ -22,7 +22,7 @@
 
 #import "DocumentViewController.h"
 
- at interface DocumentViewController() <WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler> {
+ at interface DocumentViewController() <WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler, UIScrollViewDelegate> {
     int closeNotificationPipeForForwardingThread[2];
 }
 
@@ -49,6 +49,11 @@
     // so the problem is still there when using Online from Mobile Safari.
     self.webView.scrollView.scrollEnabled = NO;
 
+    // Prevent the user from zooming the WebView by assigning ourselves as the delegate, and
+    // stopping any zoom attempt in scrollViewWillBeginZooming: below. (The zooming of the document
+    // contents is handled fully in JavaScript, the WebView has no knowledge of that.)
+    self.webView.scrollView.delegate = self;
+
     [self.view addSubview:self.webView];
 
     self.webView.navigationDelegate = self;
@@ -354,6 +359,10 @@
     }
 }
 
+- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view {
+    scrollView.pinchGestureRecognizer.enabled = NO;
+}
+
 @end
 
 // vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list