Temporarily disable WebView flickable until new solution will be investigated

This commit is contained in:
vladest 2017-09-12 15:48:47 +02:00
parent 996277b34c
commit 17a923b9de

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 2.2
import "../styles-uit" as StylesUIt
Flickable {
Item {
id: flick
property alias url: _webview.url
@ -19,38 +19,15 @@ Flickable {
signal newViewRequestedCallback(var request)
signal loadingChangedCallback(var loadRequest)
pressDelay: 300
boundsBehavior: Flickable.StopAtBounds
property bool interactive: false
StylesUIt.HifiConstants {
id: hifi
}
onHeightChanged: {
if (height > 0) {
//reload page since window dimentions changed,
//so web engine should recalculate page render dimentions
reloadTimer.start()
}
}
ScrollBar.vertical: ScrollBar {
id: scrollBar
visible: flick.contentHeight > flick.height
contentItem: Rectangle {
opacity: 0.75
implicitWidth: hifi.dimensions.scrollbarHandleWidth
radius: height / 2
color: hifi.colors.tableScrollHandleDark
}
}
function onLoadingChanged(loadRequest) {
if (WebEngineView.LoadStartedStatus === loadRequest.status) {
flick.contentWidth = flick.width
flick.contentHeight = flick.height
// Required to support clicking on "hifi://" links
var url = loadRequest.url.toString();
@ -67,32 +44,13 @@ Flickable {
if (WebEngineView.LoadSucceededStatus === loadRequest.status) {
//disable Chromium's scroll bars
_webview.runJavaScript("document.body.style.overflow = 'hidden';");
//calculate page height
_webview.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
if (i_actualPageHeight !== undefined) {
flick.contentHeight = i_actualPageHeight
} else {
flick.contentHeight = flick.height;
}
})
flick.contentWidth = flick.width
}
}
Timer {
id: reloadTimer
interval: 100
repeat: false
onTriggered: {
_webview.reload()
}
}
WebEngineView {
id: _webview
height: parent.height
anchors.fill: parent
profile: HFWebEngineProfile;
@ -125,7 +83,6 @@ Flickable {
property string newUrl: ""
Component.onCompleted: {
width = Qt.binding(function() { return flick.width; });
webChannel.registerObject("eventBridge", eventBridge);
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
// Ensure the JS from the web-engine makes it to our logging
@ -140,10 +97,6 @@ Flickable {
grantFeaturePermission(securityOrigin, feature, true);
}
onContentsSizeChanged: {
flick.contentHeight = Math.max(contentsSize.height, flick.height);
flick.contentWidth = flick.width
}
//disable popup
onContextMenuRequested: {
request.accepted = true;
@ -168,11 +121,4 @@ Flickable {
playing: visible
z: 10000
}
MouseArea {
anchors.fill: parent
onWheel: {
flick.flick(0, wheel.angleDelta.y*10)
}
}
}