From 60550fcbfb697fb0140d5135b0aec718ddeb2017 Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 6 Feb 2013 17:42:32 +0100 Subject: [PATCH] Fixed scrolling to anchor(#) links in background tabs. Setting correct QWebPage::viewportSize() on creation. Closes #663 --- .gitignore | 1 + src/lib/webview/tabwidget.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 082774227..c31b0396a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ tests/modeltest *.embed.manifest bin/autotests .clang_complete +.tx/ diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index 36cac46aa..5a76bba54 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -347,6 +347,17 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT m_isClosingToLastTabIndex = true; } + if (openFlags & Qz::NT_NotSelectedTab) { + WebTab* currentWebTab = weTab(); + // Workarounding invalid QWebPage::viewportSize() until QWebView is shown + // Fixes invalid scrolling to anchor(#) links + if (currentWebTab && currentWebTab->view()) { + TabbedWebView* currentView = currentWebTab->view(); + webView->resize(currentView->size()); + webView->page()->setViewportSize(currentView->page()->viewportSize()); + } + } + return index; }