diff options
author | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 05:56:24 +0000 |
---|---|---|
committer | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-22 05:56:24 +0000 |
commit | f97238d2329697e3d38cf187d94e62da9f73de02 (patch) | |
tree | d60214f75643f2d0f998d9ed3f8be276cf887e47 /webkit | |
parent | 4b14d07f99813eee85d240a91f6ccf132e5dfd89 (diff) | |
download | chromium_src-f97238d2329697e3d38cf187d94e62da9f73de02.zip chromium_src-f97238d2329697e3d38cf187d94e62da9f73de02.tar.gz chromium_src-f97238d2329697e3d38cf187d94e62da9f73de02.tar.bz2 |
This CL fixes issue 5996: Tooltip gets direction from Chrome langauge, not element (or even page)
The related webkit bug is
https://bugs.webkit.org/show_bug.cgi?id=24187
After webkit passes both the title string and its directionality to its client, Chrome will force the title to be displayed in correct directionality using Unicode Control characters.
BUG=http://crbug.com/5996
TEST=In both English Chrome and Hebrew Chrome
1. open the test case in http://crbug.com/5996 comment #1
2. hover over the red span, tooltip should be displayed as RTL in both English Chrome and Hebrew Chrome.
3. hover over the blue span, tooltip should be displayed as LTR in both English Chrome and Hebrew Chrome.
Review URL: http://codereview.chromium.org/147240
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/chrome_client_impl.cc | 13 | ||||
-rw-r--r-- | webkit/glue/chrome_client_impl.h | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index d6f4fda..1d2d561 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -9,6 +9,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "AccessibilityObject.h" #include "AXObjectCache.h" +#include "CharacterNames.h" #include "Console.h" #include "Cursor.h" #include "Document.h" @@ -507,10 +508,20 @@ void ChromeClientImpl::mouseDidMoveOverElement( } } -void ChromeClientImpl::setToolTip(const WebCore::String& tooltip_text) { +void ChromeClientImpl::setToolTip(const WebCore::String& tooltip_text, + WebCore::TextDirection dir) { if (webview_->delegate()) { std::wstring tooltip_text_as_wstring = webkit_glue::StringToStdWString(tooltip_text); + if (dir == WebCore::LTR) { + // Force the tooltip to have LTR directionality. + tooltip_text_as_wstring.insert(0, 1, WebCore::leftToRightEmbed); + tooltip_text_as_wstring.push_back(WebCore::popDirectionalFormatting); + } else { + // Force the tooltip to have RTL directionality. + tooltip_text_as_wstring.insert(0, 1, WebCore::rightToLeftEmbed); + tooltip_text_as_wstring.push_back(WebCore::popDirectionalFormatting); + } webview_->delegate()->SetTooltipText(webview_, tooltip_text_as_wstring); } } diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h index 2a91659..a6cf956 100644 --- a/webkit/glue/chrome_client_impl.h +++ b/webkit/glue/chrome_client_impl.h @@ -117,7 +117,8 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium { virtual void mouseDidMoveOverElement(const WebCore::HitTestResult& result, unsigned modifierFlags); - virtual void setToolTip(const WebCore::String& tooltip_text); + virtual void setToolTip(const WebCore::String& tooltip_text, + WebCore::TextDirection dir); virtual void print(WebCore::Frame*); |