summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-06-21 13:49:11 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-06-21 13:49:11 (GMT)
commit3fb36b36de90068db241cc21184a8ac3b899ad2d (patch)
tree22490e313f1415681ddfb35f1b0ea0dca8f94ac6 /src
parentd11e3d6e327677e828918de3173732116976fbe4 (diff)
parentf34f4ea2d35b92631e98a772e02a1b77ce26681e (diff)
downloadQt-3fb36b36de90068db241cc21184a8ac3b899ad2d.zip
Qt-3fb36b36de90068db241cc21184a8ac3b899ad2d.tar.gz
Qt-3fb36b36de90068db241cc21184a8ac3b899ad2d.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gpos.c25
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-open-private.h2
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-open.c14
-rw-r--r--src/3rdparty/phonon/ds9/videorenderer_evr.cpp16
-rw-r--r--src/3rdparty/webkit/.tag2
-rw-r--r--src/3rdparty/webkit/ChangeLog13
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog13
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog201
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.cpp176
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.cpp54
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.h14
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp25
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.h7
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp18
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp23
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp45
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp7
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog37
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp24
-rw-r--r--src/corelib/plugin/quuid.cpp58
-rw-r--r--src/gui/image/qimage.cpp274
-rw-r--r--src/gui/image/qimage_p.h3
-rw-r--r--src/gui/image/qpixmap_raster.cpp201
-rw-r--r--src/gui/image/qpixmap_raster_p.h3
-rw-r--r--src/gui/image/qpixmapdata.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemdelegate.cpp10
-rw-r--r--src/gui/painting/qoutlinemapper_p.h4
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp2
-rw-r--r--src/gui/styles/qmacstyle_mac.mm2
-rw-r--r--src/gui/text/qstatictext.cpp9
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp2
35 files changed, 1038 insertions, 257 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
index d71a85e..31b9ae1 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
@@ -500,34 +500,24 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi,
{
/* pixel -> fractional pixel */
- if ( format & HB_GPOS_FORMAT_HAVE_DEVICE_TABLES )
- {
- if ( ALLOC_ARRAY( vr->DeviceTables, 4, HB_Device ) )
- return error;
- vr->DeviceTables[VR_X_ADVANCE_DEVICE] = 0;
- vr->DeviceTables[VR_Y_ADVANCE_DEVICE] = 0;
- vr->DeviceTables[VR_X_PLACEMENT_DEVICE] = 0;
- vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] = 0;
- }
-
if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE )
{
- _HB_OPEN_Get_Device( &vr->DeviceTables[VR_X_PLACEMENT_DEVICE], x_ppem, &pixel_value );
+ _HB_OPEN_Get_Device( vr->DeviceTables[VR_X_PLACEMENT_DEVICE], x_ppem, &pixel_value );
gd->x_pos += pixel_value << 6;
}
if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE )
{
- _HB_OPEN_Get_Device( &vr->DeviceTables[VR_Y_PLACEMENT_DEVICE], y_ppem, &pixel_value );
+ _HB_OPEN_Get_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE], y_ppem, &pixel_value );
gd->y_pos += pixel_value << 6;
}
if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE )
{
- _HB_OPEN_Get_Device( &vr->DeviceTables[VR_X_ADVANCE_DEVICE], x_ppem, &pixel_value );
+ _HB_OPEN_Get_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE], x_ppem, &pixel_value );
gd->x_advance += pixel_value << 6;
}
if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE )
{
- _HB_OPEN_Get_Device( &vr->DeviceTables[VR_Y_ADVANCE_DEVICE], y_ppem, &pixel_value );
+ _HB_OPEN_Get_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE], y_ppem, &pixel_value );
gd->y_advance += pixel_value << 6;
}
}
@@ -779,12 +769,9 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi,
case 3:
if ( !gpi->dvi )
{
- if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) )
- return error;
-
- _HB_OPEN_Get_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], x_ppem, &pixel_value );
+ _HB_OPEN_Get_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], x_ppem, &pixel_value );
*x_value = pixel_value << 6;
- _HB_OPEN_Get_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], y_ppem, &pixel_value );
+ _HB_OPEN_Get_Device( an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], y_ppem, &pixel_value );
*y_value = pixel_value << 6;
}
else
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h
index 1f7b353..65ca453 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h
@@ -93,7 +93,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd,
HB_UShort* klass,
HB_UShort* index );
HB_INTERNAL HB_Error
-_HB_OPEN_Get_Device( HB_Device** d,
+_HB_OPEN_Get_Device( HB_Device* d,
HB_UShort size,
HB_Short* value );
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c
index 255b7e6..adc6cec 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c
@@ -1399,21 +1399,11 @@ _HB_OPEN_Free_Device( HB_Device** d )
mask = 0x00FF */
HB_INTERNAL HB_Error
-_HB_OPEN_Get_Device( HB_Device** device,
+_HB_OPEN_Get_Device( HB_Device* d,
HB_UShort size,
HB_Short* value )
{
- HB_Device* d;
HB_UShort byte, bits, mask, f, s;
- HB_Error error;
-
- if ( ALLOC( *device, sizeof(HB_Device)) )
- {
- *device = 0;
- return error;
- }
-
- d = *device;
f = d->DeltaFormat;
@@ -1436,8 +1426,6 @@ _HB_OPEN_Get_Device( HB_Device** device,
else
{
*value = 0;
- FREE( *device );
- *device = 0;
return HB_Err_Not_Covered;
}
}
diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp
index d23d9ce..de3f46f 100644
--- a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp
+++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp
@@ -43,14 +43,12 @@ namespace Phonon
{
//normally we should use IID_IMFGetService but this introduces another dependency
//so here we simply define our own IId with the same value
+ ComPointer<T> ret;
ComPointer<IMFGetService> getService(filter, IID_IMFGetService);
- Q_ASSERT(getService);
- T *ptr = 0;
- HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast<void **>(&ptr));
- if (!SUCCEEDED(hr) || ptr == 0)
- Q_ASSERT(!SUCCEEDED(hr) && ptr != 0);
- ComPointer<T> service(ptr);
- return service;
+ if (getService) {
+ getService->GetService(guidService, riid, reinterpret_cast<void**>(ret.pparam()));
+ }
+ return ret;
}
VideoRendererEVR::~VideoRendererEVR()
@@ -70,6 +68,10 @@ namespace Phonon
}
ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl);
+ if (!filterControl) {
+ m_filter = Filter(); //will release the interface
+ return;
+ }
filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId()));
filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index 07a02d7..f5b6af3 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-40c2d6907ef75288b4f15e7fad334b9138acdbbf
+6623b5da196390748dc619461739f9cb84524736
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index c2862fd..51d08a0 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,16 @@
+2010-06-17 Mark Brand <mabrand@mabrand.nl>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] use "win32-g++*" scope to match all MinGW makespecs
+
+ The scope "win32-g++" comes from the name of the makespec. However, it
+ is frequently used to check for MinGW. This works fine as long as
+ win32-g++ is the only makespec for MinGW. Now we need the wildcard
+ to cover "win32-g++-cross" as well.
+
+ * WebKit.pri:
+
2010-05-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Unreviewed, build fix for Symbian.
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index d9b2987..adaf390 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-06-17 Mark Brand <mabrand@mabrand.nl>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] use "win32-g++*" scope to match all MinGW makespecs
+
+ The scope "win32-g++" comes from the name of the makespec. However, it
+ is frequently used to check for MinGW. This works fine as long as
+ win32-g++ is the only makespec for MinGW. Now we need the wildcard
+ to cover "win32-g++-cross" as well.
+
+ * JavaScriptCore.pro:
+
2010-06-07 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index b648b94..1e7351f 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 40c2d6907ef75288b4f15e7fad334b9138acdbbf
+ 6623b5da196390748dc619461739f9cb84524736
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 6a7da30..c17a8aa 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,204 @@
+2010-06-17 Mark Brand <mabrand@mabrand.nl>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] use "win32-g++*" scope to match all MinGW makespecs
+
+ The scope "win32-g++" comes from the name of the makespec. However, it
+ is frequently used to check for MinGW. This works fine as long as
+ win32-g++ is the only makespec for MinGW. Now we need the wildcard
+ to cover "win32-g++-cross" as well.
+
+ * WebCore.pro:
+
+2010-06-16 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Kenneth Christiansen.
+
+ Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position
+ https://bugs.webkit.org/show_bug.cgi?id=39439
+
+ As pointed out by Darin Adler in https://bugs.webkit.org/show_bug.cgi?id=18662#c20,
+ "It's not correct to use the offsetLeft and offsetTop of the frame owner element's renderer because
+ that's just the distance from the offsetParent, not the absolute position".
+
+ Patch fixes that behavior by now considering the offsetTop and offsetLeft the offsetParent recursively,
+ starting from the HtmlFrameOwnerElement. Previously, only calling offsetTop and offsetLeft works
+ because all tests were done in htmls where the {i}frame element was a directly a child of the body,
+ e.g. <html>...<body><iframe src=xxx>....<body></html>.
+
+ Test: fast/events/spatial-navigation/snav-iframe-recursive-offset-parent.html
+
+ * page/SpatialNavigation.cpp:
+ (WebCore::renderRectRelativeToRootDocument):
+
+2010-06-16 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Simon Fraser.
+
+ Spatial Navigation: refactor scrollInDirection to work with scrollable content
+ https://bugs.webkit.org/show_bug.cgi?id=39195
+
+ scrollInDirection now receives as parameter the node that the Spatial Navigation
+ found as the more appropriated to move focus to. If it is in a scrollable container
+ (e.g. <div> with clipped overflow content), it scrolls recursively starting from
+ the container, not the current focused node.
+
+ Test: fast/events/spatial-navigation/snav-only-clipped-overflow-content.html
+
+ * page/FocusController.cpp:
+ (WebCore::FocusController::advanceFocusDirectionally):
+ * page/SpatialNavigation.cpp:
+ (WebCore::scrollInDirection):
+ * page/SpatialNavigation.h:
+
+2010-05-28 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Simon Hausmann, Antti Koivisto
+
+ Make repaint throttling parameters runtime configurable.
+ https://bugs.webkit.org/show_bug.cgi?id=38401
+
+ REPAINT_THROTTLING now chooses default values for throttling parameters.
+ Should be removed when applications start using runtime configuration.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::reset):
+ (WebCore::FrameView::updateDeferredRepaintDelay):
+ (WebCore::FrameView::setRepaintThrottlingDeferredRepaintDelay):
+ (WebCore::FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading):
+ (WebCore::FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading):
+ (WebCore::FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading):
+ * page/FrameView.h:
+
+2010-06-16 Dawit Alemayehu <adawit@kde.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64.
+ https://bugs.webkit.org/show_bug.cgi?id=40567
+
+ Avoid preventable crashes by ensuring gtk_init() is called in the
+ flash viewer plugins before calling NP_Initialize.
+
+ * plugins/qt/PluginPackageQt.cpp:
+ (WebCore::PluginPackage::load):
+
+2010-04-21 Zoltan Herczeg <zherczeg@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] startAnimation() is not needed to preceede nativeImageForCurrentFrame()
+ https://bugs.webkit.org/show_bug.cgi?id=37844
+
+ nativeImageForCurrentFrame() resets the m_decoder parameter under Qt,
+ which is required by startAnimation() to detect frame and repetition counts.
+ Hence, Image::drawTiled cannot start animations under Qt:
+ <html><body background="animated.gif"></body></html> does not work
+
+ * platform/graphics/qt/ImageDecoderQt.cpp:
+ (WebCore::ImageDecoderQt::internalHandleCurrentImage):
+
+2010-05-28 Peter Kasting <pkasting@google.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=39857
+ Make GIFs loop the correct number of times. Previously, everyone looped
+ one time too few for non-infinitely-looping GIFs.
+
+ Modified a Qt manual test to be correct and moved it to the general
+ manual test directory.
+
+ * manual-tests/animated-gif-looping.html: Copied from WebCore/manual-tests/qt/qt-gif-test.html.
+ * manual-tests/qt/qt-10loop-anim.gif: Removed.
+ * manual-tests/qt/qt-anim.gif: Removed.
+ * manual-tests/qt/qt-gif-test.html: Removed.
+ * manual-tests/qt/qt-noanim.gif: Removed.
+ * manual-tests/resources/animated-10x.gif: Copied from WebCore/manual-tests/qt/qt-10loop-anim.gif and modified.
+ * manual-tests/resources/animated-infinite.gif: Copied from WebCore/manual-tests/qt/qt-anim.gif.
+ * manual-tests/resources/non-animated.gif: Copied from WebCore/manual-tests/qt/qt-noanim.gif.
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::internalAdvanceAnimation): For a loop count of n, show a total of n + 1 animation cycles.
+ * platform/graphics/ImageSource.h:
+ * platform/graphics/cg/ImageSourceCG.cpp:
+ (WebCore::ImageSource::repetitionCount):
+ * platform/graphics/qt/ImageDecoderQt.cpp:
+ (WebCore::ImageDecoderQt::repetitionCount): Remove translation code now that WebCore matches Qt's internal handling of the loop count. Qt itself may still have a bug here.
+ * platform/image-decoders/gif/GIFImageDecoder.cpp:
+ (WebCore::GIFImageDecoder::repetitionCount):
+ * platform/image-decoders/gif/GIFImageReader.cpp:
+ (GIFImageReader::read): Translate loop count 0 to "loop infinitely" (by restoring one piece of the Mozilla code we'd removed).
+
+2010-05-04 Tucker Jay <jay.tucker@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Animated GIF images does not animate 10x as expected by default.
+ https://bugs.webkit.org/show_bug.cgi?id=36818
+
+ Added test case to existing manual test to test the
+ fixed functionality.
+
+ * manual-tests/qt/qt-10loop-anim.gif: Added.
+ * manual-tests/qt/qt-gif-test.html:
+ * platform/graphics/qt/ImageDecoderQt.cpp:
+ (WebCore::ImageDecoderQt::repetitionCount):
+
+2010-05-16 Antonio Gomes <tonikitoo@webkit.org>
+
+ Unreviewed naming fixes of local variables used in Spatial Navigation methods.
+
+ Summary:
+ * "candidate" renamed to "node";
+ * "currentFocusCandidate" renamed to "candidate"
+ * "closestFocusCandidate" renamed to "closest"
+
+ That way naming is more consistent in the various Spatial Navigation methods.
+
+ * page/FocusController.cpp:
+ (WebCore::FocusController::findFocusableNodeInDirection):
+ (WebCore::FocusController::deepFindFocusableNodeInDirection):
+
+2010-06-14 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Simon Fraser and Kenneth Christiansen.
+
+ Spatial Navigation: make it work with focusable elements in overflow content
+ https://bugs.webkit.org/show_bug.cgi?id=36463
+
+ This patch addresses the problem with Spatial Navigation. It currently does not
+ properly traverse scrollable contents, including scrollable div's. For this to work,
+ a new class member called scrollableEnclosingBox was introduced to FocusCandidate class which
+ keeps track of the current scrollable box Node wrapping a FocusCandidate.
+
+ To make use of enclosingScrollableBox of FocusCandidate, the DOM traversal routine
+ (FocusController::findNextFocusableInDirection) was changed as follows: when it
+ encounters a scrollable Node, each focusable node which is 'inner' keeps track of
+ the container reference. By the time a sibling of the scrollable Node is encountered,
+ there is no need to track this reference any more and the traversal algorithm continues
+ normally.
+
+ The common case is obviously that there is no scrollable container wrapping it.
+
+ updateFocusCandiditeIfCloser logic was also adapted to fit the need of the
+ newly introduced enclosingScrollableBox class member, getting simpler and more
+ easily maintainable.
+
+ Tests: fast/events/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html
+ fast/events/spatial-navigation/snav-clipped-overflow-content.html
+
+ * page/FocusController.cpp:
+ (WebCore::updateFocusCandidateInSameContainer):
+ (WebCore::updateFocusCandidateIfCloser):
+ (WebCore::FocusController::findFocusableNodeInDirection):
+ (WebCore::FocusController::deepFindFocusableNodeInDirection):
+ * page/SpatialNavigation.cpp:
+ (WebCore::isScrollableContainerNode):
+ * page/SpatialNavigation.h:
+ (WebCore::FocusCandidate::FocusCandidate):
+ (WebCore::FocusCandidate::isInScrollableContainer):
+
2010-06-15 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.cpp b/src/3rdparty/webkit/WebCore/page/FocusController.cpp
index 6c2a956..a285e52 100644
--- a/src/3rdparty/webkit/WebCore/page/FocusController.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FocusController.cpp
@@ -319,7 +319,7 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa
// if |node| element is not in the viewport.
if (hasOffscreenRect(node)) {
Frame* frame = node->document()->view()->frame();
- scrollInDirection(frame, direction);
+ scrollInDirection(frame, direction, focusCandidate);
return true;
}
@@ -341,105 +341,152 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa
return true;
}
-// FIXME: Make this method more modular, and simpler to understand and maintain.
-static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate& candidate, FocusCandidate& closest)
+static void updateFocusCandidateInSameContainer(const FocusCandidate& candidate, FocusCandidate& closest)
{
- bool sameDocument = candidate.document() == closest.document();
- if (sameDocument) {
- if (closest.alignment > candidate.alignment
- || (closest.parentAlignment && candidate.alignment > closest.parentAlignment))
- return;
- } else if (closest.alignment > candidate.alignment
- && (closest.parentAlignment && candidate.alignment > closest.parentAlignment))
+ if (closest.isNull()) {
+ closest = candidate;
return;
+ }
- if (candidate.alignment != None
- || (closest.parentAlignment >= candidate.alignment
- && closest.document() == candidate.document())) {
+ if (candidate.alignment == closest.alignment) {
+ if (candidate.distance < closest.distance)
+ closest = candidate;
+ return;
+ }
- // If we are now in an higher precedent case, lets reset the current closest's
- // distance so we force it to be bigger than any result we will get from
- // spatialDistance().
- if (closest.alignment < candidate.alignment
- && closest.parentAlignment < candidate.alignment)
- closest.distance = maxDistance();
+ if (candidate.alignment > closest.alignment)
+ closest = candidate;
+}
- closest.alignment = candidate.alignment;
+static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate& candidate, FocusCandidate& closest)
+{
+ // First, check the common case: neither candidate nor closest are
+ // inside scrollable content, then no need to care about enclosingScrollableBox
+ // heuristics or parent{Distance,Alignment}, but only distance and alignment.
+ if (!candidate.inScrollableContainer() && !closest.inScrollableContainer()) {
+ updateFocusCandidateInSameContainer(candidate, closest);
+ return;
}
- // Bail out if candidate's distance is larger than that of the closest candidate.
- if (candidate.distance >= closest.distance)
+ bool sameContainer = candidate.document() == closest.document() && candidate.enclosingScrollableBox == closest.enclosingScrollableBox;
+
+ // Second, if candidate and closest are in the same "container" (i.e. {i}frame or any
+ // scrollable block element), we can handle them as common case.
+ if (sameContainer) {
+ updateFocusCandidateInSameContainer(candidate, closest);
return;
+ }
- if (closest.isNull()) {
+ // Last, we are considering moving to a candidate located in a different enclosing
+ // scrollable box than closest.
+ bool isInInnerDocument = !isInRootDocument(focusedNode);
+
+ bool sameContainerAsCandidate = isInInnerDocument ? focusedNode->document() == candidate.document() :
+ focusedNode->isDescendantOf(candidate.enclosingScrollableBox);
+
+ bool sameContainerAsClosest = isInInnerDocument ? focusedNode->document() == closest.document() :
+ focusedNode->isDescendantOf(closest.enclosingScrollableBox);
+
+ // sameContainerAsCandidate and sameContainerAsClosest are mutually exclusive.
+ ASSERT(!(sameContainerAsCandidate && sameContainerAsClosest));
+
+ if (sameContainerAsCandidate) {
closest = candidate;
return;
}
- // If the focused node and the candadate are in the same document and current
- // closest candidate is not in an {i}frame that is preferable to get focused ...
- if (focusedNode->document() == candidate.document()
- && candidate.distance < closest.parentDistance)
- closest = candidate;
- else if (focusedNode->document() != candidate.document()) {
- // If the focusedNode is in an inner document and candidate is in a
- // different document, we only consider to change focus if there is not
- // another already good focusable candidate in the same document as focusedNode.
- if (!((isInRootDocument(candidate.node) && !isInRootDocument(focusedNode))
- && focusedNode->document() == closest.document()))
+ if (sameContainerAsClosest) {
+ // Nothing to be done.
+ return;
+ }
+
+ // NOTE: !sameContainerAsCandidate && !sameContainerAsClosest
+ // If distance is shorter, and we are talking about scrollable container,
+ // lets compare parent distance and alignment before anything.
+ if (candidate.distance < closest.distance) {
+ if (candidate.alignment >= closest.parentAlignment
+ || candidate.parentAlignment == closest.parentAlignment) {
closest = candidate;
+ return;
+ }
+
+ } else if (candidate.parentDistance < closest.distance) {
+ if (candidate.parentAlignment >= closest.alignment) {
+ closest = candidate;
+ return;
+ }
}
}
void FocusController::findFocusableNodeInDirection(Node* outer, Node* focusedNode,
FocusDirection direction, KeyboardEvent* event,
- FocusCandidate& closestFocusCandidate,
- const FocusCandidate& candidateParent)
+ FocusCandidate& closest, const FocusCandidate& candidateParent)
{
ASSERT(outer);
ASSERT(candidateParent.isNull()
|| candidateParent.node->hasTagName(frameTag)
- || candidateParent.node->hasTagName(iframeTag));
+ || candidateParent.node->hasTagName(iframeTag)
+ || isScrollableContainerNode(candidateParent.node));
+
+ // Walk all the child nodes and update closest if we find a nearer node.
+ Node* node = outer;
+ while (node) {
- // Walk all the child nodes and update closestFocusCandidate if we find a nearer node.
- Node* candidate = outer;
- while (candidate) {
// Inner documents case.
+ if (node->isFrameOwnerElement()) {
+ deepFindFocusableNodeInDirection(node, focusedNode, direction, event, closest);
- if (candidate->isFrameOwnerElement())
- deepFindFocusableNodeInDirection(candidate, focusedNode, direction, event, closestFocusCandidate);
- else if (candidate != focusedNode && candidate->isKeyboardFocusable(event)) {
- FocusCandidate currentFocusCandidate(candidate);
+ // Scrollable block elements (e.g. <div>, etc) case.
+ } else if (isScrollableContainerNode(node)) {
+ deepFindFocusableNodeInDirection(node, focusedNode, direction, event, closest);
+ node = node->traverseNextSibling();
+ continue;
+
+ } else if (node != focusedNode && node->isKeyboardFocusable(event)) {
+ FocusCandidate candidate(node);
+
+ // There are two ways to identify we are in a recursive call from deepFindFocusableNodeInDirection
+ // (i.e. processing an element in an iframe, frame or a scrollable block element):
+
+ // 1) If candidateParent is not null, and it holds the distance and alignment data of the
+ // parent container element itself;
+ // 2) Parent of outer is <frame> or <iframe>;
+ // 3) Parent is any other scrollable block element.
+ if (!candidateParent.isNull()) {
+ candidate.parentAlignment = candidateParent.alignment;
+ candidate.parentDistance = candidateParent.distance;
+ candidate.enclosingScrollableBox = candidateParent.node;
+
+ } else if (!isInRootDocument(outer)) {
+ if (Document* document = static_cast<Document*>(outer->parent()))
+ candidate.enclosingScrollableBox = static_cast<Node*>(document->ownerElement());
+
+ } else if (isScrollableContainerNode(outer->parent()))
+ candidate.enclosingScrollableBox = outer->parent();
// Get distance and alignment from current candidate.
- distanceDataForNode(direction, focusedNode, currentFocusCandidate);
+ distanceDataForNode(direction, focusedNode, candidate);
// Bail out if distance is maximum.
- if (currentFocusCandidate.distance == maxDistance()) {
- candidate = candidate->traverseNextNode(outer->parent());
+ if (candidate.distance == maxDistance()) {
+ node = node->traverseNextNode(outer->parent());
continue;
}
- // If candidateParent is not null, it means that we are in a recursive call
- // from deepFineFocusableNodeInDirection (i.e. processing an element in an iframe),
- // and holds the distance and alignment data of the iframe element itself.
- if (!candidateParent.isNull()) {
- currentFocusCandidate.parentAlignment = candidateParent.alignment;
- currentFocusCandidate.parentDistance = candidateParent.distance;
- }
-
- updateFocusCandidateIfCloser(focusedNode, currentFocusCandidate, closestFocusCandidate);
+ updateFocusCandidateIfCloser(focusedNode, candidate, closest);
}
- candidate = candidate->traverseNextNode(outer->parent());
+ node = node->traverseNextNode(outer->parent());
}
}
void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* focusedNode,
FocusDirection direction, KeyboardEvent* event,
- FocusCandidate& closestFocusCandidate)
+ FocusCandidate& closest)
{
- ASSERT(container->hasTagName(frameTag) || container->hasTagName(iframeTag));
+ ASSERT(container->hasTagName(frameTag)
+ || container->hasTagName(iframeTag)
+ || isScrollableContainerNode(container));
// Track if focusedNode is a descendant of the current container node being processed.
bool descendantOfContainer = false;
@@ -459,10 +506,15 @@ void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* fo
descendantOfContainer = innerDocument == focusedNode->document();
firstChild = innerDocument->firstChild();
+ // Scrollable block elements (e.g. <div>, etc)
+ } else if (isScrollableContainerNode(container)) {
+
+ firstChild = container->firstChild();
+ descendantOfContainer = focusedNode->isDescendantOf(container);
}
if (descendantOfContainer) {
- findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate);
+ findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closest);
return;
}
@@ -476,8 +528,8 @@ void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* fo
return;
// FIXME: Consider alignment?
- if (candidateParent.distance < closestFocusCandidate.distance)
- findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate, candidateParent);
+ if (candidateParent.distance < closest.distance)
+ findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closest, candidateParent);
}
static bool relinquishesEditingFocus(Node *node)
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
index bc0519f..a53db36 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
@@ -80,23 +80,25 @@ using namespace HTMLNames;
double FrameView::sCurrentPaintTimeStamp = 0.0;
+// REPAINT_THROTTLING now chooses default values for throttling parameters.
+// Should be removed when applications start using runtime configuration.
#if ENABLE(REPAINT_THROTTLING)
// Normal delay
-static const double deferredRepaintDelay = 0.025;
+double FrameView::s_deferredRepaintDelay = 0.025;
// Negative value would mean that first few repaints happen without a delay
-static const double initialDeferredRepaintDelayDuringLoading = 0;
+double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0;
// The delay grows on each repaint to this maximum value
-static const double maxDeferredRepaintDelayDuringLoading = 2.5;
+double FrameView::s_maxDeferredRepaintDelayDuringLoading = 2.5;
// On each repaint the delay increses by this amount
-static const double deferredRepaintDelayIncrementDuringLoading = 0.5;
+double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0.5;
#else
// FIXME: Repaint throttling could be good to have on all platform.
// The balance between CPU use and repaint frequency will need some tuning for desktop.
// More hooks may be needed to reset the delay on things like GIF and CSS animations.
-static const double deferredRepaintDelay = 0;
-static const double initialDeferredRepaintDelayDuringLoading = 0;
-static const double maxDeferredRepaintDelayDuringLoading = 0;
-static const double deferredRepaintDelayIncrementDuringLoading = 0;
+double FrameView::s_deferredRepaintDelay = 0;
+double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0;
+double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0;
+double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0;
#endif
// The maximum number of updateWidgets iterations that should be done before returning.
@@ -200,7 +202,7 @@ void FrameView::reset()
m_deferringRepaints = 0;
m_repaintCount = 0;
m_repaintRects.clear();
- m_deferredRepaintDelay = initialDeferredRepaintDelayDuringLoading;
+ m_deferredRepaintDelay = s_initialDeferredRepaintDelayDuringLoading;
m_deferredRepaintTimer.stop();
m_lastPaintTime = 0;
m_paintBehavior = PaintBehaviorNormal;
@@ -1218,13 +1220,13 @@ void FrameView::updateDeferredRepaintDelay()
{
Document* document = m_frame->document();
if (!document || (!document->parsing() && !document->docLoader()->requestCount())) {
- m_deferredRepaintDelay = deferredRepaintDelay;
+ m_deferredRepaintDelay = s_deferredRepaintDelay;
return;
}
- if (m_deferredRepaintDelay < maxDeferredRepaintDelayDuringLoading) {
- m_deferredRepaintDelay += deferredRepaintDelayIncrementDuringLoading;
- if (m_deferredRepaintDelay > maxDeferredRepaintDelayDuringLoading)
- m_deferredRepaintDelay = maxDeferredRepaintDelayDuringLoading;
+ if (m_deferredRepaintDelay < s_maxDeferredRepaintDelayDuringLoading) {
+ m_deferredRepaintDelay += s_deferredRepaintDelayIncrementDuringLoading;
+ if (m_deferredRepaintDelay > s_maxDeferredRepaintDelayDuringLoading)
+ m_deferredRepaintDelay = s_maxDeferredRepaintDelayDuringLoading;
}
}
@@ -2143,4 +2145,28 @@ IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const
return parentPoint;
}
+// Normal delay
+void FrameView::setRepaintThrottlingDeferredRepaintDelay(double p)
+{
+ s_deferredRepaintDelay = p;
+}
+
+// Negative value would mean that first few repaints happen without a delay
+void FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p)
+{
+ s_initialDeferredRepaintDelayDuringLoading = p;
+}
+
+// The delay grows on each repaint to this maximum value
+void FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p)
+{
+ s_maxDeferredRepaintDelayDuringLoading = p;
+}
+
+// On each repaint the delay increases by this amount
+void FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p)
+{
+ s_deferredRepaintDelayIncrementDuringLoading = p;
+}
+
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.h b/src/3rdparty/webkit/WebCore/page/FrameView.h
index 71e2966..71fa8cd 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.h
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.h
@@ -210,6 +210,15 @@ public:
bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
void invalidateScrollCorner();
+ // Normal delay
+ static void setRepaintThrottlingDeferredRepaintDelay(double p);
+ // Negative value would mean that first few repaints happen without a delay
+ static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p);
+ // The delay grows on each repaint to this maximum value
+ static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p);
+ // On each repaint the delay increses by this amount
+ static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
+
protected:
virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
@@ -340,6 +349,11 @@ private:
// Renderer to hold our custom scroll corner.
RenderScrollbarPart* m_scrollCorner;
+
+ static double s_deferredRepaintDelay;
+ static double s_initialDeferredRepaintDelayDuringLoading;
+ static double s_maxDeferredRepaintDelayDuringLoading;
+ static double s_deferredRepaintDelayIncrementDuringLoading;
};
#if ENABLE(INSPECTOR)
diff --git a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
index d7eaf25..1ce61c3 100644
--- a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
+++ b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
@@ -124,8 +124,11 @@ static IntRect renderRectRelativeToRootDocument(RenderObject* render)
// Handle nested frames.
for (Frame* frame = render->document()->frame(); frame; frame = frame->tree()->parent()) {
- if (HTMLFrameOwnerElement* ownerElement = frame->ownerElement())
- rect.move(ownerElement->offsetLeft(), ownerElement->offsetTop());
+ if (Element* element = static_cast<Element*>(frame->ownerElement())) {
+ do {
+ rect.move(element->offsetLeft(), element->offsetTop());
+ } while ((element = element->offsetParent()));
+ }
}
return rect;
@@ -444,7 +447,7 @@ bool hasOffscreenRect(Node* node)
// In a bottom-up way, this method tries to scroll |frame| in a given direction
// |direction|, going up in the frame tree hierarchy in case it does not succeed.
-bool scrollInDirection(Frame* frame, FocusDirection direction)
+bool scrollInDirection(Frame* frame, FocusDirection direction, const FocusCandidate& candidate)
{
if (!frame)
return false;
@@ -468,6 +471,9 @@ bool scrollInDirection(Frame* frame, FocusDirection direction)
return false;
}
+ if (!candidate.isNull() && isScrollableContainerNode(candidate.enclosingScrollableBox))
+ return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine, candidate.enclosingScrollableBox);
+
return frame->eventHandler()->scrollRecursively(scrollDirection, ScrollByLine);
}
@@ -526,4 +532,17 @@ static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect)
return canBeScrolled;
}
+bool isScrollableContainerNode(Node* node)
+{
+ if (!node)
+ return false;
+
+ if (RenderObject* renderer = node->renderer()) {
+ return (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()
+ && node->hasChildNodes() && !node->isDocumentNode());
+ }
+
+ return false;
+}
+
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h
index 309b095..06389a3 100644
--- a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h
+++ b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h
@@ -97,6 +97,7 @@ enum RectsAlignment {
struct FocusCandidate {
FocusCandidate()
: node(0)
+ , enclosingScrollableBox(0)
, distance(maxDistance())
, parentDistance(maxDistance())
, alignment(None)
@@ -106,6 +107,7 @@ struct FocusCandidate {
FocusCandidate(Node* n)
: node(n)
+ , enclosingScrollableBox(0)
, distance(maxDistance())
, parentDistance(maxDistance())
, alignment(None)
@@ -114,9 +116,11 @@ struct FocusCandidate {
}
bool isNull() const { return !node; }
+ bool inScrollableContainer() const { return node && enclosingScrollableBox; }
Document* document() const { return node ? node->document() : 0; }
Node* node;
+ Node* enclosingScrollableBox;
long long distance;
long long parentDistance;
RectsAlignment alignment;
@@ -124,10 +128,11 @@ struct FocusCandidate {
};
void distanceDataForNode(FocusDirection direction, Node* start, FocusCandidate& candidate);
-bool scrollInDirection(Frame*, FocusDirection);
+bool scrollInDirection(Frame*, FocusDirection, const FocusCandidate& candidate = FocusCandidate());
void scrollIntoView(Element*);
bool hasOffscreenRect(Node*);
bool isInRootDocument(Node*);
+bool isScrollableContainerNode(Node*);
} // namspace WebCore
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
index b10cc71..cc707da 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
@@ -115,22 +115,8 @@ size_t ImageDecoderQt::frameCount()
int ImageDecoderQt::repetitionCount() const
{
- if (m_reader && m_reader->supportsAnimation()) {
+ if (m_reader && m_reader->supportsAnimation())
m_repetitionCount = m_reader->loopCount();
-
- // Qt and WebCore have a incompatible understanding of
- // the loop count and we can not completely map everything.
- // Qt | WebCore | description
- // -1 | 0 | infinite animation
- // 0 | cAnimationLoopOnce | show every frame once
- // n | n | no idea if that is supported
- // n/a | cAnimationNone | show only the first frame
- if (m_repetitionCount == -1)
- m_repetitionCount = 0;
- else if (m_repetitionCount == 0)
- m_repetitionCount = cAnimationLoopOnce;
- }
-
return m_repetitionCount;
}
@@ -205,6 +191,8 @@ bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex)
// Now get the QImage from Qt and place it in the RGBA32Buffer
QImage img;
if (!m_reader->read(&img)) {
+ frameCount();
+ repetitionCount();
clearPointers();
return false;
}
diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp
index 74deaf6..d5292fe 100644
--- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp
@@ -35,6 +35,8 @@
namespace WebCore {
+typedef void gtkInitFunc(int *argc, char ***argv);
+
bool PluginPackage::fetchInfo()
{
if (!load())
@@ -109,6 +111,7 @@ bool PluginPackage::load()
NP_InitializeFuncPtr NP_Initialize;
NPError npErr;
+ gtkInitFunc* gtkInit;
NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize");
m_NPP_Shutdown = (NPP_ShutdownProcPtr)m_module->resolve("NP_Shutdown");
@@ -127,6 +130,26 @@ bool PluginPackage::load()
m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue;
}
+ // WORKAROUND: Prevent gtk based plugin crashes such as BR# 40567 by
+ // explicitly forcing the initializing of Gtk, i.e. calling gtk_init,
+ // whenver the symbol is present in the plugin library loaded above.
+ // Note that this workaround is based on code from the NSPluginClass ctor
+ // in KDE's kdebase/apps/nsplugins/viewer/nsplugin.cpp file.
+ gtkInit = (gtkInitFunc*)m_module->resolve("gtk_init");
+ if (gtkInit) {
+ // Prevent gtk_init() from replacing the X error handlers, since the Gtk
+ // handlers abort when they receive an X error, thus killing the viewer.
+#ifdef Q_WS_X11
+ int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0);
+ int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0);
+#endif
+ gtkInit(0, 0);
+#ifdef Q_WS_X11
+ XSetErrorHandler(old_error_handler);
+ XSetIOErrorHandler(old_io_error_handler);
+#endif
+ }
+
#if defined(XP_UNIX)
npErr = NP_Initialize(&m_browserFuncs, &m_pluginFuncs);
#else
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 8c7b93d..4460ad3 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1371,6 +1371,14 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
}
#ifndef QT_NO_PROPERTIES
+typedef struct {
+ const char* name;
+ double deferredRepaintDelay;
+ double initialDeferredRepaintDelayDuringLoading;
+ double maxDeferredRepaintDelayDuringLoading;
+ double deferredRepaintDelayIncrementDuringLoading;
+} QRepaintThrottlingPreset;
+
void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event)
{
if (event->propertyName() == "_q_viewMode") {
@@ -1388,7 +1396,42 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev
} else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") {
double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble();
q->handle()->page->setCustomHTMLTokenizerTimeDelay(timeDelay);
- }
+ } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelay") {
+ double p = q->property("_q_RepaintThrottlingDeferredRepaintDelay").toDouble();
+ FrameView::setRepaintThrottlingDeferredRepaintDelay(p);
+ } else if (event->propertyName() == "_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading") {
+ double p = q->property("_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading").toDouble();
+ FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(p);
+ } else if (event->propertyName() == "_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading") {
+ double p = q->property("_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading").toDouble();
+ FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(p);
+ } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading") {
+ double p = q->property("_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading").toDouble();
+ FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(p);
+ } else if (event->propertyName() == "_q_RepaintThrottlingPreset") {
+ static const QRepaintThrottlingPreset presets[] = {
+ { "NoThrottling", 0, 0, 0, 0 },
+ { "Legacy", 0.025, 0, 2.5, 0.5 },
+ { "Minimal", 0.01, 0, 1, 0.2 },
+ { "Medium", 0.025, 1, 5, 0.5 },
+ { "Heavy", 0.1, 2, 10, 1 }
+ };
+
+ QString p = q->property("_q_RepaintThrottlingPreset").toString();
+ for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) {
+ if(p == presets[i].name) {
+ FrameView::setRepaintThrottlingDeferredRepaintDelay(
+ presets[i].deferredRepaintDelay);
+ FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(
+ presets[i].initialDeferredRepaintDelayDuringLoading);
+ FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(
+ presets[i].maxDeferredRepaintDelayDuringLoading);
+ FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(
+ presets[i].deferredRepaintDelayIncrementDuringLoading);
+ break;
+ }
+ }
+ }
#if ENABLE(TILED_BACKING_STORE)
else if (event->propertyName() == "_q_TiledBackingStoreTileSize") {
WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame());
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index a5fc794..47b4f3b 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -245,6 +245,10 @@ void QWebSettingsPrivate::apply()
settings->setTiledBackingStoreEnabled(value);
#endif
+ value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled,
+ global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled));
+ settings->setNeedsSiteSpecificQuirks(value);
+
settings->setUsesPageCache(WebCore::pageCache()->capacity());
} else {
QList<QWebSettingsPrivate*> settings = *::allSettings();
@@ -426,6 +430,8 @@ QWebSettings* QWebSettings::globalSettings()
and at other times scrolling the page itself. For this reason iframes and framesets are
barely usable on touch devices. This will flatten all the frames to become one scrollable page.
This is disabled by default.
+ \value SiteSpecificQuirksEnabled This setting enables WebKit's workaround for broken sites. It is
+ enabled by default.
*/
/*!
@@ -461,6 +467,7 @@ QWebSettings::QWebSettings()
d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, true);
d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false);
d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false);
+ d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true);
d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
d->defaultTextEncoding = QLatin1String("iso-8859-1");
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
index b978f5e..207a9b6 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
@@ -73,7 +73,8 @@ public:
SpatialNavigationEnabled,
LocalContentCanAccessFileUrls,
TiledBackingStoreEnabled,
- FrameFlatteningEnabled
+ FrameFlatteningEnabled,
+ SiteSpecificQuirksEnabled
};
enum WebGraphic {
MissingImageGraphic,
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 671acec..475d22d 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,40 @@
+2010-06-17 Mark Brand <mabrand@mabrand.nl>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] use "win32-g++*" scope to match all MinGW makespecs
+
+ The scope "win32-g++" comes from the name of the makespec. However, it
+ is frequently used to check for MinGW. This works fine as long as
+ win32-g++ is the only makespec for MinGW. Now we need the wildcard
+ to cover "win32-g++-cross" as well.
+
+ * Api/DerivedSources.pro:
+
+2010-05-28 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
+
+ Reviewed by Simon Hausmann, Antti Koivisto
+
+ [Qt] Add internal Qt Api to configure repaint throttling parameters.
+ https://bugs.webkit.org/show_bug.cgi?id=38401
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::dynamicPropertyChangeEvent):
+
+2010-06-12 Dawit Alemayehu <adawit@kde.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Added an attribute to enable/disable site specific quirks mode in WebKit.
+ The attribute is enabled by default.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40073
+
+ * Api/qwebsettings.cpp:
+ (QWebSettingsPrivate::apply):
+ (QWebSettings::QWebSettings):
+ * Api/qwebsettings.h:
+
2010-06-09 Pierre Rossi <pierre.rossi@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index ee3c4f2..bcf4477 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -393,6 +393,27 @@ void QAbstractEventDispatcher::closingDown()
\snippet doc/src/snippets/code/src_corelib_kernel_qabstracteventdispatcher.cpp 0
+ Note that the type of the \a message is platform dependent. The
+ following table shows the \a {message}'s type on Windows, Mac, and
+ X11. You can do a static cast to these types.
+
+ \table
+ \header
+ \o Platform
+ \o type
+ \row
+ \o Windows
+ \o MSG
+ \row
+ \o X11
+ \o XEvent
+ \row
+ \o Mac
+ \o NSEvent
+ \endtable
+
+
+
\sa setEventFilter(), filterEvent()
*/
@@ -434,6 +455,9 @@ QAbstractEventDispatcher::EventFilter QAbstractEventDispatcher::setEventFilter(E
compatibility with any extensions that may be used in the
application.
+ Note that the type of \a message is platform dependent. See
+ QAbstractEventDispatcher::EventFilter for details.
+
\sa setEventFilter()
*/
bool QAbstractEventDispatcher::filterEvent(void *message)
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 8541c7d..9332bbc 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -546,13 +546,13 @@ bool QUuid::operator>(const QUuid &other) const
\fn QUuid QUuid::createUuid()
On any platform other than Windows, this function returns a new
- UUID with variant QUuid::DCE and version QUuid::Random. The random
- numbers used to construct the UUID are obtained from the local
- pseudo-random generator, qrand(), which is usually not a cryptographic
- quality random number generator. Therefore, a UUID generated by
- this function can't be guaranteed to be unique. If the pseudo-random
- number generator for the calling thread has not yet been seeded, this
- function will seed the pseudo-random number generator by calling qsrand().
+ UUID with variant QUuid::DCE and version QUuid::Random. If
+ the /dev/urandom device exists, then the numbers used to construct
+ the UUID will be of cryptographic quality, which will make the UUID
+ unique. Otherwise, the numbers of the UUID will be obtained from
+ the local pseudo-random number generator (qrand(), which is seeded
+ by qsrand()) which is usually not of cryptograhic quality, which
+ means that the UUID can't be guaranteed to be unique.
On a Windows platform, a GUID is generated, which almost certainly
\e{will} be unique, on this or any other system, networked or not.
@@ -577,6 +577,7 @@ QUuid QUuid::createUuid()
QT_BEGIN_INCLUDE_NAMESPACE
#include "qdatetime.h"
+#include "qfile.h"
#include "stdlib.h" // For srand/rand
QT_END_INCLUDE_NAMESPACE
@@ -584,24 +585,35 @@ extern void qsrand(); // in qglobal.cpp
QUuid QUuid::createUuid()
{
- static const int intbits = sizeof(int)*8;
- static int randbits = 0;
- if (!randbits) {
- int max = RAND_MAX;
- do { ++randbits; } while ((max=max>>1));
- }
-
- // reseed, but only if not already seeded
- qsrand();
-
QUuid result;
uint *data = &(result.data1);
- int chunks = 16 / sizeof(uint);
- while (chunks--) {
- uint randNumber = 0;
- for (int filled = 0; filled < intbits; filled += randbits)
- randNumber |= qrand()<<filled;
- *(data+chunks) = randNumber;
+
+#ifdef Q_OS_UNIX
+ QFile devUrandom;
+ devUrandom.setFileName(QLatin1String("/dev/urandom"));
+ if (devUrandom.open(QIODevice::ReadOnly)) {
+ qint64 numToRead = 4 * sizeof(uint);
+ devUrandom.read((char *) data, numToRead); // should read 128-bits of data
+ } else
+#endif
+ {
+ static const int intbits = sizeof(int)*8;
+ static int randbits = 0;
+ if (!randbits) {
+ int max = RAND_MAX;
+ do { ++randbits; } while ((max=max>>1));
+ }
+
+ // reseed, but only if not already seeded
+ qsrand();
+
+ int chunks = 16 / sizeof(uint);
+ while (chunks--) {
+ uint randNumber = 0;
+ for (int filled = 0; filled < intbits; filled += randbits)
+ randNumber |= qrand()<<filled;
+ *(data+chunks) = randNumber;
+ }
}
result.data4[0] = (result.data4[0] & 0x3F) | 0x80; // UV_DCE
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index adc2632..bb8a994 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2274,6 +2274,8 @@ bool QImage::create(const QSize& size, int depth, int numColors, QImage::Endian
typedef void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags);
+
static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_ARGB32);
@@ -2298,6 +2300,169 @@ static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt:
}
}
+static bool convert_ARGB_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_ARGB32);
+
+ const int pad = (data->bytes_per_line >> 2) - data->width;
+ QRgb *rgb_data = (QRgb *) data->data;
+
+ for (int i = 0; i < data->height; ++i) {
+ const QRgb *end = rgb_data + data->width;
+ while (rgb_data < end) {
+ *rgb_data = PREMUL(*rgb_data);
+ ++rgb_data;
+ }
+ rgb_data += pad;
+ }
+ data->format = QImage::Format_ARGB32_Premultiplied;
+ return true;
+}
+
+static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_Indexed8);
+ const int depth = 32;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, nbytes);
+ if (!newData)
+ return false;
+
+ data->data = newData;
+
+ // start converting from the end because the end image is bigger than the source
+ uchar *src_data = newData + data->nbytes; // end of src
+ quint32 *dest_data = (quint32 *) (newData + nbytes); // end of dest > end of src
+ const int width = data->width;
+ const int src_pad = data->bytes_per_line - width;
+ const int dest_pad = (dst_bytes_per_line >> 2) - width;
+
+ for (int i = 0; i < data->height; ++i) {
+ src_data -= src_pad;
+ dest_data -= dest_pad;
+ for (int pixI = 0; pixI < width; ++pixI) {
+ --src_data;
+ --dest_data;
+ const uint pixel = data->colortable[*src_data];
+ *dest_data = (quint32) PREMUL(pixel);
+ }
+ }
+
+ data->format = QImage::Format_ARGB32_Premultiplied;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = nbytes;
+
+ return true;
+}
+
+static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_Indexed8);
+ const int depth = 32;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, nbytes);
+ if (!newData)
+ return false;
+
+ data->data = newData;
+
+ // start converting from the end because the end image is bigger than the source
+ uchar *src_data = newData + data->nbytes;
+ quint32 *dest_data = (quint32 *) (newData + nbytes);
+ const int width = data->width;
+ const int src_pad = data->bytes_per_line - width;
+ const int dest_pad = (dst_bytes_per_line >> 2) - width;
+
+ for (int i = 0; i < data->height; ++i) {
+ src_data -= src_pad;
+ dest_data -= dest_pad;
+ for (int pixI = 0; pixI < width; ++pixI) {
+ --src_data;
+ --dest_data;
+ *dest_data = (quint32) data->colortable[*src_data];
+ }
+ }
+
+ data->format = QImage::Format_RGB32;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = nbytes;
+
+ return true;
+}
+
+static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_Indexed8);
+ const int depth = 16;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, nbytes);
+ if (!newData)
+ return false;
+
+ data->data = newData;
+
+ // start converting from the end because the end image is bigger than the source
+ uchar *src_data = newData + data->nbytes;
+ quint16 *dest_data = (quint16 *) (newData + nbytes);
+ const int width = data->width;
+ const int src_pad = data->bytes_per_line - width;
+ const int dest_pad = (dst_bytes_per_line >> 1) - width;
+
+ for (int i = 0; i < data->height; ++i) {
+ src_data -= src_pad;
+ dest_data -= dest_pad;
+ for (int pixI = 0; pixI < width; ++pixI) {
+ --src_data;
+ --dest_data;
+ const uint pixel = data->colortable[*src_data];
+ *dest_data = qt_colorConvert<quint16, quint32>(pixel, 0);
+ }
+ }
+
+ data->format = QImage::Format_RGB16;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = nbytes;
+
+ return true;
+}
+
+static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_RGB32);
+ const int depth = 16;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int src_bytes_per_line = data->bytes_per_line;
+ quint32 *src_data = (quint32 *) data->data;
+ quint16 *dst_data = (quint16 *) data->data;
+
+ for (int i = 0; i < data->height; ++i) {
+ qt_memconvert(dst_data, src_data, data->width);
+ src_data = (quint32 *) (((char*)src_data) + src_bytes_per_line);
+ dst_data = (quint16 *) (((char*)dst_data) + dst_bytes_per_line);
+ }
+ data->format = QImage::Format_RGB16;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, data->nbytes);
+ if (newData) {
+ data->data = newData;
+ return true;
+ } else {
+ return false;
+ }
+}
+
static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied);
@@ -3447,6 +3612,103 @@ static const Image_Converter converter_map[QImage::NImageFormats][QImage::NImage
} // Format_ARGB4444_Premultiplied
};
+static const InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
+{
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_Mono
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_MonoLSB
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ convert_indexed8_to_RGB_inplace,
+ convert_indexed8_to_ARGB_PM_inplace,
+ convert_indexed8_to_RGB16_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }, // Format_Indexed8
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ convert_RGB_to_RGB16_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }, // Format_ARGB32
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ convert_ARGB_to_ARGB_PM_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }, // Format_ARGB32
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB32_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB16
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB8565_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB666
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB6666_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB555
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB8555_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB888
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB444
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ } // Format_ARGB4444_Premultiplied
+};
+
/*!
Returns a copy of the image in the given \a format.
@@ -6276,6 +6538,18 @@ QTransform QImage::trueMatrix(const QTransform &matrix, int w, int h)
return matrix * QTransform().translate(-delta.x(), -delta.y());
}
+bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags flags)
+{
+ if (format == newFormat)
+ return true;
+
+ const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat];
+ InPlace_Image_Converter converter = *converterPtr;
+ if (converter)
+ return converter(this, flags);
+ else
+ return false;
+}
/*!
\typedef QImage::DataPtr
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 0c19647..f1a0c47 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -96,6 +96,9 @@ struct Q_GUI_EXPORT QImageData { // internal image data
bool checkForAlphaPixels() const;
+ // Convert the image in-place, minimizing memory reallocation
+ // Return false if the conversion cannot be done in-place.
+ bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags);
#ifndef QT_NO_IMAGE_TEXT
QMap<QString, QString> text;
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 9dc15fc..13c03a1 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -47,6 +47,9 @@
#include "qbitmap.h"
#include "qimage.h"
+#include <QBuffer>
+#include <QImageReader>
+#include <private/qsimd_p.h>
#include <private/qwidget_p.h>
#include <private/qdrawhelper_p.h>
@@ -127,91 +130,26 @@ void QRasterPixmapData::resize(int width, int height)
setSerialNumber(image.serialNumber());
}
+bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *format,
+ Qt::ImageConversionFlags flags)
+{
+ QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len);
+ QBuffer b(&a);
+ b.open(QIODevice::ReadOnly);
+ QImage image = QImageReader(&b, format).read();
+ if (image.isNull())
+ return false;
+
+ createPixmapForImage(image, flags, /* inplace = */true);
+ return !isNull();
+}
+
void QRasterPixmapData::fromImage(const QImage &sourceImage,
Qt::ImageConversionFlags flags)
{
Q_UNUSED(flags);
-
-#ifdef Q_WS_QWS
- QImage::Format format;
- if (pixelType() == BitmapType) {
- format = QImage::Format_Mono;
- } else {
- format = QScreen::instance()->pixelFormat();
- if (format == QImage::Format_Invalid)
- format = QImage::Format_ARGB32_Premultiplied;
- else if (format == QImage::Format_Indexed8) // currently not supported
- format = QImage::Format_RGB444;
- }
-
- if (sourceImage.hasAlphaChannel()
- && ((flags & Qt::NoOpaqueDetection)
- || const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) {
- switch (format) {
- case QImage::Format_RGB16:
- format = QImage::Format_ARGB8565_Premultiplied;
- break;
- case QImage::Format_RGB666:
- format = QImage::Format_ARGB6666_Premultiplied;
- break;
- case QImage::Format_RGB555:
- format = QImage::Format_ARGB8555_Premultiplied;
- break;
- case QImage::Format_RGB444:
- format = QImage::Format_ARGB4444_Premultiplied;
- break;
- default:
- format = QImage::Format_ARGB32_Premultiplied;
- break;
- }
- } else if (format == QImage::Format_Invalid) {
- format = QImage::Format_ARGB32_Premultiplied;
- }
-
- image = sourceImage.convertToFormat(format);
-#else
- if (pixelType() == BitmapType) {
- image = sourceImage.convertToFormat(QImage::Format_MonoLSB);
- } else {
- if (sourceImage.depth() == 1) {
- image = sourceImage.hasAlphaChannel()
- ? sourceImage.convertToFormat(QImage::Format_ARGB32_Premultiplied)
- : sourceImage.convertToFormat(QImage::Format_RGB32);
- } else {
-
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
- QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
-
-#ifndef QT_HAVE_NEON
- switch (opaqueFormat) {
- case QImage::Format_RGB16:
- alphaFormat = QImage::Format_ARGB8565_Premultiplied;
- break;
- default: // We don't care about the others...
- break;
- }
-#endif
-
- if (!sourceImage.hasAlphaChannel()
- || ((flags & Qt::NoOpaqueDetection) == 0
- && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) {
- image = sourceImage.convertToFormat(opaqueFormat);
- } else {
- image = sourceImage.convertToFormat(alphaFormat);
- }
- }
- }
-#endif
- if (image.d) {
- w = image.d->width;
- h = image.d->height;
- d = image.d->depth;
- } else {
- w = h = d = 0;
- }
- is_null = (w <= 0 || h <= 0);
-
- setSerialNumber(image.serialNumber());
+ QImage image = sourceImage;
+ createPixmapForImage(image, flags, /* inplace = */false);
}
// from qwindowsurface.cpp
@@ -240,7 +178,7 @@ void QRasterPixmapData::fill(const QColor &color)
if (alpha != 255) {
if (!image.hasAlphaChannel()) {
QImage::Format toFormat;
-#ifndef QT_HAVE_NEON
+#if !(defined(QT_HAVE_NEON) || defined(QT_ALWAYS_HAVE_SSE2))
if (image.format() == QImage::Format_RGB16)
toFormat = QImage::Format_ARGB8565_Premultiplied;
else if (image.format() == QImage::Format_RGB666)
@@ -398,6 +336,105 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
return 0;
}
+void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace)
+{
+ QImage::Format format;
+#ifdef Q_WS_QWS
+ if (pixelType() == BitmapType) {
+ format = QImage::Format_Mono;
+ } else {
+ format = QScreen::instance()->pixelFormat();
+ if (format == QImage::Format_Invalid)
+ format = QImage::Format_ARGB32_Premultiplied;
+ else if (format == QImage::Format_Indexed8) // currently not supported
+ format = QImage::Format_RGB444;
+ }
+
+ if (sourceImage.hasAlphaChannel()
+ && ((flags & Qt::NoOpaqueDetection)
+ || const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) {
+ switch (format) {
+ case QImage::Format_RGB16:
+ format = QImage::Format_ARGB8565_Premultiplied;
+ break;
+ case QImage::Format_RGB666:
+ format = QImage::Format_ARGB6666_Premultiplied;
+ break;
+ case QImage::Format_RGB555:
+ format = QImage::Format_ARGB8555_Premultiplied;
+ break;
+ case QImage::Format_RGB444:
+ format = QImage::Format_ARGB4444_Premultiplied;
+ break;
+ default:
+ format = QImage::Format_ARGB32_Premultiplied;
+ break;
+ }
+ } else if (format == QImage::Format_Invalid) {
+ format = QImage::Format_ARGB32_Premultiplied;
+ }
+#else
+ if (pixelType() == BitmapType) {
+ format = QImage::Format_MonoLSB;
+ } else {
+ if (sourceImage.depth() == 1) {
+ format = sourceImage.hasAlphaChannel()
+ ? QImage::Format_ARGB32_Premultiplied
+ : QImage::Format_RGB32;
+ } else {
+ QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
+
+#if !defined(QT_HAVE_NEON) && !defined(QT_ALWAYS_HAVE_SSE2)
+ switch (opaqueFormat) {
+ case QImage::Format_RGB16:
+ alphaFormat = QImage::Format_ARGB8565_Premultiplied;
+ break;
+ default: // We don't care about the others...
+ break;
+ }
+#endif
+
+ if (!sourceImage.hasAlphaChannel()) {
+ format = opaqueFormat;
+ } else if ((flags & Qt::NoOpaqueDetection) == 0
+ && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
+ {
+ // image has alpha format but is really opaque, so try to do a
+ // more efficient conversion
+ if (sourceImage.format() == QImage::Format_ARGB32
+ || sourceImage.format() == QImage::Format_ARGB32_Premultiplied)
+ {
+ if (!inPlace)
+ sourceImage.detach();
+ sourceImage.d->format = QImage::Format_RGB32;
+ }
+ format = opaqueFormat;
+ } else {
+ format = alphaFormat;
+ }
+ }
+ }
+#endif
+
+ if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
+ image = sourceImage;
+ } else {
+ image = sourceImage.convertToFormat(format);
+ }
+
+ if (image.d) {
+ w = image.d->width;
+ h = image.d->height;
+ d = image.d->depth;
+ } else {
+ w = h = d = 0;
+ }
+ is_null = (w <= 0 || h <= 0);
+
+ setSerialNumber(image.serialNumber());
+}
+
QImage* QRasterPixmapData::buffer()
{
return &image;
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 6cdd3d7..d7e3f85 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -72,6 +72,7 @@ public:
void resize(int width, int height);
void fromFile(const QString &filename, Qt::ImageConversionFlags flags);
+ bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
bool scroll(int dx, int dy, const QRect &rect);
@@ -85,6 +86,8 @@ public:
protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
+ void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace);
+ void setImage(const QImage &image);
QImage image;
private:
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index ea4fe6b..31ca909 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -146,7 +146,7 @@ bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::I
void QPixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- fromImage(data->toImage().copy(rect), Qt::AutoColor);
+ fromImage(data->toImage().copy(rect), Qt::NoOpaqueDetection);
}
bool QPixmapData::scroll(int dx, int dy, const QRect &rect)
diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp
index 775bf7d..0ea6d67 100644
--- a/src/gui/itemviews/qabstractitemdelegate.cpp
+++ b/src/gui/itemviews/qabstractitemdelegate.cpp
@@ -291,8 +291,14 @@ void QAbstractItemDelegate::updateEditorGeometry(QWidget *,
}
/*!
- Whenever an event occurs, this function is called with the \a event
- \a model \a option and the \a index that corresponds to the item being edited.
+ When editing of an item starts, this function is called with the
+ \a event that triggered the editing, the \a model, the \a index of
+ the item, and the \a option used for rendering the item.
+
+ Mouse events are sent to editorEvent() even if they don't start
+ editing of the item. This can, for instance, be useful if you wish
+ to open a context menu when the right mouse button is pressed on
+ an item.
The base implementation returns false (indicating that it has not
handled the event).
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index f64d03b..d534f76 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -95,8 +95,8 @@ public:
m_tags(0),
m_contours(0),
m_polygon_dev(0),
- m_round_coords(false),
- m_in_clip_elements(false)
+ m_in_clip_elements(false),
+ m_round_coords(false)
{
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index d17c711..71bc990 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2391,6 +2391,8 @@ void QPainter::setCompositionMode(CompositionMode mode)
qWarning("QPainter::setCompositionMode: Painter not active");
return;
}
+ if (d->state->composition_mode == mode)
+ return;
if (d->extended) {
d->state->composition_mode = mode;
d->extended->compositionModeChanged();
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 883f511..ada5293 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -884,7 +884,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
}
painter->restore();
break;
-#ifndef QT_NO_LINEDIT
+#ifndef QT_NO_LINEEDIT
case PE_FrameLineEdit:
// fall through
#endif // QT_NO_LINEEDIT
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index f029602..d18383c 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -1808,7 +1808,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
painter->setClipRegion(rgn);
- CGContextRef cg = qt_mac_cg_context(target);
+ QCFType<CGContextRef> cg = qt_mac_cg_context(target);
CGContextSaveGState(cg);
HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index c742455..91a6612 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -421,7 +421,7 @@ namespace {
class DrawTextItemRecorder: public QPaintEngine
{
public:
- DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations, int numChars)
+ DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations)
: m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations),
m_untransformedCoordinates(untransformedCoordinates)
{
@@ -518,11 +518,10 @@ namespace {
class DrawTextItemDevice: public QPaintDevice
{
public:
- DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations,
- int numChars)
+ DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations)
{
m_paintEngine = new DrawTextItemRecorder(untransformedCoordinates,
- useBackendOptimizations, numChars);
+ useBackendOptimizations);
}
~DrawTextItemDevice()
@@ -664,7 +663,7 @@ void QStaticTextPrivate::init()
position = QPointF(0, 0);
- DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations, text.size());
+ DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations);
{
QPainter painter(&device);
painter.setFont(font);
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 48aee8f..e0386f1 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -127,6 +127,8 @@ bool Qt::mightBeRichText(const QString& text)
tag += text[i];
else if (!tag.isEmpty() && text[i].isSpace())
break;
+ else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close)
+ break;
else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
return false; // that's not a tag
}
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index ac1fffd..60195a8 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2670,7 +2670,7 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe)
: flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline),
- num_chars(0), chars(0), logClusters(0), f(font), fontEngine(fe), glyphs(g)
+ num_chars(0), chars(0), logClusters(0), f(font), glyphs(g), fontEngine(fe)
{
}