diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-11-16 11:52:15 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-11-16 11:52:15 (GMT) |
commit | 15e2b2d753250bbe01a78d9ece37f0f0b08cd21c (patch) | |
tree | a37bb70124fdbecbbaf7e0e2a141a359eaf4f412 /src/3rdparty | |
parent | 3328e0ee94b94c83fe9d64f741bede6725f5c952 (diff) | |
parent | 7fdfa58b958b658feb7b20dd7a7322d235fe4bea (diff) | |
download | Qt-15e2b2d753250bbe01a78d9ece37f0f0b08cd21c.zip Qt-15e2b2d753250bbe01a78d9ece37f0f0b08cd21c.tar.gz Qt-15e2b2d753250bbe01a78d9ece37f0f0b08cd21c.tar.bz2 |
Merge branch '4.6' into mmfphonon
Diffstat (limited to 'src/3rdparty')
48 files changed, 921 insertions, 340 deletions
diff --git a/src/3rdparty/easing/easing.cpp b/src/3rdparty/easing/easing.cpp index 81af40f..65e9f95 100644 --- a/src/3rdparty/easing/easing.cpp +++ b/src/3rdparty/easing/easing.cpp @@ -18,13 +18,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */ #include <QtCore/qmath.h> -#include <math.h> -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_PI_2 -#define M_PI_2 (M_PI / 2) -#endif +#include <private/qnumeric_p.h> QT_USE_NAMESPACE @@ -69,12 +63,12 @@ static qreal easeOutQuad(qreal t) */ static qreal easeInOutQuad(qreal t) { - t*=2.0; + t*=qreal(2.0); if (t < 1) { - return t*t/qreal(2); + return t*t*qreal(0.5); } else { --t; - return -0.5 * (t*(t-2) - 1); + return qreal(-0.5) * (t*(t-2) - 1); } } @@ -86,8 +80,8 @@ static qreal easeInOutQuad(qreal t) */ static qreal easeOutInQuad(qreal t) { - if (t < 0.5) return easeOutQuad (t*2)/2; - return easeInQuad((2*t)-1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutQuad (t*2) * qreal(0.5); + return easeInQuad((2*t)-1) * qreal(0.5) + qreal(0.5); } /** @@ -109,7 +103,7 @@ static qreal easeInCubic(qreal t) */ static qreal easeOutCubic(qreal t) { - t-=1.0; + t-=qreal(1.0); return t*t*t + 1; } @@ -121,12 +115,12 @@ static qreal easeOutCubic(qreal t) */ static qreal easeInOutCubic(qreal t) { - t*=2.0; + t*=qreal(2.0); if(t < 1) { - return 0.5*t*t*t; + return qreal(0.5)*t*t*t; } else { t -= qreal(2.0); - return 0.5*(t*t*t + 2); + return qreal(0.5)*(t*t*t + 2); } } @@ -138,8 +132,8 @@ static qreal easeInOutCubic(qreal t) */ static qreal easeOutInCubic(qreal t) { - if (t < 0.5) return easeOutCubic (2*t)/2; - return easeInCubic(2*t - 1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutCubic (2*t) * qreal(0.5); + return easeInCubic(2*t - 1) * qreal(0.5) + qreal(0.5); } /** @@ -174,10 +168,10 @@ static qreal easeOutQuart(qreal t) static qreal easeInOutQuart(qreal t) { t*=2; - if (t < 1) return 0.5*t*t*t*t; + if (t < 1) return qreal(0.5)*t*t*t*t; else { t -= 2.0f; - return -0.5 * (t*t*t*t- 2); + return qreal(-0.5) * (t*t*t*t- 2); } } @@ -189,8 +183,8 @@ static qreal easeInOutQuart(qreal t) */ static qreal easeOutInQuart(qreal t) { - if (t < 0.5) return easeOutQuart (2*t)/2; - return easeInQuart(2*t-1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutQuart (2*t) * qreal(0.5); + return easeInQuart(2*t-1) * qreal(0.5) + qreal(0.5); } /** @@ -212,7 +206,7 @@ static qreal easeInQuint(qreal t) */ static qreal easeOutQuint(qreal t) { - t-=1.0; + t-=qreal(1.0); return t*t*t*t*t + 1; } @@ -224,11 +218,11 @@ static qreal easeOutQuint(qreal t) */ static qreal easeInOutQuint(qreal t) { - t*=2.0; - if (t < 1) return 0.5*t*t*t*t*t; + t*=qreal(2.0); + if (t < 1) return qreal(0.5)*t*t*t*t*t; else { - t -= 2.0; - return 0.5*(t*t*t*t*t + 2); + t -= qreal(2.0); + return qreal(0.5)*(t*t*t*t*t + 2); } } @@ -240,8 +234,8 @@ static qreal easeInOutQuint(qreal t) */ static qreal easeOutInQuint(qreal t) { - if (t < 0.5) return easeOutQuint (2*t)/2; - return easeInQuint(2*t - 1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutQuint (2*t) * qreal(0.5); + return easeInQuint(2*t - 1) * qreal(0.5) + qreal(0.5); } /** @@ -252,7 +246,7 @@ static qreal easeOutInQuint(qreal t) */ static qreal easeInSine(qreal t) { - return (t == 1.0) ? 1.0 : -::cos(t * M_PI_2) + 1.0; + return (t == qreal(1.0)) ? qreal(1.0) : -qCos(t * Q_PI2) + qreal(1.0); } /** @@ -263,7 +257,7 @@ static qreal easeInSine(qreal t) */ static qreal easeOutSine(qreal t) { - return ::sin(t* M_PI_2); + return qSin(t* Q_PI2); } /** @@ -274,7 +268,7 @@ static qreal easeOutSine(qreal t) */ static qreal easeInOutSine(qreal t) { - return -0.5 * (::cos(M_PI*t) - 1); + return qreal(-0.5) * (qCos(Q_PI*t) - 1); } /** @@ -285,8 +279,8 @@ static qreal easeInOutSine(qreal t) */ static qreal easeOutInSine(qreal t) { - if (t < 0.5) return easeOutSine (2*t)/2; - return easeInSine(2*t - 1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutSine (2*t) * qreal(0.5); + return easeInSine(2*t - 1) * qreal(0.5) + qreal(0.5); } /** @@ -297,7 +291,7 @@ static qreal easeOutInSine(qreal t) */ static qreal easeInExpo(qreal t) { - return (t==0 || t == 1.0) ? t : ::qPow(2.0, 10 * (t - 1)) - qreal(0.001); + return (t==0 || t == qreal(1.0)) ? t : ::qPow(qreal(2.0), 10 * (t - 1)) - qreal(0.001); } /** @@ -308,7 +302,7 @@ static qreal easeInExpo(qreal t) */ static qreal easeOutExpo(qreal t) { - return (t==1.0) ? 1.0 : 1.001 * (-::qPow(2.0f, -10 * t) + 1); + return (t==qreal(1.0)) ? qreal(1.0) : qreal(1.001) * (-::qPow(2.0f, -10 * t) + 1); } /** @@ -319,11 +313,11 @@ static qreal easeOutExpo(qreal t) */ static qreal easeInOutExpo(qreal t) { - if (t==0.0) return qreal(0.0); - if (t==1.0) return qreal(1.0); - t*=2.0; - if (t < 1) return 0.5 * ::qPow(qreal(2.0), 10 * (t - 1)) - 0.0005; - return 0.5 * 1.0005 * (-::qPow(qreal(2.0), -10 * (t - 1)) + 2); + if (t==qreal(0.0)) return qreal(0.0); + if (t==qreal(1.0)) return qreal(1.0); + t*=qreal(2.0); + if (t < 1) return qreal(0.5) * ::qPow(qreal(2.0), 10 * (t - 1)) - qreal(0.0005); + return qreal(0.5) * qreal(1.0005) * (-::qPow(qreal(2.0), -10 * (t - 1)) + 2); } /** @@ -334,8 +328,8 @@ static qreal easeInOutExpo(qreal t) */ static qreal easeOutInExpo(qreal t) { - if (t < 0.5) return easeOutExpo (2*t)/2; - return easeInExpo(2*t - 1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutExpo (2*t) * qreal(0.5); + return easeInExpo(2*t - 1) * qreal(0.5) + qreal(0.5); } /** @@ -346,7 +340,7 @@ static qreal easeOutInExpo(qreal t) */ static qreal easeInCirc(qreal t) { - return -(::sqrt(1 - t*t) - 1); + return -(::qSqrt(1 - t*t) - 1); } /** @@ -358,7 +352,7 @@ static qreal easeInCirc(qreal t) static qreal easeOutCirc(qreal t) { t-= qreal(1.0); - return ::sqrt(1 - t* t); + return ::qSqrt(1 - t* t); } /** @@ -371,10 +365,10 @@ static qreal easeInOutCirc(qreal t) { t*=qreal(2.0); if (t < 1) { - return -0.5 * (::sqrt(1 - t*t) - 1); + return qreal(-0.5) * (::qSqrt(1 - t*t) - 1); } else { t -= qreal(2.0); - return 0.5 * (::sqrt(1 - t*t) + 1); + return qreal(0.5) * (::qSqrt(1 - t*t) + 1); } } @@ -386,26 +380,26 @@ static qreal easeInOutCirc(qreal t) */ static qreal easeOutInCirc(qreal t) { - if (t < 0.5) return easeOutCirc (2*t)/2; - return easeInCirc(2*t - 1)/2 + 0.5; + if (t < qreal(0.5)) return easeOutCirc (2*t)*qreal(0.5); + return easeInCirc(2*t - 1)*qreal(0.5) + qreal(0.5); } static qreal easeInElastic_helper(qreal t, qreal b, qreal c, qreal d, qreal a, qreal p) { if (t==0) return b; - qreal t_adj = (qreal)t / (qreal)d; + qreal t_adj = t / d; if (t_adj==1) return b+c; qreal s; - if(a < ::fabs(c)) { + if(a < ::qAbs(c)) { a = c; - s = p / 4.0f; + s = p * 0.25f; } else { - s = p / (2 * M_PI) * ::asin(c / a); + s = p / (Q_2PI) * ::qAsin(c / a); } t_adj -= 1.0f; - return -(a*::qPow(2.0f,10*t_adj) * ::sin( (t_adj*d-s)*(2*M_PI)/p )) + b; + return -(a*::qPow(2.0f,10*t_adj) * qSin( (t_adj*d-s)*(Q_2PI)/p )) + b; } /** @@ -429,12 +423,12 @@ static qreal easeOutElastic_helper(qreal t, qreal /*b*/, qreal c, qreal /*d*/, q qreal s; if(a < c) { a = c; - s = p / 4.0f; + s = p * 0.25f; } else { - s = p / (2 * M_PI) * ::asin(c / a); + s = p / (Q_2PI) * ::qAsin(c / a); } - return (a*::qPow(2.0f,-10*t) * ::sin( (t-s)*(2*M_PI)/p ) + c); + return (a*::qPow(2.0f,-10*t) * ::qSin( (t-s)*(Q_2PI)/p ) + c); } /** @@ -460,20 +454,20 @@ static qreal easeOutElastic(qreal t, qreal a, qreal p) */ static qreal easeInOutElastic(qreal t, qreal a, qreal p) { - if (t==0) return 0.0; - t*=2.0; - if (t==2) return 1.0; + if (t==0) return qreal(0.0); + t*=qreal(2.0); + if (t==2) return qreal(1.0); qreal s; - if(a < 1.0) { - a = 1.0; - s = p / 4.0f; + if(a < qreal(1.0)) { + a = qreal(1.0); + s = p * 0.25f; } else { - s = p / (2 * M_PI) * ::asin(1.0 / a); + s = p / (Q_2PI) * ::qAsin(qreal(1.0) / a); } - if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )); - return a*::qPow(2.0f,-10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0; + if (t < 1) return qreal(-.5)*(a*::qPow(2.0f,10*(t-1)) * ::qSin( (t-1-s)*(Q_2PI)/p )); + return a*::qPow(2.0f,-10*(t-1)) * ::qSin( (t-1-s)*(Q_2PI)/p )*qreal(.5) + qreal(1.0); } /** @@ -486,8 +480,8 @@ static qreal easeInOutElastic(qreal t, qreal a, qreal p) */ static qreal easeOutInElastic(qreal t, qreal a, qreal p) { - if (t < 0.5) return easeOutElastic_helper(t*2, 0, 0.5, 1.0, a, p); - return easeInElastic_helper(2*t - 1.0, 0.5, 0.5, 1.0, a, p); + if (t < qreal(0.5)) return easeOutElastic_helper(t*2, 0, qreal(0.5), qreal(1.0), a, p); + return easeInElastic_helper(2*t - qreal(1.0), qreal(0.5), qreal(0.5), qreal(1.0), a, p); } /** @@ -524,14 +518,14 @@ static qreal easeOutBack(qreal t, qreal s) */ static qreal easeInOutBack(qreal t, qreal s) { - t *= 2.0; + t *= qreal(2.0); if (t < 1) { s *= 1.525f; - return 0.5*(t*t*((s+1)*t - s)); + return qreal(0.5)*(t*t*((s+1)*t - s)); } else { t -= 2; s *= 1.525f; - return 0.5*(t*t*((s+1)*t+ s) + 2); + return qreal(0.5)*(t*t*((s+1)*t+ s) + 2); } } @@ -544,24 +538,26 @@ static qreal easeInOutBack(qreal t, qreal s) */ static qreal easeOutInBack(qreal t, qreal s) { - if (t < 0.5) return easeOutBack (2*t, s)/2; - return easeInBack(2*t - 1, s)/2 + 0.5; + if (t < qreal(0.5)) return easeOutBack (2*t, s) * qreal(0.5); + return easeInBack(2*t - 1, s) * qreal(0.5) + qreal(0.5); } static qreal easeOutBounce_helper(qreal t, qreal c, qreal a) { - if (t == 1.0) return c; - if (t < (4/11.0)) { - return c*(7.5625*t*t); - } else if (t < (8/11.0)) { - t -= (6/11.0); - return -a * (1. - (7.5625*t*t + .75)) + c; - } else if (t < (10/11.0)) { - t -= (9/11.0); - return -a * (1. - (7.5625*t*t + .9375)) + c; + const qreal inv_22 = 1 / qreal(22.0); + const qreal inv_11 = 2 * inv_22; + if (t == qreal(1.0)) return c; + if (t < (4 * inv_11)) { + return c*(qreal(7.5625)*t*t); + } else if (t < (8 * inv_11)) { + t -= (6 * inv_11); + return -a * (qreal(1.) - (qreal(7.5625)*t*t + qreal(.75))) + c; + } else if (t < (10 * inv_11)) { + t -= (9 * inv_11); + return -a * (qreal(1.) - (qreal(7.5625)*t*t + qreal(.9375))) + c; } else { - t -= (21/22.0); - return -a * (1. - (7.5625*t*t + .984375)) + c; + t -= (21 * inv_22); + return -a * (qreal(1.) - (qreal(7.5625)*t*t + qreal(.984375))) + c; } } @@ -586,7 +582,7 @@ static qreal easeOutBounce(qreal t, qreal a) */ static qreal easeInBounce(qreal t, qreal a) { - return 1.0 - easeOutBounce_helper(1.0-t, 1.0, a); + return qreal(1.0) - easeOutBounce_helper(qreal(1.0)-t, qreal(1.0), a); } @@ -599,8 +595,8 @@ static qreal easeInBounce(qreal t, qreal a) */ static qreal easeInOutBounce(qreal t, qreal a) { - if (t < 0.5) return easeInBounce (2*t, a)/2; - else return (t == 1.0) ? 1.0 : easeOutBounce (2*t - 1, a)/2 + 0.5; + if (t < qreal(0.5)) return easeInBounce (2*t, a) * qreal(0.5); + else return (t == qreal(1.0)) ? qreal(1.0) : easeOutBounce (2*t - 1, a) * qreal(0.5) + qreal(0.5); } /** @@ -612,13 +608,13 @@ static qreal easeInOutBounce(qreal t, qreal a) */ static qreal easeOutInBounce(qreal t, qreal a) { - if (t < 0.5) return easeOutBounce_helper(t*2, 0.5, a); - return 1.0 - easeOutBounce_helper (2.0-2*t, 0.5, a); + if (t < qreal(0.5)) return easeOutBounce_helper(t*2, qreal(0.5), a); + return qreal(1.0) - easeOutBounce_helper (qreal(2.0)-2*t, qreal(0.5), a); } static inline qreal qt_sinProgress(qreal value) { - return qSin((value * M_PI) - M_PI_2) / 2 + qreal(0.5); + return qSin((value * Q_PI) - Q_PI2) * qreal(0.5) + qreal(0.5); } static inline qreal qt_smoothBeginEndMixFactor(qreal value) @@ -656,7 +652,7 @@ static qreal easeOutCurve(qreal t) */ static qreal easeSineCurve(qreal t) { - return (qSin(((t * M_PI * 2)) - M_PI_2) + 1) / 2; + return (qSin(((t * Q_2PI)) - Q_PI2) + 1) * qreal(0.5); } /** @@ -665,6 +661,6 @@ static qreal easeSineCurve(qreal t) */ static qreal easeCosineCurve(qreal t) { - return (qCos(((t * M_PI * 2)) - M_PI_2) + 1) / 2; + return (qCos(((t * Q_2PI)) - Q_PI2) + 1) * qreal(0.5); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c index 0609232..3837087 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c @@ -489,6 +489,56 @@ static void getArabicProperties(const unsigned short *chars, int len, HB_ArabicP */ } +static Joining getNkoJoining(unsigned short uc) +{ + if (uc < 0x7ca) + return JNone; + if (uc <= 0x7ea) + return JDual; + if (uc <= 0x7f3) + return JTransparent; + if (uc <= 0x7f9) + return JNone; + if (uc == 0x7fa) + return JCausing; + return JNone; +} + +static void getNkoProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties) +{ + int lastPos = 0; + int i = 0; + + Joining j = getNkoJoining(chars[0]); + ArabicShape shape = joining_table[XIsolated][j].form2; + properties[0].justification = HB_NoJustification; + + for (i = 1; i < len; ++i) { + properties[i].justification = (HB_GetUnicodeCharCategory(chars[i]) == HB_Separator_Space) ? + ArabicSpace : ArabicNone; + + j = getNkoJoining(chars[i]); + + if (j == JTransparent) { + properties[i].shape = XIsolated; + continue; + } + + properties[lastPos].shape = joining_table[shape][j].form1; + shape = joining_table[shape][j].form2; + + + lastPos = i; + } + properties[lastPos].shape = joining_table[shape][JNone].form1; + + + /* + for (int i = 0; i < len; ++i) + qDebug("nko properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification); + */ +} + /* // The unicode to unicode shaping codec. // does only presentation forms B at the moment, but that should be enough for @@ -1009,10 +1059,13 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) ++l; ++properties; } - if (f + l < item->stringLength) { + if (f + l + item->item.pos < item->stringLength) { ++l; } - getArabicProperties(uc+f, l, props); + if (item->item.script == HB_Script_Nko) + getNkoProperties(uc+f, l, props); + else + getArabicProperties(uc+f, l, props); for (i = 0; i < (int)item->num_glyphs; i++) { apply[i] = 0; @@ -1051,7 +1104,8 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) HB_Bool haveGlyphs; HB_STACKARRAY(HB_UChar16, shapedChars, item->item.length); - assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac); + assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac + || item->item.script == HB_Script_Nko); #ifndef NO_OPENTYPE @@ -1065,7 +1119,7 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item) } #endif - if (item->item.script == HB_Script_Syriac) + if (item->item.script != HB_Script_Arabic) return HB_BasicShape(item); shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen, diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index c932ec2..356dc01 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -2059,15 +2059,17 @@ static void Free_BaseArray( HB_BaseArray* ba, HB_BaseRecord *br; HB_Anchor *bans; - HB_UNUSED(num_classes); - if ( ba->BaseRecord ) { br = ba->BaseRecord; if ( ba->BaseCount ) { + HB_UShort i, count; + count = num_classes * ba->BaseCount; bans = br[0].BaseAnchor; + for (i = 0; i < count; i++) + Free_Anchor (&bans[i]); FREE( bans ); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c index 533a063..2bda386 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c @@ -56,6 +56,8 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) assert(shaper_item->item.script == HB_Script_Hebrew); + HB_HeuristicSetGlyphAttributes(shaper_item); + #ifndef NO_OPENTYPE if (HB_SelectScript(shaper_item, hebrew_features)) { @@ -64,7 +66,6 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) return FALSE; - HB_HeuristicSetGlyphAttributes(shaper_item); HB_OpenTypeShape(shaper_item, /*properties*/0); return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 7104d2a..3008fca 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -419,7 +419,7 @@ static const unsigned char indicForms[0xe00-0x900] = { Matra, Halant, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, - Invalid, Invalid, Invalid, LengthMark, + Invalid, Invalid, Invalid, Matra, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, @@ -566,7 +566,7 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, None, - None, None, None, None, + Below, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, @@ -1050,62 +1050,59 @@ static const IndicOrdering * const indic_order[] = { // vowel matras that have to be split into two parts. static const unsigned short split_matras[] = { - // matra, split1, split2 + // matra, split1, split2, split3 // bengalis - 0x9cb, 0x9c7, 0x9be, - 0x9cc, 0x9c7, 0x9d7, + 0x9cb, 0x9c7, 0x9be, 0x0, + 0x9cc, 0x9c7, 0x9d7, 0x0, // oriya - 0xb48, 0xb47, 0xb56, - 0xb4b, 0xb47, 0xb3e, - 0xb4c, 0xb47, 0xb57, + 0xb48, 0xb47, 0xb56, 0x0, + 0xb4b, 0xb47, 0xb3e, 0x0, + 0xb4c, 0xb47, 0xb57, 0x0, // tamil - 0xbca, 0xbc6, 0xbbe, - 0xbcb, 0xbc7, 0xbbe, - 0xbcc, 0xbc6, 0xbd7, + 0xbca, 0xbc6, 0xbbe, 0x0, + 0xbcb, 0xbc7, 0xbbe, 0x0, + 0xbcc, 0xbc6, 0xbd7, 0x0, // telugu - 0xc48, 0xc46, 0xc56, + 0xc48, 0xc46, 0xc56, 0x0, // kannada - 0xcc0, 0xcbf, 0xcd5, - 0xcc7, 0xcc6, 0xcd5, - 0xcc8, 0xcc6, 0xcd6, - 0xcca, 0xcc6, 0xcc2, - 0xccb, 0xcca, 0xcd5, + 0xcc0, 0xcbf, 0xcd5, 0x0, + 0xcc7, 0xcc6, 0xcd5, 0x0, + 0xcc8, 0xcc6, 0xcd6, 0x0, + 0xcca, 0xcc6, 0xcc2, 0x0, + 0xccb, 0xcc6, 0xcc2, 0xcd5, // malayalam - 0xd4a, 0xd46, 0xd3e, - 0xd4b, 0xd47, 0xd3e, - 0xd4c, 0xd46, 0xd57, + 0xd4a, 0xd46, 0xd3e, 0x0, + 0xd4b, 0xd47, 0xd3e, 0x0, + 0xd4c, 0xd46, 0xd57, 0x0, // sinhala - 0xdda, 0xdd9, 0xdca, - 0xddc, 0xdd9, 0xdcf, - 0xddd, 0xddc, 0xdca, - 0xdde, 0xdd9, 0xddf, + 0xdda, 0xdd9, 0xdca, 0x0, + 0xddc, 0xdd9, 0xdcf, 0x0, + 0xddd, 0xdd9, 0xdcf, 0xdca, + 0xdde, 0xdd9, 0xddf, 0x0, 0xffff }; -static inline void splitMatra(unsigned short *reordered, int matra, int &len, int &base) +static inline void splitMatra(unsigned short *reordered, int matra, int &len) { unsigned short matra_uc = reordered[matra]; //qDebug("matra=%d, reordered[matra]=%x", matra, reordered[matra]); const unsigned short *split = split_matras; while (split[0] < matra_uc) - split += 3; + split += 4; assert(*split == matra_uc); ++split; - if (indic_position(*split) == Pre) { - reordered[matra] = split[1]; - memmove(reordered + 1, reordered, len*sizeof(unsigned short)); - reordered[0] = split[0]; - base++; - } else { - memmove(reordered + matra + 1, reordered + matra, (len-matra)*sizeof(unsigned short)); - reordered[matra] = split[0]; - reordered[matra+1] = split[1]; - } - len++; + int added_chars = split[2] == 0x0 ? 1 : 2; + + memmove(reordered + matra + added_chars, reordered + matra, (len-matra)*sizeof(unsigned short)); + reordered[matra] = split[0]; + reordered[matra+1] = split[1]; + if(added_chars == 2) + reordered[matra+2] = split[2]; + len += added_chars; } #ifndef NO_OPENTYPE @@ -1130,12 +1127,23 @@ static const HB_OpenTypeFeature indic_features[] = { // #define INDIC_DEBUG #ifdef INDIC_DEBUG -#define IDEBUG qDebug +#define IDEBUG hb_debug +#include <stdarg.h> + +static void hb_debug(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); // use variable arg list + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + #else #define IDEBUG if(0) printf #endif -#ifdef INDIC_DEBUG +#if 0 //def INDIC_DEBUG static QString propertiesToString(int properties) { QString res; @@ -1244,7 +1252,9 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // farther than 3 consonants from the end of the syllable. // #### replace the HasReph property by testing if the feature exists in the font! if (form(*uc) == Consonant || (script == HB_Script_Bengali && form(*uc) == IndependentVowel)) { - beginsWithRa = (properties & HasReph) && ((len > 2) && *uc == ra && *(uc+1) == halant); + if ((properties & HasReph) && (len > 2) && + (*uc == ra || *uc == 0x9f0) && *(uc+1) == halant) + beginsWithRa = true; if (beginsWithRa && form(*(uc+2)) == Control) beginsWithRa = false; @@ -1386,12 +1396,12 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // to be at the beginning of the syllable, so we just move // them there now. if (matra_position == Split) { - splitMatra(uc, matra, len, base); + splitMatra(uc, matra, len); // Handle three-part matras (0xccb in Kannada) matra_position = indic_position(uc[matra]); - if (matra_position == Split) - splitMatra(uc, matra, len, base); - } else if (matra_position == Pre) { + } + + if (matra_position == Pre) { unsigned short m = uc[matra]; while (matra--) uc[matra+1] = uc[matra]; @@ -1609,11 +1619,11 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // halant always applies #ifdef INDIC_DEBUG - { - IDEBUG("OT properties:"); - for (int i = 0; i < len; ++i) - qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); - } +// { +// IDEBUG("OT properties:"); +// for (int i = 0; i < len; ++i) +// qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); +// } #endif // initialize @@ -1731,6 +1741,15 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int if (script == HB_Script_Bengali && pos == 1 && (uc[0] == 0x0985 || uc[0] == 0x098f)) break; + // Sinhala uses the Halant as a component of certain matras. Allow these, but keep the state on Matra. + if (script == HB_Script_Sinhala && state == Matra) { + ++pos; + continue; + } + if (script == HB_Script_Malayalam && state == Matra && uc[pos-1] == 0x0d41) { + ++pos; + continue; + } goto finish; case Nukta: if (state == Consonant) @@ -1741,12 +1760,16 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int break; // fall through case VowelMark: - if (state == Matra || state == IndependentVowel) + if (state == Matra || state == LengthMark || state == IndependentVowel) break; // fall through case Matra: if (state == Consonant || state == Nukta) break; + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } // ### not sure if this is correct. If it is, does it apply only to Bengali or should // it work for all Indic languages? // the combination Independent_A + Vowel Sign AA is allowed. @@ -1762,6 +1785,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int goto finish; case LengthMark: + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } case IndependentVowel: case Invalid: case Other: diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index cde5465..0fe1e4d 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1114,6 +1114,8 @@ _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) ) return error; + cd->loaded = TRUE; + return HB_Err_Ok; } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h index 4f714a3..e4b5f9a 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h @@ -161,7 +161,7 @@ typedef enum { /* * Buffer for output */ -typedef struct _HB_GlyphBufer HB_GlyphBuffer; +typedef struct _HB_GlyphBuffer HB_GlyphBuffer; struct _HB_GlyphBuffer { int glyph_item_size; int total_glyphs; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index f92bb55..f3ec8e1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -637,7 +637,9 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Runic { HB_BasicShape, 0 }, // Khmer - { HB_KhmerShape, HB_KhmerAttributes } + { HB_KhmerShape, HB_KhmerAttributes }, + // N'Ko + { HB_ArabicShape, 0} }; void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, @@ -877,7 +879,9 @@ static const OTScripts ot_scripts [] = { // Runic { HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 }, // Khmer - { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 } + { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }, + // N'Ko + { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 } }; enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) }; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index e8f5513..f7c7714 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -62,6 +62,7 @@ typedef enum { HB_Script_Ogham, HB_Script_Runic, HB_Script_Khmer, + HB_Script_Nko, HB_Script_Inherited, HB_ScriptCount = HB_Script_Inherited /* @@ -102,7 +103,6 @@ typedef enum { HB_Script_Cuneiform = Common, HB_Script_Phoenician = Common, HB_Script_PhagsPa = Common, - HB_Script_Nko = Common */ } HB_Script; @@ -242,27 +242,30 @@ typedef struct HB_Font_ { void *userData; } HB_FontRec; -typedef struct { - const HB_UChar16 *string; - hb_uint32 stringLength; - HB_ScriptItem item; - HB_Font font; - HB_Face face; - int shaperFlags; /* HB_ShaperFlags */ - - HB_Bool glyphIndicesPresent; /* set to true if the glyph indicies are already setup in the glyphs array */ - hb_uint32 initialGlyphCount; - - hb_uint32 num_glyphs; /* in: available glyphs out: glyphs used/needed */ - HB_Glyph *glyphs; /* out parameter */ - HB_GlyphAttributes *attributes; /* out */ - HB_Fixed *advances; /* out */ - HB_FixedPoint *offsets; /* out */ - unsigned short *log_clusters; /* out */ +typedef struct HB_ShaperItem_ HB_ShaperItem; + +struct HB_ShaperItem_ { + const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */ + hb_uint32 stringLength; /* input: the length of the input in 16-bit words */ + HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of <string> */ + HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */ + HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */ + int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */ + HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */ + hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */ + + hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */ + /* output: required capacity (may be larger than actual capacity) */ + + HB_Glyph *glyphs; /* output: <num_glyphs> indices of shaped glyphs */ + HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attributes */ + HB_Fixed *advances; /* output: <num_glyphs> advances */ + HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */ + unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */ /* internal */ - HB_Bool kerning_applied; /* out: kerning applied by shaper */ -} HB_ShaperItem; + HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */ +}; HB_Bool HB_ShapeItem(HB_ShaperItem *item); diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 1a3ef4f..12fa7c4 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -178,9 +178,10 @@ private slots: void telugu(); void kannada(); void malayalam(); - // sinhala missing + void sinhala(); void khmer(); + void nko(); void linearB(); }; @@ -510,6 +511,17 @@ void tst_QScriptEngine::bengali() { 0x151, 0x276, 0x172, 0x143, 0x0 } }, { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 }, { 0x151, 0x276, 0x172, 0x144, 0x0 } }, + // test decomposed two parts matras + { { 0x995, 0x9c7, 0x9be, 0x0 }, + { 0x179, 0x151, 0x172, 0x0 } }, + { { 0x995, 0x9c7, 0x9d7, 0x0 }, + { 0x179, 0x151, 0x17e, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0x168, 0x276, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x191, 0x17d, 0x168, 0x0 } }, { {0}, {0} } }; @@ -638,15 +650,21 @@ void tst_QScriptEngine::bengali() if (face) { const ShapeTable shape_table [] = { { { 0x09a8, 0x09cd, 0x09af, 0x0 }, - { 0x0192, 0x0 } }, + { 0x01ca, 0x0 } }, { { 0x09b8, 0x09cd, 0x09af, 0x0 }, - { 0x01d6, 0x0 } }, + { 0x020e, 0x0 } }, { { 0x09b6, 0x09cd, 0x09af, 0x0 }, - { 0x01bc, 0x0 } }, + { 0x01f4, 0x0 } }, { { 0x09b7, 0x09cd, 0x09af, 0x0 }, - { 0x01c6, 0x0 } }, + { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, - { 0xd3, 0x12f, 0x0 } }, + { 0x10b, 0x167, 0x0 } }, + { { 0x9b0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f0, 0x9cd, 0x9ad, 0x0 }, + { 0xa1, 0x167, 0x0 } }, + { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, + { 0x11c, 0xa1, 0x0 } }, { {0}, {0} } }; @@ -823,8 +841,9 @@ void tst_QScriptEngine::telugu() { 0xe6, 0xb3, 0x83, 0x0 } }, { { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 }, { 0xe6, 0xb3, 0x9f, 0x0 } }, - { {0}, {0} } - + { { 0xc15, 0xc46, 0xc56, 0x0 }, + { 0xe6, 0xb3, 0x0 } }, + { {0}, {0} } }; const ShapeTable *s = shape_table; @@ -867,7 +886,6 @@ void tst_QScriptEngine::kannada() { 0x0036, 0x00c1, 0x0 } }, { { 0x0cb0, 0x0ccd, 0x200d, 0x0c95, 0x0 }, { 0x0050, 0x00a7, 0x0 } }, - { {0}, {0} } }; @@ -891,6 +909,17 @@ void tst_QScriptEngine::kannada() { 0x00b0, 0x006c, 0x0 } }, { { 0x0cb7, 0x0ccd, 0x0 }, { 0x0163, 0x0 } }, + { { 0xc95, 0xcbf, 0xcd5, 0x0 }, + { 0x114, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd6, 0x0 }, + { 0x90, 0x6c, 0x74, 0x0 } }, + { { 0xc95, 0xcc6, 0xcc2, 0x0 }, + { 0x90, 0x6c, 0x69, 0x0 } }, + { { 0xc95, 0xcca, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x69, 0x73, 0x0 } }, + { {0}, {0} } }; @@ -943,7 +972,16 @@ void tst_QScriptEngine::malayalam() { 0x009e, 0x0 } }, { { 0x0d30, 0x0d4d, 0x200d, 0x0 }, { 0x009e, 0x0 } }, - + { { 0xd15, 0xd46, 0xd3e, 0x0 }, + { 0x5e, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd47, 0xd3e, 0x0 }, + { 0x5f, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd46, 0xd57, 0x0 }, + { 0x5e, 0x34, 0x65, 0x0 } }, + { { 0xd15, 0xd57, 0x0 }, + { 0x34, 0x65, 0x0 } }, + { { 0xd1f, 0xd4d, 0xd1f, 0xd41, 0xd4d, 0x0 }, + { 0x69, 0x5b, 0x64, 0x0 } }, { {0}, {0} } }; @@ -962,6 +1000,39 @@ void tst_QScriptEngine::malayalam() } } +void tst_QScriptEngine::sinhala() +{ + { + FT_Face face = loadFace("FM-MalithiUW46.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xd9a, 0xdd9, 0xdcf, 0x0 }, + { 0x4a, 0x61, 0x42, 0x0 } }, + { { 0xd9a, 0xdd9, 0xddf, 0x0 }, + { 0x4a, 0x61, 0x50, 0x0 } }, + { { 0xd9a, 0xdd9, 0xdca, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddc, 0xdca, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { { 0xd9a, 0xdda, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddd, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { {0}, {0} } + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Sinhala) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find FM-MalithiUW46.ttf", SkipAll); + } + } +} void tst_QScriptEngine::khmer() @@ -1005,6 +1076,40 @@ void tst_QScriptEngine::khmer() } } +void tst_QScriptEngine::nko() +{ + { + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0x7ca, 0x0 }, + { 0x5c1, 0x0 } }, + { { 0x7ca, 0x7ca, 0x0 }, + { 0x14db, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5ec, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x14d9, 0x0 } }, + { { 0x7ca, 0x7f3, 0x7fa, 0x7ca, 0x0 }, + { 0x14db, 0x5e7, 0x5ec, 0x14d9, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Nko) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVuSans.ttf", SkipAll); + } + } +} + + void tst_QScriptEngine::linearB() { { diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index 82d6235..f7d42cf 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -661,7 +661,10 @@ namespace Phonon #ifndef QT_NO_OPENGL - if (painter.paintEngine() && painter.paintEngine()->type() == QPaintEngine::OpenGL && checkGLPrograms()) { + if (painter.paintEngine() && + (painter.paintEngine()->type() == QPaintEngine::OpenGL || painter.paintEngine()->type() == QPaintEngine::OpenGL2) + && checkGLPrograms()) { + //for now we only support YUV (both YV12 and YUY2) updateTexture(); @@ -673,6 +676,7 @@ namespace Phonon } //let's draw the texture + painter.beginNativePainting(); //Let's pass the other arguments const Program prog = (m_inputPin->connectedType().subtype == MEDIASUBTYPE_YV12) ? YV12toRGB : YUY2toRGB; @@ -722,6 +726,7 @@ namespace Phonon glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_FRAGMENT_PROGRAM_ARB); + painter.endNativePainting(); return; } else #endif diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index a793390..a559249 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -29,6 +29,10 @@ using namespace Phonon::MMF; \internal */ +/*! \namespace Phonon::MMF + \internal +*/ + AbstractAudioEffect::AbstractAudioEffect(QObject *parent, const QList<EffectParameter> ¶ms) : MediaNode::MediaNode(parent) , m_params(params) diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp index 0447d57..18ced94 100644 --- a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp @@ -26,7 +26,7 @@ QT_BEGIN_NAMESPACE using namespace Phonon::MMF; -/*! \class MMF::AncestorMoveMonitor +/*! \class Phonon::MMF::AncestorMoveMonitor \internal \brief Class which installs a global event filter, and listens for move events which may affect the absolute position of widgets registered with @@ -34,6 +34,11 @@ using namespace Phonon::MMF; See QTBUG-4956 */ + +/*! \class Phonon::MMF::VideoOutputObserver + \internal +*/ + //----------------------------------------------------------------------------- // Constructor / destructor //----------------------------------------------------------------------------- diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index 58d1ece..d728fcf 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -24,16 +24,24 @@ QT_BEGIN_NAMESPACE using namespace Phonon; using namespace Phonon::MMF; -/*! \namespace MMF::Utils +/*! \namespace Phonon::MMF::Utils \internal */ -/*! \class MMF::TTraceContext +/*! \class Phonon::MMF::TTraceContext \internal */ -/*! \class MMF::Utils - \internal +/*! \enum Phonon::MMF::PanicCode + \internal +*/ + +/*! \enum Phonon::MMF::TTraceCategory + \internal +*/ + +/*! \enum Phonon::MMF::MediaType + \internal */ _LIT(PanicCategory, "Phonon::MMF"); diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 98f007c..810781f 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - qtwebkit-4.6-snapshot-20091003 branch/tag + qtwebkit/qtwebkit-4.6 branch/tag and has the sha1 checksum - 8f810287200d21aded375664cc0a6ac0476dbdea + 16aab1b39e14195abdc2100265da2e45b96b739f diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 2b36014..1dfc2f9 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,111 @@ +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Unreviewed build fix for WebInspector with Qt build. + + Simply re-generate the Qt resource file by running + WebKitTools/Scripts/generate-qt-inspector-resource + + * inspector/front-end/WebKit.qrc: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * WebCore.pro: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Extended the conversion of the WebCore ResourceRequest to the + QNetworkRequest with a mandatory originating object argument, + which is meant to be the QWebFrame the request belongs to. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + (WebCore::QNetworkReplyHandler::start): + * platform/network/qt/ResourceRequest.h: + * platform/network/qt/ResourceRequestQt.cpp: + (WebCore::ResourceRequest::toNetworkRequest): + +2009-11-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * loader/ProgressTracker.cpp: + (WebCore::ProgressTracker::incrementProgress): + +2009-11-02 Kai Koehne <kai.koehne@nokia.com> + + Reviewed by Holger Freyther. + + Remove implementation of ImageDecocerQt::clearFrameBufferCache. + The implementation was buggy, and will visually break repeating + animations anyway. + + https://bugs.webkit.org/show_bug.cgi?id=31009 + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::clearFrameBufferCache): + +2009-11-01 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Don't add '/' to the URL path if the it does not include '/' after the protocol component + https://bugs.webkit.org/show_bug.cgi?id=30971 + + Match IE8 behaviour, that does not add '/' if there is none after the protocol component. + + * platform/KURL.cpp: + (WebCore::KURL::parse): + +2009-10-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Holger Hans Peter Freyther. + + If the owner widget of the page has a palette set, we + should use that one. This was only working when the + owner was a QWebView. This patch fixes that. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::applyTheme): + +2009-10-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::start): + 2009-11-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Rubber-stamped by Antti Koivisto. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 1379fdd..4e84a80 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -2327,6 +2327,7 @@ HEADERS += \ xml/XSLTExtensions.h \ xml/XSLTProcessor.h \ xml/XSLTUnicodeSort.h \ + $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ $$PWD/platform/network/qt/DnsPrefetchHelper.h diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc index a1d671e..0347952 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc @@ -28,6 +28,7 @@ <file>InjectedScript.js</file> <file>InjectedScriptAccess.js</file> <file>inspector.js</file> + <file>InspectorControllerStub.js</file> <file>KeyboardShortcut.js</file> <file>MetricsSidebarPane.js</file> <file>Object.js</file> @@ -161,6 +162,15 @@ <file>Images/statusbarResizerVertical.png</file> <file>Images/storageIcon.png</file> <file>Images/successGreenDot.png</file> + <file>Images/timelineBarBlue.png</file> + <file>Images/timelineBarGray.png</file> + <file>Images/timelineBarGreen.png</file> + <file>Images/timelineBarOrange.png</file> + <file>Images/timelineBarPurple.png</file> + <file>Images/timelineBarRed.png</file> + <file>Images/timelineBarYellow.png</file> + <file>Images/timelineCheckmarks.png</file> + <file>Images/timelineDots.png</file> <file>Images/timelineHollowPillBlue.png</file> <file>Images/timelineHollowPillGray.png</file> <file>Images/timelineHollowPillGreen.png</file> @@ -168,6 +178,7 @@ <file>Images/timelineHollowPillPurple.png</file> <file>Images/timelineHollowPillRed.png</file> <file>Images/timelineHollowPillYellow.png</file> + <file>Images/timelineIcon.png</file> <file>Images/timelinePillBlue.png</file> <file>Images/timelinePillGray.png</file> <file>Images/timelinePillGreen.png</file> diff --git a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp index e682b9b..6b6ce1b 100644 --- a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp @@ -176,8 +176,10 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // FIXME: Can this ever happen? if (!item) return; + + RefPtr<Frame> frame = m_originatingProgressFrame; - m_originatingProgressFrame->loader()->client()->willChangeEstimatedProgress(); + frame->loader()->client()->willChangeEstimatedProgress(); unsigned bytesReceived = length; double increment, percentOfRemainingBytes; @@ -189,7 +191,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i item->estimatedLength = item->bytesReceived * 2; } - int numPendingOrLoadingRequests = m_originatingProgressFrame->loader()->numPendingOrLoadingRequests(true); + int numPendingOrLoadingRequests = frame->loader()->numPendingOrLoadingRequests(true); estimatedBytesForPendingRequests = progressItemDefaultEstimatedLength * numPendingOrLoadingRequests; remainingBytes = ((m_totalPageAndResourceBytesToLoad + estimatedBytesForPendingRequests) - m_totalBytesReceived); if (remainingBytes > 0) // Prevent divide by 0. @@ -199,8 +201,8 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // For documents that use WebCore's layout system, treat first layout as the half-way point. // FIXME: The hasHTMLView function is a sort of roundabout way of asking "do you use WebCore's layout system". - bool useClampedMaxProgress = m_originatingProgressFrame->loader()->client()->hasHTMLView() - && !m_originatingProgressFrame->loader()->firstLayoutDone(); + bool useClampedMaxProgress = frame->loader()->client()->hasHTMLView() + && !frame->loader()->firstLayoutDone(); double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue; increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes; m_progressValue += increment; @@ -221,14 +223,14 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i if (m_progressValue == 1) m_finalProgressChangedSent = true; - m_originatingProgressFrame->loader()->client()->postProgressEstimateChangedNotification(); + frame->loader()->client()->postProgressEstimateChangedNotification(); m_lastNotifiedProgressValue = m_progressValue; m_lastNotifiedProgressTime = now; } } - m_originatingProgressFrame->loader()->client()->didChangeEstimatedProgress(); + frame->loader()->client()->didChangeEstimatedProgress(); } void ProgressTracker::completeProgress(unsigned long identifier) diff --git a/src/3rdparty/webkit/WebCore/platform/KURL.cpp b/src/3rdparty/webkit/WebCore/platform/KURL.cpp index ffacc19..c5829d2 100644 --- a/src/3rdparty/webkit/WebCore/platform/KURL.cpp +++ b/src/3rdparty/webkit/WebCore/platform/KURL.cpp @@ -1269,8 +1269,8 @@ void KURL::parse(const char* url, const String* originalString) m_userStart = m_userEnd = m_passwordEnd = m_hostEnd = m_portEnd = p - buffer.data(); // For canonicalization, ensure we have a '/' for no path. - // Only do this for http and https. - if (m_protocolInHTTPFamily && pathEnd - pathStart == 0) + // Do this only for hierarchical URL with protocol http or https. + if (m_protocolInHTTPFamily && hierarchical && pathEnd == pathStart) *p++ = '/'; // add path, escaping bad characters diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index f8403b7..b6823dd 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -145,16 +145,8 @@ RGBA32Buffer* ImageDecoderQt::frameBufferAtIndex(size_t index) return &frame; } -void ImageDecoderQt::clearFrameBufferCache(size_t index) +void ImageDecoderQt::clearFrameBufferCache(size_t /*index*/) { - // Currently QImageReader will be asked to read everything. This - // might change when we read gif images on demand. For now we - // can have a rather simple implementation. - if (index > m_frameBufferCache.size()) - return; - - for (size_t i = 0; i < index; ++index) - m_frameBufferCache[index].clear(); } void ImageDecoderQt::internalDecodeSize() diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index ed5e024..bbf5525 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -140,10 +140,14 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load m_method = QNetworkAccessManager::PostOperation; else if (r.httpMethod() == "PUT") m_method = QNetworkAccessManager::PutOperation; +#if QT_VERSION >= 0x040600 + else if (r.httpMethod() == "DELETE") + m_method = QNetworkAccessManager::DeleteOperation; +#endif else m_method = QNetworkAccessManager::UnknownOperation; - m_request = r.toNetworkRequest(); + m_request = r.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); if (m_loadMode == LoadNormal) start(); @@ -323,10 +327,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded() client->willSendRequest(m_resourceHandle, newRequest, response); m_redirected = true; - m_request = newRequest.toNetworkRequest(); - - ResourceHandleInternal* d = m_resourceHandle->getInternal(); - emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request); + m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); return; } @@ -368,8 +369,6 @@ void QNetworkReplyHandler::start() QNetworkAccessManager* manager = d->m_frame->page()->networkAccessManager(); - emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request); - const QUrl url = m_request.url(); const QString scheme = url.scheme(); // Post requests on files and data don't really make sense, but for @@ -398,6 +397,12 @@ void QNetworkReplyHandler::start() putDevice->setParent(m_reply); break; } +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: { + m_reply = manager->deleteResource(m_request); + break; + } +#endif case QNetworkAccessManager::UnknownOperation: { m_reply = 0; ResourceHandleClient* client = m_resourceHandle->client(); diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h index 93dacf3..60d32dd 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h @@ -31,6 +31,7 @@ QT_BEGIN_NAMESPACE class QNetworkRequest; +class QObject; QT_END_NAMESPACE namespace WebCore { @@ -59,7 +60,7 @@ namespace WebCore { } #if QT_VERSION >= 0x040400 - QNetworkRequest toNetworkRequest() const; + QNetworkRequest toNetworkRequest(QObject* originatingObject) const; #endif private: diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp index c8f6ad5..c866a54 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -28,10 +28,13 @@ namespace WebCore { -QNetworkRequest ResourceRequest::toNetworkRequest() const +QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) const { QNetworkRequest request; request.setUrl(url()); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + request.setOriginatingObject(originatingFrame); +#endif const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index b61d356..501a28b 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -45,6 +45,7 @@ #include "RenderBox.h" #include "RenderTheme.h" #include "UserAgentStyleSheets.h" +#include "QWebPageClient.h" #include "qwebpage.h" #include <QApplication> @@ -757,12 +758,13 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); - // If the webview has a custom palette, use it + // If the owner widget has a custom palette, use it Page* page = o->document()->page(); if (page) { - QWidget* view = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage->view(); - if (view) - option.palette = view->palette(); + ChromeClient* client = page->chrome()->client(); + QWebPageClient* pageClient = client->platformPageClient(); + if (pageClient) + option.palette = pageClient->palette(); } return result; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri index 5a95c67..1a42597 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri +++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri @@ -8,7 +8,6 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebdatabase.h \ $$PWD/qwebsecurityorigin.h \ $$PWD/qwebelement.h \ - $$PWD/qwebplugindatabase.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ $$PWD/qwebinspector.h \ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 606dae4..17a0118 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -734,6 +734,11 @@ void QWebFrame::load(const QNetworkRequest &req, case QNetworkAccessManager::PostOperation: request.setHTTPMethod("POST"); break; +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: + request.setHTTPMethod("DELETE"); + break; +#endif case QNetworkAccessManager::UnknownOperation: // eh? break; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index 4578dc9..409e1a0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -188,9 +188,3 @@ void QWebInspectorPrivate::adjustFrontendSize(const QSize& size) frontend->resize(size); } -/*! - \fn void QWebInspector::windowTitleChanged(const QString& newTitle); - - This is emitted to signal that this widget's title changed to \a newTitle. -*/ - diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h index bb5bd64..a5c1ed5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h @@ -39,9 +39,6 @@ public: QSize sizeHint() const; bool event(QEvent*); -Q_SIGNALS: - void windowTitleChanged(const QString& newTitle); - protected: void resizeEvent(QResizeEvent* event); void showEvent(QShowEvent* event); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 6f1347c..a1e131a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -78,6 +78,7 @@ #include "Cache.h" #include "runtime/InitializeThreading.h" #include "PageGroup.h" +#include "QWebPageClient.h" #include <QApplication> #include <QBasicTimer> @@ -107,6 +108,9 @@ #else #include "qwebnetworkinterface.h" #endif +#if defined(Q_WS_X11) +#include <QX11Info> +#endif using namespace WebCore; @@ -138,6 +142,95 @@ QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) return page->handle()->page->groupName(); } +class QWebPageWidgetClient : public QWebPageClient { +public: + QWebPageWidgetClient(QWidget* view) + : view(view) + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif + +#ifndef QT_NO_CURSOR + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); +#endif + + virtual QPalette palette() const; + virtual int screenNumber() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; + + QWidget* view; +}; + +void QWebPageWidgetClient::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebPageWidgetClient::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +void QWebPageWidgetClient::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} +#if QT_VERSION >= 0x040600 +void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif +#ifndef QT_NO_CURSOR +QCursor QWebPageWidgetClient::cursor() const +{ + return view->cursor(); +} + +void QWebPageWidgetClient::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} +#endif + +QPalette QWebPageWidgetClient::palette() const +{ + return view->palette(); +} + +int QWebPageWidgetClient::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); +#endif + + return 0; +} + +QWidget* QWebPageWidgetClient::ownerWidget() const +{ + return view; +} + +QObject* QWebPageWidgetClient::pluginParent() const +{ + return view; +} + // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -1672,6 +1765,15 @@ void QWebPage::setView(QWidget *view) { if (this->view() != view) { d->view = view; + if (!view) { + delete d->client; + d->client = 0; + } else { + if (!d->client) + d->client = new QWebPageWidgetClient(view); + else + static_cast<QWebPageWidgetClient*>(d->client)->view = view; + } setViewportSize(view ? view->size() : QSize(0, 0)); } } @@ -3406,16 +3508,6 @@ quint64 QWebPage::bytesReceived() const */ /*! - \since 4.6 - \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - \preliminary - - This signal is emitted when a \a frame of the current page requests a web resource. The application - may want to associate the \a request with the \a frame that initiated it by storing the \a frame - as an attribute of the \a request. -*/ - -/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index f2bbde0..f39209c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -347,8 +347,6 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); - void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp index 623895f..758e257 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp @@ -18,7 +18,7 @@ */ #include "config.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -26,6 +26,7 @@ using namespace WebCore; /*! + \internal \typedef QWebPluginInfo::MimeType \since 4.6 \brief Represents a single MIME type supported by a plugin. @@ -33,6 +34,7 @@ using namespace WebCore; /*! \class QWebPluginInfo + \internal \since 4.6 \brief The QWebPluginInfo class represents a single Netscape plugin. @@ -232,6 +234,7 @@ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other) /*! \class QWebPluginDatabase + \internal \since 4.6 \brief The QWebPluginDatabase class provides an interface for managing Netscape plugins used by WebKit in QWebPages. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h index b22c3de..b22c3de 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index ffa21e4..3052056 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -22,7 +22,7 @@ #include "qwebpage.h" #include "qwebpage_p.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "Cache.h" #include "CrossOriginPreflightResultCache.h" @@ -627,7 +627,7 @@ QIcon QWebSettings::iconForUrl(const QUrl& url) /*! Returns the plugin database object. -*/ + QWebPluginDatabase *QWebSettings::pluginDatabase() { static QWebPluginDatabase* database = 0; @@ -635,6 +635,7 @@ QWebPluginDatabase *QWebSettings::pluginDatabase() database = new QWebPluginDatabase(); return database; } +*/ /*! Sets \a graphic to be drawn when QtWebKit needs to draw an image of the diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index e68ea53..c958ae7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -114,7 +114,7 @@ public: static void clearIconDatabase(); static QIcon iconForUrl(const QUrl &url); - static QWebPluginDatabase *pluginDatabase(); + //static QWebPluginDatabase *pluginDatabase(); static void setWebGraphic(WebGraphic type, const QPixmap &graphic); static QPixmap webGraphic(WebGraphic type); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index b9c2f74..55ce1f7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -32,11 +32,8 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" -#if defined(Q_WS_X11) -#include <QX11Info> -#endif -class QWebViewPrivate : public QWebPageClient { +class QWebViewPrivate { public: QWebViewPrivate(QWebView *view) : view(view) @@ -46,24 +43,6 @@ public: Q_ASSERT(view); } - virtual void scroll(int dx, int dy, const QRect&); - virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); -#if QT_VERSION >= 0x040600 - virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); -#endif - -#ifndef QT_NO_CURSOR - virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); -#endif - - virtual QPalette palette() const; - virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; - - virtual QObject* pluginParent() const; - void _q_pageDestroyed(); QWebView *view; @@ -72,66 +51,6 @@ public: QPainter::RenderHints renderHints; }; -void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) -{ - view->scroll(qreal(dx), qreal(dy), rectToScroll); -} - -void QWebViewPrivate::update(const QRect & dirtyRect) -{ - view->update(dirtyRect); -} - -void QWebViewPrivate::setInputMethodEnabled(bool enable) -{ - view->setAttribute(Qt::WA_InputMethodEnabled, enable); -} -#if QT_VERSION >= 0x040600 -void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) -{ - if (enable) - view->setInputMethodHints(view->inputMethodHints() | hint); - else - view->setInputMethodHints(view->inputMethodHints() & ~hint); -} -#endif -#ifndef QT_NO_CURSOR -QCursor QWebViewPrivate::cursor() const -{ - return view->cursor(); -} - -void QWebViewPrivate::updateCursor(const QCursor& cursor) -{ - view->setCursor(cursor); -} -#endif - -QPalette QWebViewPrivate::palette() const -{ - return view->palette(); -} - -int QWebViewPrivate::screenNumber() const -{ -#if defined(Q_WS_X11) - if (view) - return view->x11Info().screen(); -#endif - - return 0; -} - -QWidget* QWebViewPrivate::ownerWidget() const -{ - return view; -} - -QObject* QWebViewPrivate::pluginParent() const -{ - return view; -} - void QWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -251,6 +170,7 @@ QWebView::~QWebView() #else d->page->d->view = 0; #endif + delete d->page->d->client; d->page->d->client = 0; } @@ -296,7 +216,6 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); - d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -728,7 +647,7 @@ bool QWebView::event(QEvent *e) // WebCore. // FIXME: Add a QEvent::CursorUnset or similar to Qt. if (cursor().shape() == Qt::ArrowCursor) - d->resetCursor(); + d->page->d->client->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index b19a1d0..84c5d43 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,132 @@ +2009-11-04 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] REGRESSION: Allow applications to use their own QWidget bypassing QWebView. + https://bugs.webkit.org/show_bug.cgi?id=30979 + + Decouple QWebViewPrivate from QWebPageClient, and automatically create + QWebPageWidgetClient whenever the view is QWidget based. + + * Api/qwebpage.cpp: + (QWebPageWidgetClient::QWebPageWidgetClient): + (QWebPageWidgetClient::scroll): + (QWebPageWidgetClient::update): + (QWebPageWidgetClient::setInputMethodEnabled): + (QWebPageWidgetClient::setInputMethodHint): + (QWebPageWidgetClient::cursor): + (QWebPageWidgetClient::updateCursor): + (QWebPageWidgetClient::palette): + (QWebPageWidgetClient::screenNumber): + (QWebPageWidgetClient::ownerWidget): + (QWebPageWidgetClient::pluginParent): + (QWebPage::setView): + * Api/qwebview.cpp: + (QWebView::~QWebView): + (QWebView::setPage): + (QWebView::event): + +2009-11-03 Andras Becsi <becsi.andras@stud.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Fix build of unit-test after r50454. + + * tests/qwebpage/tst_qwebpage.cpp: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * Api/headers.pri: + * Api/qwebplugindatabase.cpp: + * Api/qwebplugindatabase_p.h: Renamed from WebKit/qt/Api/qwebplugindatabase.h. + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * QtLauncher/main.cpp: + (MainWindow::setupUI): + * tests/tests.pro: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Rubber-stamped by Tor Arne Vestbø. + + Oops, also remove the API docs of the removed networkRequestStarted() signal. + + * Api/qwebpage.cpp: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Replace the QWebPage::networkRequestStarted() signal with the originatingObject + property set to the QWebFrame that belongs to the request. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientQt::startDownload): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + (TestNetworkManager::createRequest): + (tst_QWebPage::originatingObjectInNetworkRequests): + +2009-11-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * tests/qwebview/tst_qwebview.cpp: + (WebViewCrashTest::WebViewCrashTest): + (WebViewCrashTest::loading): + (tst_QWebView::crashTests): + +2009-10-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Remove the QWebInspector::windowTitleChanged signal, + QEvent::WindowTitleChange can be used to achieve the same. + https://bugs.webkit.org/show_bug.cgi?id=30927 + + * Api/qwebinspector.cpp: + * Api/qwebinspector.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::updateWindowTitle): + +2009-10-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * Api/qwebframe.cpp: + (QWebFrame::load): + 2009-10-29 Kenneth Rohde Christiansen <kenneth@webkit.org> Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 1ed9b21..f706d77 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -708,7 +708,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), - QCoreApplication::translate("QWebFrame", "Request canceled", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); error.setIsCancellation(true); return error; } @@ -746,7 +746,7 @@ WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show MIME type", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) @@ -946,7 +946,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage* page = m_webFrame->page(); @@ -971,7 +971,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage*page = m_webFrame->page(); @@ -1001,7 +1001,7 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request) if (!m_webFrame) return; - emit m_webFrame->page()->downloadRequested(request.toNetworkRequest()); + emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame)); #endif } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 12f405c..7a1bfd5 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -166,7 +166,6 @@ void InspectorClientQt::updateWindowTitle() if (m_inspectedWebPage->d->inspector) { QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); m_inspectedWebPage->d->inspector->setWindowTitle(caption); - emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption); } } diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 408478c..09dfae5 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -31,7 +31,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 3. + GPL version 2. \legalese WebKit is licensed under the GNU Library General Public License. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index d304d3e..6f07e90 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -590,6 +590,7 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2375,6 +2376,28 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } +void tst_QWebFrame::setHtmlWithBaseURL() +{ + QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + // in few seconds, the image should be completey loaded + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + QTest::qWait(200); + QCOMPARE(spy.count(), 1); + + QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); + QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); + QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); + + // no history item has to be added. + QCOMPARE(m_view->page()->history()->count(), 0); +} + class TestNetworkManager : public QNetworkAccessManager { public: diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 8373e04..3eead92 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -133,6 +133,8 @@ private slots: void screenshot_data(); void screenshot(); + void originatingObjectInNetworkRequests(); + private: QWebView* m_view; QWebPage* m_page; @@ -238,7 +240,6 @@ void tst_QWebPage::loadFinished() { qRegisterMetaType<QWebFrame*>("QWebFrame*"); qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*"); - QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*))); QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); @@ -249,7 +250,6 @@ void tst_QWebPage::loadFinished() QTest::qWait(3000); - QVERIFY(spyNetworkRequestStarted.count() > 1); QVERIFY(spyLoadStarted.count() > 1); QVERIFY(spyLoadFinished.count() > 1); @@ -350,9 +350,11 @@ public: TestNetworkManager(QObject* parent) : QNetworkAccessManager(parent) {} QList<QUrl> requestedUrls; + QList<QNetworkRequest> requests; protected: virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) { + requests.append(request); requestedUrls.append(request.url()); return QNetworkAccessManager::createRequest(op, request, outgoingData); } @@ -1613,5 +1615,27 @@ void tst_QWebPage::screenshot() QDir::setCurrent(QApplication::applicationDirPath()); } +void tst_QWebPage::originatingObjectInNetworkRequests() +{ + TestNetworkManager* networkManager = new TestNetworkManager(m_page); + m_page->setNetworkAccessManager(networkManager); + networkManager->requests.clear(); + + m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," + "<head><meta http-equiv='refresh' content='1'></head>foo \">" + "<frame src=\"data:text/html,bar\"></frameset>"), QUrl()); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); + + QCOMPARE(networkManager->requests.count(), 2); + + QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames(); + QCOMPARE(childFrames.count(), 2); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + for (int i = 0; i < 2; ++i) + QVERIFY(qobject_cast<QWebFrame*>(networkManager->requests.at(i).originatingObject()) == childFrames.at(i)); +#endif +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html new file mode 100644 index 0000000..9ff68f1 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html @@ -0,0 +1,2 @@ +<a href="http://google.com" target="frame_b"><img src="" width=100 height=100 alt="Google"></a> +<a href="http://yahoo.com" target="frame_b"><img src="" width=100 height=100 alt="Yahoo"></a> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html new file mode 100644 index 0000000..c53ad09 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html @@ -0,0 +1,4 @@ +<frameset cols="25%,75%"> + <frame src="frame_a.html" name="frame_a"> + <frame src="frame_b.html" name="frame_b"> +</frameset> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index e67bb7a..735537b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -4,6 +4,7 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +RESOURCES += tst_qwebview.qrc DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian { diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index fda979e..27daf38 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -20,6 +20,7 @@ */ #include <qtest.h> +#include "../util.h" #include <qpainter.h> #include <qwebview.h> @@ -45,6 +46,8 @@ private slots: void reusePage_data(); void reusePage(); + + void crashTests(); }; // This will be called before the first test function is executed. @@ -148,6 +151,46 @@ void tst_QWebView::reusePage() QDir::setCurrent(QApplication::applicationDirPath()); } +// Class used in crashTests +class WebViewCrashTest : public QObject { + Q_OBJECT + QWebView* m_view; +public: + bool m_executed; + + + WebViewCrashTest(QWebView* view) + : m_view(view) + , m_executed(false) + { + view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int))); + } + +private slots: + void loading(int progress) + { + if (progress >= 20 && progress < 90) { + QVERIFY(!m_executed); + m_view->stop(); + m_executed = true; + } + } +}; + + +// Should not crash. +void tst_QWebView::crashTests() +{ + // Test if loading can be stopped in loadProgress handler without crash. + // Test page should have frames. + QWebView view; + WebViewCrashTest tester(&view); + QUrl url("qrc:///data/index.html"); + view.load(url); + QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed. +} + + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc new file mode 100644 index 0000000..ede34a9 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -0,0 +1,7 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>data/index.html</file> + <file>data/frame_a.html</file> +</qresource> +</RCC> + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index 81cc8f3..939cd22 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro |