summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/qt
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/qt')
-rw-r--r--Source/WebCore/platform/qt/CursorQt.cpp83
-rw-r--r--Source/WebCore/platform/qt/FileSystemQt.cpp2
-rw-r--r--Source/WebCore/platform/qt/PasteboardQt.cpp2
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQStyle.cpp8
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQStyle.h2
5 files changed, 46 insertions, 51 deletions
diff --git a/Source/WebCore/platform/qt/CursorQt.cpp b/Source/WebCore/platform/qt/CursorQt.cpp
index ffec6715a..6f27b671c 100644
--- a/Source/WebCore/platform/qt/CursorQt.cpp
+++ b/Source/WebCore/platform/qt/CursorQt.cpp
@@ -49,17 +49,12 @@ Cursor::Cursor(const Cursor& other)
, m_image(other.m_image)
, m_hotSpot(other.m_hotSpot)
#ifndef QT_NO_CURSOR
- , m_platformCursor(other.m_platformCursor ? new QCursor(*other.m_platformCursor) : 0)
+ , m_platformCursor(other.m_platformCursor)
#endif
{
}
-Cursor::~Cursor()
-{
-#ifndef QT_NO_CURSOR
- delete m_platformCursor;
-#endif
-}
+Cursor::~Cursor() = default;
Cursor& Cursor::operator=(const Cursor& other)
{
@@ -67,18 +62,18 @@ Cursor& Cursor::operator=(const Cursor& other)
m_image = other.m_image;
m_hotSpot = other.m_hotSpot;
#ifndef QT_NO_CURSOR
- m_platformCursor = other.m_platformCursor ? new QCursor(*other.m_platformCursor) : 0;
+ m_platformCursor = other.m_platformCursor;
#endif
return *this;
}
#ifndef QT_NO_CURSOR
-static QCursor* createCustomCursor(Image* image, const IntPoint& hotSpot)
+static Optional<QCursor> createCustomCursor(Image* image, const IntPoint& hotSpot)
{
if (!image->nativeImageForCurrentFrame())
- return 0;
+ return Nullopt;
IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
- return new QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y());
+ return QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y());
}
#endif
@@ -90,117 +85,117 @@ void Cursor::ensurePlatformCursor() const
switch (m_type) {
case Pointer:
- m_platformCursor = new QCursor(Qt::ArrowCursor);
+ m_platformCursor = QCursor(Qt::ArrowCursor);
break;
case Cross:
- m_platformCursor = new QCursor(Qt::CrossCursor);
+ m_platformCursor = QCursor(Qt::CrossCursor);
break;
case Hand:
- m_platformCursor = new QCursor(Qt::PointingHandCursor);
+ m_platformCursor = QCursor(Qt::PointingHandCursor);
break;
case IBeam:
- m_platformCursor = new QCursor(Qt::IBeamCursor);
+ m_platformCursor = QCursor(Qt::IBeamCursor);
break;
case Wait:
- m_platformCursor = new QCursor(Qt::WaitCursor);
+ m_platformCursor = QCursor(Qt::WaitCursor);
break;
case Help:
- m_platformCursor = new QCursor(Qt::WhatsThisCursor);
+ m_platformCursor = QCursor(Qt::WhatsThisCursor);
break;
case EastResize:
case EastPanning:
- m_platformCursor = new QCursor(Qt::SizeHorCursor);
+ m_platformCursor = QCursor(Qt::SizeHorCursor);
break;
case NorthResize:
case NorthPanning:
- m_platformCursor = new QCursor(Qt::SizeVerCursor);
+ m_platformCursor = QCursor(Qt::SizeVerCursor);
break;
case NorthEastResize:
case NorthEastPanning:
- m_platformCursor = new QCursor(Qt::SizeBDiagCursor);
+ m_platformCursor = QCursor(Qt::SizeBDiagCursor);
break;
case NorthWestResize:
case NorthWestPanning:
- m_platformCursor = new QCursor(Qt::SizeFDiagCursor);
+ m_platformCursor = QCursor(Qt::SizeFDiagCursor);
break;
case SouthResize:
case SouthPanning:
- m_platformCursor = new QCursor(Qt::SizeVerCursor);
+ m_platformCursor = QCursor(Qt::SizeVerCursor);
break;
case SouthEastResize:
case SouthEastPanning:
- m_platformCursor = new QCursor(Qt::SizeFDiagCursor);
+ m_platformCursor = QCursor(Qt::SizeFDiagCursor);
break;
case SouthWestResize:
case SouthWestPanning:
- m_platformCursor = new QCursor(Qt::SizeBDiagCursor);
+ m_platformCursor = QCursor(Qt::SizeBDiagCursor);
break;
case WestResize:
case WestPanning:
- m_platformCursor = new QCursor(Qt::SizeHorCursor);
+ m_platformCursor = QCursor(Qt::SizeHorCursor);
break;
case NorthSouthResize:
- m_platformCursor = new QCursor(Qt::SizeVerCursor);
+ m_platformCursor = QCursor(Qt::SizeVerCursor);
break;
case EastWestResize:
- m_platformCursor = new QCursor(Qt::SizeHorCursor);
+ m_platformCursor = QCursor(Qt::SizeHorCursor);
break;
case NorthEastSouthWestResize:
- m_platformCursor = new QCursor(Qt::SizeBDiagCursor);
+ m_platformCursor = QCursor(Qt::SizeBDiagCursor);
break;
case NorthWestSouthEastResize:
- m_platformCursor = new QCursor(Qt::SizeFDiagCursor);
+ m_platformCursor = QCursor(Qt::SizeFDiagCursor);
break;
case ColumnResize:
- m_platformCursor = new QCursor(Qt::SplitHCursor);
+ m_platformCursor = QCursor(Qt::SplitHCursor);
break;
case RowResize:
- m_platformCursor = new QCursor(Qt::SplitVCursor);
+ m_platformCursor = QCursor(Qt::SplitVCursor);
break;
case MiddlePanning:
case Move:
- m_platformCursor = new QCursor(Qt::SizeAllCursor);
+ m_platformCursor = QCursor(Qt::SizeAllCursor);
break;
case None:
- m_platformCursor = new QCursor(Qt::BlankCursor);
+ m_platformCursor = QCursor(Qt::BlankCursor);
break;
case NoDrop:
case NotAllowed:
- m_platformCursor = new QCursor(Qt::ForbiddenCursor);
+ m_platformCursor = QCursor(Qt::ForbiddenCursor);
break;
case Grab:
case Grabbing:
notImplemented();
- m_platformCursor = new QCursor(Qt::ArrowCursor);
+ m_platformCursor = QCursor(Qt::ArrowCursor);
break;
case VerticalText:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7);
break;
case Cell:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7);
break;
case ContextMenu:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2);
break;
case Alias:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3);
break;
case Progress:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2);
break;
case Copy:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2);
break;
case ZoomIn:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7);
break;
case ZoomOut:
- m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7);
+ m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7);
break;
case Custom:
m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot);
if (!m_platformCursor)
- m_platformCursor = new QCursor(Qt::ArrowCursor);
+ m_platformCursor = QCursor(Qt::ArrowCursor);
break;
default:
ASSERT_NOT_REACHED();
diff --git a/Source/WebCore/platform/qt/FileSystemQt.cpp b/Source/WebCore/platform/qt/FileSystemQt.cpp
index 167ff8354..7f62d0e1f 100644
--- a/Source/WebCore/platform/qt/FileSystemQt.cpp
+++ b/Source/WebCore/platform/qt/FileSystemQt.cpp
@@ -257,7 +257,7 @@ int writeToFile(PlatformFileHandle handle, const char* data, int length)
bool unloadModule(PlatformModule module)
{
-#if defined(Q_OS_MAC)
+#if defined(Q_OS_MACOS)
CFRelease(module);
return true;
diff --git a/Source/WebCore/platform/qt/PasteboardQt.cpp b/Source/WebCore/platform/qt/PasteboardQt.cpp
index 2bc766782..2b4a2220c 100644
--- a/Source/WebCore/platform/qt/PasteboardQt.cpp
+++ b/Source/WebCore/platform/qt/PasteboardQt.cpp
@@ -131,7 +131,7 @@ void Pasteboard::writeSelection(Range& selectedRange, bool canSmartCopyOrDelete,
m_writableData->setText(text);
QString markup = createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs);
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
markup.prepend(QLatin1String("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>"));
markup.append(QLatin1String("</body></html>"));
m_writableData->setData(QLatin1String("text/html"), markup.toUtf8());
diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
index 706570399..8c6bbba03 100644
--- a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
+++ b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
@@ -130,7 +130,7 @@ RenderThemeQStyle::RenderThemeQStyle(Page* page)
{
int buttonPixelSize = 0;
m_qStyle->getButtonMetrics(&m_buttonFontFamily, &buttonPixelSize);
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
m_buttonFontPixelSize = buttonPixelSize;
#endif
}
@@ -288,7 +288,7 @@ void RenderThemeQStyle::adjustButtonStyle(StyleResolver& styleResolver, RenderSt
// Ditch the border.
style.resetBorder();
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
if (style.appearance() == PushButtonPart) {
// The Mac ports ignore the specified height for <input type="button"> elements
// unless a border and/or background CSS property is also specified.
@@ -299,7 +299,7 @@ void RenderThemeQStyle::adjustButtonStyle(StyleResolver& styleResolver, RenderSt
FontCascadeDescription fontDescription = style.fontDescription();
fontDescription.setIsAbsoluteSize(true);
-#ifdef Q_OS_MAC // Use fixed font size and family on Mac (like Safari does)
+#ifdef Q_OS_MACOS // Use fixed font size and family on Mac (like Safari does)
fontDescription.setSpecifiedSize(m_buttonFontPixelSize);
fontDescription.setComputedSize(m_buttonFontPixelSize);
#else
@@ -601,7 +601,7 @@ ControlPart RenderThemeQStyle::initializeCommonQStyleOptions(QStyleFacadeOption
option.state &= ~(QStyleFacade::State_HasFocus | QStyleFacade::State_MouseOver);
option.state |= QStyleFacade::State_Enabled;
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
// to render controls in correct positions we also should set the State_Active flag
option.state |= QStyleFacade::State_Active;
#endif
diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.h b/Source/WebCore/platform/qt/RenderThemeQStyle.h
index 665eee005..463404b7d 100644
--- a/Source/WebCore/platform/qt/RenderThemeQStyle.h
+++ b/Source/WebCore/platform/qt/RenderThemeQStyle.h
@@ -110,7 +110,7 @@ private:
QRect indicatorRect(QStyleFacade::ButtonType part, const QRect& originalRect) const;
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
int m_buttonFontPixelSize;
#endif