summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text.h
Commit message (Collapse)AuthorAgeFilesLines
* Re-land: Use a common font baseline in RenderText classes.asvitkine@chromium.org2012-04-041-3/+4
| | | | | | | | | | | | | | | 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-4/+3
| | | | | | | | | | | | | | | | | 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
* Use a common font baseline in RenderText classes.asvitkine@chromium.org2012-04-031-3/+4
| | | | | | | | | | | | | | 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
* Calculate height from all runs' fonts in RenderTextWin::GetStringSize().asvitkine@chromium.org2012-03-291-1/+2
| | | | | | | | | | | 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
* Change RenderTextWin to use SetFontFamilyWithStyle().asvitkine@chromium.org2012-03-271-2/+0
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/9809020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129091 0039d316-1c4b-4281-b951-d872f2087c98
* Add a SkiaTextRenderer::SetFontFamilyWithStylexiyuan@chromium.org2012-03-241-0/+2
| | | | | | | | | | | RenderTextLinux::DrawVisualText use it to stick with one font familty and avoid bad glyph index problem; BUG=119680 TEST=Verify fix for 119680 and other text should look the same as before. Review URL: https://chromiumcodereview.appspot.com/9808098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128774 0039d316-1c4b-4281-b951-d872f2087c98
* Rename UpdateLayout() to ResetLayout() which is more accurate.xji@chromium.org2012-03-131-3/+2
| | | | | | Review URL: http://codereview.chromium.org/9691002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126460 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify handling of BiDi cursor movementbenrg@chromium.org2012-03-131-52/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+12
| | | | | | | | | | | | | | | | | | | | 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
* views: Add Textfield::SetCursorColor().derat@chromium.org2012-02-291-0/+6
| | | | | | | | | | | | | | | | | This adds a method for setting a text field's cursor to a custom color. The value is plumbed through to gfx::RenderText. I'm leaving custom colors unimplemented on Windows and GTK for now; we just need this for Aura. BUG=116099 TEST=manual: applied xiyuan's applist patch, set the search field's cursor to white, and checked that the omnibox still has a black cursor Review URL: http://codereview.chromium.org/9522011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124156 0039d316-1c4b-4281-b951-d872f2087c98
* Disable subpixel rendering for transparent textfields.derat@chromium.org2012-02-281-0/+8
| | | | | | | | | | | | | | This updates gfx::RenderText to disable subpixel rendering when we're using it to draw into a views::Textfield with a non-opaque background. BUG=115198 TEST=manual: applied in-progress aura applist search patch and checked that we don't use subpixel rendering for it (but we _do_ still use it for the omnibox) Review URL: http://codereview.chromium.org/9480018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124033 0039d316-1c4b-4281-b951-d872f2087c98
* Respect the system ClearType setting in RenderTextWin.asvitkine@chromium.org2012-02-171-0/+1
| | | | | | | | | BUG=113184, 105550 TEST=Build Chrome Windows with gyp flag use_canvas_skia_skia=1. Open Chrome and observe text rendering in the tab strip, bookmarks bar, etc. Change Windows ClearType settings while Chrome is running. Text rendering should be updated appropriately. Review URL: http://codereview.chromium.org/9370026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122514 0039d316-1c4b-4281-b951-d872f2087c98
* Add diagonal strike support in RenderTextoshima@chromium.org2012-01-271-1/+3
| | | | | | | | | BUG=111125 TEST=manual Review URL: https://chromiumcodereview.appspot.com/9234052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119478 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for horizontal text alignment to RenderText.asvitkine@chromium.org2012-01-241-7/+34
| | | | | | | | | | | Also adds a |cursor_enabled| setting to RenderText to control whether the cursor bounds should be added to the string width for the purposes of layout and gating the |display_offset_| behavior. BUG=110595 TEST=Moving cursor outside of omnibox bounds under Aura in both LTR and RTL mode - view should pan and follow the cursor. Resizing the window when there is a pan offset, which should consume any new empty space. Also programmatically setting the new alignment modes via some unreleased code and inspecting the results. Review URL: http://codereview.chromium.org/9252021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118856 0039d316-1c4b-4281-b951-d872f2087c98
* Aura: apply UI font list to cros.xji@chromium.org2012-01-241-0/+4
| | | | | | | | | | | | | | | | | | - 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-43/+57
| | | | | | | | | | | | | | | | | | | | * 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
* Fix cursor in replacement mode is not drawn correctly.xji@chromium.org2012-01-181-1/+1
| | | | | | | | | | | | | 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
* Add text fading API to RenderText.asvitkine@chromium.org2012-01-171-5/+24
| | | | | | | | | | | This will be used once I change CanvasSkia's text drawing functions to go through RenderText. BUG=110200 TEST=Manual, using some unreleased code to use this. Review URL: http://codereview.chromium.org/8894006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117930 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/+1
| | | | | | | | | | | | | | 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-6/+3
| | | | | | | | | | | | | | | | 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-3/+6
| | | | | | | | | | | | | | | | | | | 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-6/+3
| | | | | | | | | | | | | | | | 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-6/+18
| | | | | | | | | | | | | 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
* [Coverity] More pass by val -> pass by const ref.dbeam@chromium.org2011-12-291-1/+1
| | | | | | | | | CID=101510 R=groby@chromium.org,msw@chromium.org,sky@chromium.org Review URL: http://codereview.chromium.org/8999004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115951 0039d316-1c4b-4281-b951-d872f2087c98
* Coverity: Fixing pass by value bugsdpapad@chromium.org2011-12-201-1/+1
| | | | | | | | | | | CID= 101435, 101591, 101592, 101512, 100534 BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/8965046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115215 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 114953 (breaks cros font sizes, etc.) - specify locale-dependent font ↵msw@chromium.org2011-12-201-17/+5
| | | | | | | | | | | | | | 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-5/+17
| | | | | | | | | | | 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
* Optimize setting the font when drawing in RenderTextLinux.asvitkine@chromium.org2011-12-151-0/+2
| | | | | | | | | | | | | | | Avoid creating a temporary |gfx::Font| just to get its name and size to pass it to Skia. Note: There's room for further optimizations here, such as caching, which I plan to look at in a future CL. BUG=107394 TEST=Run aura and check that omnibox still looks fine. Run about:tracing and check that time used by this code is significantly decreased. Review URL: http://codereview.chromium.org/8910004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114541 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 113956 (revert didn't help) - Revert 113635 (speculative revert for ↵thakis@chromium.org2011-12-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+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
* Draw text via Skia in RenderTextLinux.asvitkine@chromium.org2011-12-091-3/+36
| | | | | | | | | | | | | | | Refactors some common Skia drawing code into RenderText internal class SkiaTextRenderer. Rewrite RenderTextLinux::DrawVisualText() to use SkiaTextRenderer and refactor RenderTextWin::DrawVisualText() to also use SkiaTextRenderer, to re-use code. BUG=103648 TEST=Run Linux views_examples_exe --use-pure-views. In the textfield example tab, the text field should draw its text correctly. Review URL: http://codereview.chromium.org/8725002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113706 0039d316-1c4b-4281-b951-d872f2087c98
* Improve RenderTextWin font fallback.asvitkine@chromium.org2011-12-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+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/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+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/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+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/+8
| | | | | | | | | | | | | | | | | | | | | | | 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
* Separate selection highlight from pango layout, highlight selection using skia.xji@chromium.org2011-11-301-15/+24
| | | | | | | | | | | | | Cache substring bounds to avoid unnecessary g_free. Consolidate drawing functions with RenderTextWin. Remove UpdateLayout() from RenderText::SetSelectionModel(). BUG=103647 TEST=TextfieldViewModelTest; Manual test selection highlight on bidi text. (Do not really know how to test "fi" ligature part. But since the selection highlight is not done by using pango attribute, I would assume that solves the problem). Review URL: http://codereview.chromium.org/8536047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112188 0039d316-1c4b-4281-b951-d872f2087c98
* Update layout when selection is updated.oshima@chromium.org2011-11-091-6/+10
| | | | | | | | | | BUG=103452 TEST=none Review URL: http://codereview.chromium.org/8502032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109279 0039d316-1c4b-4281-b951-d872f2087c98
* Updating textfield hardcoded value. This is temporary until we use the theme ↵saintlou@chromium.org2011-10-261-1/+1
| | | | | | | | | | | | (see crbug.com/100229). BUG=100229 TEST=none Review URL: http://codereview.chromium.org/8392024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107305 0039d316-1c4b-4281-b951-d872f2087c98
* 1. change the setters of gfx::SelectionModel to be private. Set one alone ↵xji@google.com2011-10-121-4/+7
| | | | | | | | | | | | | | might make SelectionModel into un-stable state, which should not be allowed. 2. Removing SelectionModel(size_t, size_t) constructor. Introduce RenderText::SelectRange(const ui::Range&) to handle range. 3. revert removal of SelectRange/GetSelectedRange in r103188. BUG=90426 TEST=view_unittests. Review URL: http://codereview.chromium.org/8044004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105138 0039d316-1c4b-4281-b951-d872f2087c98
* Fix selection handler position in touch.xji@google.com2011-10-031-4/+4
| | | | | | | | BUG=90426 TEST=compile with touch, try selection in bidi text. run views_unittests --gtest_filter=TouchSelectionControllerImplTest.* Review URL: http://codereview.chromium.org/8095002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103755 0039d316-1c4b-4281-b951-d872f2087c98
* Fix omnibox state for each tab.xji@google.com2011-09-281-82/+2
| | | | | | | | | | ui::Range only saves cursor's logical positions. In order to restore cursor's visual position, need to save and restore gfx::SelectionModel. BUG=90426 TEST=start chromeos --use-pure-views, type in "abcABC" in omnibox, where "ABC" stands for Hebrew characters. Mouse click on right half of 'c' so that cursor is placed at "abc|CBA". Create a new tab. Click to restore the previous tab page, cursor should be displayed the same as before "abc|CBA", not "abcCBA|". Review URL: http://codereview.chromium.org/7973007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103188 0039d316-1c4b-4281-b951-d872f2087c98
* This is a reapply of xji@google.com2011-09-211-3/+16
| | | | | | | | | | | | | | | | | | | 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-16/+3
| | | | | | | | | | | | | | | | | | 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-3/+16
| | | | | | | | | | | | | | | 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
* Implement Pango RenderText for Linux.xji@google.com2011-09-071-5/+13
| | | | | | | | | | Follow the I18N recommendations for BiDi text editing. BUG=90426 TEST=--use-pure-views text editing Review URL: http://codereview.chromium.org/7511029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99987 0039d316-1c4b-4281-b951-d872f2087c98
* Implement Uniscribe RenderText for Windows.msw@chromium.org2011-08-301-18/+34
| | | | | | | | | | | | | | | | | | | | Follow the I18N recommendations for BiDi text editing. Visual cursor movement and logical selection over BiDi text. Cleanup some common RenderText code and interfaces. Fixup TextfieldExample for views_examples. Known issues: Word breaking is not well implemented. Font sizes and vertical alignments are slightly off. Text styles break runs (colors can affect glyph shaping). Composition/selection ranges aren't stylized. BUG=90426 TEST=--use-pure-views text editing Review URL: http://codereview.chromium.org/7458014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98785 0039d316-1c4b-4281-b951-d872f2087c98
* Remove PREVIOUS_GRAPHEME_TRAILING. xji@google.com2011-08-161-4/+2
| | | | | | | | | | | | Remove const from GetIndexOfPreviousGrapheme() so the override function could update local data. Construct SelectionModel correctly in unittest. BUG=90426 TEST=--use-pure-view. Review URL: http://codereview.chromium.org/7607018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97029 0039d316-1c4b-4281-b951-d872f2087c98