diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 00:36:16 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 00:36:16 +0000 |
commit | a6aae4a0266149529cdb28b9db4ad8cb19741b80 (patch) | |
tree | 3aa520dcac0b75a501df9e44116139b810cdc7ae /webkit/tools | |
parent | 4e0f0aeb701d1920df37216a6bdf4f851074e41e (diff) | |
download | chromium_src-a6aae4a0266149529cdb28b9db4ad8cb19741b80.zip chromium_src-a6aae4a0266149529cdb28b9db4ad8cb19741b80.tar.gz chromium_src-a6aae4a0266149529cdb28b9db4ad8cb19741b80.tar.bz2 |
Second attempt at adding setSmartInsertDeleteEnabled and
setSelectTrailingWhitespaceEnabled.
Now we allow both to be true because that's what we do on Windows.
Review URL: http://codereview.chromium.org/13213
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/layout_tests/test_lists/tests_fixable.txt | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 22 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 20 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 17 |
6 files changed, 72 insertions, 5 deletions
diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index fee8223..183fa7e 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -1227,7 +1227,6 @@ LayoutTests/http/tests/misc/dns-prefetch-control.html = FAIL TIMEOUT PASS MAC WIN DEBUG : LayoutTests/tables/mozilla_expected_failures/marvin/table_overflow_dirty_reflow_tbody.html = FAIL PASS // NEW FOR MERGE 37604:38097 -LayoutTests/editing/deleting/smart-editing-disabled.html = FAIL LayoutTests/fast/events/destroyed-atomic-string.html = FAIL LayoutTests/fast/js/exception-thrown-from-new.html = FAIL LayoutTests/fast/js/global-constructors.html = FAIL @@ -1346,7 +1345,6 @@ LayoutTests/http/tests/misc/single-character-pi-stylesheet.xhtml = FAIL LayoutTests/fast/workers/stress-js-execution.html = TIMEOUT // MERGE 38729:38760: New tests -LayoutTests/editing/selection/doubleclick-whitespace.html = FAIL LayoutTests/fast/workers/worker-terminate.html = TIMEOUT LayoutTests/http/tests/misc/timer-vs-loading.html = TIMEOUT PASS diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 86e0527..79494b2 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -94,6 +94,8 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("execCommand", &LayoutTestController::execCommand); BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled); BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvisionalFrameLoads); + BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInsertDeleteEnabled); + BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSelectTrailingWhitespaceEnabled); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -534,6 +536,25 @@ void LayoutTestController::setStopProvisionalFrameLoads( stop_provisional_frame_loads_ = true; } +void LayoutTestController::setSmartInsertDeleteEnabled( + const CppArgumentList& args, CppVariant* result) { + if (args.size() > 0 && args[0].isBool()) { + shell_->delegate()->SetSmartInsertDeleteEnabled(args[0].value.boolValue); + } + + result->SetNull(); +} + +void LayoutTestController::setSelectTrailingWhitespaceEnabled( + const CppArgumentList& args, CppVariant* result) { + if (args.size() > 0 && args[0].isBool()) { + shell_->delegate()->SetSelectTrailingWhitespaceEnabled( + args[0].value.boolValue); + } + + result->SetNull(); +} + // // Unimplemented stubs // @@ -615,4 +636,3 @@ void LayoutTestController::fallbackMethod( } result->SetNull(); } - diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index c6a46e2..f6ddc82 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -122,6 +122,14 @@ class LayoutTestController : public CppBoundClass { void setStopProvisionalFrameLoads(const CppArgumentList& args, CppVariant* result); + // Enable or disable smart insert/delete. This is enabled by default. + void setSmartInsertDeleteEnabled(const CppArgumentList& args, + CppVariant* result); + + // Enable or disable trailing whitespace selection on double click. + void setSelectTrailingWhitespaceEnabled(const CppArgumentList& args, + CppVariant* result); + // The following are only stubs. TODO(pamg): Implement any of these that // are needed to pass the layout tests. void dumpAsWebArchive(const CppArgumentList& args, CppVariant* result); diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 95b0d47..ef9de09 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -119,6 +119,14 @@ public: void ResetTestController() { layout_test_controller_->Reset(); event_sending_controller_->Reset(); + + // Reset state in the test webview delegate. + delegate()->SetSmartInsertDeleteEnabled(true); +#if defined(OS_WIN) + delegate()->SetSelectTrailingWhitespaceEnabled(true); +#else + delegate()->SetSelectTrailingWhitespaceEnabled(false); +#endif } // Passes options from LayoutTestController through to the delegate (or diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 061cc9b..19354f6 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -548,7 +548,25 @@ bool TestWebViewDelegate::ShouldApplyStyle(WebView* webview, } bool TestWebViewDelegate::SmartInsertDeleteEnabled() { - return true; + return smart_insert_delete_enabled_; +} + +void TestWebViewDelegate::SetSmartInsertDeleteEnabled(bool enabled) { + smart_insert_delete_enabled_ = enabled; + // In upstream WebKit, smart insert/delete is mutually exclusive with select + // trailing whitespace, however, we allow both because Chromium on Windows + // allows both. +} + +bool TestWebViewDelegate::IsSelectTrailingWhitespaceEnabled() { + return select_trailing_whitespace_enabled_; +} + +void TestWebViewDelegate::SetSelectTrailingWhitespaceEnabled(bool enabled) { + select_trailing_whitespace_enabled_ = enabled; + // In upstream WebKit, smart insert/delete is mutually exclusive with select + // trailing whitespace, however, we allow both because Chromium on Windows + // allows both. } void TestWebViewDelegate::DidBeginEditing() { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 1bded4f..febbefa 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -59,7 +59,13 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, shell_(shell), top_loading_frame_(NULL), page_id_(-1), - last_page_id_updated_(-1) + last_page_id_updated_(-1), + smart_insert_delete_enabled_(true) +#if defined(OS_WIN) + , select_trailing_whitespace_enabled_(true) +#else + , select_trailing_whitespace_enabled_(false) +#endif #if defined(OS_WIN) , custom_cursor_(NULL) #elif defined(OS_LINUX) @@ -175,6 +181,9 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, std::wstring style, std::wstring range); virtual bool SmartInsertDeleteEnabled(); + virtual void SetSmartInsertDeleteEnabled(bool enabled); + virtual bool IsSelectTrailingWhitespaceEnabled(); + virtual void SetSelectTrailingWhitespaceEnabled(bool enabled); virtual void DidBeginEditing(); virtual void DidChangeSelection(bool is_empty_selection); virtual void DidChangeContents(); @@ -295,6 +304,12 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, ResourceMap resource_identifier_map_; std::string GetResourceDescription(uint32 identifier); + // true if we want to enable smart insert/delete. + bool smart_insert_delete_enabled_; + + // true if we want to enable selection of trailing whitespaces + bool select_trailing_whitespace_enabled_; + #if defined(OS_WIN) HCURSOR custom_cursor_; |