StandardDocumentationView positioning fixes

Authored by antonanikin on Dec 17 2016, 2:13 PM.

Description

StandardDocumentationView positioning fixes

Summary:
The patch fixes wrong positioning for StandardDocumentationView. Steps to reproduce:

  1. Place such test code into editor:
#include <QWebView>
#include <QLabel>
#include <QDebug>

void test()
{
    QWebView v;
    v.setUrl(QUrl("https://www.kdevelop.org/"));

    QLabel l;
    l.setText("label_text");

    qDebug() << "debug_message";
}
  1. Move cursor to any method and call context help.
  2. Help view will be shown with wrong position.
  3. Recall context help for previous place.
  4. Help view will be shown with right position.
  5. At any help view show we will see fast scrollbar "jumping" from initial (0) to some final position.

The cause of the problem is:

  1. Some page is loaded and loadFinished() signal is emitted, then QWebView sets right position inside page.
  1. After loadFinished() emitting, page JS code finishes it's work and changes font settings (size). This leads to page contents "moving" inside view widget and as a result we have wrong position.

To fix this, first, we disable view painter updates during load to avoid content "flickering" and also to hide font size "jumping". Secondly, we reset position inside page after loading with using standard QWebFrame method scrollToAnchor().

Test Plan: Tested on master branch.

Reviewers: KDevelop, kfunk

Reviewed By: KDevelop, kfunk

Subscribers: kfunk, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D3683

Details

Committed
antonanikinDec 17 2016, 2:13 PM
Reviewer
KDevelop
Differential Revision
D3683: StandardDocumentationView positioning fixes
Parents
R33:a372180f280d: Update INSTALL
Branches
Unknown
Tags
Unknown