summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-05-19 15:54:46 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-05-19 15:54:46 (GMT)
commite9dec649afc2e513354c79f6e38ca53b6943cccc (patch)
treec3947491e089a1d1d82148481c80ab4e46a49741 /src/3rdparty
parent92b47ba61809de30eed205e7d1eafb1cde1087e1 (diff)
parent90b4f0ca7b9fe21f6c4b39a80f8f9cf98626690a (diff)
downloadQt-e9dec649afc2e513354c79f6e38ca53b6943cccc.zip
Qt-e9dec649afc2e513354c79f6e38ca53b6943cccc.tar.gz
Qt-e9dec649afc2e513354c79f6e38ca53b6943cccc.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog90
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp27
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp19
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h3
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog11
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp39
11 files changed, 202 insertions, 20 deletions
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 26ce489..9f85d76 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -8,4 +8,4 @@ The commit imported was from the
and has the sha1 checksum
- a6ebe3865025e2bb4d767a79435af4daf5a9b4db
+ 7b8d6ab6f2b73862d11c2a41ab0223e55585d88f
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 00bd427..23f3ca6 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,93 @@
+2009-05-18 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Done together with Balazs Kelemen <kelemen.balazs@stud.u-szeged.hu>.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24551
+
+ [Qt] Reuse FontPlatformData for the same FontDescription.
+ This effectively prevents growing heap usage for loading every web page.
+
+ * platform/graphics/qt/FontCacheQt.cpp:
+ (WebCore::qHash): Necessary for FontPlatformDataCache.
+ (WebCore::FontCache::getCachedFontPlatformData): Reuse the instance if
+ it exists, otherwise create a new one and insert it in the cache.
+
+2009-05-18 Balazs Kelemen <kelemen.balazs@stud.u-szeged.hu>
+
+ Reviewed by Ariya Hidayat.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24551
+
+ [Qt] Fix the leak in FontFallbackList::fontDataAt() function.
+ When creating a new instance of SimpleFontData, put it in the font list
+ so that it can deleted later on.
+
+ * platform/graphics/qt/FontFallbackListQt.cpp:
+ (WebCore::FontFallbackList::invalidate):
+ (WebCore::FontFallbackList::releaseFontData):
+ (WebCore::FontFallbackList::fontDataAt):
+
+2009-05-15 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ [Qt] In the image decoder, remove the raw image data represented as QImage
+ once the image is converted to QPixmap and inserted in the pixmap cache.
+ This effectively reduces the heap usage when running on graphics system
+ other than raster (i.e the case where QImage != QPixmap).
+
+ * platform/graphics/qt/ImageDecoderQt.cpp:
+ (WebCore::ImageDecoderQt::imageAtIndex): Nullified the image on purpose.
+ * platform/graphics/qt/ImageDecoderQt.h: Made m_imageList mutable.
+
+2009-05-15 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ [Qt] Refactor alpha channel detection the image decoder.
+ Sets the boolean flag as soon as the image is being read.
+
+ * platform/graphics/qt/ImageDecoderQt.cpp:
+ (WebCore::ImageDecoderQt::ImageDecoderQt): Initialized m_hasAlphaChannel.
+ (WebCore::ImageDecoderQt::setData): Set the flag when appropriate.
+ (WebCore::ImageDecoderQt::supportsAlpha): Simplified.
+ (WebCore::ImageDecoderQt::reset): Resetted the flag.
+ * platform/graphics/qt/ImageDecoderQt.h: Added m_hasAlphaChannel.
+
+2009-05-13 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Sam Weinig.
+
+ [Qt] Fix "lighther" composition mode.
+ QPainter::CompositionMode_Plus is the right match.
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::toQtCompositionMode):
+
+2009-04-29 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Simon Fraser.
+
+ [Qt] Initialize GraphicsContext's and ImageBuffer's QPainter to match
+ the default values of canvas attributes.
+
+ * platform/graphics/qt/ImageBufferQt.cpp:
+ (WebCore::ImageBufferData::ImageBufferData):
+
+2009-04-27 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ https://bugs.webkit.org/show_bug.cgi?id=18475
+
+ [Qt] Widget painting should follow the layout direction (LTR, RTL)
+ of the element style, not the application layout direction.
+
+ * platform/qt/RenderThemeQt.cpp:
+ (WebCore::RenderThemeQt::applyTheme):
+
2009-03-13 Adam Bergkvist <adam.bergkvist@ericsson.com>
Reviewed by Alexey Proskuryakov.
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp
index 8a31861..5d1f147 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp
@@ -26,6 +26,9 @@
#include "FontDescription.h"
#include "FontPlatformData.h"
#include "Font.h"
+#include "StringHash.h"
+
+#include <QHash>
namespace WebCore {
@@ -33,9 +36,31 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigne
{
}
+typedef QHash<FontDescription, FontPlatformData*> FontPlatformDataCache;
+
+// using Q_GLOBAL_STATIC leads to crash. TODO investigate the way to fix this.
+static FontPlatformDataCache* gFontPlatformDataCache;
+
+uint qHash(const FontDescription& key)
+{
+ uint value = CaseFoldingHash::hash(key.family().family());
+ value ^= key.computedPixelSize();
+ value ^= static_cast<int>(key.weight());
+ return value;
+}
+
FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& description, const AtomicString& family, bool checkingAlternateName)
{
- return new FontPlatformData(description);
+ if (!gFontPlatformDataCache)
+ gFontPlatformDataCache = new FontPlatformDataCache;
+
+ FontPlatformData* fontData = gFontPlatformDataCache->value(description, 0);
+ if (!fontData) {
+ fontData = new FontPlatformData(description);
+ gFontPlatformDataCache->insert(description, fontData);
+ }
+
+ return fontData;
}
SimpleFontData* FontCache::getCachedFontData(const FontPlatformData*)
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp
index 22ae205..50627b7 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp
@@ -42,8 +42,6 @@ FontFallbackList::FontFallbackList()
void FontFallbackList::invalidate(WTF::PassRefPtr<WebCore::FontSelector> fontSelector)
{
- releaseFontData();
- m_fontList.clear();
m_familyIndex = 0;
m_pitch = UnknownPitch;
m_loadingCustomFonts = false;
@@ -53,6 +51,9 @@ void FontFallbackList::invalidate(WTF::PassRefPtr<WebCore::FontSelector> fontSel
void FontFallbackList::releaseFontData()
{
+ if (m_fontList.size())
+ delete m_fontList[0].first;
+ m_fontList.clear();
}
void FontFallbackList::determinePitch(const WebCore::Font* font) const
@@ -90,7 +91,12 @@ const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigne
family = family->next();
}
- return new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing());
+ if (m_fontList.size())
+ return m_fontList[0].first;
+
+ const FontData* result = new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing());
+ m_fontList.append(pair<const FontData*, bool>(result, result->isCustomFont()));
+ return result;
}
const FontData* FontFallbackList::fontDataForCharacters(const WebCore::Font* font, const UChar*, int) const
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 6c90ea3..490b54b 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -98,7 +98,7 @@ static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op
case CompositeHighlight:
return QPainter::CompositionMode_SourceOver;
case CompositePlusLighter:
- return QPainter::CompositionMode_SourceOver;
+ return QPainter::CompositionMode_Plus;
}
return QPainter::CompositionMode_SourceOver;
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index 29a02d4..333269e 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -47,7 +47,24 @@ ImageBufferData::ImageBufferData(const IntSize& size)
: m_pixmap(size)
{
m_pixmap.fill(QColor(Qt::transparent));
- m_painter.set(new QPainter(&m_pixmap));
+
+ QPainter* painter = new QPainter(&m_pixmap);
+ m_painter.set(painter);
+
+ // Since ImageBuffer is used mainly for Canvas, explicitly initialize
+ // its painter's pen and brush with the corresponding canvas defaults
+ // NOTE: keep in sync with CanvasRenderingContext2D::State
+ QPen pen = painter->pen();
+ pen.setColor(Qt::black);
+ pen.setWidth(1);
+ pen.setCapStyle(Qt::FlatCap);
+ pen.setJoinStyle(Qt::MiterJoin);
+ pen.setMiterLimit(10);
+ painter->setPen(pen);
+ QBrush brush = painter->brush();
+ brush.setColor(Qt::black);
+ painter->setBrush(brush);
+ painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
}
ImageBuffer::ImageBuffer(const IntSize& size, bool grayScale, bool& success)
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
index 394c7a7..cd32428 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
@@ -197,7 +197,8 @@ ImageDecoderQt* ImageDecoderQt::create(const SharedBuffer& data)
}
ImageDecoderQt::ImageDecoderQt(const QString &imageFormat)
- : m_imageFormat(imageFormat)
+ : m_hasAlphaChannel(false)
+ , m_imageFormat(imageFormat)
{
}
@@ -212,6 +213,7 @@ bool ImageDecoderQt::hasFirstImageHeader() const
void ImageDecoderQt::reset()
{
+ m_hasAlphaChannel = false;
m_failed = false;
m_imageList.clear();
m_pixmapCache.clear();
@@ -230,6 +232,9 @@ void ImageDecoderQt::setData(const IncomingData &data, bool allDataReceived)
const ReadContext::ReadResult readResult = readContext.read(allDataReceived);
+ if (hasFirstImageHeader())
+ m_hasAlphaChannel = m_imageList[0].m_image.hasAlphaChannel();
+
if (debugImageDecoderQt)
qDebug() << " read returns " << readResult;
@@ -280,7 +285,7 @@ int ImageDecoderQt::repetitionCount() const
bool ImageDecoderQt::supportsAlpha() const
{
- return hasFirstImageHeader() && m_imageList[0].m_image.hasAlphaChannel();
+ return m_hasAlphaChannel;
}
int ImageDecoderQt::duration(size_t index) const
@@ -314,6 +319,10 @@ QPixmap* ImageDecoderQt::imageAtIndex(size_t index) const
if (!m_pixmapCache.contains(index)) {
m_pixmapCache.insert(index,
QPixmap::fromImage(m_imageList[index].m_image));
+
+ // store null image since the converted pixmap is already in pixmap cache
+ Q_ASSERT(m_imageList[index].m_imageState == ImageComplete);
+ m_imageList[index].m_image = QImage();
}
return &m_pixmapCache[index];
}
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h
index a2eb6aa..b8c3edd 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h
@@ -81,8 +81,9 @@ private:
int m_duration;
};
+ bool m_hasAlphaChannel;
typedef QList<ImageData> ImageList;
- ImageList m_imageList;
+ mutable ImageList m_imageList;
mutable QHash<int, QPixmap> m_pixmapCache;
int m_loopCount;
QString m_imageFormat;
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
index a9da76b..02d17ed 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
@@ -737,6 +737,10 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con
if (isHovered(o))
option.state |= QStyle::State_MouseOver;
+ option.direction = Qt::LeftToRight;
+ if (o->style() && o->style()->direction() == WebCore::RTL)
+ option.direction = Qt::RightToLeft;
+
ControlPart result = o->style()->appearance();
switch (result) {
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index c3bd633..2aeb8da 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,14 @@
+2009-03-27 Erik L. Bunce <elbunce@xendom.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24746
+
+ Improved selection tests.
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::textSelection):
+
2009-04-24 Simon Hausmann <simon.hausmann@nokia.com>
Rubber-stamped by Ariya Hidayat.
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index fe74fac..620aa31 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -872,14 +872,6 @@ void tst_QWebPage::textSelection()
"<p>May the source<br/>be with you!</p></body></html>");
page->mainFrame()->setHtml(content);
- // this will select the first paragraph
- QString script = "var range = document.createRange(); " \
- "var node = document.getElementById(\"one\"); " \
- "range.selectNode(node); " \
- "getSelection().addRange(range);";
- page->mainFrame()->evaluateJavaScript(script);
- QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox"));
-
// these actions must exist
QVERIFY(page->action(QWebPage::SelectAll) != 0);
QVERIFY(page->action(QWebPage::SelectNextChar) != 0);
@@ -895,7 +887,8 @@ void tst_QWebPage::textSelection()
QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0);
QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0);
- // right now they are disabled because contentEditable is false
+ // right now they are disabled because contentEditable is false and
+ // there isn't an existing selection to modify
QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), false);
@@ -912,11 +905,37 @@ void tst_QWebPage::textSelection()
// ..but SelectAll is awalys enabled
QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true);
+ // this will select the first paragraph
+ QString selectScript = "var range = document.createRange(); " \
+ "var node = document.getElementById(\"one\"); " \
+ "range.selectNode(node); " \
+ "getSelection().addRange(range);";
+ page->mainFrame()->evaluateJavaScript(selectScript);
+ QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox"));
+
+ // here the actions are enabled after a selection has been created
+ QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectPreviousWord)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectNextLine)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectPreviousLine)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectStartOfLine)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectEndOfLine)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectStartOfBlock)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectEndOfBlock)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectStartOfDocument)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::SelectEndOfDocument)->isEnabled(), true);
+
// make it editable before navigating the cursor
page->setContentEditable(true);
+ // cursor will be before the word "The", this makes sure there is a charet
+ page->triggerAction(QWebPage::MoveToStartOfDocument);
+ QVERIFY(page->isSelectionCollapsed());
+ QCOMPARE(page->selectionStartOffset(), 0);
+
// here the actions are enabled after contentEditable is true
- QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), true);