+2006-08-19 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Eric. Landed by rwlbuis.
+
+ Next chunk of the implementation for:
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=10467
+
+ WebKit should have Qt platform support
+
+ * platform/qt/AffineTransformQt.cpp: Added.
+ (WebCore::AffineTransform::AffineTransform):
+ (WebCore::AffineTransform::setMatrix):
+ (WebCore::AffineTransform::map):
+ (WebCore::AffineTransform::mapRect):
+ (WebCore::AffineTransform::isIdentity):
+ (WebCore::AffineTransform::m11):
+ (WebCore::AffineTransform::m12):
+ (WebCore::AffineTransform::m21):
+ (WebCore::AffineTransform::m22):
+ (WebCore::AffineTransform::dx):
+ (WebCore::AffineTransform::dy):
+ (WebCore::AffineTransform::reset):
+ (WebCore::AffineTransform::scale):
+ (WebCore::AffineTransform::rotate):
+ (WebCore::AffineTransform::translate):
+ (WebCore::AffineTransform::shear):
+ (WebCore::AffineTransform::det):
+ (WebCore::AffineTransform::invert):
+ (WebCore::AffineTransform::operator QMatrix):
+ (WebCore::AffineTransform::operator==):
+ (WebCore::AffineTransform::operator*=):
+ (WebCore::AffineTransform::operator*):
+ * platform/qt/BrowserExtensionQt.cpp: Added.
+ (WebCore::BrowserExtensionQt::BrowserExtensionQt):
+ (WebCore::BrowserExtensionQt::canRunModal):
+ (WebCore::BrowserExtensionQt::createNewWindow):
+ (WebCore::BrowserExtensionQt::canRunModalNow):
+ (WebCore::BrowserExtensionQt::runModal):
+ (WebCore::BrowserExtensionQt::goBackOrForward):
+ (WebCore::BrowserExtensionQt::historyURL):
+ (WebCore::BrowserExtensionQt::setTypedIconURL):
+ (WebCore::BrowserExtensionQt::setIconURL):
+ (WebCore::BrowserExtensionQt::getHistoryLength):
+ * platform/qt/BrowserExtensionQt.h: Added.
+ * platform/qt/CookieJarQt.cpp: Added.
+ (WebCore::setCookies):
+ (WebCore::cookies):
+ (WebCore::cookiesEnabled):
+ * platform/qt/PageQt.cpp: Added.
+ (WebCore::rootWindowForFrame):
+ (WebCore::Page::windowRect):
+ (WebCore::Page::setWindowRect):
+ * platform/qt/PathQt.cpp: Added.
+ (WebCore::Path::Path):
+ (WebCore::Path::~Path):
+ (WebCore::Path::operator=):
+ (WebCore::Path::contains):
+ (WebCore::Path::translate):
+ (WebCore::Path::boundingRect):
+ (WebCore::Path::moveTo):
+ (WebCore::Path::addLineTo):
+ (WebCore::Path::addQuadCurveTo):
+ (WebCore::Path::addBezierCurveTo):
+ (WebCore::Path::addArcTo):
+ (WebCore::Path::closeSubpath):
+ (WebCore::Path::addArc):
+ (WebCore::Path::addRect):
+ (WebCore::Path::addEllipse):
+ (WebCore::Path::clear):
+ * platform/qt/ScreenQt.cpp: Added.
+ (WebCore::screenRect):
+ (WebCore::screenDepth):
+ (WebCore::usableScreenRect):
+
+
2006-08-19 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Eric. Landed by rwlbuis.
--- /dev/null
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AffineTransform.h"
+
+#include "IntRect.h"
+#include "FloatRect.h"
+
+namespace WebCore {
+
+AffineTransform::AffineTransform()
+ : m_transform()
+{
+}
+
+AffineTransform::AffineTransform(double a, double b, double c, double d, double tx, double ty)
+ : m_transform(a, b, c, d, tx, ty)
+{
+}
+
+AffineTransform::AffineTransform(const QMatrix& matrix)
+ : m_transform(matrix)
+{
+}
+
+void AffineTransform::setMatrix(double a, double b, double c, double d, double tx, double ty)
+{
+ m_transform.setMatrix(a, b, c, d, tx, ty);
+}
+
+void AffineTransform::map(double x, double y, double* x2, double* y2) const
+{
+ m_transform.map(x, y, x2, y2);
+}
+
+IntRect AffineTransform::mapRect(const IntRect& rect) const
+{
+ return m_transform.mapRect(rect);
+}
+
+FloatRect AffineTransform::mapRect(const FloatRect& rect) const
+{
+ return m_transform.mapRect(rect);
+}
+
+bool AffineTransform::isIdentity() const
+{
+ return m_transform.isIdentity();
+}
+
+double AffineTransform::m11() const
+{
+ return m_transform.m11();
+}
+
+double AffineTransform::m12() const
+{
+ return m_transform.m12();
+}
+
+double AffineTransform::m21() const
+{
+ return m_transform.m21();
+}
+
+double AffineTransform::m22() const
+{
+ return m_transform.m22();
+}
+
+double AffineTransform::dx() const
+{
+ return m_transform.dx();
+}
+
+double AffineTransform::dy() const
+{
+ return m_transform.dy();
+}
+
+void AffineTransform::reset()
+{
+ m_transform.reset();
+}
+
+AffineTransform& AffineTransform::scale(double sx, double sy)
+{
+ m_transform.scale(sx, sy);
+ return *this;
+}
+
+AffineTransform& AffineTransform::rotate(double d)
+{
+ m_transform.rotate(d);
+ return *this;
+}
+
+AffineTransform& AffineTransform::translate(double tx, double ty)
+{
+ m_transform.translate(tx, ty);
+ return *this;
+}
+
+AffineTransform& AffineTransform::shear(double sx, double sy)
+{
+ m_transform.shear(sx, sy);
+ return *this;
+}
+
+double AffineTransform::det() const
+{
+ return m_transform.det();
+}
+
+AffineTransform AffineTransform::invert() const
+{
+ if(!isInvertible())
+ return AffineTransform();
+
+ return m_transform.inverted();
+}
+
+AffineTransform::operator QMatrix() const
+{
+ return m_transform;
+}
+
+bool AffineTransform::operator==(const AffineTransform& other) const
+{
+ return m_transform == other.m_transform;
+}
+
+AffineTransform& AffineTransform::operator*=(const AffineTransform& other)
+{
+ m_transform *= other.m_transform;
+ return *this;
+}
+
+AffineTransform AffineTransform::operator*(const AffineTransform& other)
+{
+ return m_transform * other.m_transform;
+}
+
+}
+
+// vim: ts=4 sw=4 et
--- /dev/null
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HelperQt.h"
+#include "BrowserExtensionQt.h"
+
+namespace WebCore {
+
+BrowserExtensionQt::BrowserExtensionQt(Frame* frame)
+ : m_frame(frame)
+{
+}
+
+bool BrowserExtensionQt::canRunModal()
+{
+ notImplemented();
+ return false;
+}
+
+void BrowserExtensionQt::createNewWindow(const ResourceRequest& request)
+{
+}
+
+void BrowserExtensionQt::createNewWindow(const ResourceRequest& request, const WindowArgs& args, Frame*& frame)
+{
+ notImplemented();
+}
+
+bool BrowserExtensionQt::canRunModalNow()
+{
+ notImplemented();
+ return false;
+}
+
+void BrowserExtensionQt::runModal()
+{
+ notImplemented();
+}
+
+void BrowserExtensionQt::goBackOrForward(int)
+{
+ notImplemented();
+}
+
+KURL BrowserExtensionQt::historyURL(int distance)
+{
+ notImplemented();
+ return KURL();
+}
+
+void BrowserExtensionQt::setTypedIconURL(KURL const&, const String&)
+{
+ notImplemented();
+}
+
+void BrowserExtensionQt::setIconURL(KURL const&)
+{
+ notImplemented();
+}
+
+int BrowserExtensionQt::getHistoryLength()
+{
+ notImplemented();
+ return 0;
+}
+
+}
+
+// vim: ts=4 sw=4 et
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BrowserExtensionQt_H_
+#define BrowserExtensionQt_H_
+
+#include "BrowserExtension.h"
+
+namespace WebCore {
+
+class Frame;
+
+class BrowserExtensionQt : public BrowserExtension {
+public:
+ BrowserExtensionQt(Frame*);
+
+ virtual void createNewWindow(const ResourceRequest&);
+ virtual void createNewWindow(const ResourceRequest&, const WindowArgs&, Frame*&);
+
+ virtual void setIconURL(const KURL&);
+ virtual void setTypedIconURL(const KURL&, const String& type);
+
+ virtual int getHistoryLength();
+ virtual void goBackOrForward(int distance);
+ virtual KURL historyURL(int distance);
+
+ virtual bool canRunModal();
+ virtual bool canRunModalNow();
+ virtual void runModal();
+
+private:
+ Frame* m_frame;
+};
+
+}
+
+#endif
+
+// vim: ts=4 sw=4 et
--- /dev/null
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CookieJar.h"
+
+#include "DeprecatedString.h"
+#include "KURL.h"
+#include "PlatformString.h"
+#include "StringHash.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+static HashMap<String, String> cookieJar;
+
+void setCookies(const KURL& url, const KURL& /*policyURL*/, const String& value)
+{
+ cookieJar.set(url.url(), value);
+}
+
+String cookies(const KURL& url)
+{
+ return cookieJar.get(url.url());
+}
+
+bool cookiesEnabled()
+{
+ return true;
+}
+
+}
+
+// vim: ts=4 sw=4 et
--- /dev/null
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <QDebug>
+#include <QWidget>
+
+#include "config.h"
+#include "Page.h"
+
+#include "IntRect.h"
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameView.h"
+
+namespace WebCore {
+
+static QWidget* rootWindowForFrame(const Frame* frame)
+{
+ FrameView* frameView = (frame ? frame->view() : 0);
+ if (!frameView)
+ return 0;
+
+ return frameView->qwidget();
+}
+
+FloatRect Page::windowRect() const
+{
+ QWidget* widget = rootWindowForFrame(mainFrame());
+ if (!widget)
+ return FloatRect();
+
+ qDebug() << " Page::windowRect() -> " << (QRectF) widget->geometry();
+ return (IntRect) widget->geometry();
+}
+
+void Page::setWindowRect(const FloatRect& r)
+{
+ qDebug() << " Page::setWindowRect() -> " << (QRectF) r;
+
+ QWidget* widget = rootWindowForFrame(mainFrame());
+ if (widget)
+ widget->setGeometry(QRect(qRound(r.x()), qRound(r.y()), qRound(r.width()), qRound(r.height())));
+}
+
+}
+
+// vim: ts=4 sw=4 et
--- /dev/null
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Path.h"
+
+#include "FloatRect.h"
+#include <QPainterPath>
+#include <QMatrix>
+
+#include <math.h>
+
+namespace WebCore {
+
+Path::Path()
+ : m_path(new QPainterPath())
+{
+}
+
+Path::~Path()
+{
+ delete m_path;
+ m_path = 0;
+}
+
+Path::Path(const Path& other)
+ : m_path(new QPainterPath(*other.platformPath()))
+{
+}
+
+Path& Path::operator=(const Path& other)
+{
+ if (&other != this) {
+ delete m_path;
+ m_path = new QPainterPath(*other.platformPath());
+ }
+
+ return *this;
+}
+
+bool Path::contains(const FloatPoint& point) const
+{
+ return m_path->contains(point);
+}
+
+void Path::translate(const FloatSize& size)
+{
+ QMatrix matrix;
+ matrix.translate(size.width(), size.height());
+ *m_path = (*m_path) * matrix;
+}
+
+FloatRect Path::boundingRect() const
+{
+ return m_path->boundingRect();
+}
+
+void Path::moveTo(const FloatPoint& point)
+{
+ m_path->moveTo(point);
+}
+
+void Path::addLineTo(const FloatPoint& p)
+{
+ m_path->lineTo(p);
+}
+
+void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p)
+{
+ m_path->quadTo(cp, p);
+}
+
+void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p)
+{
+ m_path->cubicTo(cp1, cp2, p);
+}
+
+void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
+{
+ //FIXME: busted
+ qWarning("arcTo is busted");
+ m_path->arcTo(p1.x(), p1.y(), p2.x(), p2.y(), radius, 90);
+}
+
+void Path::closeSubpath()
+{
+ m_path->closeSubpath();
+}
+
+#define DEGREES(t) ((t) * 180.0 / M_PI)
+void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise)
+{
+ qreal xc = p.x();
+ qreal yc = p.y();
+ qreal radius = r;
+
+
+ //### HACK
+ // In Qt we don't switch the coordinate system for degrees
+ // and still use the 0,0 as bottom left for degrees so we need
+ // to switch
+ sar = -sar;
+ ear = -ear;
+ anticlockwise = !anticlockwise;
+ //end hack
+
+ float sa = DEGREES(sar);
+ float ea = DEGREES(ear);
+
+ double span = 0;
+
+ double xs = xc - radius;
+ double ys = yc - radius;
+ double width = radius*2;
+ double height = radius*2;
+
+ if (!anticlockwise && (ea < sa))
+ span += 360;
+ else if (anticlockwise && (sa < ea))
+ span -= 360;
+
+ //### this is also due to switched coordinate system
+ // we would end up with a 0 span instead of 360
+ if (!(qFuzzyCompare(span + (ea - sa), 0.0) &&
+ qFuzzyCompare(abs(span), 360.0))) {
+ span += ea - sa;
+ }
+
+ m_path->moveTo(QPointF(xc + radius * cos(sar),
+ yc - radius * sin(sar)));
+ m_path->arcTo(xs, ys, width, height, sa, span);
+}
+
+void Path::addRect(const FloatRect& r)
+{
+ m_path->addRect(r.x(), r.y(), r.width(), r.height());
+}
+
+void Path::addEllipse(const FloatRect& r)
+{
+ m_path->addEllipse(r.x(), r.y(), r.width(), r.height());
+}
+
+void Path::clear()
+{
+ *m_path = QPainterPath();
+}
+
+}
+
+// vim: ts=4 sw=4 et
--- /dev/null
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Screen.h"
+
+#include "Widget.h"
+#include "IntRect.h"
+#include "HelperQt.h"
+#include "FloatRect.h"
+
+#include <QApplication>
+#include <QDesktopWidget>
+
+namespace WebCore {
+
+FloatRect screenRect(Widget* widget)
+{
+ QWidget* qw = widget->qwidget();
+ if (!qw)
+ return FloatRect();
+
+ // Taken from KGlobalSettings::desktopGeometry
+ QDesktopWidget* dw = QApplication::desktop();
+ if (!dw)
+ return FloatRect();
+
+ return (IntRect) dw->screenGeometry(qw);
+}
+
+int screenDepth(Widget* widget)
+{
+ QWidget* qw = widget->qwidget();
+ if (!qw)
+ return 32;
+
+ return qw->depth();
+}
+
+FloatRect usableScreenRect(Widget* widget)
+{
+ QWidget* qw = widget->qwidget();
+ if (!qw)
+ return FloatRect();
+
+ // Taken from KGlobalSettings::desktopGeometry
+ QDesktopWidget* dw = QApplication::desktop();
+ if (!dw)
+ return FloatRect();
+
+ return (IntRect) dw->availableGeometry(qw);
+}
+
+}
+
+// vim: ts=4 sw=4 et