[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

ariya at webkit.org ariya at webkit.org
Wed Dec 22 18:44:30 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b95d128039dabde2ea046189936cf2c9aa638317
Author: ariya at webkit.org <ariya at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 17 01:44:53 2010 +0000

    2010-12-16  Ariya Hidayat  <ariya at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt] GraphicsContext should respect QWebView render hints
            https://bugs.webkit.org/show_bug.cgi?id=51208
    
            GraphicsContext does not override SmoothPixmapTransform (see also
            r62762). To keep the same behavior, canvas default image interpolation
            quality is set to medium and QWebView's render hints by default also
            include SmoothPixmapTransform.
    
            * html/HTMLCanvasElement.h:
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
    2010-12-16  Ariya Hidayat  <ariya at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt] GraphicsContext should respect QWebView render hints
            https://bugs.webkit.org/show_bug.cgi?id=51208
    
            Add some checks to ensure that GraphicsContext (via QWebFrame)
            does not clobber the render hints.
    
            * Api/qwebview.cpp:
            (QWebViewPrivate::QWebViewPrivate):
            * tests/qwebframe/tst_qwebframe.cpp:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74220 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b23134c..11e66f0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-16  Ariya Hidayat  <ariya at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] GraphicsContext should respect QWebView render hints
+        https://bugs.webkit.org/show_bug.cgi?id=51208
+
+        GraphicsContext does not override SmoothPixmapTransform (see also
+        r62762). To keep the same behavior, canvas default image interpolation
+        quality is set to medium and QWebView's render hints by default also
+        include SmoothPixmapTransform.
+
+        * html/HTMLCanvasElement.h:
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+
 2010-12-16  Daniel Bates  <dbates at rim.com>
 
         Formatting fix; un-indent one level all lines in [2793, 2808] (with respect to r74217)
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index ba2b99d..281ea5d 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -32,7 +32,7 @@
 #include "HTMLElement.h"
 #include "IntSize.h"
 
-#if PLATFORM(CHROMIUM)
+#if PLATFORM(CHROMIUM) || PLATFORM(QT)
 #define DefaultInterpolationQuality InterpolationMedium
 #elif PLATFORM(CG)
 #define DefaultInterpolationQuality InterpolationLow
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 2f8a91f..92dd3e4 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -237,7 +237,7 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, cons
     // Use the default the QPainter was constructed with.
     antiAliasingForRectsAndLines = painter->testRenderHint(QPainter::Antialiasing);
 
-    painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, true);
+    painter->setRenderHint(QPainter::Antialiasing, true);
 }
 
 GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index a04b5f2..31ee521 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -39,7 +39,7 @@ public:
     QWebViewPrivate(QWebView *view)
         : view(view)
         , page(0)
-        , renderHints(QPainter::TextAntialiasing)
+        , renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform)
     {
         Q_ASSERT(view);
     }
@@ -713,7 +713,7 @@ qreal QWebView::textSizeMultiplier() const
 
     These hints are used to initialize QPainter before painting the Web page.
 
-    QPainter::TextAntialiasing is enabled by default.
+    QPainter::TextAntialiasing and QPainter::SmoothPixmapTransform are enabled by default.
 
     \note This property is not available on Symbian. However, the getter and
     setter functions can still be used directly.
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index aac0b64..eaa40e8 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-16  Ariya Hidayat  <ariya at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] GraphicsContext should respect QWebView render hints
+        https://bugs.webkit.org/show_bug.cgi?id=51208
+
+        Add some checks to ensure that GraphicsContext (via QWebFrame)
+        does not clobber the render hints.
+
+        * Api/qwebview.cpp:
+        (QWebViewPrivate::QWebViewPrivate):
+        * tests/qwebframe/tst_qwebframe.cpp:
+
 2010-12-15  Laszlo Gombos  <laszlo.1.gombos at nokia.com>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 6923315..2ae85e4 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -29,6 +29,7 @@
 #include <QAbstractItemView>
 #include <QApplication>
 #include <QComboBox>
+#include <QPaintEngine>
 #include <QPicture>
 #include <QRegExp>
 #include <QNetworkRequest>
@@ -616,6 +617,7 @@ private slots:
     void baseUrl();
     void hasSetFocus();
     void render();
+    void renderHints();
     void scrollPosition();
     void scrollToAnchor();
     void scrollbarsOff();
