[webkit-qt] prevent mainframe from scrolling

Felipe Crochik felipe at crochik.com
Fri Apr 13 05:30:50 PDT 2012


Just created a small sample project:
source: http://www.crochik.com/webkit/webviewbug.zip
deb for harmattan: http://www.crochik.com/webview/webviewbug_0.0.1_armel.deb

The qml page is really simple:

import QtQuick 1.1

import com.nokia.meego 1.0

import QtWebKit 1.0

PageStackWindow {

    id: window

    initialPage: mainPage;

    Page {

        id: mainPage

        Flickable {

                contentWidth: 500

                contentHeight: 500

                interactive: true

            WebView {

                width: 400

                height: 400

                anchors.centerIn: parent

                url: "http://www.crochik.com/webkit/scroll.html"

            }

        }

    }

}



Thanks,
Felipe



On Fri, Apr 13, 2012 at 8:10 AM, Felipe Crochik <felipe at crochik.com> wrote:

> I am using resizeToContents and as far as I can tell by the code the only
> thing it does is resize the GraphicsWebView to match the mainframe size.
> The issue here is that using window.scrollTo will affect the rendering of
> the page on the graphicsview. I tried on Grob and it works but if you try
> on a qml WebView it will move the page "out"  of the view.
>
> Please try this URL on a QML WebView on Harmattan (I can provide an
> example app later - don't have one ready):
> http://www.crochik.com/webkit/scroll.html (make sure to click the button)
>
> Thanks,
> Felipe
>
>
> On Fri, Apr 13, 2012 at 5:57 AM, Kenneth Rohde Christiansen <
> kenneth.christiansen at gmail.com> wrote:
>
>> I suppose your are not using resizesToContents then? Because if you are
>> not WebCore will scroll the content for you.
>>
>> Kenneth
>>
>> On Fri, Apr 13, 2012 at 3:34 AM, Felipe Crochik <felipe at crochik.com>wrote:
>>
>>> Is there a way to prevent the mainframe from scrolling?
>>>
>>> I would have hopped that by setting the QWebSettings::FrameFlatteningEnabled
>>> attribute the scrollrequests would not have any effect on the mainframe.
>>> Some web sites (e.g. gmail, google+) try to change the scroll position
>>> using javascript. And even without showing any scrollbars the "mainframe"
>>> is scrolled "getting out" of the QGraphicsWebView.
>>>
>>> Is there any way to prevent this? Ideally I would like to keep receiving
>>> the "scrollRequested" events from the page so I can adjust the "flickable
>>> position" accordingly but they should not any effect on how the "mainframe"
>>> is rendered on the graphics view.
>>>
>>> The best I managed so far is to set a timer when my page receives the
>>> scrollRequest event that will trigger resetting the scroll position to 0 on
>>> the mainframe. Can't imagine that there isn't a better way...
>>>
>>> BTW, I am looking for a solution using Qt 4.7.4 on Symbian and Harmattan.
>>>
>>> Thanks in advance
>>> Felipe
>>>
>>> _______________________________________________
>>> webkit-qt mailing list
>>> webkit-qt at lists.webkit.org
>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>>>
>>>
>>
>>
>> --
>> Kenneth Rohde Christiansen
>> Senior Engineer
>> Nokia Mobile Phones, Browser / WebKit team
>> Phone  +45 4093 0598 / E-mail kenneth at webkit. <http://gmail.com>org
>>
>> http://codeposts.blogspot.com ﹆﹆﹆
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120413/b7f8341b/attachment.html>


More information about the webkit-qt mailing list