summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add RenderText DirectionalityMode enum and support; etc.msw@chromium.org2012-08-011-36/+60
| | | | | | | | | | | | | | | | | | | Add gfx::DirectionalityMode enum. Add RenderText::SetDirectionalityMode and member. Revise/consolidate RenderText::GetTextDirection. Expand on existing unit tests; minor cleanup. Consume GetTextDirection in layout initialization: -Windows: RenderTextWin::ItemizeLogicalText() -Linux: SetupPangoLayoutWithoutFont() -Mac: Add TODO in RenderTextMac::EnsureLayout() BUG=134746 TEST=Existing/updated unit tests, no behavioral changes! Review URL: https://chromiumcodereview.appspot.com/10807082 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149503 0039d316-1c4b-4281-b951-d872f2087c98
* Initial RenderTextMac implementation using CoreText.asvitkine@chromium.org2012-07-231-0/+12
| | | | | | | | | | Has support for drawing and sizing the text, but not selection and cursor movement. BUG=125664 TEST=Existing RenderText unit tests and manual testing by enabling RenderText on Mac in print_web_view_helper.cc code. Review URL: https://chromiumcodereview.appspot.com/10543057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147862 0039d316-1c4b-4281-b951-d872f2087c98
* Add and specify Views::Textfield::SelectAll |reversed| flag, etc.msw@chromium.org2012-07-131-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SelectAll should be consistent and explicit with range reversal. This dictates if leading or trailing text is shown when textfields overflow. Currently, NativeTextfield[Win|Views]::SelectAll behavior is implicit and differs. (Windows native reverses the selection, while ChromeOS/Views doesn't) Revise SelectAll in RenderText, NativeTextfieldWin, and OmniboxViewViews. Add the |reversed| parameter and plumbing to related interfaces/functions. Add/update RenderTextTest.SelectAll and TextfieldViewsModelTest.Selection. Specify explicit reversal behavior in all the following cases: 1) Use reversed selection (changes ChromeOS/Views behavior) in: a) BookmarkBubbleView::ShowBubble (focus on bookmark title when shown). b) BookmarkEditorView::Accept (focus on invalid bookmark URL on "Save"). c) BookmarkEditorView::Show (focus on bookmark title when shown). d) FindBarView::UpdateForResult (find bar matches are found/iterated). e) FindBarView::SetFocusAndSelection (find bar shown, etc.). f) FindBarView::SearchTextfieldView::RequestFocus (click find bar parts, etc.). g) EditSearchEngineDialog::Show (focus on search engine title when shown). h) LoginView::OnAutofillDataAvailable (HTTP/FTP auth window shown). i) MessageBoxView::ViewHierarchyChanged (JS dialog with text input shown). 2) Use forward selection (changes Windows native behavior) in: a) NativeTextfieldWin::ExecuteCommand (textfield context menu "Select All"). (note: the Omnibox context menu "Select All" already uses forward selection) b) Textfield::AboutToRequestFocusFromTabTraversal (focus via tab-traversal). (note1: THIS IS CONTENTIOUS! Though OmniBoxViewWin is unaffected) (note2: OmniboxViewViews should be fixed later as per crbug.com/134701#c9) c) TreeView::StartEditing (editing tree view nodes ex/ collected cookies). d) NativeTextfieldViewsTest.* and ViewTest.* (changes inconsequential to tests) 3) Formally specify existing implicit behavior (no behavioral change): a) NativeTextfieldWin::OnAfterPossibleChange (temporary selection is reversed). b) NativeTextfieldViews::OnGestureEvent (double tap is forwards). c) NativeTextfieldViews::ExecuteCommand (context menu "Select All" is forwards). d) NativeTextfieldViews::HandleKeyEvent (CTRL-A is forwards). e) NativeTextfieldViews::HandleMousePressEvent (triple-click is forwards). f) TextfieldViewsModel::SetText (temporary selection is forwards). g) TextfieldViewsModelTest.* is mostly forwards, |Selection| tests reversed. TBR=ben@chromium.org BUG=134762 TEST=New RenderTextTest.SelectAll, updated TextfieldViewsModelTest.Selection, other unit tests, manual. Review URL: https://chromiumcodereview.appspot.com/10693160 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146520 0039d316-1c4b-4281-b951-d872f2087c98
* Rename RenderText::CreateRenderText() to RenderText::CreateInstance().asvitkine@chromium.org2012-07-091-30/+30
| | | | | | | | | | | BUG=none TEST=compiles R=msw@chromium.org TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10701104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145701 0039d316-1c4b-4281-b951-d872f2087c98
* Fix RenderTextWin base direction; remove test exceptions; etc.msw@chromium.org2012-07-041-70/+57
| | | | | | | | | | | | | | | | | | | | | | | | | Use the first strong character's direction to set SCRIPT_STATE.uBidiLevel. RenderTextWin::GetTextDirection returns this calculated base direction. Fix RenderTextWin::AdjacentCharSelectionModel: Handle all out-of-bounds run indicies as invalid runs. Use the visual ordering of runs (implicit on Linux) to determine edges. Add new RenderTextTest.GetTextDirection unit test. Add SetRTL test utility function which works with GTK. Fix RenderTextTest.DisplayRectShowsCursorRTL on linux with SetRTL. Remove relevant Windows-specific unit test exceptions. TODO(msw): Cleanup canvas_skia.cc in a followup CL. TODO(msw): Use UI dir by default in GetFirstStrongCharacterDirection. BUG=134746,134009 TEST=Updated unit tests; no RTL/LTR regressions. TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10693061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145476 0039d316-1c4b-4281-b951-d872f2087c98
* Expose GetBaseline() method on RenderText.asvitkine@chromium.org2012-06-221-0/+7
| | | | | | | | | | | | | This is needed for use by autocomplete_result_view.cc for text alignment and my rewrite of print_web_view_helper.cc's use of RenderText. BUG=128027,105550 TEST=New unit test. Review URL: https://chromiumcodereview.appspot.com/10591003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143705 0039d316-1c4b-4281-b951-d872f2087c98
* Make gyp inclusion of render_text_unittest.cc consistent with the ↵asvitkine@chromium.org2012-06-221-0/+3
| | | | | | | | | | | | | | | implementation. This puts render_text_unittest.cc in the list of files included by default and disables it per the same criteria as render_text.cc in ui.gyp. Also disables RenderTextTest.DisplayRectShowsCursorRTL on desktop Linux since it fails (previously, RenderTextTest was not enabled on desktop Linux). BUG=134009 TEST=RenderTextTest.* ui_unittests. Review URL: https://chromiumcodereview.appspot.com/10627007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143535 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite RenderText::IndexOfAdjacentGrapheme() in terms of ↵asvitkine@chromium.org2012-05-161-0/+16
| | | | | | | | | | | | | | | | | IsCursorablePosition(). This moves the implementation of IndexOfAdjacentGrapheme() entirely into the base class, removing the need for platform-specific implementations. This rewrite exposed a couple of problems in RenderTextLinux::IsCursorablePosition() that caused some tests to fail. The fixes are also included. Also includes additional test coverage for UTF16 surrogate pairs, which was only caught by a Linux-specific password censorship test. BUG=125664 TEST=Existing unit tests. Review URL: https://chromiumcodereview.appspot.com/10389148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137320 0039d316-1c4b-4281-b951-d872f2087c98
* Add a RenderText test that checks that matching parentheses use the same font.asvitkine@chromium.org2012-05-121-0/+86
| | | | | | | | | | | | This is a test for http://crbug.com/125792, which I had fixed earlier. BUG=125792, 105550 TEST=This is one. Checked that this test fails without the fix for http://crbug.com/125792. Review URL: https://chromiumcodereview.appspot.com/10388092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136720 0039d316-1c4b-4281-b951-d872f2087c98
* Expand RenderText bold width test.asvitkine@chromium.org2012-05-101-1/+15
| | | | | | | | | | | Also, add some ASSERTS() to a couple of other tests. BUG=105550 TEST=This is one. Review URL: https://chromiumcodereview.appspot.com/10382103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136354 0039d316-1c4b-4281-b951-d872f2087c98
* Re-land: Use a common font baseline in RenderText classes.asvitkine@chromium.org2012-04-041-6/+6
| | | | | | | | | | | | | | | This ensures the text in different runs gets aligned along a common bottom baseline and that the correct font's baseline gets used in case of font fallback. Original CL: http://codereview.chromium.org/9968040/ BUG=105550 TEST=none TBR=msw Review URL: https://chromiumcodereview.appspot.com/9982001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130618 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 130447 - Use a common font baseline in RenderText classes.dbeam@chromium.org2012-04-041-6/+6
| | | | | | | | | | | | | | | | | This ensures the text in different runs gets aligned along a common bottom baseline and that the correct font's baseline gets used in case of font fallback. Also, uses the correct height when centering text. BUG=105550 TEST=none Review URL: https://chromiumcodereview.appspot.com/9968040 TBR=asvitkine@chromium.org Review URL: https://chromiumcodereview.appspot.com/9965140 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130562 0039d316-1c4b-4281-b951-d872f2087c98
* Make RenderTextWin::GetStringSize() return a non-zero height if the text is ↵asvitkine@chromium.org2012-04-031-0/+13
| | | | | | | | | | | | | | | | empty. This makes it match the RenderTextLinux behavior and is needed for my upcoming change to make canvas_skia.cc use GetStringSize(). Also, some cleanups to RenderTextWin: - Don't need to check runs_.size() > 0 in LayoutVisualText() (adds a DCHECK() instead). - Change loop from iterator to index for cleaner, more consistent code with the rest of the file. BUG=105550 TEST=New RenderTextTest.StringSizeHeightEmpty test. Review URL: https://chromiumcodereview.appspot.com/9969100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130452 0039d316-1c4b-4281-b951-d872f2087c98
* Use a common font baseline in RenderText classes.asvitkine@chromium.org2012-04-031-6/+6
| | | | | | | | | | | | | | This ensures the text in different runs gets aligned along a common bottom baseline and that the correct font's baseline gets used in case of font fallback. Also, uses the correct height when centering text. BUG=105550 TEST=none Review URL: https://chromiumcodereview.appspot.com/9968040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130447 0039d316-1c4b-4281-b951-d872f2087c98
* Fix issues in RenderTextWin where font style and sizes may not be getting ↵asvitkine@chromium.org2012-03-301-5/+29
| | | | | | | | | | | | | | applied. This CL ensures that any substitute font that is picked has the correct style and size for the purposes of the Uniscribe API calls. The calls to DeriveFont() are not so bad in this CL, due to my optimization of DeriveFont() in http://crrev.com/129533. BUG=105550 TEST=New RenderText unit test and enabled an existing test on Windows. Review URL: https://chromiumcodereview.appspot.com/9802045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129839 0039d316-1c4b-4281-b951-d872f2087c98
* Calculate height from all runs' fonts in RenderTextWin::GetStringSize().asvitkine@chromium.org2012-03-291-6/+19
| | | | | | | | | | | Adds a sanity test for this. Also enables part of an existing test on Windows and adds a TODO to fix the currently broken part. BUG=105550 TEST=New RenderText unit test. Review URL: https://chromiumcodereview.appspot.com/9873032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129669 0039d316-1c4b-4281-b951-d872f2087c98
* Fix RenderTextTest.OriginForSkiaDrawing unit test. Skia is expecting y to be ↵reveman@google.com2012-03-261-2/+2
| | | | | | | | | | | the baseline. BUG=119820 TEST=gfx_unittests Review URL: https://chromiumcodereview.appspot.com/9856029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128982 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a check_perms error.hbono@chromium.org2012-03-131-0/+0
| | | | | | | | | | | This change just removes a svn:executable flag added by r126287 <http://crrev.com/126287>. TBR=benrg BUG=none TEST=check_perms Review URL: https://chromiumcodereview.appspot.com/9694029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126341 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify handling of BiDi cursor movementbenrg@chromium.org2012-03-131-240/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current caret position and the end of the current selection in a text field are logically the same thing, but the current code represents them separately as SelectionModel::caret_pos_ and SelectionModel::selection_end_, which sometimes have different values, for two reasons: 1. selection_end_ indexes a point between two graphemes (range 0 to N, where N is the text length), but caret_pos_ indexes a grapheme (range 0 to N-1). SelectionModel::caret_placement_ specifies whether the caret is to be displayed at the leading or trailing edge of that grapheme. When the placement is LEADING, selection_end_ and caret_pos_ have the same value, but when it's TRAILING, caret_pos_ points to the start of the grapheme while selection_end_ points to the end. 2. The first and last logical graphemes of the text are not always at the visual boundary (for example, when the text is visually abcFED, the last logical character, F, is in the middle). In order to make the cursor appear at the visual boundary in such cases, the current code attaches it to the leading edge of the D, whereas selection_end_ points after the F. The first case can be fixed by making caret_pos_ point between graphemes like selection_end_. This is enough to determine the caret position except when it is between bidi runs that aren't visually contiguous: in that case, an extra field ("affinity", replacing placement) indicates whether it appears attached to the previous or the next run. The second case can be fixed by pretending that the text is surrounded on both sides by text in the default bidi direction, and allowing the caret to be attached to those runs. This makes EdgeSelectionModel() much simpler: it always returns either (0, previous) or (text_length, next). After these changes, caret_pos_ and selection_end_ always have the same value, so I merged them. For examples of how the old and new SelectionModels compare, look at the changes to ui/gfx/render_text_unittest.cc. The visual behavior of the text field is mostly unaffected by this change. I'm not sure that the current behavior is actually what we want (it's different from WebKit, Windows, and GTK behavior, all of which are different from each other), but that's a separate issue. Visible changes: * RenderText::IsPointInSelection should now behave as expected when clicking on the trailing half of a glyph (it was a TODO). * Clicking on the right half of a glyph used to place the caret to the left of the glyph on Windows. It should now place it on the right. * There was a bug in the Windows cursoring code: with the text "CBAdef" in a LTR locale, pressing End, then Left repeatedly, causes the caret to cycle through the leftmost five visual positions instead of stopping at the left. This should now be fixed. Drive-by changes: * Replaced the selection with a ui::Range and use ui::Range methods like GetMin() and is_reversed() instead of SelectionModel-specific code. * Merged RenderText{Linux,Win}::{EdgeSelectionModel,GetCursorBounds} into RenderText. I didn't merge other methods (such as AdjacentCharSelectionModel) that should eventually be merged but aren't as easy to merge. * Some simplification of the unit tests. BUG=90426 TEST=existing unit tests Review URL: http://codereview.chromium.org/9390022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126287 0039d316-1c4b-4281-b951-d872f2087c98
* Support for password entry fields, with all charactersbenrg@chromium.org2012-03-021-0/+75
| | | | | | | | | | | | | | | | | | | | displayed as '*', was implemented in NativeTextfieldViews via TextfieldViewsModel::GetVisibleText() (issue 5857002), but the refactoring into RenderText (issue 7265011) removed all calls of that method. I moved the password handling code into RenderText because I think it's logically a visual style (although RenderText also contains a lot of model-related stuff right now). RenderText now has a password property (in earlier patchsets it was an attribute in StyleRange). BUG=105054 TEST=unit tests and manual testing of the wifi login dialog Review URL: https://chromiumcodereview.appspot.com/8747001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124611 0039d316-1c4b-4281-b951-d872f2087c98
* Aura: apply UI font list to cros.xji@chromium.org2012-01-241-8/+0
| | | | | | | | | | | | | | | | | | - change IDS_UI_FONT_FAMILY_CROS back to 12px in default. - GetDefaultFont() in platform_font_pango.cc returns IDS_UI_FONT_FAMILY_CROS for Aura Chrome OS. - views::NativeTextfieldViews::UpdateFont() applies the size from the passed-in font on Chrome OS - OmniboxViewViews requests a larger font size. - Correspondingly, decrease OmniboxViewViews's vertical margin so that the display area has greater height to accommodate larger font size. BUG=103860, 109961 TEST=visual on omnibox and popup, bookmark bubble, findbar, and omnibox in popup. Review URL: http://codereview.chromium.org/9192018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118802 0039d316-1c4b-4281-b951-d872f2087c98
* Merge left and right cursor movement code in RenderText, and misc fixesbenrg@chromium.org2012-01-211-61/+63
| | | | | | | | | | | | | | | | | | | | * Combine method pairs for left/right cursor motion in RenderText{,Linux,Win}, eliminating a lot of duplicate logic. The merged functions use new enums VisualTextDirection {VISUAL_LEFT, VISUAL_RIGHT} and LogicalTextDirection {LOGICAL_PREVIOUS, LOGICAL_NEXT}. * Make CalculateSubstringBounds and GetSelectionBounds return the result instead of taking it as an out pointer argument. * Remove Utf16IndexOfAdjacentGrapheme for clarity (it took a UTF-8 index as its argument) * Delete some unused obsolete methods in RenderText, remove some logging code, and fix some comments. The logic should be unchanged except that in the Backspace handler in NativeTextfieldViews, cursor_changed is now set to true only if the text changed (like Delete). Formerly it was always set to true, which appears to be a bug. BUG=none TEST=existing unit tests Review URL: http://codereview.chromium.org/8958024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118580 0039d316-1c4b-4281-b951-d872f2087c98
* RenderText: Pan to show additional overflow text when the display width ↵msw@chromium.org2012-01-181-0/+106
| | | | | | | | | | | | | | increases. This is my alternate solution to Xiaomei's http://codereview.chromium.org/9120008/ BUG=103663 TEST=Shrinking/enlarging RenderText textfields. Review URL: http://codereview.chromium.org/9166036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118051 0039d316-1c4b-4281-b951-d872f2087c98
* Fix cursor in replacement mode is not drawn correctly.xji@chromium.org2012-01-181-0/+13
| | | | | | | | | | | | | Fix a cursor bound width calculation bug in RenderTextLinux when in replacement mode. When in replacement mode, fill cursor as black rectangle and draw the underline character as white. BUG=110109 TEST=manual, RenderTextTest.CursorBoundsInReplacementMode Review URL: http://codereview.chromium.org/9187076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118043 0039d316-1c4b-4281-b951-d872f2087c98
* Fix input text is not visible in Find bar textfield and Add Bookmark name field.xji@chromium.org2012-01-121-0/+31
| | | | | | | | | | | | | | The display area's height in find-in-page and bookmark bubble textfields are smaller than font.GetHeight(). The size_t/int conversion in GetOriginForSkiaDrawing() made origin.y (drawing y coordindate) a very large negative number. BUG=109327 TEST=manual find-in-page and bookmark bubble. RenderTextTest.OriginForSkiaDrawing Review URL: http://codereview.chromium.org/9181001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117365 0039d316-1c4b-4281-b951-d872f2087c98
* Enable bold and italic text styles in RenderText*.asvitkine@chromium.org2012-01-101-0/+16
| | | | | | | | | | | | | | | | To do this, the following changes were made: Added functions GetStyle() and DeriveFontList(style) to FontList. Changed font list to use strings "Bold" and "Italic" instead of PANGO_STYLE_ITALIC and PANGO_WEIGHT_BOLD - where were actually compile constants for setting attributes and weren't recognized by Pango in a font string. (Whereas "Bold" and "Italic" are recognized). Add RenderText test that checks that the width of a bold string > the width of a non-bold string. Add FontList tests for the new functions. BUG=107893 TEST=Run views_examples_exe "Text Styles" examples and try bold and italic styles (this depends on an unreleased CL). Also, new tests in FontListTest and RenderTextTest. Review URL: http://codereview.chromium.org/8963027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117034 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 116945 - Enable bold and italic text styles in RenderText*.binji@chromium.org2012-01-091-16/+0
| | | | | | | | | | | | | | | | | | | To do this, the following changes were made: Added functions GetStyle() and DeriveFontList(style) to FontList. Changed font list to use strings "Bold" and "Italic" instead of PANGO_STYLE_ITALIC and PANGO_WEIGHT_BOLD - where were actually compile constants for setting attributes and weren't recognized by Pango in a font string. (Whereas "Bold" and "Italic" are recognized). Add RenderText test that checks that the width of a bold string > the width of a non-bold string. Add FontList tests for the new functions. BUG=107893 TEST=Run views_examples_exe "Text Styles" examples and try bold and italic styles (this depends on an unreleased CL). Also, new tests in FontListTest and RenderTextTest. Review URL: http://codereview.chromium.org/8963027 TBR=asvitkine@chromium.org Review URL: http://codereview.chromium.org/9147016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116948 0039d316-1c4b-4281-b951-d872f2087c98
* Enable bold and italic text styles in RenderText*.asvitkine@chromium.org2012-01-091-0/+16
| | | | | | | | | | | | | | | | To do this, the following changes were made: Added functions GetStyle() and DeriveFontList(style) to FontList. Changed font list to use strings "Bold" and "Italic" instead of PANGO_STYLE_ITALIC and PANGO_WEIGHT_BOLD - where were actually compile constants for setting attributes and weren't recognized by Pango in a font string. (Whereas "Bold" and "Italic" are recognized). Add RenderText test that checks that the width of a bold string > the width of a non-bold string. Add FontList tests for the new functions. BUG=107893 TEST=Run views_examples_exe "Text Styles" examples and try bold and italic styles (this depends on an unreleased CL). Also, new tests in FontListTest and RenderTextTest. Review URL: http://codereview.chromium.org/8963027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116945 0039d316-1c4b-4281-b951-d872f2087c98
* specify locale-dependent font list for UI on ChromeOS, so that those fonts ↵xji@chromium.org2012-01-041-3/+1
| | | | | | | | | | | | | have higher priority over the fallback fonts Pango picks up. BUG=103860 TEST=build aura, start chromium in 'ar' locale. type in Arabic and check the Arabic text's shapes. remove IDS_UI_FONT_FAMILY_CROS from 'ar' resource file, build aura again, start chromium in 'ar', type in Arabic and the Arabic text's shapes should be different. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114953 Review URL: http://codereview.chromium.org/8770034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116359 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 114953 (breaks cros font sizes, etc.) - specify locale-dependent font ↵msw@chromium.org2011-12-201-0/+2
| | | | | | | | | | | | | | list for UI on ChromeOS, so that those fonts have higher priority over the fallback fonts Pango picks up. BUG=103860 TEST=build aura, start chromium in 'ar' locale. type in Arabic and check the Arabic text's shapes. remove IDS_UI_FONT_FAMILY_CROS from 'ar' resource file, build aura again, start chromium in 'ar', type in Arabic and the Arabic text's shapes should be different. Review URL: http://codereview.chromium.org/8770034 TBR=xji@chromium.org Review URL: http://codereview.chromium.org/9007028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115179 0039d316-1c4b-4281-b951-d872f2087c98
* specify locale-dependent font list for UI on ChromeOS, so that those fonts ↵xji@chromium.org2011-12-191-2/+0
| | | | | | | | | | | have higher priority over the fallback fonts Pango picks up. BUG=103860 TEST=build aura, start chromium in 'ar' locale. type in Arabic and check the Arabic text's shapes. remove IDS_UI_FONT_FAMILY_CROS from 'ar' resource file, build aura again, start chromium in 'ar', type in Arabic and the Arabic text's shapes should be different. Review URL: http://codereview.chromium.org/8770034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114953 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 113956 (revert didn't help) - Revert 113635 (speculative revert for ↵thakis@chromium.org2011-12-101-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug 107104) - Improve RenderTextWin font fallback. Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Review URL: http://codereview.chromium.org/8575020 TBR=asvitkine@chromium.org TBR=thakis@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113960 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 113635 (speculative revert for bug 107104)thakis@chromium.org2011-12-101-117/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Improve RenderTextWin font fallback. Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Review URL: http://codereview.chromium.org/8575020 TBR=asvitkine@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113956 0039d316-1c4b-4281-b951-d872f2087c98
* Improve RenderTextWin font fallback.asvitkine@chromium.org2011-12-081-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Review URL: http://codereview.chromium.org/8575020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113635 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 113606 - Improve RenderTextWin font fallback.sky@chromium.org2011-12-081-117/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=113075 Review URL: http://codereview.chromium.org/8575020 TBR=asvitkine@chromium.org Review URL: http://codereview.chromium.org/8872024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113613 0039d316-1c4b-4281-b951-d872f2087c98
* Improve RenderTextWin font fallback.asvitkine@chromium.org2011-12-081-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=113075 Review URL: http://codereview.chromium.org/8575020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113606 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 113075 (requested by asvitkine) (requested by asvitkine) (requested ↵thakis@chromium.org2011-12-061-99/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by asvitkine) (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) - Improve RenderTextWin font fallback. Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Review URL: http://codereview.chromium.org/8575020 TBR=asvitkine@chromium.org Review URL: http://codereview.chromium.org/8819001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113083 0039d316-1c4b-4281-b951-d872f2087c98
* Improve RenderTextWin font fallback.asvitkine@chromium.org2011-12-061-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Some tests are disabled under XP, see: http://crbug.com/106450 Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Review URL: http://codereview.chromium.org/8575020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113075 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 112983 - Improve RenderTextWin font fallback.avi@chromium.org2011-12-051-99/+0
| | | | | | | | | | | | | Breaks GraphemePositions and EditString_ComplexScript on Win XP. BUG=90426 Review URL: http://codereview.chromium.org/8575020 TBR=asvitkine@chromium.org Review URL: http://codereview.chromium.org/8802011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112994 0039d316-1c4b-4281-b951-d872f2087c98
* Improve RenderTextWin font fallback.asvitkine@chromium.org2011-12-051-0/+99
| | | | | | | | | | | | | | | | | | | | | | | Don't use SCRIPT_UNDEFINED in the case of font fallback, unless font fallback actually fails to return a script that can display the characters. This fixes the problem of some scripts not being properly displayed. This actually makes RenderTextWin properly validate whether a text position accepts a cursor, which caused several tests to fail and revealed some additional issues in RenderTextWin. The CL includes some modifications to address this. Also, fixes some lint warnings. BUG=90426 TEST=Run chrome.exe --use-pure-views and paste some Bengali text into the omnibox. It should show up properly. Review URL: http://codereview.chromium.org/8575020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112983 0039d316-1c4b-4281-b951-d872f2087c98
* Fix style_range_.erase() which caused style range not deleted completely and ↵xji@google.com2011-10-141-0/+100
| | | | | | | | | | dcheck error. BUG=99923 TEST=start chrome with new profile and --no-first-run --use-pure-view. type in http://sites.google.com/a/google.com/ several times until autocomplete kicks in. continue typing while with autocomplete, browser should not crash. Review URL: http://codereview.chromium.org/8252001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105547 0039d316-1c4b-4281-b951-d872f2087c98
* 1. Implement move cursor left/right by word.xji@google.com2011-09-221-0/+165
| | | | | | | | | | | | 2. Fix pango rendering of Arabic joining shapes. In Pango, different font means different runs, and it breaks arabic shaping across run boundaries. Do not reset font attribute if it is the same as default. BUG=90426 TEST=RenderTextTest.MoveLeftRightByWord*. Build chromeos, open it with --use-pure-views, type in تسیک then select the 2nd and 3rd characters, check whether the characters' shapes changes (from joining to not joining). Review URL: http://codereview.chromium.org/7892044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102359 0039d316-1c4b-4281-b951-d872f2087c98
* This is a reapply of xji@google.com2011-09-211-14/+323
| | | | | | | | | | | | | | | | | | | http://src.chromium.org/viewvc/chrome?view=rev&revision=102006 fix know issues in RenderText 1. add tests. 2. change SelectWord() to use BreakIterator, so it works for Chinese and Complex script. 3. DELETE/ReplaceChar delete/replace a whole grapheme. ReplaceTextInternal should only replace one grapheme when there is no selection. 4. pointing to position outside of text returns HOME/END position. 5. based on Chrome Linux omnibox and gedit, given "abc| def", double click should select " " instead of "abc". Change test expectation. BUG=90426 TEST=compile with touchui=1 test omnibox. run views_unittests.NativeTextfieldViewsTest/TextfieldViewsModelTest Review URL: http://codereview.chromium.org/7841056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102160 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 102006 - fix know issues in RenderTextsky@chromium.org2011-09-201-323/+14
| | | | | | | | | | | | | | | | | | 1. add tests. 2. change SelectWord() to use BreakIterator, so it works for Chinese and Complex script. 3. DELETE/ReplaceChar delete/replace a whole grapheme. ReplaceTextInternal should only replace one grapheme when there is no selection. 4. pointing to position outside of text returns HOME/END position. 5. based on Chrome Linux omnibox and gedit, given "abc| def", double click should select " " instead of "abc". Change test expectation. BUG=90426 TEST=compile with touchui=1 test omnibox. run views_unittests.NativeTextfieldViewsTest/TextfieldViewsModelTest Review URL: http://codereview.chromium.org/7841056 TBR=xji@google.com Review URL: http://codereview.chromium.org/7982013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102020 0039d316-1c4b-4281-b951-d872f2087c98
* fix know issues in RenderTextxji@google.com2011-09-201-14/+323
| | | | | | | | | | | | | | | 1. add tests. 2. change SelectWord() to use BreakIterator, so it works for Chinese and Complex script. 3. DELETE/ReplaceChar delete/replace a whole grapheme. ReplaceTextInternal should only replace one grapheme when there is no selection. 4. pointing to position outside of text returns HOME/END position. 5. based on Chrome Linux omnibox and gedit, given "abc| def", double click should select " " instead of "abc". Change test expectation. BUG=90426 TEST=compile with touchui=1 test omnibox. run views_unittests.NativeTextfieldViewsTest/TextfieldViewsModelTest Review URL: http://codereview.chromium.org/7841056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102006 0039d316-1c4b-4281-b951-d872f2087c98
* Use scoped_ptr for RenderTextTest memory management.msw@chromium.org2011-07-271-4/+5
| | | | | | | | | | | Eliminate heapcheck and valgrind suppressions. BUG=90370 TEST=none Review URL: http://codereview.chromium.org/7466043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94257 0039d316-1c4b-4281-b951-d872f2087c98
* Add gfx::RenderText and support code.msw@chromium.org2011-07-251-0/+180
| | | | | | | | | | | | RenderText is NativeTextFieldViews' interface to platform-specific text rendering engines. This change doesn't hook in any new Pango or Uniscribe functionality, it will just setup the necessary API. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=93840 Review URL: http://codereview.chromium.org/7265011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93855 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 93840 - Add gfx::RenderText and support code.msw@chromium.org2011-07-251-180/+0
| | | | | | | | | | | | | RenderText is NativeTextFieldViews' interface to platform-specific text rendering engines. This change doesn't hook in any new Pango or Uniscribe functionality, it will just setup the necessary API. Review URL: http://codereview.chromium.org/7265011 TBR=msw@chromium.org Review URL: http://codereview.chromium.org/7492041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93842 0039d316-1c4b-4281-b951-d872f2087c98
* Add gfx::RenderText and support code.msw@chromium.org2011-07-251-0/+180
RenderText is NativeTextFieldViews' interface to platform-specific text rendering engines. This change doesn't hook in any new Pango or Uniscribe functionality, it will just setup the necessary API. Review URL: http://codereview.chromium.org/7265011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93840 0039d316-1c4b-4281-b951-d872f2087c98