@@ -2857,6 +2859,139 @@ void tst_QWebFrame::render()
     QCOMPARE(size.height(), picture.boundingRect().height()); // height: 100px
 }
 
+
+class DummyPaintEngine: public QPaintEngine {
+public:
+
+    DummyPaintEngine()
+        : QPaintEngine(QPaintEngine::AllFeatures)
+        , renderHints(0)
+    {
+    }
+
+    bool begin(QPaintDevice*)
+    {
+        setActive(true);
+        return true;
+    }
+
+    bool end()
+    {
+        setActive(false);
+        return false;
+    }
+
+    void updateState(const QPaintEngineState& state)
+    {
+        renderHints = state.renderHints();
+    }
+
+    void drawPath(const QPainterPath&) { }
+    void drawPixmap(const QRectF&, const QPixmap&, const QRectF&) { }
+
+    QPaintEngine::Type type() const
+    {
+        return static_cast<QPaintEngine::Type>(QPaintEngine::User + 2);
+    }
+
+    QPainter::RenderHints renderHints;
+};
+
+class DummyPaintDevice: public QPaintDevice {
+public:
+    DummyPaintDevice()
+        : QPaintDevice()
+        , m_engine(new DummyPaintEngine)
+    {
+    }
+
+    ~DummyPaintDevice()
+    {
+        delete m_engine;
+    }
+
+    QPaintEngine* paintEngine() const
+    {
+        return m_engine;
+    }
+
+    QPainter::RenderHints renderHints() const
+    {
+        return m_engine->renderHints;
+    }
+
+protected:
+    int metric(PaintDeviceMetric metric) const;
+
+private:
+    DummyPaintEngine* m_engine;
+    friend class DummyPaintEngine;
+};
+
+
+int DummyPaintDevice::metric(PaintDeviceMetric metric) const
+{
+    switch (metric) {
+    case PdmWidth:
+        return 400;
+        break;
+
+    case PdmHeight:
+        return 200;
+        break;
+
+    case PdmNumColors:
+        return INT_MAX;
+        break;
+
+    case PdmDepth:
+        return 32;
+        break;
+
+    default:
+        break;
+    }
+    return 0;
+}
+
+void tst_QWebFrame::renderHints()
+{
+    QString html("<html><body><p>Hello, world!</p></body></html>");
+
+    QWebPage page;
+    page.mainFrame()->setHtml(html);
+    page.setViewportSize(page.mainFrame()->contentsSize());
+
+    // We will call frame->render and trap the paint engine state changes
+    // to ensure that GraphicsContext does not clobber the render hints.
+    DummyPaintDevice buffer;
+    QPainter painter(&buffer);
+
+    painter.setRenderHint(QPainter::TextAntialiasing, false);
+    page.mainFrame()->render(&painter);
+    QVERIFY(!(buffer.renderHints() & QPainter::TextAntialiasing));
+    QVERIFY(!(buffer.renderHints() & QPainter::SmoothPixmapTransform));
+    QVERIFY(!(buffer.renderHints() & QPainter::HighQualityAntialiasing));
+
+    painter.setRenderHint(QPainter::TextAntialiasing, true);
+    page.mainFrame()->render(&painter);
+    QVERIFY(buffer.renderHints() & QPainter::TextAntialiasing);
+    QVERIFY(!(buffer.renderHints() & QPainter::SmoothPixmapTransform));
+    QVERIFY(!(buffer.renderHints() & QPainter::HighQualityAntialiasing));
+
+    painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
+    page.mainFrame()->render(&painter);
+    QVERIFY(buffer.renderHints() & QPainter::TextAntialiasing);
+    QVERIFY(buffer.renderHints() & QPainter::SmoothPixmapTransform);
+    QVERIFY(!(buffer.renderHints() & QPainter::HighQualityAntialiasing));
+
+    painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
+    page.mainFrame()->render(&painter);
+    QVERIFY(buffer.renderHints() & QPainter::TextAntialiasing);
+    QVERIFY(buffer.renderHints() & QPainter::SmoothPixmapTransform);
+    QVERIFY(buffer.renderHints() & QPainter::HighQualityAntialiasing);
+}
+
 void tst_QWebFrame::scrollPosition()
 {
     // enlarged image in a small viewport, to provoke the scrollbars to appear

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list