diff options
64 files changed, 1420 insertions, 341 deletions
diff --git a/demos/mainwindow/mainwindow.cpp b/demos/mainwindow/mainwindow.cpp index 3ddb74b..350cefa 100644 --- a/demos/mainwindow/mainwindow.cpp +++ b/demos/mainwindow/mainwindow.cpp @@ -81,6 +81,8 @@ static const char * const message = #endif ; +Q_DECLARE_METATYPE(QDockWidget::DockWidgetFeatures) + MainWindow::MainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) @@ -274,6 +276,8 @@ QAction *addAction(QMenu *menu, const QString &text, QActionGroup *group, QSigna void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints) { + qRegisterMetaType<QDockWidget::DockWidgetFeatures>(); + mapper = new QSignalMapper(this); connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCorner(int))); diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 58a0248..2723ff2 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -104,9 +104,9 @@ function processNokiaData(response){ } - if(lookupCount == 0){$('#ul001').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} - if(articleCount == 0){$('#ul002').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');} - if(exampleCount == 0){$('#ul003').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');} + if(lookupCount == 0){$('#ul001').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} + if(articleCount == 0){$('#ul002').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');} + if(exampleCount == 0){$('#ul003').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');} // reset count variables; lookupCount=0; articleCount = 0; @@ -160,7 +160,8 @@ else var searchString = $('#pageType').val() ; if ((searchString == null) || (searchString.length < 3)) { $('#pageType').removeClass('loading'); - $('.liveResult').remove(); // replaces removeResults(); + $('.liveResult').remove(); + $('.searching').remove(); CheckEmptyAndLoadList(); $('.report').remove(); // debug$('.content').prepend('<li>too short or blank</li>'); // debug @@ -169,9 +170,7 @@ else if (this.timer) clearTimeout(this.timer); this.timer = setTimeout(function () { $('#pageType').addClass('loading'); - // debug$('.content').prepend('<li>new search started </li>');// debug - // debug$('.content').prepend('<p class=\"report\">Search string ' +searchString +'</p>'); // debug - + $('.list ul').prepend('<li class="menuAlert searching">Searching...</li>'); $.ajax({ contentType: "application/x-www-form-urlencoded", url: 'http://' + location.host + '/nokiasearch/GetDataServlet', @@ -180,9 +179,9 @@ else type: 'post', success: function (response, textStatus) { - $('.liveResult').remove(); // replaces removeResults(); + $('.liveResult').remove(); $('#pageType').removeClass('loading'); - + $('.list ul').prepend('<li class="menuAlert searching">Searching...</li>'); processNokiaData(response); } diff --git a/doc/src/template/scripts/narrow.js b/doc/src/template/scripts/narrow.js index 12d0ce8..35c81bf 100644 --- a/doc/src/template/scripts/narrow.js +++ b/doc/src/template/scripts/narrow.js @@ -59,9 +59,20 @@ var narrowInit = function() { } $(document).ready(function(){ - if ($('body').hasClass('narrow')) { +/* if ($('body').hasClass('narrow')) { narrowInit(); } + */ + if($(window).width()<600) { + $('body').addClass('narrow'); + + if ($("#narrowsearch").length == 0) { + narrowInit(); + } + } + else { + $('body').removeClass('narrow'); + } }); $(window).bind('resize', function () { diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css index ddd580a..afa7de0 100644 --- a/doc/src/template/style/OfflineStyle.css +++ b/doc/src/template/style/OfflineStyle.css @@ -337,9 +337,10 @@ } .wrap .content li { - padding-left: 12px; + /*padding-left: 12px;*/ background: url(../images/bullet_sq.png) no-repeat 0 5px; font: normal 400 10pt/1 Verdana; + /* color: #44a51c;*/ margin-bottom: 10px; } @@ -794,6 +795,18 @@ ul.sf-menu li li li.sfHover ul { left: 10em; /* match ul width */ top: 0; } + .wrap .content ol li { + background:none; + font:400 10pt/1 Verdana; + margin-bottom:10px; + margin-left:12px; + } + .wrap .content ol li { + list-style-type:decimal; + + } + + } /* end of screen media */ diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 47fe2e0..78a21f6 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -256,9 +256,9 @@ .sidebar .box h2 { - font: normal 18px/1.2 Arial; + font: 600 16px/1.2 Arial; padding: 0; - min-height: 32px; +/* min-height: 32px;*/ } .sidebar .box h2 span { @@ -271,10 +271,10 @@ } .sidebar #lookup.box h2 span { - background: url(../images/sprites-combined.png) no-repeat -6px -311px; +/* background: url(../images/sprites-combined.png) no-repeat -6px -311px; width: 27px; height: 35px; - margin-right: 13px; + margin-right: 13px;*/ } .sidebar .box#topics h2 { @@ -282,10 +282,10 @@ } .sidebar #topics.box h2 span { - background: url(../images/sprites-combined.png) no-repeat -94px -311px; + /* background: url(../images/sprites-combined.png) no-repeat -94px -311px; width: 27px; height: 32px; - margin-right: 13px; + margin-right: 13px;*/ } .sidebar .box#examples h2 { @@ -293,32 +293,30 @@ } .sidebar #examples.box h2 span { - background: url(../images/sprites-combined.png) no-repeat -48px -311px; + /* background: url(../images/sprites-combined.png) no-repeat -48px -311px; width: 30px; height: 31px; - margin-right: 9px; + margin-right: 9px;*/ } .sidebar .box .list { display: block; max-height:200px; + min-height:120px; overflow-y:auto; overflow-x:none; } - .sidebar .box .live - { - display: none; - height: 100px; - overflow: auto; - } - .list li a:hover, .live li a:hover + .list li a:hover { text-decoration: underline; } .sidebar .box ul { - padding:10px; + /*padding:10px;*/ + padding-bottom:5px; + padding-left:10px; + padding-top:5px; } .sidebar .box ul li { @@ -330,6 +328,14 @@ { background: url(../images/box_bg.png) repeat-x 0 bottom; } + .sidebar .box ul li.menuAlert + { + background: none; + color:gray; + font-style:italic; + } + + .wrap { margin: 0 5px 0 208px; @@ -461,11 +467,12 @@ .wrap .content li { - padding-left: 12px; + /*padding-left: 12px;*/ background: url(../images/bullet_sq.png) no-repeat 0 5px; font: normal 400 10pt/1 Verdana; /* color: #44a51c;*/ margin-bottom: 10px; + padding-left:12px; } .content li:hover { @@ -493,6 +500,7 @@ { line-height: 20px; padding: 5px; + /* text-align:justify;*/ } .wrap .content table p { @@ -776,7 +784,7 @@ td.rightAlign { - padding: 3px 15px 3px 10px; + padding: 3px 5px 3px 10px; } table tr.odd { @@ -898,10 +906,14 @@ } .generic{ - max-width:75%; + /*max-width:75%;*/ } .generic td{ - padding:0; + padding:5px; + } + + .generic .alphaChar{ + margin-top:5px; } .generic .odd .alphaChar{ @@ -915,7 +927,9 @@ .alignedsummary{} .propsummary{} .memItemLeft{} - .memItemRight{} + .memItemRight{ + padding:3px 15px 3px 0; + } .bottomAlign{} .highlightedCode { @@ -923,7 +937,9 @@ } .LegaleseLeft{} .valuelist{} - .annotated{} + .annotated td{ + padding: 3px 5px 3px 5px; + } .obsolete{} .compat{} .flags{} @@ -984,6 +1000,7 @@ border-color: #E6E6E6; font-weight: bold; word-spacing:3px; + padding:3px 5px; } .functionIndex { @@ -1173,8 +1190,36 @@ pre.highlightedCode { display: block; overflow:hidden; } - +.floatingResult{ + z-index:1; + position:relative; + padding-top:0px; + background-color:white; + border:solid 1px black; + height:250px; + width:600px; + overflow-x:hidden; + overflow-y:auto; } + + .floatingResult:hover{ + display:block; + } + .floatingResult:hover{ + /*display:none;*/ + } + + .wrap .content ol li { + background:none; + font:400 10pt/1 Verdana; + margin-bottom:10px; + margin-left:12px; + } + .wrap .content ol li { + list-style-type:decimal; + + } + /* end of screen media */ /* start of print media */ diff --git a/examples/dbus/remotecontrolledcar/car/car.h b/examples/dbus/remotecontrolledcar/car/car.h index 5ef046e..c611018 100644 --- a/examples/dbus/remotecontrolledcar/car/car.h +++ b/examples/dbus/remotecontrolledcar/car/car.h @@ -41,14 +41,12 @@ #ifndef CAR_H #define CAR_H -#include <QGraphicsItem> -#include <QObject> +#include <QGraphicsObject> #include <QBrush> -class Car : public QObject, public QGraphicsItem +class Car : public QGraphicsObject { Q_OBJECT - public: Car(); QRectF boundingRect() const; diff --git a/examples/examples.pro b/examples/examples.pro index 43cad55..9a83216 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -30,6 +30,8 @@ SUBDIRS = \ gestures } +contains(QT_CONFIG, webkit):SUBDIRS += webkit + symbian: SUBDIRS = \ graphicsview \ itemviews \ diff --git a/examples/graphicsview/dragdroprobot/coloritem.cpp b/examples/graphicsview/dragdroprobot/coloritem.cpp index b6113fd..327fa87 100644 --- a/examples/graphicsview/dragdroprobot/coloritem.cpp +++ b/examples/graphicsview/dragdroprobot/coloritem.cpp @@ -76,7 +76,7 @@ void ColorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, //! [2] //! [3] -void ColorItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +void ColorItem::mousePressEvent(QGraphicsSceneMouseEvent *) { setCursor(Qt::ClosedHandCursor); } diff --git a/examples/graphicsview/simpleanchorlayout/main.cpp b/examples/graphicsview/simpleanchorlayout/main.cpp index 9cb4006..942cdc4 100644 --- a/examples/graphicsview/simpleanchorlayout/main.cpp +++ b/examples/graphicsview/simpleanchorlayout/main.cpp @@ -49,7 +49,7 @@ public: { } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * = 0) { QFont font; font.setPixelSize(0.75 * qMin(boundingRect().width(), boundingRect().height())); diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp index 5dc2ef1..5ab4918 100644 --- a/examples/multimedia/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audiodevices/audiodevices.cpp @@ -58,6 +58,8 @@ QString toString(QAudioFormat::SampleType sampleType) case QAudioFormat::Float: result = "Float"; break; + case QAudioFormat::Unknown: + break; } return result; } 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 ℑ 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) { } diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 0538607..06c70f9 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -79,7 +79,7 @@ private: tst_Headers::tst_Headers() : copyrightPattern("\\*\\* Copyright \\(C\\) 20[0-9][0-9] Nokia Corporation and/or its subsidiary\\(-ies\\)."), - licensePattern("\\*\\* \\$QT_BEGIN_LICENSE:(LGPL|BSD|3RDPARTY|LGPL-ONLY)\\$"), + licensePattern("\\*\\* \\$QT_BEGIN_LICENSE:(LGPL|BSD|3RDPARTY|LGPL-ONLY|FDL)\\$"), moduleTest(QLatin1String("\\*\\* This file is part of the .+ of the Qt Toolkit.")) { } diff --git a/tests/auto/qpixmap/loadFromData/designer_argb32.png b/tests/auto/qpixmap/loadFromData/designer_argb32.png Binary files differnew file mode 100644 index 0000000..55d8247 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_argb32.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif Binary files differnew file mode 100644 index 0000000..26a6da3 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png Binary files differnew file mode 100644 index 0000000..28cd2f0 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif Binary files differnew file mode 100644 index 0000000..49ec77b --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png Binary files differnew file mode 100644 index 0000000..09735a9 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg b/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg Binary files differnew file mode 100644 index 0000000..70f39c2 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.png b/tests/auto/qpixmap/loadFromData/designer_rgb32.png Binary files differnew file mode 100644 index 0000000..bca471d --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_rgb32.png diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 49b1e52..179f068 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -172,6 +172,9 @@ private slots: void fromData(); void loadFromDataNullValues(); + void loadFromDataImage_data(); + void loadFromDataImage(); + void preserveDepth(); void splash_crash(); @@ -1540,6 +1543,40 @@ void tst_QPixmap::loadFromDataNullValues() } } +void tst_QPixmap::loadFromDataImage_data() +{ + QTest::addColumn<QString>("imagePath"); +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; + QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; + QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png"; + QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png"; + QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; + QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; + QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; +} + +void tst_QPixmap::loadFromDataImage() +{ + QFETCH(QString, imagePath); + + QImage imageRef(imagePath); + QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef); + + QFile file(imagePath); + file.open(QIODevice::ReadOnly); + QByteArray rawData = file.readAll(); + + QPixmap directLoadingPixmap; + directLoadingPixmap.loadFromData(rawData); + + QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); +} + void tst_QPixmap::task_246446() { // This crashed without the bugfix in 246446 diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 51aee74..808299b 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -98,6 +98,7 @@ private slots: void noundo_isModified2(); void noundo_isModified3(); void mightBeRichText(); + void mightBeRichText_data(); void task240325(); @@ -679,13 +680,32 @@ void tst_QTextDocument::noundo_isModified3() QVERIFY(doc->isModified()); } -void tst_QTextDocument::mightBeRichText() +void tst_QTextDocument::mightBeRichText_data() { const char qtDocuHeader[] = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n" "<!DOCTYPE html\n" " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n" "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">"; QVERIFY(Qt::mightBeRichText(QString::fromLatin1(qtDocuHeader))); + QTest::addColumn<QString>("input"); + QTest::addColumn<bool>("result"); + + QTest::newRow("documentation-header") << QString("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n" + "<!DOCTYPE html\n" + " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">") + << true; + QTest::newRow("br-nospace") << QString("Test <br/> new line") << true; + QTest::newRow("br-space") << QString("Test <br /> new line") << true; + QTest::newRow("br-invalidspace") << QString("Test <br/ > new line") << false; + QTest::newRow("invalid closing tag") << QString("Test <br/ line") << false; +} + +void tst_QTextDocument::mightBeRichText() +{ + QFETCH(QString, input); + QFETCH(bool, result); + QVERIFY(result == Qt::mightBeRichText(input)); } Q_DECLARE_METATYPE(QTextDocumentFragment) diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index a0c9e83..6f009e3 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -2125,6 +2125,21 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget ui_widget->setElementItem(ui_items); } +// Return the buttongroups assigned to a button except the internal one +// (with empty object name) used by Q3ButtonGroup. +static inline const QButtonGroup *formButtonGroup(const QAbstractButton *widget) +{ + const QButtonGroup *buttonGroup = widget->group(); + if (!buttonGroup) + return 0; + if (buttonGroup->objectName().isEmpty()) { + if (const QWidget *parent = widget->parentWidget()) + if (!qstrcmp(parent->metaObject()->className(), "Q3ButtonGroup")) + return 0; + } + return buttonGroup; +} + /*! \internal \since 4.5 @@ -2133,7 +2148,7 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, DomWidget *ui_widget, DomWidget *) { typedef QList<DomProperty*> DomPropertyList; - if (const QButtonGroup *buttonGroup = widget->group()) { + if (const QButtonGroup *buttonGroup = formButtonGroup(widget)) { DomPropertyList attributes = ui_widget->elementAttribute(); DomString *domString = new DomString(); domString->setText(buttonGroup->objectName()); diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index e80f948..e5481a0 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1402,20 +1402,20 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QList<Section> sections; QList<Section>::ConstIterator s; - const ClassNode* cn = 0; - const NamespaceNode *namespasse = 0; + ClassNode* cn = 0; + NamespaceNode* namespasse = 0; QString title; QString rawTitle; QString fullTitle; if (inner->type() == Node::Namespace) { - namespasse = static_cast<const NamespaceNode *>(inner); + namespasse = static_cast<const NamespaceNode*>(inner); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace"; } else if (inner->type() == Node::Class) { - cn = static_cast<const ClassNode *>(inner); + cn = static_cast<const ClassNode*>(inner); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Class Reference"; @@ -4563,6 +4563,11 @@ void DitaXmlGenerator::writeLocation(const Node* n, CodeMarker* marker) s2 = CXXFUNCTIONDECLARATIONFILE; s3 = CXXFUNCTIONDECLARATIONFILELINE; } + else if (n->type() == Node::Enum) { + s1 = CXXENUMERATIONAPIITEMLOCATION; + s2 = CXXENUMERATIONDECLARATIONFILE; + s3 = CXXENUMERATIONDECLARATIONFILELINE; + } writer.writeStartElement(s1); writer.writeStartElement(s2); writer.writeAttribute("name","filePath"); @@ -4583,12 +4588,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s, NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { if ((*m)->type() == Node::Function) { - const FunctionNode* fn = reinterpret_cast<const FunctionNode*>(*m); - QString name = fn->name(); + FunctionNode* fn = static_cast<const FunctionNode*>(*m); writer.writeStartElement(CXXFUNCTION); - writeGuidAttribute(name); + writer.writeAttribute("id",fn->guid()); writer.writeStartElement(APINAME); - writer.writeCharacters(name); + writer.writeCharacters(fn->name()); writer.writeEndElement(); // </apiName> generateBrief(fn,marker); writer.writeStartElement(CXXFUNCTIONDETAIL); @@ -4662,11 +4666,14 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writer.writeCharacters(fnl); writer.writeEndElement(); // <cxxFunctionNameLookup> - //writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED); - //writer.writeAttribute("href", zzz); - //writer.writeCharacters(); - //writer.writeEndElement(); // </cxxFunctionReimplemented> - + if (fn->isReimp() && fn->reimplementedFrom() != 0) { + FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); + writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED); + writer.writeAttribute("href",rfn->ditaXmlHref()); + writer.writeCharacters(marker->plainFullName(rfn)); + writer.writeEndElement(); // </cxxFunctionReimplemented> + } + writeParameters(fn,marker); writeLocation(fn, marker); writer.writeEndElement(); // <cxxFunctionDefinition> writer.writeStartElement(APIDESC); @@ -4689,6 +4696,32 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } } +void DitaXmlGenerator::writeParameters(FunctionNode* fn, CodeMarker* marker) +{ + const QList<Parameter>& parameters = fn->parameters(); + if (!parameters.isEmpty()) { + writer.writeStartElement(CXXFUNCTIONPARAMETERS); + QList<Parameter>::ConstIterator p = parameters.begin(); + while (p != parameters.end()) { + writer.writeStartElement(CXXFUNCTIONPARAMETER); + writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); + writer.writeCharacters((*p).leftType()); + writer.writeEndElement(); // <cxxFunctionParameterDeclaredType> + writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); + writer.writeCharacters((*p).name()); + writer.writeEndElement(); // <cxxFunctionParameterDeclarationName> + if (!(*p).defaultValue().isEmpty()) { + writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); + writer.writeCharacters((*p).defaultValue()); + writer.writeEndElement(); // <cxxFunctionParameterDefaultValue> + } + writer.writeEndElement(); // <cxxFunctionParameter> + ++p; + } + writer.writeEndElement(); // <cxxFunctionParameters> + } +} + void DitaXmlGenerator::writeNestedClasses(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4699,6 +4732,67 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, const ClassNode* cn, CodeMarker* marker) { + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Enum) { + EnumNode* en = static_cast<const EnumNode*>(*m); + writer.writeStartElement(CXXENUMERATION); + writer.writeAttribute("id",en->guid()); + writer.writeStartElement(APINAME); + writer.writeCharacters(en->name()); + writer.writeEndElement(); // </apiName> + generateBrief(en,marker); + writer.writeStartElement(CXXENUMERATIONDETAIL); + writer.writeStartElement(CXXENUMERATIONDEFINITION); + writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); + writer.writeAttribute("value",en->accessString()); + writer.writeEndElement(); // <cxxEnumerationAccessSpecifier> + + QString fq = fullQualification(en); + if (!fq.isEmpty()) { + writer.writeStartElement(CXXENUMERATIONSCOPEDNAME); + writer.writeCharacters(fq); + writer.writeEndElement(); // <cxxEnumerationScopedName> + } + const QList<EnumItem>& items = en->items(); + if (!items.isEmpty()) { + writer.writeStartElement(CXXENUMERATIONPROTOTYPE); + writer.writeCharacters(en->name()); + writer.writeCharacters(" = { "); + QList<EnumItem>::ConstIterator i = items.begin(); + while (i != items.end()) { + writer.writeCharacters((*i).name()); + if (!(*i).value().isEmpty()) { + writer.writeCharacters(" = "); + writer.writeCharacters((*i).value()); + } + ++i; + if (i != items.end()) + writer.writeCharacters(", "); + } + writer.writeCharacters(" }"); + writer.writeEndElement(); // <cxxEnumerationPrototype> + } + + writer.writeStartElement(CXXENUMERATIONNAMELOOKUP); + writer.writeCharacters(en->parent()->name() + "::" + en->name()); + writer.writeEndElement(); // <cxxEnumerationNameLookup> + + writeLocation(en, marker); + writer.writeEndElement(); // <cxxEnumerationDefinition> + writer.writeStartElement(APIDESC); + + if (!en->doc().isEmpty()) { + generateBody(en, marker); + // generateAlsoList(inner, marker); + } + + writer.writeEndElement(); // </apiDesc> + writer.writeEndElement(); // </cxxEnumerationDetail> + writer.writeEndElement(); // </cxxEnumeration> + } + ++m; + } } void DitaXmlGenerator::writeTypedefs(const Section& s, diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 71304b3..e8ad8ba 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -117,6 +117,7 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const ClassNode* cn, CodeMarker* marker); + void writeParameters(FunctionNode* fn, CodeMarker* marker); void writeNestedClasses(const Section& s, const ClassNode* cn, CodeMarker* marker); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index f6b8c06..339c390 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1831,13 +1831,13 @@ void HtmlGenerator::generateHeader(const QString& title, out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />"; // syntax highlighter js and css - // out() << " <link type=\"text/css\" rel=\"stylesheet\" href=\"style/shCore.css\"/>\n"; - // out() << " <link type=\"text/css\" rel=\"stylesheet\" href=\"style/shThemeDefault.css\"/>\n"; - // out() << " <script type=\"text/javascript\" src=\"scripts/shCore.js\"></script>\n"; - // out() << " <script type=\"text/javascript\" src=\"scripts/shBrushCpp.js\"></script>\n"; - // out() << " <script type=\"text/javascript\">\n"; - // out() << " SyntaxHighlighter.all();\n"; - // out() << " </script>\n"; + // out() << " <link type=\"text/css\" rel=\"stylesheet\" href=\"style/shCore.css\"/>\n"; + // out() << " <link type=\"text/css\" rel=\"stylesheet\" href=\"style/shThemeDefault.css\"/>\n"; + // out() << " <script type=\"text/javascript\" src=\"scripts/shCore.js\"></script>\n"; + // out() << " <script type=\"text/javascript\" src=\"scripts/shBrushCpp.js\"></script>\n"; + // out() << " <script type=\"text/javascript\">\n"; + // out() << " SyntaxHighlighter.all();\n"; + // out() << " </script>\n"; out() << "</head>\n"; out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 2a03fd2..12dee87 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -101,7 +101,7 @@ Node::Node(Type type, InnerNode *parent, const QString& name) { if (par) par->addChild(this); - uuid = QUuid::createUuid(); + //uuid = QUuid::createUuid(); } /*! @@ -241,20 +241,32 @@ QString Node::fileBase() const return base.toLower(); } -/*! \fnQUuid Node::guid() const +/*! Returns this node's Universally Unique IDentifier. If its UUID has not yet been created, it is created first. */ +QUuid Node::guid() +{ + if (uuid.isNull()) + uuid = QUuid::createUuid(); + return uuid; +} /*! Composes a string to be used as an href attribute in DITA XML. It is composed of the file name and the UUID separated - by a '#' + by a '#'. If this node is a class node, the file name is + taken from this node; if this node is a function node, the + file name is taken from the parent node of this node. */ QString Node::ditaXmlHref() { - QString href = fileBase(); + QString href; + if (type() == Function) + href = parent()->fileBase(); + else + href = fileBase(); if (!href.endsWith(".xml")) href += ".xml"; return href + "#" + guid(); @@ -956,6 +968,8 @@ QString FakeNode::subTitle() const */ /*! + The constructor for the node representing an enum type + has a \a parent class and an enum type \a name. */ EnumNode::EnumNode(InnerNode *parent, const QString& name) : LeafNode(Enum, parent, name), ft(0) @@ -963,6 +977,7 @@ EnumNode::EnumNode(InnerNode *parent, const QString& name) } /*! + Add \a item to the enum type's item list. */ void EnumNode::addItem(const EnumItem& item) { @@ -971,15 +986,15 @@ void EnumNode::addItem(const EnumItem& item) } /*! + Returns the access level of the enumeration item named \a name. + Apparently it is private if it has been omitted by qdoc's + omitvalue command. Otherwise it is public. */ Node::Access EnumNode::itemAccess(const QString &name) const { - if (doc().omitEnumItemNames().contains(name)) { + if (doc().omitEnumItemNames().contains(name)) return Private; - } - else { - return Public; - } + return Public; } /*! diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 44cdac2..4d1e757 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -191,7 +191,8 @@ class Node void clearRelated() { rel = 0; } virtual QString fileBase() const; - QUuid guid() const { return uuid; } + //QUuid guid() const { return uuid; } + QUuid guid(); QString ditaXmlHref(); protected: diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 216ac6a..09cbc45 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -44,6 +44,16 @@ qhp.Qt.extraFiles = index.html \ images/dynamiclayouts-example.png \ scripts/functions.js \ scripts/jquery.js \ + scripts/shBrushCpp.js \ + scripts/shCore.js \ + scripts/shLegacy.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/shCore.css \ + style/shThemeDefault.css \ + style/narrow.css \ + style/superfish.css \ + style/superfish_skin.css \ style/OfflineStyle.css \ style/style_ie6.css \ style/style_ie7.css \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 60f5fb1..1fb000b 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -165,14 +165,4 @@ HTML.footer = " <!-- /div -->\n" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ - " </div>\n" \ - "<script type=\"text/javascript\">\n" \ - " var _gaq = _gaq || [];\n" \ - " _gaq.push([\'_setAccount\', \'UA-4457116-5\']);\n" \ - " _gaq.push([\'_trackPageview\']);\n" \ - " (function() {\n" \ - " var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n" \ - " ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n" \ - " var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n" \ - " })();\n" \ - "</script>\n" + " </div>\n" diff --git a/translations/check-ts.pl b/translations/check-ts.pl index 7b46bf5..5f38703 100755 --- a/translations/check-ts.pl +++ b/translations/check-ts.pl @@ -1,4 +1,45 @@ #! /usr/bin/perl -w +############################################################################# +## +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is part of the translations module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 2.1 requirements +## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + use strict; |