summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp64
-rw-r--r--Source/WebCore/platform/network/qt/DNSQt.cpp7
-rw-r--r--Source/WebCore/platform/network/qt/ResourceRequestQt.cpp28
-rw-r--r--Source/WebCore/platform/qt/EventLoopQt.cpp2
-rw-r--r--Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp52
5 files changed, 137 insertions, 16 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
index 48130eba4..b8b605805 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
@@ -114,14 +114,70 @@ void TextureMapperImageBuffer::drawSolidColor(const FloatRect& rect, const Trans
context->restore();
}
-void TextureMapperImageBuffer::drawBorder(const Color&, float /* borderWidth */, const FloatRect&, const TransformationMatrix&)
+void TextureMapperImageBuffer::drawBorder(const Color& color, float borderWidth , const FloatRect& rect, const TransformationMatrix& matrix)
{
- notImplemented();
+#if PLATFORM(QT)
+ GraphicsContext* context = currentContext();
+ if (!context)
+ return;
+
+ context->save();
+ context->setCompositeOperation(isInMaskMode() ? CompositeDestinationIn : CompositeSourceOver);
+#if ENABLE(3D_TRANSFORMS)
+ context->concat3DTransform(matrix);
+#else
+ context->concatCTM(matrix.toAffineTransform());
+#endif
+
+ QPainter& painter = *context->platformContext();
+ painter.setBrush(Qt::NoBrush);
+ QPen newPen(color);
+ newPen.setWidthF(borderWidth);
+ painter.setPen(newPen);
+ painter.drawRect(rect);
+
+ context->restore();
+#endif
}
-void TextureMapperImageBuffer::drawNumber(int /* number */, const Color&, const FloatPoint&, const TransformationMatrix&)
+void TextureMapperImageBuffer::drawNumber(int number, const Color& color, const FloatPoint& targetPoint, const TransformationMatrix& matrix)
{
- notImplemented();
+#if PLATFORM(QT)
+ GraphicsContext* context = currentContext();
+ if (!context)
+ return;
+
+ context->save();
+ context->setCompositeOperation(isInMaskMode() ? CompositeDestinationIn : CompositeSourceOver);
+#if ENABLE(3D_TRANSFORMS)
+ context->concat3DTransform(matrix);
+#else
+ context->concatCTM(matrix.toAffineTransform());
+#endif
+
+ // Partially duplicates TextureMapperGL::drawNumber
+ int pointSize = 8;
+ QString counterString = QString::number(number);
+
+ QFont font(QString::fromLatin1("Monospace"), pointSize, QFont::Bold);
+ font.setStyleHint(QFont::TypeWriter);
+
+ QFontMetrics fontMetrics(font);
+ int width = fontMetrics.width(counterString) + 4;
+ int height = fontMetrics.height();
+
+ IntSize size(width, height);
+ IntRect sourceRect(IntPoint::zero(), size);
+
+ QPainter& painter = *context->platformContext();
+ painter.translate(targetPoint);
+ painter.fillRect(sourceRect, color);
+ painter.setFont(font);
+ painter.setPen(Qt::white);
+ painter.drawText(2, height * 0.85, counterString);
+
+ context->restore();
+#endif
}
PassRefPtr<BitmapTexture> BitmapTextureImageBuffer::applyFilters(TextureMapper&, const FilterOperations& filters)
diff --git a/Source/WebCore/platform/network/qt/DNSQt.cpp b/Source/WebCore/platform/network/qt/DNSQt.cpp
index b12cbaa09..4559d17a0 100644
--- a/Source/WebCore/platform/network/qt/DNSQt.cpp
+++ b/Source/WebCore/platform/network/qt/DNSQt.cpp
@@ -24,6 +24,7 @@
#include <QHostInfo>
#include <QObject>
#include <QString>
+#include <wtf/NeverDestroyed.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -34,7 +35,7 @@ public:
DnsPrefetchHelper() : QObject() { }
public Q_SLOTS:
- void lookup(QString hostname)
+ void lookup(const String& hostname)
{
if (hostname.isEmpty()) {
DNSResolveQueue::singleton().decrementRequestCount();
@@ -71,8 +72,8 @@ void DNSResolveQueue::updateIsUsingProxy()
// This is called by the platform-independent DNSResolveQueue.
void DNSResolveQueue::platformResolve(const String& hostname)
{
- static DnsPrefetchHelper dnsPrefetchHelper;
- dnsPrefetchHelper.lookup(QString(hostname));
+ static NeverDestroyed<DnsPrefetchHelper> dnsPrefetchHelper;
+ dnsPrefetchHelper.get().lookup(hostname);
}
} // namespace
diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
index b7f9447bc..c54a8115b 100644
--- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -27,6 +27,18 @@
#include <QNetworkRequest>
#include <QUrl>
+// HTTP/2 is implemented since Qt 5.8, but QTBUG-64359 makes it unusable in browser
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 4)
+#define USE_HTTP2 1
+#endif
+
+// HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
+#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 1
+#else
+#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 0
+#endif
+
namespace WebCore {
// The limit can be found in qhttpnetworkconnection.cpp.
@@ -57,15 +69,19 @@ static inline QByteArray stringToByteArray(const String& string)
QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const
{
QNetworkRequest request;
- QUrl newurl = toQUrl(url());
- request.setUrl(newurl);
+ const URL& originalUrl = url();
+ request.setUrl(toQUrl(originalUrl));
request.setOriginatingObject(context ? context->originatingObject() : 0);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
- // HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397
- if (newurl.scheme().toLower() == QLatin1String("https"))
- request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
+#if USE(HTTP2)
+#if HTTP2_IS_BUGGY_WITHOUT_HTTPS
+ if (originalUrl.protocolIs("https"))
#endif
+ {
+ request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
+ }
+#endif // USE(HTTP2)
+
const HTTPHeaderMap &headers = httpHeaderFields();
for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end();
diff --git a/Source/WebCore/platform/qt/EventLoopQt.cpp b/Source/WebCore/platform/qt/EventLoopQt.cpp
index 39bb54c53..c0ca31ec5 100644
--- a/Source/WebCore/platform/qt/EventLoopQt.cpp
+++ b/Source/WebCore/platform/qt/EventLoopQt.cpp
@@ -26,7 +26,7 @@ namespace WebCore {
void EventLoop::cycle()
{
- QCoreApplication::processEvents();
+ QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
index a0e67e494..2e667e2da 100644
--- a/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
+++ b/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
@@ -808,6 +808,7 @@ static bool isVirtualKeyCodeRepresentingCharacter(int code)
}
}
+template<bool unmodified>
static String keyTextForKeyEvent(const QKeyEvent* event)
{
switch (event->key()) {
@@ -820,6 +821,53 @@ static String keyTextForKeyEvent(const QKeyEvent* event)
case Qt::Key_Enter:
if (event->text().isNull())
return ASCIILiteral("\r");
+ break;
+
+// Workaround for broken accesskey when QKeyEvent has modifier, see QTBUG-64891
+#define MAKE_TEXT_FOR_KEY(QtKey, Character) \
+ case Qt::Key_##QtKey: \
+ if (unmodified && event->text().isNull()) \
+ return ASCIILiteral(#Character); \
+ break;
+
+ MAKE_TEXT_FOR_KEY(0, 0);
+ MAKE_TEXT_FOR_KEY(1, 1);
+ MAKE_TEXT_FOR_KEY(2, 2);
+ MAKE_TEXT_FOR_KEY(3, 3);
+ MAKE_TEXT_FOR_KEY(4, 4);
+ MAKE_TEXT_FOR_KEY(5, 5);
+ MAKE_TEXT_FOR_KEY(6, 6);
+ MAKE_TEXT_FOR_KEY(7, 7);
+ MAKE_TEXT_FOR_KEY(8, 8);
+ MAKE_TEXT_FOR_KEY(9, 9);
+ MAKE_TEXT_FOR_KEY(A, a);
+ MAKE_TEXT_FOR_KEY(B, b);
+ MAKE_TEXT_FOR_KEY(C, c);
+ MAKE_TEXT_FOR_KEY(D, d);
+ MAKE_TEXT_FOR_KEY(E, e);
+ MAKE_TEXT_FOR_KEY(F, f);
+ MAKE_TEXT_FOR_KEY(G, g);
+ MAKE_TEXT_FOR_KEY(H, h);
+ MAKE_TEXT_FOR_KEY(I, i);
+ MAKE_TEXT_FOR_KEY(J, j);
+ MAKE_TEXT_FOR_KEY(K, k);
+ MAKE_TEXT_FOR_KEY(L, l);
+ MAKE_TEXT_FOR_KEY(M, m);
+ MAKE_TEXT_FOR_KEY(N, n);
+ MAKE_TEXT_FOR_KEY(O, o);
+ MAKE_TEXT_FOR_KEY(P, p);
+ MAKE_TEXT_FOR_KEY(Q, q);
+ MAKE_TEXT_FOR_KEY(R, r);
+ MAKE_TEXT_FOR_KEY(S, s);
+ MAKE_TEXT_FOR_KEY(T, t);
+ MAKE_TEXT_FOR_KEY(U, u);
+ MAKE_TEXT_FOR_KEY(V, v);
+ MAKE_TEXT_FOR_KEY(W, w);
+ MAKE_TEXT_FOR_KEY(X, x);
+ MAKE_TEXT_FOR_KEY(Y, y);
+ MAKE_TEXT_FOR_KEY(Z, z);
+
+#undef MAKE_TEXT_FOR_KEY
}
return event->text();
}
@@ -840,8 +888,8 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event, bool useNativeVir
m_modifiers |= MetaKey;
m_useNativeVirtualKeyAsDOMKey = useNativeVirtualKeyAsDOMKey;
- m_text = keyTextForKeyEvent(event);
- m_unmodifiedText = m_text; // FIXME: not correct
+ m_text = keyTextForKeyEvent<false>(event);
+ m_unmodifiedText = keyTextForKeyEvent<true>(event);
m_keyIdentifier = keyIdentifierForQtKeyCode(event->key());
m_autoRepeat = event->isAutoRepeat();
m_isKeypad = (state & Qt::KeypadModifier);