summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/qt
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-25 15:09:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-25 15:09:11 +0200
commita89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch)
treeb7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/WebKit2/UIProcess/qt
parent8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff)
downloadqtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/WebKit2/UIProcess/qt')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp107
-rw-r--r--Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h24
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebError.cpp5
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebError.h2
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp40
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h8
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp9
7 files changed, 125 insertions, 70 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
index eb3c5a8d2..d3d5efef2 100644
--- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
@@ -85,7 +85,7 @@ public:
}
// Make sure that tiles all around the viewport will be requested.
- emit engine->contentViewportChanged(QPointF());
+ emit engine->informVisibleContentChange(QPointF());
}
private:
@@ -98,22 +98,22 @@ static inline bool fuzzyCompare(qreal a, qreal b, qreal epsilon)
return qAbs(a - b) < epsilon;
}
-inline qreal QtViewportInteractionEngine::cssScaleFromItem(qreal itemScale)
+inline qreal QtViewportInteractionEngine::cssScaleFromItem(qreal itemScale) const
{
return itemScale / m_devicePixelRatio;
}
-inline qreal QtViewportInteractionEngine::itemScaleFromCSS(qreal cssScale)
+inline qreal QtViewportInteractionEngine::itemScaleFromCSS(qreal cssScale) const
{
return cssScale * m_devicePixelRatio;
}
-inline qreal QtViewportInteractionEngine::itemCoordFromCSS(qreal value)
+inline qreal QtViewportInteractionEngine::itemCoordFromCSS(qreal value) const
{
return value * m_devicePixelRatio;
}
-inline QRectF QtViewportInteractionEngine::itemRectFromCSS(const QRectF& cssRect)
+inline QRectF QtViewportInteractionEngine::itemRectFromCSS(const QRectF& cssRect) const
{
QRectF itemRect;
@@ -152,12 +152,12 @@ QtViewportInteractionEngine::~QtViewportInteractionEngine()
{
}
-qreal QtViewportInteractionEngine::innerBoundedCSSScale(qreal cssScale)
+qreal QtViewportInteractionEngine::innerBoundedCSSScale(qreal cssScale) const
{
return qBound(m_minimumScale, cssScale, m_maximumScale);
}
-qreal QtViewportInteractionEngine::outerBoundedCSSScale(qreal cssScale)
+qreal QtViewportInteractionEngine::outerBoundedCSSScale(qreal cssScale) const
{
if (m_allowsUserScaling) {
// Bounded by [0.1, 10.0] like the viewport meta code in WebCore.
@@ -173,8 +173,6 @@ void QtViewportInteractionEngine::setItemRectVisible(const QRectF& itemRect)
if (itemRect.isEmpty())
return;
- ViewportUpdateDeferrer guard(this);
-
qreal itemScale = m_viewport->width() / itemRect.width();
m_content->setContentsScale(itemScale);
@@ -186,27 +184,41 @@ void QtViewportInteractionEngine::setItemRectVisible(const QRectF& itemRect)
m_viewport->setContentPos(newPosition);
}
-bool QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
+// Ease out overshoot of 1.25 combined with ease in correction of 0.25. Both quadratic to have physical motion.
+static qreal physicalOvershoot(qreal t)
+{
+ return (-t * (t - 2)) * 1.25 - (t * t) * 0.25;
+}
+
+void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
{
+ ASSERT(m_scaleAnimation->state() == QAbstractAnimation::Stopped);
+
+ ASSERT(!scrollAnimationActive());
+ if (scrollAnimationActive())
+ return;
+
QRectF currentItemRectVisible = m_viewport->mapRectToWebContent(m_viewport->boundingRect());
if (itemRect == currentItemRectVisible)
- return false;
+ return;
// FIXME: Investigate why that animation doesn't run when we are unfocused.
if (!m_viewport->isVisible() || !m_viewport->hasFocus()) {
// Apply the end result immediately when we are non-visible.
setItemRectVisible(itemRect);
- return true;
+ return;
}
+ QEasingCurve easingCurve;
+ easingCurve.setCustomType(physicalOvershoot);
+
m_scaleAnimation->setDuration(kScaleAnimationDurationMillis);
- m_scaleAnimation->setEasingCurve(QEasingCurve::OutCubic);
+ m_scaleAnimation->setEasingCurve(easingCurve);
m_scaleAnimation->setStartValue(currentItemRectVisible);
m_scaleAnimation->setEndValue(itemRect);
m_scaleAnimation->start();
- return true;
}
void QtViewportInteractionEngine::flickableMoveStarted()
@@ -234,7 +246,7 @@ void QtViewportInteractionEngine::flickableMovingPositionUpdate()
{
QPointF newPosition = m_viewport->contentPos();
- emit contentViewportChanged(m_lastScrollPosition - newPosition);
+ emit informVisibleContentChange(m_lastScrollPosition - newPosition);
m_lastScrollPosition = newPosition;
}
@@ -244,11 +256,11 @@ void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation:
switch (newState) {
case QAbstractAnimation::Running:
m_viewport->cancelFlick();
- if (!m_scaleUpdateDeferrer)
- m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent));
+ ASSERT(!m_animationUpdateDeferrer);
+ m_animationUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent));
break;
case QAbstractAnimation::Stopped:
- m_scaleUpdateDeferrer.clear();
+ m_animationUpdateDeferrer.clear();
break;
default:
break;
@@ -275,10 +287,15 @@ void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition
QRectF endVisibleContentRect(endPosition / endItemScale, m_viewport->boundingRect().size() / endItemScale);
setItemRectVisible(endVisibleContentRect);
+
+ // Make sure that tiles all around the viewport will be requested.
+ emit informVisibleContentChange(QPointF());
}
void QtViewportInteractionEngine::touchBegin()
{
+ m_hadUserInteraction = true;
+
// Prevents resuming the page between the user's flicks of the page while the animation is running.
if (scrollAnimationActive())
m_touchUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent));
@@ -302,6 +319,9 @@ QRectF QtViewportInteractionEngine::computePosRangeForItemAtScale(qreal itemScal
void QtViewportInteractionEngine::focusEditableArea(const QRectF& caretArea, const QRectF& targetArea)
{
+ // This can only happen as a result of a user interaction.
+ ASSERT(m_hadUserInteraction);
+
QRectF endArea = itemRectFromCSS(targetArea);
qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(2.0));
@@ -336,14 +356,15 @@ void QtViewportInteractionEngine::focusEditableArea(const QRectF& caretArea, con
void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoint, const QRectF& targetArea)
{
+ // This can only happen as a result of a user interaction.
+ ASSERT(m_hadUserInteraction);
+
if (!targetArea.isValid())
return;
- if (scrollAnimationActive() || scaleAnimationActive())
+ if (m_suspendCount)
return;
- m_hadUserInteraction = true;
-
const int margin = 10; // We want at least a little bit of margin.
QRectF endArea = itemRectFromCSS(targetArea.adjusted(-margin, -margin, margin, margin));
@@ -417,11 +438,8 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi
animateItemRectVisible(endVisibleContentRect);
}
-bool QtViewportInteractionEngine::ensureContentWithinViewportBoundary(bool immediate)
+QRectF QtViewportInteractionEngine::nearestValidBounds() const
{
- if (scrollAnimationActive() || scaleAnimationActive())
- return false;
-
qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(currentCSSScale()));
const QRectF viewportRect = m_viewport->boundingRect();
@@ -434,11 +452,7 @@ bool QtViewportInteractionEngine::ensureContentWithinViewportBoundary(bool immed
QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale);
- if (immediate) {
- setItemRectVisible(endVisibleContentRect);
- return true;
- }
- return !animateItemRectVisible(endVisibleContentRect);
+ return endVisibleContentRect;
}
void QtViewportInteractionEngine::reset()
@@ -475,7 +489,7 @@ void QtViewportInteractionEngine::setCSSScale(qreal scale)
m_content->setContentsScale(itemScaleFromCSS(newScale));
}
-qreal QtViewportInteractionEngine::currentCSSScale()
+qreal QtViewportInteractionEngine::currentCSSScale() const
{
return cssScaleFromItem(m_content->contentsScale());
}
@@ -492,7 +506,9 @@ bool QtViewportInteractionEngine::panGestureActive() const
void QtViewportInteractionEngine::panGestureStarted(const QPointF& position, qint64 eventTimestampMillis)
{
- m_hadUserInteraction = true;
+ // This can only happen as a result of a user interaction.
+ ASSERT(m_hadUserInteraction);
+
m_viewport->handleFlickableMousePress(position, eventTimestampMillis);
m_lastPinchCenterInViewportCoordinates = position;
}
@@ -528,7 +544,8 @@ bool QtViewportInteractionEngine::scaleAnimationActive() const
void QtViewportInteractionEngine::cancelScrollAnimation()
{
- ViewportUpdateDeferrer guard(this);
+ if (!scrollAnimationActive())
+ return;
// If the pan gesture recognizer receives a touch begin event
// during an ongoing kinetic scroll animation of a previous
@@ -536,7 +553,7 @@ void QtViewportInteractionEngine::cancelScrollAnimation()
// immediately positioned back to valid boundaries.
m_viewport->cancelFlick();
- ensureContentWithinViewportBoundary(/*immediate*/ true);
+ setItemRectVisible(nearestValidBounds());
}
void QtViewportInteractionEngine::interruptScaleAnimation()
@@ -552,10 +569,12 @@ bool QtViewportInteractionEngine::pinchGestureActive() const
void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenterInViewportCoordinates)
{
+ // This can only happen as a result of a user interaction.
+ ASSERT(m_hadUserInteraction);
+
if (!m_allowsUserScaling)
return;
- m_hadUserInteraction = true;
m_scaleStack.clear();
m_zoomOutScale = 0.0;
@@ -565,7 +584,7 @@ void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenter
m_pinchStartScale = m_content->contentsScale();
// Reset the tiling look-ahead vector so that tiles all around the viewport will be requested on pinch-end.
- emit contentViewportChanged(QPointF());
+ emit informVisibleContentChange(QPointF());
}
void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinchCenterInViewportCoordinates, qreal totalScaleFactor)
@@ -598,9 +617,9 @@ void QtViewportInteractionEngine::pinchGestureEnded()
return;
m_pinchStartScale = -1;
- // Clear the update deferrer now if we're in our final position and there won't be any animation to clear it later.
- if (ensureContentWithinViewportBoundary())
- m_scaleUpdateDeferrer.clear();
+
+ animateItemRectVisible(nearestValidBounds());
+ m_scaleUpdateDeferrer.clear(); // Clear after starting potential animation, which takes over deferring.
}
void QtViewportInteractionEngine::pinchGestureCancelled()
@@ -609,14 +628,18 @@ void QtViewportInteractionEngine::pinchGestureCancelled()
m_scaleUpdateDeferrer.clear();
}
+/*
+ * This is called for all changes of item scale, width or height.
+ * This is called when interacting, ie. during for instance pinch-zooming.
+ *
+ * FIXME: This is currently called twice if you concurrently change width and height.
+ */
void QtViewportInteractionEngine::itemSizeChanged()
{
- // FIXME: This needs to be done smarter. What happens if it resizes when we were interacting?
if (m_suspendCount)
return;
- ViewportUpdateDeferrer guard(this);
- ensureContentWithinViewportBoundary(true);
+ setItemRectVisible(nearestValidBounds());
}
void QtViewportInteractionEngine::scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale)
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h
index accfc6ad7..ba540d548 100644
--- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h
+++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h
@@ -55,15 +55,15 @@ public:
void setCSSScaleBounds(qreal minimum, qreal maximum);
void setCSSScale(qreal);
- qreal currentCSSScale();
-
- bool ensureContentWithinViewportBoundary(bool immediate = false);
+ qreal currentCSSScale() const;
void setAllowsUserScaling(bool allow) { m_allowsUserScaling = allow; }
void setContentToDevicePixelRatio(qreal ratio) {m_devicePixelRatio = ratio; }
void setItemRectVisible(const QRectF&);
- bool animateItemRectVisible(const QRectF&);
+ void animateItemRectVisible(const QRectF&);
+
+ QRectF nearestValidBounds() const;
void pagePositionRequest(const QPoint& pos);
void touchBegin();
@@ -96,9 +96,8 @@ Q_SIGNALS:
void contentSuspendRequested();
void contentResumeRequested();
- void contentViewportChanged(const QPointF& trajectory = QPointF());
+ void informVisibleContentChange(const QPointF& trajectory = QPointF());
- void viewportTrajectoryVectorChanged(const QPointF&);
void visibleContentRectAndScaleChanged();
private Q_SLOTS:
@@ -120,13 +119,13 @@ private:
QQuickWebView* const m_viewport;
QQuickWebPage* const m_content;
- qreal cssScaleFromItem(qreal);
- qreal itemScaleFromCSS(qreal);
- qreal itemCoordFromCSS(qreal);
- QRectF itemRectFromCSS(const QRectF&);
+ qreal cssScaleFromItem(qreal) const;
+ qreal itemScaleFromCSS(qreal) const;
+ qreal itemCoordFromCSS(qreal) const;
+ QRectF itemRectFromCSS(const QRectF&) const;
- qreal innerBoundedCSSScale(qreal);
- qreal outerBoundedCSSScale(qreal);
+ qreal innerBoundedCSSScale(qreal) const;
+ qreal outerBoundedCSSScale(qreal) const;
bool m_allowsUserScaling;
qreal m_minimumScale;
@@ -144,6 +143,7 @@ private:
OwnPtr<ViewportUpdateDeferrer> m_scaleUpdateDeferrer;
OwnPtr<ViewportUpdateDeferrer> m_scrollUpdateDeferrer;
OwnPtr<ViewportUpdateDeferrer> m_touchUpdateDeferrer;
+ OwnPtr<ViewportUpdateDeferrer> m_animationUpdateDeferrer;
bool m_hadUserInteraction;
diff --git a/Source/WebKit2/UIProcess/qt/QtWebError.cpp b/Source/WebKit2/UIProcess/qt/QtWebError.cpp
index 9ea2925a9..75884f440 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebError.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebError.cpp
@@ -55,10 +55,9 @@ int QtWebError::errorCode() const
return WKErrorGetErrorCode(error.get());
}
-QUrl QtWebError::url() const
+QString QtWebError::url() const
{
- WKRetainPtr<WKURLRef> failingURL = adoptWK(WKErrorCopyFailingURL(error.get()));
- return WKURLCopyQUrl(failingURL.get());
+ return toImpl(error.get())->failingURL();
}
QString QtWebError::description() const
diff --git a/Source/WebKit2/UIProcess/qt/QtWebError.h b/Source/WebKit2/UIProcess/qt/QtWebError.h
index 8f954054e..c2b922603 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebError.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebError.h
@@ -43,7 +43,7 @@ public:
};
Type type() const;
- QUrl url() const;
+ QString url() const;
int errorCode() const;
QString description() const;
bool isCancellation() const;
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
index c7a69cd28..578faa2c9 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp
@@ -36,6 +36,7 @@ QtWebPageLoadClient::QtWebPageLoadClient(WKPageRef pageRef, QQuickWebView* webVi
loadClient.version = kWKPageLoaderClientCurrentVersion;
loadClient.clientInfo = this;
loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
+ loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
loadClient.didCommitLoadForFrame = didCommitLoadForFrame;
loadClient.didFinishLoadForFrame = didFinishLoadForFrame;
@@ -49,11 +50,16 @@ QtWebPageLoadClient::QtWebPageLoadClient(WKPageRef pageRef, QQuickWebView* webVi
WKPageSetPageLoaderClient(pageRef, &loadClient);
}
-void QtWebPageLoadClient::didStartProvisionalLoad(const QUrl& url)
+void QtWebPageLoadClient::didStartProvisionalLoad(const WTF::String& url)
{
m_webView->d_func()->provisionalLoadDidStart(url);
}
+void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoad(const WTF::String& url)
+{
+ m_webView->d_func()->didReceiveServerRedirectForProvisionalLoad(url);
+}
+
void QtWebPageLoadClient::didCommitLoad()
{
m_webView->d_func()->loadDidCommit();
@@ -84,16 +90,29 @@ void QtWebPageLoadClient::dispatchLoadSucceeded()
m_webView->d_func()->loadDidSucceed();
}
-void QtWebPageLoadClient::dispatchLoadFailed(const QtWebError& error)
+void QtWebPageLoadClient::dispatchLoadFailed(WebFrameProxy* frame, const QtWebError& error)
{
int errorCode = error.errorCode();
if (error.isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
+ // The active url might have changed
+ m_webView->emitUrlChangeIfNeeded();
+
// Make sure that LoadStartedStatus has a counterpart when e.g. requesting a download.
dispatchLoadSucceeded();
+
return;
}
+ // We set the unreachable url unconditionally so that the current
+ // active url of the webview when the loadingChanged signal is
+ // emitted reflects the failed url, not the previously committed
+ // url. This also ensures that if the user does not do a loadHtml
+ // with an error page and and unreachable url as a reponse to the
+ // failed load, we can still detect the failed url for reloads.
+ frame->setUnreachableURL(error.url());
+ m_webView->emitUrlChangeIfNeeded();
+
m_webView->d_func()->loadDidFail(error);
}
@@ -107,16 +126,23 @@ void QtWebPageLoadClient::didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef
{
if (!WKFrameIsMainFrame(frame))
return;
- QString urlStr(toImpl(frame)->provisionalURL());
- QUrl qUrl = urlStr;
- toQtWebPageLoadClient(clientInfo)->didStartProvisionalLoad(qUrl);
+ toQtWebPageLoadClient(clientInfo)->didStartProvisionalLoad(toImpl(frame)->provisionalURL());
+}
+
+void QtWebPageLoadClient::didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ WebFrameProxy* wkframe = toImpl(frame);
+ toQtWebPageLoadClient(clientInfo)->didReceiveServerRedirectForProvisionalLoad(wkframe->provisionalURL());
}
void QtWebPageLoadClient::didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void* clientInfo)
{
if (!WKFrameIsMainFrame(frame))
return;
- toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(error);
+ toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(toImpl(frame), error);
}
void QtWebPageLoadClient::didCommitLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void* clientInfo)
@@ -137,7 +163,7 @@ void QtWebPageLoadClient::didFailLoadWithErrorForFrame(WKPageRef, WKFrameRef fra
{
if (!WKFrameIsMainFrame(frame))
return;
- toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(error);
+ toQtWebPageLoadClient(clientInfo)->dispatchLoadFailed(toImpl(frame), error);
}
void QtWebPageLoadClient::didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void* clientInfo)
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h
index 179eb8ed2..68eac0f98 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h
@@ -22,7 +22,9 @@
#define QtWebPageLoadClient_h
#include <QtGlobal>
+#include <WebFrameProxy.h>
#include <WKPage.h>
+#include <wtf/text/WTFString.h>
QT_BEGIN_NAMESPACE
class QUrl;
@@ -39,7 +41,8 @@ public:
QtWebPageLoadClient(WKPageRef, QQuickWebView*);
private:
- void didStartProvisionalLoad(const QUrl&);
+ void didStartProvisionalLoad(const WTF::String&);
+ void didReceiveServerRedirectForProvisionalLoad(const WTF::String&);
void didCommitLoad();
void didSameDocumentNavigation();
void didReceiveTitle();
@@ -47,11 +50,12 @@ private:
void didChangeBackForwardList();
void dispatchLoadSucceeded();
- void dispatchLoadFailed(const QtWebError&);
+ void dispatchLoadFailed(WebFrameProxy*, const QtWebError&);
// WKPageLoadClient callbacks.
static void didStartProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
+ static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef userData, const void* clientInfo);
static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void* clientInfo);
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
index 648394b6f..2f92098ca 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
@@ -186,12 +186,15 @@ void PopupMenuItemModel::select(int index)
if (!item.enabled)
return;
- Item& oldItem = m_items[oldIndex];
- oldItem.selected = false;
item.selected = true;
m_selectedModelIndex = index;
- emit dataChanged(this->index(oldIndex), this->index(oldIndex));
+ if (oldIndex != -1) {
+ Item& oldItem = m_items[oldIndex];
+ oldItem.selected = false;
+ emit dataChanged(this->index(oldIndex), this->index(oldIndex));
+ }
+
emit dataChanged(this->index(index), this->index(index));
}