summaryrefslogtreecommitdiffstats
path: root/chrome/views/label.cc
Commit message (Collapse)AuthorAgeFilesLines
* This CL fixes issue 6099 -- bad display of multi-line English message in pop ↵xji@chromium.org2009-02-231-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ups. (http://crbug.com/6099) Currently, in RTL locales, a pure *multi-line* English message is displayed as right aligned and has RTL directionality (such as the ending punctuation appears at the very left). Single-line message works fine. I do not know why, but simply putting LRE-PDF around a multi-line English text which has the following flags DT_WORDBREAK | DT_RTLREADING wont render the English message as LTR. We have to remove the DT_RTLREADING to render multi-line English message correctly in LTR direction. The fix is that in RTL locales, for JavaScript message, if the message is pure English, the alignment is set to be left-aligned, and the directionality is set to be left-to-right. If the message is mixed BiDi text, the alignment and the directionality is determined by the directionality of the first character with strong directionality in the text. JavaScript message is a MessageBoxView, and the message is a view::Label. Both MessageBoxView and Label are used by Chrome's UI as well. If the message is one of Chrome UI's, the alignment and directionality of the message should be taken from that of the UI's. In order to distinguish where the message comes from, a new flag kFlagWebMessage is introduced in MessageBoxView, and a new argument is introduced in Label::SetHorizontalAlignment() to control whether the alignment need to be flipped or not for RTL locales. Consequently, quite a few files which calls Label::SetHorizontalAlignment() are changed. The main changes are in 5 areas. Other files are changed due to the signature change of Label::SetHorizontalAlignment(). 1. jsmessage_box_handler.cc: pass in extra flag kFlagWebPage when creating MessageBoxView to indicate the message box is one from a web page, not from Chrome UI. 2. l10n_util.h/.cc added function GetFirstStrongDirection() 3. label.h/.cc a new argument is introduced in Label::SetHorizontalAlignment() to control whether the alignment need to be flipped or not for RTL locales. 4. message_box_view.cc when init message box view, if the flag is kFlagWebPage, get the text directionality from the text itself (not Chrome UI's) and calls Label::SetHorizontalAlignment() to not resetting the flag for RTL locales. 5. chrome_canvas_win.cc 5.1 ComputeFormatFlags() only set flag DT_RTLREADING for RTL locales if the text contains strong RTL characters and the alignment is RIGHT aligned. All labels of Chrome's UI and other Chrome UI components in RTL locales have been set as (or flipped to) RIGHT aligned. 5.2 DoDrawText() Only adjust string for locale is the reading direction is DT_RTLREADING. Review URL: http://codereview.chromium.org/18863 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10178 0039d316-1c4b-4281-b951-d872f2087c98
* Add ability to set a flag in the Label view class that tells it tomunjal@chromium.org2009-02-131-0/+10
| | | | | | | | return a preferred size of 0, 0 when the label is not visible. Review URL: http://codereview.chromium.org/21313 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9725 0039d316-1c4b-4281-b951-d872f2087c98
* Add NOTREACHED() in switch default part which should never be reached.phajdan.jr@chromium.org2009-01-271-0/+1
| | | | | | Review URL: http://codereview.chromium.org/18850 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8730 0039d316-1c4b-4281-b951-d872f2087c98
* Fix linux build breakage.maruel@chromium.org2009-01-271-0/+3
| | | | | | Review URL: http://codereview.chromium.org/19020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8720 0039d316-1c4b-4281-b951-d872f2087c98
* Porting in chrome/views/phajdan.jr@chromium.org2009-01-271-1/+3
| | | | | | | | Some highlights: label, throbber. And others. Review URL: http://codereview.chromium.org/18757 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8715 0039d316-1c4b-4281-b951-d872f2087c98
* Rename Container->Widgetben@chromium.org2008-11-211-1/+0
| | | | | | | | | R=erg review url = http://codereview.chromium.org/11348/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5849 0039d316-1c4b-4281-b951-d872f2087c98
* Make border and background setting and getting non-virtual and use the ↵brettw@google.com2008-11-141-1/+1
| | | | | | | | correct style. I was debugging in here and this was annoying me, since there is no reason for these functions to be virtual. Review URL: http://codereview.chromium.org/10638 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5445 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the 0x0 canvas used for computing text sizes. Creating this is not ↵brettw@google.com2008-11-131-2/+1
| | | | | | | | | necessary since the text can be sized using the desktop DC, which should be faster. I made this function static, and moved the functions it used into file-local functions since they didn't depend on the class either. This is trying to fix bug 49. This code is very close to the crash, and a 0x0 canvas seems like it might cause problems. However, it is unclear whether this will have any effect (other than performance). Review URL: http://codereview.chromium.org/10409 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5328 0039d316-1c4b-4281-b951-d872f2087c98
* Add a function for eliding filenames to a set pixel width while preserving ↵glen@chromium.org2008-11-061-1/+1
| | | | | | | | the display of the extension. This touches a lot of files because it renames url_elider to text_elider (as it already contained a bunch of text ellision functions), and so requires header file reference changes. BUG=1208 Review URL: http://codereview.chromium.org/9613 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4912 0039d316-1c4b-4281-b951-d872f2087c98
* Make multiline labels respect the inset.levin@chromium.org2008-11-011-24/+44
| | | | | | | | Add a unittest for label.cc Review URL: http://codereview.chromium.org/8902 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4351 0039d316-1c4b-4281-b951-d872f2087c98
* Rename ChromeViews namespace to viewsben@chromium.org2008-10-161-2/+2
| | | | | | http://crbug.com/2188 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3495 0039d316-1c4b-4281-b951-d872f2087c98
* Make View::SetBounds take a const gfx::Rect& instead of a const CRect&ben@chromium.org2008-10-161-3/+1
| | | | | | | | | | Make View::DidChangeBounds call Layout by default, eliminating this function from most places. http://crbug.com/2186 Review URL: http://codereview.chromium.org/7429 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3471 0039d316-1c4b-4281-b951-d872f2087c98
* Rename ViewContainer to Container and HWNDViewContainer to ContainerWin.ben@chromium.org2008-10-161-1/+1
| | | | | | | http://crbug.com/3430 Review URL: http://codereview.chromium.org/7376 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3441 0039d316-1c4b-4281-b951-d872f2087c98
* Convert GetPreferredSize from:beng@google.com2008-10-151-22/+18
| | | | | | | | | | | | | | | | | void GetPreferredSize(CSize* out); to: gfx::Size GetPreferredSize(); .. and update some other places to use gfx::Size as well. http://crbug.com/2186 Review URL: http://codereview.chromium.org/7344 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3400 0039d316-1c4b-4281-b951-d872f2087c98
* Label::SizeToFit was not setting the width properly.jcampan@chromium.org2008-10-151-1/+1
| | | | | | | | BUG=3432 TEST=See bug. Review URL: http://codereview.chromium.org/7337 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3390 0039d316-1c4b-4281-b951-d872f2087c98
* Replace View::GetBounds(CRect* bounds) const; with gfx::Rect bounds() const. ben@chromium.org2008-10-141-6/+4
| | | | | | | | http://crbug.com/2186 Review URL: http://codereview.chromium.org/7136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3348 0039d316-1c4b-4281-b951-d872f2087c98
* Rename legacy methods that were in CamelCase to unix_hacker.erg@google.com2008-09-171-8/+8
| | | | | | | | | Required going through and modifying some of the code to solve name clashes. Review URL: http://codereview.chromium.org/2945 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2337 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Large patch set (159 files total) to cleanup the includes.maruel@google.com2008-08-151-0/+3
| | | | | | | | | | - Slightly reduce the size of the generated .lib files ~3%. - Reduce the number of implicit and explicit atl and windows includes. hooray! - Help incremental build by reducing the number of unnecessary included files. - Split some template class in two, one base class for the common code and the specialization that inherits from the base class. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@937 0039d316-1c4b-4281-b951-d872f2087c98
* Add chrome to the repository.initial.commit2008-07-261-0/+406
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15 0039d316-1c4b-4281-b951-d872f2087c98