diff --git a/interface/resources/qml/controls/WebView.qml b/interface/resources/qml/controls/WebView.qml index 2013de4ef9..91f204bd78 100644 --- a/interface/resources/qml/controls/WebView.qml +++ b/interface/resources/qml/controls/WebView.qml @@ -4,6 +4,9 @@ import QtWebChannel 1.0 import "../controls-uit" as HiFiControls Item { + width: parent !== null ? parent.width : undefined + height: parent !== null ? parent.height : undefined + property alias url: root.url property alias scriptURL: root.userScriptUrl property alias canGoBack: root.canGoBack; @@ -25,12 +28,9 @@ Item { Flickable { id: flick - x: 0 - y: 0 width: parent.width height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height - WebEngineView { id: root objectName: "webEngineView" @@ -86,9 +86,13 @@ Item { onContentsSizeChanged: { console.log("WebView contentsSize", contentsSize) - flick.contentWidth = Math.max(contentsSize.width, flick.width) + flick.contentWidth = flick.width flick.contentHeight = Math.max(contentsSize.height, flick.height) } + //disable popup + onContextMenuRequested: { + request.accepted = true; + } onLoadingChanged: { keyboardRaised = false; @@ -97,6 +101,8 @@ Item { // Required to support clicking on "hifi://" links if (WebEngineView.LoadStartedStatus == loadRequest.status) { + flick.contentWidth = 0 + flick.contentHeight = 0 var url = loadRequest.url.toString(); url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag; if (urlHandler.canHandleUrl(url)) { @@ -106,22 +112,10 @@ Item { } } if (WebEngineView.LoadSucceededStatus == loadRequest.status) { - -// flick.contentWidth = Math.max(contentsSize.width, flick.width) -// flick.contentHeight = Math.max(contentsSize.height, flick.height) - root.runJavaScript( - "document.body.scrollHeight;", - function (i_actualPageHeight) { - flick.contentHeight = Math.max ( - i_actualPageHeight, flick.height); - }) - root.runJavaScript( - "document.body.scrollWidth;", - function (i_actualPageWidth) { - flick.contentWidth = Math.max ( - i_actualPageWidth, flick.width); - }) - + root.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) { + flick.contentHeight = Math.max(i_actualPageHeight, flick.height); + }) + flick.contentWidth = flick.width } } @@ -133,11 +127,14 @@ Item { tabletRoot.openBrowserWindow(request, profile); } } - - HiFiControls.WebSpinner { } } } + HiFiControls.WebSpinner { + anchors.centerIn: parent + webroot: root + } + HiFiControls.Keyboard { id: keyboard raised: parent.keyboardEnabled && parent.keyboardRaised