summaryrefslogtreecommitdiff
path: root/Source/WebCore
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2017-03-04 18:59:02 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-03-04 16:15:23 +0000
commitfdcba363c7e7e01790ba4b946e4f53f8600d8a20 (patch)
tree735f50270fe51995a9961615ae0263fd057ca564 /Source/WebCore
parentb6d52c42e6595e1b283090ebb9bb21db50fed87b (diff)
downloadqtwebkit-fdcba363c7e7e01790ba4b946e4f53f8600d8a20.tar.gz
Import WebKit commit 3da312bb5ff3deccba0a495b6ad6d5cafba56597
Change-Id: Ifc702a2f8477e8a07e51cb0cd44161c1d9a84357 Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/PlatformQt.cmake10
-rw-r--r--Source/WebCore/platform/ScrollAnimationSmooth.cpp38
-rw-r--r--Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp2
-rw-r--r--Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp12
-rw-r--r--Source/WebCore/platform/network/qt/ResourceRequestQt.cpp20
5 files changed, 54 insertions, 28 deletions
diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake
index 26883021a..2e649507d 100644
--- a/Source/WebCore/PlatformQt.cmake
+++ b/Source/WebCore/PlatformQt.cmake
@@ -88,7 +88,6 @@ list(APPEND WebCore_SOURCES
platform/graphics/qt/IntPointQt.cpp
platform/graphics/qt/IntRectQt.cpp
platform/graphics/qt/IntSizeQt.cpp
- platform/graphics/qt/QFramebufferPaintDevice.cpp
platform/graphics/qt/PathQt.cpp
platform/graphics/qt/PatternQt.cpp
platform/graphics/qt/StillImageQt.cpp
@@ -198,6 +197,13 @@ if (ENABLE_NETSCAPE_PLUGIN_API AND WIN32)
)
endif ()
+if (ENABLE_SMOOTH_SCROLLING)
+ list(APPEND WebCore_SOURCES
+ platform/ScrollAnimationSmooth.cpp
+ platform/ScrollAnimatorSmooth.cpp
+ )
+endif ()
+
# Do it in the WebCore to support SHARED_CORE since WebKitWidgets won't load WebKit in that case.
# This should match the opposite statement in WebKit/PlatformQt.cmake
if (SHARED_CORE)
@@ -265,6 +271,8 @@ if (ENABLE_OPENGL)
platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
platform/graphics/opengl/TemporaryOpenGLSetting.cpp
+
+ platform/graphics/qt/QFramebufferPaintDevice.cpp
)
if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLESv2)
diff --git a/Source/WebCore/platform/ScrollAnimationSmooth.cpp b/Source/WebCore/platform/ScrollAnimationSmooth.cpp
index c8f5d5dc0..14bccf74a 100644
--- a/Source/WebCore/platform/ScrollAnimationSmooth.cpp
+++ b/Source/WebCore/platform/ScrollAnimationSmooth.cpp
@@ -228,36 +228,66 @@ static inline double releaseArea(ScrollAnimationSmooth::Curve curve, double star
static inline void getAnimationParametersForGranularity(ScrollGranularity granularity, double& animationTime, double& repeatMinimumSustainTime, double& attackTime, double& releaseTime, ScrollAnimationSmooth::Curve& coastTimeCurve, double& maximumCoastTime)
{
+ // Qt uses a slightly different strategy for the animation with a steep attack curve and natural release curve.
+ // The fast acceleration makes the animation look more responsive to user input.
switch (granularity) {
case ScrollByDocument:
animationTime = 20 * tickTime;
repeatMinimumSustainTime = 10 * tickTime;
+#if !PLATFORM(QT)
attackTime = 10 * tickTime;
releaseTime = 10 * tickTime;
coastTimeCurve = ScrollAnimationSmooth::Curve::Linear;
maximumCoastTime = 1;
+#else
+ attackTime = 6 * tickTime;
+ releaseTime = 10 * tickTime;
+ coastTimeCurve = ScrollAnimationSmooth::Curve::Quadratic;
+ maximumCoastTime = 22;
+#endif
break;
case ScrollByLine:
+#if !PLATFORM(QT)
animationTime = 10 * tickTime;
repeatMinimumSustainTime = 7 * tickTime;
attackTime = 3 * tickTime;
releaseTime = 3 * tickTime;
+#else
+ animationTime = 6 * tickTime;
+ repeatMinimumSustainTime = 5 * tickTime;
+ attackTime = 1 * tickTime;
+ releaseTime = 4 * tickTime;
+#endif
coastTimeCurve = ScrollAnimationSmooth::Curve::Linear;
maximumCoastTime = 1;
break;
case ScrollByPage:
+#if !PLATFORM(QT)
animationTime = 15 * tickTime;
repeatMinimumSustainTime = 10 * tickTime;
attackTime = 5 * tickTime;
releaseTime = 5 * tickTime;
+#else
+ animationTime = 12 * tickTime;
+ repeatMinimumSustainTime = 10 * tickTime;
+ attackTime = 3 * tickTime;
+ releaseTime = 6 * tickTime;
+#endif
coastTimeCurve = ScrollAnimationSmooth::Curve::Linear;
maximumCoastTime = 1;
break;
case ScrollByPixel:
+#if !PLATFORM(QT)
animationTime = 11 * tickTime;
repeatMinimumSustainTime = 2 * tickTime;
attackTime = 3 * tickTime;
releaseTime = 3 * tickTime;
+#else
+ animationTime = 8 * tickTime;
+ repeatMinimumSustainTime = 3 * tickTime;
+ attackTime = 2 * tickTime;
+ releaseTime = 5 * tickTime;
+#endif
coastTimeCurve = ScrollAnimationSmooth::Curve::Quadratic;
maximumCoastTime = 1.25;
break;
@@ -344,7 +374,11 @@ bool ScrollAnimationSmooth::updatePerAxisData(PerAxisData& data, ScrollGranulari
}
double releaseSpot = (data.releaseTime - releaseTimeLeft) / data.releaseTime;
+#if !PLATFORM(QT)
double releaseAreaLeft = releaseArea(Curve::Cubic, releaseSpot, 1) * data.releaseTime;
+#else
+ double releaseAreaLeft = releaseArea(Curve::Quadratic, releaseSpot, 1) * data.releaseTime;
+#endif
data.desiredVelocity = remainingDelta / (attackAreaLeft + sustainTimeLeft + releaseAreaLeft);
data.releasePosition = data.desiredPosition - data.desiredVelocity * releaseAreaLeft;
@@ -386,7 +420,11 @@ bool ScrollAnimationSmooth::animateScroll(PerAxisData& data, double currentTime)
else {
// release is based on targeting the exact final position.
double releaseDeltaT = deltaTime - (data.animationTime - data.releaseTime);
+#if !PLATFORM(QT)
newPosition = releaseCurve(Curve::Cubic, releaseDeltaT, data.releaseTime, data.releasePosition, data.desiredPosition);
+#else
+ newPosition = releaseCurve(Curve::Quadratic, releaseDeltaT, data.releaseTime, data.releasePosition, data.desiredPosition);
+#endif
}
// Normalize velocity to a per second amount. Could be used to check for jank.
diff --git a/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp b/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp
index f0e7f23e7..8685e7c90 100644
--- a/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp
+++ b/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp
@@ -116,7 +116,7 @@ void BitmapTexturePool::releaseUnusedTexturesTimerFired()
RefPtr<BitmapTexture> BitmapTexturePool::createTexture(const BitmapTexture::Flags flags)
{
-#if PLATFORM(QT)
+#if PLATFORM(QT) && USE(TEXTURE_MAPPER_GL)
if (!m_context3D)
return BitmapTextureImageBuffer::create();
#endif
diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index e94367287..211cf892a 100644
--- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -85,9 +85,7 @@ void FormDataIODevice::prepareFormElements()
if (!m_formData)
return;
-#if ENABLE(BLOB)
m_formData = m_formData->resolveBlobReferences();
-#endif
// Take a deep copy of the FormDataElements
m_formElements = m_formData->elements();
@@ -102,14 +100,10 @@ qint64 FormDataIODevice::computeSize()
m_dataSize += element.m_data.size();
else {
QFileInfo fi(element.m_filename);
-#if ENABLE(BLOB)
qint64 fileEnd = fi.size();
if (element.m_fileLength != BlobDataItem::toEndOfFile)
fileEnd = qMin<qint64>(fi.size(), element.m_fileStart + element.m_fileLength);
m_fileSize += qMax<qint64>(0, fileEnd - element.m_fileStart);
-#else
- m_fileSize += fi.size();
-#endif
}
}
return m_dataSize + m_fileSize;
@@ -150,7 +144,6 @@ void FormDataIODevice::openFileForCurrentElement()
m_currentFile->setFileName(m_formElements[0].m_filename);
m_currentFile->open(QFile::ReadOnly);
-#if ENABLE(BLOB)
if (isValidFileTime(m_formElements[0].m_expectedFileModificationTime)) {
QFileInfo info(*m_currentFile);
if (!info.exists() || static_cast<time_t>(m_formElements[0].m_expectedFileModificationTime) < info.lastModified().toTime_t()) {
@@ -160,7 +153,6 @@ void FormDataIODevice::openFileForCurrentElement()
}
if (m_formElements[0].m_fileStart)
m_currentFile->seek(m_formElements[0].m_fileStart);
-#endif
}
// m_formElements[0] is the current item. If the destination buffer is
@@ -185,10 +177,8 @@ qint64 FormDataIODevice::readData(char* destination, qint64 size)
moveToNextElement();
} else if (element.m_type == FormDataElement::Type::EncodedFile) {
quint64 toCopy = available;
-#if ENABLE(BLOB)
if (element.m_fileLength != BlobDataItem::toEndOfFile)
toCopy = qMin<qint64>(toCopy, element.m_fileLength - m_currentDelta);
-#endif
const QByteArray data = m_currentFile->read(toCopy);
memcpy(destination+copied, data.constData(), data.size());
m_currentDelta += data.size();
@@ -196,10 +186,8 @@ qint64 FormDataIODevice::readData(char* destination, qint64 size)
if (m_currentFile->atEnd() || !m_currentFile->isOpen())
moveToNextElement();
-#if ENABLE(BLOB)
else if (element.m_fileLength != BlobDataItem::toEndOfFile && m_currentDelta == element.m_fileLength)
moveToNextElement();
-#endif
}
}
diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
index 83c50062d..d74073ec5 100644
--- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -22,11 +22,8 @@
#include "ResourceRequest.h"
#include "ThirdPartyCookiesQt.h"
-#if ENABLE(BLOB)
#include "BlobData.h"
#include "BlobRegistryImpl.h"
-#include "BlobStorageData.h"
-#endif
#include <qglobal.h>
@@ -46,10 +43,9 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
return 6 * (1 + 3 + 2);
}
-#if ENABLE(BLOB)
static void appendBlobResolved(QByteArray& data, const QUrl& url, QString* contentType = 0)
{
- RefPtr<BlobStorageData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
+ RefPtr<BlobData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
if (!blobData)
return;
@@ -60,12 +56,11 @@ static void appendBlobResolved(QByteArray& data, const QUrl& url, QString* conte
const BlobDataItemList::const_iterator itend = blobData->items().end();
for (; it != itend; ++it) {
const BlobDataItem& blobItem = *it;
- if (blobItem.type == BlobDataItem::Data)
- data.append(blobItem.data->data() + static_cast<int>(blobItem.offset), static_cast<int>(blobItem.length));
- else if (blobItem.type == BlobDataItem::Blob)
- appendBlobResolved(data, blobItem.url);
- else if (blobItem.type == BlobDataItem::File) {
+ if (blobItem.type() == BlobDataItem::Type::Data)
+ data.append(reinterpret_cast<const char*>(blobItem.data().data()->data()) + static_cast<int>(blobItem.offset()), static_cast<int>(blobItem.length()));
+ else if (blobItem.type() == BlobDataItem::Type::File) {
// File types are not allowed here, so just ignore it.
+ RELEASE_ASSERT_WITH_MESSAGE(false, "File types are not allowed here");
} else
ASSERT_NOT_REACHED();
}
@@ -73,7 +68,7 @@ static void appendBlobResolved(QByteArray& data, const QUrl& url, QString* conte
static void resolveBlobUrl(const QUrl& url, QUrl& resolvedUrl)
{
- RefPtr<BlobStorageData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
+ RefPtr<BlobData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
if (!blobData)
return;
@@ -87,7 +82,6 @@ static void resolveBlobUrl(const QUrl& url, QUrl& resolvedUrl)
dataUri.append(QString::fromLatin1(data.toBase64()));
resolvedUrl = QUrl(dataUri);
}
-#endif
static inline QByteArray stringToByteArray(const String& string)
{
@@ -101,10 +95,8 @@ QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) co
QNetworkRequest request;
QUrl newurl = url();
-#if ENABLE(BLOB)
if (newurl.scheme() == QLatin1String("blob"))
resolveBlobUrl(url(), newurl);
-#endif
request.setUrl(newurl);
request.setOriginatingObject(context ? context->originatingObject() : 0);