summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2010-05-29 14:02:22 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2010-05-29 14:02:22 (GMT)
commite27032a8c5e759a0f7132dfbded5d5eeb9d0bbd3 (patch)
treee0b891cf94b1162645331702c52bb53372c8ab72 /src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
parentab8581692310db4d2786eeff21b0a8e024097d1c (diff)
downloadQt-e27032a8c5e759a0f7132dfbded5d5eeb9d0bbd3.zip
Qt-e27032a8c5e759a0f7132dfbded5d5eeb9d0bbd3.tar.gz
Qt-e27032a8c5e759a0f7132dfbded5d5eeb9d0bbd3.tar.bz2
Updated WebKit to eb07c6f9bd50d0d74e9ac19ade4a2fbd5cece7c7
Changes integrated: || <https://webkit.org/b/39488> || [Qt] QtTestBrowser is still called QtLauncher in the code || || <https://webkit.org/b/38722> || [Qt] qwebframe auto test doesn't compile || || <https://webkit.org/b/39491> || [Qt] QtTestBrowser has two graphicsview options that aren't enabled correctly || || <https://webkit.org/b/39063> || [Qt] Tiled backing store checker pattern does not paint correctly when scaling factor is not 1 || || <https://webkit.org/b/39217> || Add an optional "starting node' parameter to scrollRecursively and scrollOverflow of EventHandler || || <https://webkit.org/b/38389> || [Qt] Update the Symbian version for the user agent || || <https://webkit.org/b/35702> || [Qt] Add more support for InputTextController || || <https://webkit.org/b/39513> || [Qt] Using Accelerated Composing the rocket back animation on http://www.the-art-of-web.com/css/css-animation/ works differently as when not using AC. || || <https://webkit.org/b/39609> || [Qt] Running with accelerated compositing enabled sometimes result in a crash || Plus autotest fix.
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp99
1 files changed, 56 insertions, 43 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 44bd902..b7182b4 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1294,6 +1294,9 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
{
WebCore::Frame *frame = page->focusController()->focusedOrMainFrame();
WebCore::Editor *editor = frame->editor();
+#if QT_VERSION >= 0x040600
+ QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, 0, 0, QVariant());
+#endif
if (!editor->canEdit()) {
ev->ignore();
@@ -1310,6 +1313,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
renderTextControl = toRenderTextControl(renderer);
Vector<CompositionUnderline> underlines;
+ bool hasSelection = false;
for (int i = 0; i < ev->attributes().size(); ++i) {
const QInputMethodEvent::Attribute& a = ev->attributes().at(i);
@@ -1333,10 +1337,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
}
#if QT_VERSION >= 0x040600
case QInputMethodEvent::Selection: {
- if (renderTextControl) {
- renderTextControl->setSelectionStart(qMin(a.start, (a.start + a.length)));
- renderTextControl->setSelectionEnd(qMax(a.start, (a.start + a.length)));
- }
+ selection = a;
+ hasSelection = true;
break;
}
#endif
@@ -1345,10 +1347,25 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
if (!ev->commitString().isEmpty())
editor->confirmComposition(ev->commitString());
- else if (!ev->preeditString().isEmpty()) {
+ else {
+ // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition
+ // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text
+ // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text
+ // 4. otherwise event is updating supplied pre-edit text
QString preedit = ev->preeditString();
- editor->setComposition(preedit, underlines, preedit.length(), 0);
+#if QT_VERSION >= 0x040600
+ if (hasSelection) {
+ QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString();
+ if (preedit.isEmpty() && selection.start + selection.length > 0)
+ preedit = text;
+ editor->setComposition(preedit, underlines,
+ (selection.length < 0) ? selection.start + selection.length : selection.start,
+ (selection.length < 0) ? selection.start : selection.start + selection.length);
+ } else
+#endif
+ editor->setComposition(preedit, underlines, preedit.length(), 0);
}
+
ev->accept();
}
@@ -3329,12 +3346,37 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
#elif defined Q_WS_X11
"X11"
#elif defined Q_OS_SYMBIAN
- "SymbianOS"
+ "Symbian"
#else
"Unknown"
#endif
);
+#if defined Q_OS_SYMBIAN
+ QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
+ switch (symbianVersion) {
+ case QSysInfo::SV_9_2:
+ firstPartTemp += QString::fromLatin1("OS/9.2");
+ break;
+ case QSysInfo::SV_9_3:
+ firstPartTemp += QString::fromLatin1("OS/9.3");
+ break;
+ case QSysInfo::SV_9_4:
+ firstPartTemp += QString::fromLatin1("OS/9.4");
+ break;
+ case QSysInfo::SV_SF_2:
+ firstPartTemp += QString::fromLatin1("/2");
+ break;
+ case QSysInfo::SV_SF_3:
+ firstPartTemp += QString::fromLatin1("/3");
+ break;
+ case QSysInfo::SV_SF_4:
+ firstPartTemp += QString::fromLatin1("/4");
+ default:
+ break;
+ }
+#endif
+
firstPartTemp += QString::fromLatin1("; ");
// SSL support
@@ -3458,51 +3500,22 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
firstPartTemp += QString::fromLatin1("Sun Solaris");
#elif defined Q_OS_ULTRIX
firstPartTemp += QString::fromLatin1("DEC Ultrix");
-#elif defined Q_OS_SYMBIAN
- firstPartTemp += QString::fromLatin1("SymbianOS");
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- switch (symbianVersion) {
- case QSysInfo::SV_9_2:
- firstPartTemp += QString::fromLatin1("/9.2");
- break;
- case QSysInfo::SV_9_3:
- firstPartTemp += QString::fromLatin1("/9.3");
- break;
- case QSysInfo::SV_9_4:
- firstPartTemp += QString::fromLatin1("/9.4");
- break;
- case QSysInfo::SV_SF_2:
- firstPartTemp += QString::fromLatin1("^2");
- break;
- case QSysInfo::SV_SF_3:
- firstPartTemp += QString::fromLatin1("^3");
- break;
- case QSysInfo::SV_SF_4:
- firstPartTemp += QString::fromLatin1("^4");
- break;
- default:
- firstPartTemp += QString::fromLatin1("/Unknown");
- }
-
-#if defined Q_WS_S60
+#elif defined Q_WS_S60
firstPartTemp += QLatin1Char(' ');
- firstPartTemp += QString::fromLatin1("Series60");
QSysInfo::S60Version s60Version = QSysInfo::s60Version();
switch (s60Version) {
case QSysInfo::SV_S60_3_1:
- firstPartTemp += QString::fromLatin1("/3.1");
+ firstPartTemp += QString::fromLatin1("Series60/3.1");
break;
case QSysInfo::SV_S60_3_2:
- firstPartTemp += QString::fromLatin1("/3.2");
+ firstPartTemp += QString::fromLatin1("Series60/3.2");
break;
case QSysInfo::SV_S60_5_0:
- firstPartTemp += QString::fromLatin1("/5.0");
+ firstPartTemp += QString::fromLatin1("Series60/5.0");
break;
default:
- firstPartTemp += QString::fromLatin1("/Unknown");
+ break;
}
-#endif
-
#elif defined Q_OS_UNIX
firstPartTemp += QString::fromLatin1("UNIX BSD/SYSV system");
#elif defined Q_OS_UNIXWARE
@@ -3532,8 +3545,8 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
QString thirdPartTemp;
thirdPartTemp.reserve(150);
-#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
- thirdPartTemp + QLatin1String(" Mobile Safari/");
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
+ thirdPartTemp += QLatin1String(" Mobile Safari/");
#else
thirdPartTemp += QLatin1String(" Safari/");
#endif