summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/CMakeLists.txt5
-rw-r--r--Source/WebCore/PlatformQt.cmake6
-rw-r--r--Source/WebCore/bridge/qt/qt_runtime.cpp7
-rw-r--r--Source/WebCore/loader/cache/CachedFont.cpp4
-rw-r--r--Source/WebCore/platform/graphics/WOFFFileFormat.cpp76
-rw-r--r--Source/WebCore/platform/graphics/WOFFFileFormat.h4
-rw-r--r--Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp13
-rw-r--r--Source/WebCore/platform/qt/QStyleFacade.h2
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQStyle.cpp49
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQStyle.h5
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQt.cpp10
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQt.h3
12 files changed, 144 insertions, 40 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index ff9e12889..58fc73285 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -3807,6 +3807,11 @@ if (SHARED_CORE)
install(TARGETS WebCore DESTINATION "${LIB_INSTALL_DIR}")
endif ()
+QT_ADD_EXTRA_WEBKIT_TARGET_EXPORT(WebCore)
+if (ENABLE_TEST_SUPPORT)
+ QT_ADD_EXTRA_WEBKIT_TARGET_EXPORT(WebCoreTestSupport)
+endif ()
+
# [ARM] Build SVGPathElement.cpp with -O2 due to a GCC bug
# https://bugs.webkit.org/show_bug.cgi?id=145377
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND WTF_CPU_ARM AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.9") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.3"))
diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake
index 2e013d601..84e9127eb 100644
--- a/Source/WebCore/PlatformQt.cmake
+++ b/Source/WebCore/PlatformQt.cmake
@@ -234,6 +234,12 @@ list(APPEND WebCore_LIBRARIES
${ZLIB_LIBRARIES}
)
+if (QT_STATIC_BUILD)
+ list(APPEND WebCore_LIBRARIES
+ ${STATIC_LIB_DEPENDENCIES}
+ )
+endif ()
+
list(APPEND WebCore_USER_AGENT_STYLE_SHEETS
# ${WEBCORE_DIR}/css/mediaControlsGtk.css
# ${WEBCORE_DIR}/css/mediaControlsQt.css
diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp
index ae0c7e907..6912422d0 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.cpp
+++ b/Source/WebCore/bridge/qt/qt_runtime.cpp
@@ -1589,7 +1589,12 @@ void QtConnectionObject::execute(void** argv)
args[i] = convertQVariantToValue(m_context, m_rootObject, QVariant(argType, argv[i+1]), ignoredException);
}
- JSObjectCallAsFunction(m_context, m_receiverFunction, m_receiver, argc, args.data(), 0);
+ JSValueRef call_exception = 0;
+ ExecState* exec = toJS(m_context);
+ JSObjectCallAsFunction(m_context, m_receiverFunction, m_receiver, argc, args.data(), &call_exception);
+ if (call_exception) {
+ WebCore::reportException(exec, toJS(exec, call_exception));
+ }
}
bool QtConnectionObject::match(JSContextRef context, QObject* sender, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction)
diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp
index 08b337470..6836653a1 100644
--- a/Source/WebCore/loader/cache/CachedFont.cpp
+++ b/Source/WebCore/loader/cache/CachedFont.cpp
@@ -103,9 +103,9 @@ bool CachedFont::ensureCustomFontData(SharedBuffer* data)
RefPtr<SharedBuffer> buffer(data);
#if !PLATFORM(COCOA)
- if (isWOFF(buffer.get())) {
+ if (isWOFF(*buffer)) {
Vector<char> convertedFont;
- if (!convertWOFFToSfnt(buffer.get(), convertedFont))
+ if (!convertWOFFToSfnt(*buffer, convertedFont))
buffer = nullptr;
else
buffer = SharedBuffer::adoptVector(convertedFont);
diff --git a/Source/WebCore/platform/graphics/WOFFFileFormat.cpp b/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
index 61a58b904..c2323cf04 100644
--- a/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
+++ b/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
@@ -37,25 +37,25 @@
namespace WebCore {
-static bool readUInt32(SharedBuffer* buffer, size_t& offset, uint32_t& value)
+static bool readUInt32(SharedBuffer& buffer, size_t& offset, uint32_t& value)
{
- ASSERT_ARG(offset, offset <= buffer->size());
- if (buffer->size() - offset < sizeof(value))
+ ASSERT_ARG(offset, offset <= buffer.size());
+ if (buffer.size() - offset < sizeof(value))
return false;
- value = ntohl(*reinterpret_cast_ptr<const uint32_t*>(buffer->data() + offset));
+ value = ntohl(*reinterpret_cast_ptr<const uint32_t*>(buffer.data() + offset));
offset += sizeof(value);
return true;
}
-static bool readUInt16(SharedBuffer* buffer, size_t& offset, uint16_t& value)
+static bool readUInt16(SharedBuffer& buffer, size_t& offset, uint16_t& value)
{
- ASSERT_ARG(offset, offset <= buffer->size());
- if (buffer->size() - offset < sizeof(value))
+ ASSERT_ARG(offset, offset <= buffer.size());
+ if (buffer.size() - offset < sizeof(value))
return false;
- value = ntohs(*reinterpret_cast_ptr<const uint16_t*>(buffer->data() + offset));
+ value = ntohs(*reinterpret_cast_ptr<const uint16_t*>(buffer.data() + offset));
offset += sizeof(value);
return true;
@@ -75,7 +75,7 @@ static bool writeUInt16(Vector<char>& vector, uint16_t value)
static const uint32_t woffSignature = 0x774f4646; /* 'wOFF' */
-bool isWOFF(SharedBuffer* buffer)
+bool isWOFF(SharedBuffer& buffer)
{
size_t offset = 0;
uint32_t signature;
@@ -90,7 +90,43 @@ bool isWOFF(SharedBuffer* buffer)
#endif
}
-bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
+#if USE(WOFF2)
+class WOFF2VectorOut : public woff2::WOFF2Out {
+public:
+ WOFF2VectorOut(Vector<char>& vector)
+ : m_vector(vector)
+ { }
+
+ bool Write(const void* data, size_t n) override
+ {
+ if (!m_vector.tryReserveCapacity(m_vector.size() + n))
+ return false;
+ m_vector.append(static_cast<const char*>(data), n);
+ return true;
+ }
+
+ bool Write(const void* data, size_t offset, size_t n) override
+ {
+ if (!m_vector.tryReserveCapacity(offset + n))
+ return false;
+ if (offset + n > m_vector.size())
+ m_vector.resize(offset + n);
+ m_vector.remove(offset, n);
+ m_vector.insert(offset, static_cast<const char*>(data), n);
+ return true;
+ }
+
+ size_t Size() override
+ {
+ return m_vector.size();
+ }
+
+private:
+ Vector<char>& m_vector;
+};
+#endif
+
+bool convertWOFFToSfnt(SharedBuffer& woff, Vector<char>& sfnt)
{
ASSERT_ARG(sfnt, sfnt.isEmpty());
@@ -105,15 +141,15 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
#if USE(WOFF2)
if (signature == woff2::kWoff2Signature) {
- const uint8_t* woffData = reinterpret_cast_ptr<const uint8_t*>(woff->data());
- const size_t woffSize = woff->size();
+ const uint8_t* woffData = reinterpret_cast_ptr<const uint8_t*>(woff.data());
+ const size_t woffSize = woff.size();
const size_t sfntSize = woff2::ComputeWOFF2FinalSize(woffData, woffSize);
if (!sfnt.tryReserveCapacity(sfntSize))
return false;
- sfnt.resize(sfntSize);
- return woff2::ConvertWOFF2ToTTF(reinterpret_cast<uint8_t*>(sfnt.data()), sfnt.size(), woffData, woffSize);
+ WOFF2VectorOut out(sfnt);
+ return woff2::ConvertWOFF2ToTTF(woffData, woffSize, &out);
}
#endif
@@ -127,7 +163,7 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
return false;
uint32_t length;
- if (!readUInt32(woff, offset, length) || length != woff->size())
+ if (!readUInt32(woff, offset, length) || length != woff.size())
return false;
uint16_t numTables;
@@ -145,7 +181,7 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
if (!readUInt32(woff, offset, totalSfntSize))
return false;
- if (woff->size() - offset < sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t))
+ if (woff.size() - offset < sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t))
return false;
offset += sizeof(uint16_t); // majorVersion
@@ -157,7 +193,7 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
offset += sizeof(uint32_t); // privLength
// Check if the WOFF can supply as many tables as it claims it has.
- if (woff->size() - offset < numTables * 5 * sizeof(uint32_t))
+ if (woff.size() - offset < numTables * 5 * sizeof(uint32_t))
return false;
// Write the sfnt offset subtable.
@@ -201,7 +237,7 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
if (!readUInt32(woff, offset, tableCompLength))
return false;
- if (tableOffset > woff->size() || tableCompLength > woff->size() - tableOffset)
+ if (tableOffset > woff.size() || tableCompLength > woff.size() - tableOffset)
return false;
uint32_t tableOrigLength;
@@ -225,7 +261,7 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
if (tableCompLength == tableOrigLength) {
// The table is not compressed.
- if (!sfnt.tryAppend(woff->data() + tableOffset, tableCompLength))
+ if (!sfnt.tryAppend(woff.data() + tableOffset, tableCompLength))
return false;
} else {
uLongf destLen = tableOrigLength;
@@ -233,7 +269,7 @@ bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
return false;
Bytef* dest = reinterpret_cast<Bytef*>(sfnt.end());
sfnt.grow(sfnt.size() + tableOrigLength);
- if (uncompress(dest, &destLen, reinterpret_cast<const Bytef*>(woff->data() + tableOffset), tableCompLength) != Z_OK)
+ if (uncompress(dest, &destLen, reinterpret_cast<const Bytef*>(woff.data() + tableOffset), tableCompLength) != Z_OK)
return false;
if (destLen != tableOrigLength)
return false;
diff --git a/Source/WebCore/platform/graphics/WOFFFileFormat.h b/Source/WebCore/platform/graphics/WOFFFileFormat.h
index c6892fde1..44c38245d 100644
--- a/Source/WebCore/platform/graphics/WOFFFileFormat.h
+++ b/Source/WebCore/platform/graphics/WOFFFileFormat.h
@@ -33,11 +33,11 @@ namespace WebCore {
class SharedBuffer;
// Returns whether the buffer is a WOFF file.
-bool isWOFF(SharedBuffer* buffer);
+bool isWOFF(SharedBuffer&);
// Returns false if the WOFF file woff is invalid or could not be converted to sfnt (for example,
// if conversion ran out of memory). Otherwise returns true and writes the sfnt payload into sfnt.
-bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt);
+bool convertWOFFToSfnt(SharedBuffer& woff, Vector<char>& sfnt);
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
index 78e159aa0..bc65c0511 100644
--- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
@@ -39,18 +39,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription&
std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer)
{
- SharedBuffer* fontBuffer = &buffer;
- RefPtr<SharedBuffer> sfntBuffer;
- if (isWOFF(&buffer)) {
- Vector<char> sfnt;
- if (!convertWOFFToSfnt(&buffer, sfnt))
- return 0;
-
- sfntBuffer = SharedBuffer::adoptVector(sfnt);
- fontBuffer = sfntBuffer.get();
- }
-
- const QByteArray fontData(fontBuffer->data(), fontBuffer->size());
+ const QByteArray fontData(buffer.data(), buffer.size());
// Pixel size doesn't matter at this point, it is set in FontCustomPlatformData::fontPlatformData.
QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferDefaultHinting);
diff --git a/Source/WebCore/platform/qt/QStyleFacade.h b/Source/WebCore/platform/qt/QStyleFacade.h
index 1c82300d5..f2fbdb82b 100644
--- a/Source/WebCore/platform/qt/QStyleFacade.h
+++ b/Source/WebCore/platform/qt/QStyleFacade.h
@@ -38,6 +38,8 @@ struct QStyleFacadeOption;
class QStyleFacade {
public:
enum ButtonSubElement {
+ CheckBoxIndicator,
+ RadioButtonIndicator,
PushButtonLayoutItem,
PushButtonContents
};
diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
index 36c2d18eb..b9c6953fa 100644
--- a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
+++ b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
@@ -60,6 +60,20 @@ namespace WebCore {
using namespace HTMLNames;
+static QStyleFacade::ButtonSubElement indicatorSubElement(QStyleFacade::ButtonType part)
+{
+ switch (part) {
+ case QStyleFacade::CheckBox:
+ return QStyleFacade::CheckBoxIndicator;
+ case QStyleFacade::RadioButton:
+ return QStyleFacade::RadioButtonIndicator;
+ default:
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return QStyleFacade::CheckBoxIndicator;
+}
+
QSharedPointer<StylePainter> RenderThemeQStyle::getStylePainter(const PaintInfo& paintInfo)
{
return QSharedPointer<StylePainter>(new StylePainterQStyle(this, paintInfo));
@@ -140,6 +154,11 @@ void RenderThemeQStyle::setPaletteFromPageClientIfExists(QPalette& palette) cons
palette = pageClient->palette();
}
+QRect RenderThemeQStyle::indicatorRect(QStyleFacade::ButtonType part, const QRect& originalRect) const
+{
+ return m_qStyle->buttonSubElementRect(indicatorSubElement(part), QStyleFacade::State_Small, originalRect);
+}
+
QRect RenderThemeQStyle::inflateButtonRect(const QRect& originalRect) const
{
QRect layoutRect = m_qStyle->buttonSubElementRect(QStyleFacade::PushButtonLayoutItem, QStyleFacade::State_Small, originalRect);
@@ -168,6 +187,29 @@ QRectF RenderThemeQStyle::inflateButtonRect(const QRectF& originalRect) const
return originalRect;
}
+template<typename T>
+static void inflateCheckBoxRectImpl(T& originalRect, const QRect& rect)
+{
+ if (!rect.isNull()) {
+ int dx = static_cast<int>((rect.width() - originalRect.width()) / 2);
+ originalRect.setX(originalRect.x() - dx);
+ originalRect.setWidth(rect.width());
+ int dy = static_cast<int>((rect.height() - originalRect.height()) / 2);
+ originalRect.setY(originalRect.y() - dy);
+ originalRect.setHeight(rect.height());
+ }
+}
+
+void RenderThemeQStyle::computeControlRect(QStyleFacade::ButtonType part, QRect& originalRect) const
+{
+ inflateCheckBoxRectImpl(originalRect, indicatorRect(part, originalRect));
+}
+
+void RenderThemeQStyle::computeControlRect(QStyleFacade::ButtonType part, FloatRect& originalRect) const
+{
+ inflateCheckBoxRectImpl(originalRect, indicatorRect(part, enclosingIntRect(originalRect)));
+}
+
static int extendFixedPadding(Length oldPadding, int padding)
{
if (oldPadding.isFixed())
@@ -322,10 +364,13 @@ bool RenderThemeQStyle::paintButton(const RenderObject& o, const PaintInfo& i, c
if (p.appearance == PushButtonPart || p.appearance == ButtonPart) {
p.styleOption.rect = inflateButtonRect(p.styleOption.rect);
p.paintButton(QStyleFacade::PushButton);
- } else if (p.appearance == RadioPart)
+ } else if (p.appearance == RadioPart) {
+ computeControlRect(QStyleFacade::RadioButton, p.styleOption.rect);
p.paintButton(QStyleFacade::RadioButton);
- else if (p.appearance == CheckboxPart)
+ } else if (p.appearance == CheckboxPart) {
+ computeControlRect(QStyleFacade::CheckBox, p.styleOption.rect);
p.paintButton(QStyleFacade::CheckBox);
+ }
return false;
}
diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.h b/Source/WebCore/platform/qt/RenderThemeQStyle.h
index 17b8bfa87..d49f5e19b 100644
--- a/Source/WebCore/platform/qt/RenderThemeQStyle.h
+++ b/Source/WebCore/platform/qt/RenderThemeQStyle.h
@@ -22,7 +22,6 @@
#ifndef RenderThemeQStyle_h
#define RenderThemeQStyle_h
-#include "QStyleFacade.h"
#include "RenderThemeQt.h"
namespace WebCore {
@@ -95,6 +94,8 @@ protected:
QRect inflateButtonRect(const QRect& originalRect) const override;
QRectF inflateButtonRect(const QRectF& originalRect) const override;
+ void computeControlRect(QStyleFacade::ButtonType, QRect& originalRect) const override;
+ void computeControlRect(QStyleFacade::ButtonType, FloatRect& originalRect) const override;
void setPopupPadding(RenderStyle&) const override;
@@ -107,6 +108,8 @@ private:
void setPaletteFromPageClientIfExists(QPalette&) const;
+ QRect indicatorRect(QStyleFacade::ButtonType part, const QRect& originalRect) const;
+
#ifdef Q_OS_MAC
int m_buttonFontPixelSize;
#endif
diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp
index 32530fad2..a5a48f92b 100644
--- a/Source/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp
@@ -217,12 +217,22 @@ QRectF RenderThemeQt::inflateButtonRect(const QRectF& originalRect) const
return originalRect;
}
+void RenderThemeQt::computeControlRect(QStyleFacade::ButtonType, QRect&) const
+{
+}
+
+void RenderThemeQt::computeControlRect(QStyleFacade::ButtonType, FloatRect&) const
+{
+}
+
void RenderThemeQt::adjustRepaintRect(const RenderObject& o, FloatRect& rect)
{
switch (o.style().appearance()) {
case CheckboxPart:
+ computeControlRect(QStyleFacade::CheckBox, rect);
break;
case RadioPart:
+ computeControlRect(QStyleFacade::RadioButton, rect);
break;
case PushButtonPart:
case ButtonPart: {
diff --git a/Source/WebCore/platform/qt/RenderThemeQt.h b/Source/WebCore/platform/qt/RenderThemeQt.h
index 355b372c4..ee572bace 100644
--- a/Source/WebCore/platform/qt/RenderThemeQt.h
+++ b/Source/WebCore/platform/qt/RenderThemeQt.h
@@ -22,6 +22,7 @@
#ifndef RenderThemeQt_h
#define RenderThemeQt_h
+#include "QStyleFacade.h"
#include "RenderTheme.h"
#include <QBrush>
@@ -166,6 +167,8 @@ protected:
virtual QRect inflateButtonRect(const QRect& originalRect) const;
virtual QRectF inflateButtonRect(const QRectF& originalRect) const;
+ virtual void computeControlRect(QStyleFacade::ButtonType, QRect& originalRect) const;
+ virtual void computeControlRect(QStyleFacade::ButtonType, FloatRect& originalRect) const;
virtual void setPopupPadding(RenderStyle&) const = 0;