From ebaeb25bebdd29651f15b6e53119597633ea854f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 Mar 2009 12:08:14 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( 70604503a0365edaeff82ffad7b71f90641fa592 ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit since the last update: ++ b/WebKit/qt/ChangeLog 2009-03-20 Erik L. Bunce Reviewed by Tor Arne Vestbø. Fix QWebPage::WebActions action states to more closely match when they are actually applicable and remove erroneous documentation. * Most WebActions implemented using editor commands now use the Editor::Command::isEnabled() to control their availability. * SelectAll is always enabled (since it's editor command is). * SetTextDirection{} family of WebActions are available when canEdit() is true and not just canEditRichly(). Fix and clarify documentation about the availability of various web actions. * Api/qwebpage.cpp: (QWebPagePrivate::updateAction): (QWebPagePrivate::updateEditorActions): * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::textSelection): --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 74 ++++++++-------------- src/3rdparty/webkit/WebKit/qt/ChangeLog | 21 ++++++ .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 4 +- 4 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index c8efd63..af48a6e 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 64fe6bc7eb5887db9ed7b1c154a6f15712e0adb6 + 70604503a0365edaeff82ffad7b71f90641fa592 diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 70eb864..5e3c656 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -451,61 +451,35 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) case QWebPage::Reload: enabled = !loader->isLoading(); break; - case QWebPage::Cut: - enabled = editor->canCut(); - break; - case QWebPage::Copy: - enabled = editor->canCopy(); - break; - case QWebPage::Paste: - enabled = editor->canPaste(); - break; #ifndef QT_NO_UNDOSTACK case QWebPage::Undo: case QWebPage::Redo: // those two are handled by QUndoStack break; #endif // QT_NO_UNDOSTACK - case QWebPage::MoveToNextChar: - case QWebPage::MoveToPreviousChar: - case QWebPage::MoveToNextWord: - case QWebPage::MoveToPreviousWord: - case QWebPage::MoveToNextLine: - case QWebPage::MoveToPreviousLine: - case QWebPage::MoveToStartOfLine: - case QWebPage::MoveToEndOfLine: - case QWebPage::MoveToStartOfBlock: - case QWebPage::MoveToEndOfBlock: - case QWebPage::MoveToStartOfDocument: - case QWebPage::MoveToEndOfDocument: - case QWebPage::SelectAll: - case QWebPage::SelectNextChar: - case QWebPage::SelectPreviousChar: - case QWebPage::SelectNextWord: - case QWebPage::SelectPreviousWord: - case QWebPage::SelectNextLine: - case QWebPage::SelectPreviousLine: - case QWebPage::SelectStartOfLine: - case QWebPage::SelectEndOfLine: - case QWebPage::SelectStartOfBlock: - case QWebPage::SelectEndOfBlock: - case QWebPage::SelectStartOfDocument: - case QWebPage::SelectEndOfDocument: - case QWebPage::DeleteStartOfWord: - case QWebPage::DeleteEndOfWord: + case QWebPage::SelectAll: // editor command is always enabled + break; case QWebPage::SetTextDirectionDefault: case QWebPage::SetTextDirectionLeftToRight: case QWebPage::SetTextDirectionRightToLeft: - case QWebPage::ToggleBold: - case QWebPage::ToggleItalic: - case QWebPage::ToggleUnderline: - enabled = editor->canEditRichly(); - if (enabled) - checked = editor->command(editorCommandForWebActions(action)).state() != FalseTriState; - else - checked = false; + enabled = editor->canEdit(); + checked = false; + break; + default: { + // see if it's an editor command + const char* commandName = editorCommandForWebActions(action); + + // if it's an editor command, let it's logic determine state + if (commandName) { + Editor::Command command = editor->command(commandName); + enabled = command.isEnabled(); + if (enabled) + checked = command.state() != FalseTriState; + else + checked = false; + } break; - default: break; + } } a->setEnabled(enabled); @@ -539,7 +513,6 @@ void QWebPagePrivate::updateEditorActions() updateAction(QWebPage::MoveToEndOfBlock); updateAction(QWebPage::MoveToStartOfDocument); updateAction(QWebPage::MoveToEndOfDocument); - updateAction(QWebPage::SelectAll); updateAction(QWebPage::SelectNextChar); updateAction(QWebPage::SelectPreviousChar); updateAction(QWebPage::SelectNextWord); @@ -1118,8 +1091,13 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const \enum QWebPage::WebAction This enum describes the types of action which can be performed on the web page. - Actions which are related to text editing, cursor movement, and text selection - only have an effect if \l contentEditable is true. + + Actions only have an effect when they are applicable. The availability of + actions can be be determined by checking \l{QAction::}{enabled()} on the + action returned by \l{QWebPage::}{action()}. + + One method of enabling the text editing, cursor movement, and text selection actions + is by setting \l contentEditable to true. \value NoWebAction No action is triggered. \value OpenLink Open the current link. diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 1ceb176..0755133 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,24 @@ +2009-03-20 Erik L. Bunce + + Reviewed by Tor Arne Vestbø. + + Fix QWebPage::WebActions action states to more closely match when they are + actually applicable and remove erroneous documentation. + + * Most WebActions implemented using editor commands now use the + Editor::Command::isEnabled() to control their availability. + * SelectAll is always enabled (since it's editor command is). + * SetTextDirection{} family of WebActions are available when canEdit() is true + and not just canEditRichly(). + + Fix and clarify documentation about the availability of various web actions. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + (QWebPagePrivate::updateEditorActions): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textSelection): + 2009-03-19 Ariya Hidayat Reviewed by Simon Hausmann. 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 dea9562..54d342e 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -894,7 +894,6 @@ void tst_QWebPage::textSelection() QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0); // right now they are disabled because contentEditable is false - QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), false); @@ -908,6 +907,9 @@ void tst_QWebPage::textSelection() QCOMPARE(page->action(QWebPage::SelectStartOfDocument)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectEndOfDocument)->isEnabled(), false); + // ..but SelectAll is awalys enabled + QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); + // make it editable before navigating the cursor page->setContentEditable(true); -- cgit v0.12