summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 22:30:18 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 22:30:18 +0000
commita697f4c60ddb3b400a2cf900aa9786cd49723da9 (patch)
tree0daeb92013076663e80b41b4cb91fd7bbe35c08b /webkit
parent6461b0d6c71c9daf0eb4223fd4169bce995378b5 (diff)
downloadchromium_src-a697f4c60ddb3b400a2cf900aa9786cd49723da9.zip
chromium_src-a697f4c60ddb3b400a2cf900aa9786cd49723da9.tar.gz
chromium_src-a697f4c60ddb3b400a2cf900aa9786cd49723da9.tar.bz2
Fix for bug 2932: Chrome should not trigger page reloading when turn off auto detect
In order to fix the bug I added new interfaces to allow resetting the override encoding (including a new render message). The new logic is as follows: -) If the user turns auto-detect OFF, nothing happens (as requested in the bug description) -) If the user turns auto-detect ON, then the page is reloaded with an empty override encoding I.e., turning auto-detect on resets a previous override setting. The reverse is not true, however: specifiying a new override setting will not turn auto-detect off. BUG=2932 TEST=do the following steps, using the test file (encoding-gb18030.htm) attached to comment 14 of the original bug http://crbug.com/2932 : 1.) load the file while auto-detect is turned off -> garbage is displayed 2.) turn auto-detect on -> proper Chinese text should appear -> in the encoding menu, Chinese encoding should be highlighted 3.) turn auto-detect off -> proper Chinese text should remain -> in the encoding menu, Chinese encoding should remain highlighted 4.) choose any other encoding -> garbage is again displayed (in the new encoding) 5.) turn auto-detect on -> proper Chinese text should again appear -> in the encoding menu, Chinese should again be highlighted Original Review: http://codereview.chromium.org/173265 Patch by Roland Steiner (rolandsteiner@google.com) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webview_impl.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index a58b0c3..405a744 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -1419,12 +1419,12 @@ void WebViewImpl::SetPageEncoding(const std::string& encoding_name) {
if (!page_.get())
return;
- if (!encoding_name.empty()) {
- // only change override encoding, don't change default encoding
- // TODO(brettw) use std::string for encoding names.
- String new_encoding_name(webkit_glue::StdStringToString(encoding_name));
- page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name);
- }
+ // Only change override encoding, don't change default encoding.
+ // Note that the new encoding must be NULL if it isn't supposed to be set.
+ String new_encoding_name;
+ if (!encoding_name.empty())
+ new_encoding_name = webkit_glue::StdStringToString(encoding_name);
+ page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name);
}
// Return the canonical encoding name of current main webframe in webview.