summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text.h
Commit message (Collapse)AuthorAgeFilesLines
* Add Vector2d classes that represent offsets, instead of using Point.danakj@chromium.org2012-10-311-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously Point served two purposes, to be a position in 2d space, and also an offset from the origin. This introduces a Vector2d class to represent an offset, allowing typesafety checks for geometric operations. The following are now the case: Point +/- Vector = Point - A point plus/minus an offset gives you a point at a position offset by the vector. Vector +/- Vector = Vector - Two offsets can be added together to make a new offset. Point - Point = Vector - Subtracting one point from another gives you the offset between the two points. We add some new methods to perform these operations: Rect::OffsetFromOrigin() gives the offset between the position of the rect and the origin. Point::OffsetFromOrigin() gives the offset between the point and the origin. PointAtOffsetFromOrigin(Vector2d) converts a Vector2d to a Point at the given offset away from the origin. Rect::Offset(), Point::Add(), and Point::Subtract() now receive a Vector2d instead of a point. BUG=147395 R=sky Review URL: https://codereview.chromium.org/11269022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165198 0039d316-1c4b-4281-b951-d872f2087c98
* Support obscured RenderTextWin passwords.msw@chromium.org2012-09-281-7/+17
| | | | | | | | | | | | | | | | | | | | | Use asterisks instead of actual text when obscured on Win. Use GetLayoutText() and index conversion in RenderTextWin. Add UpdateObscuredText(), called on Set[Text|Obscured](). Shortcut word breaking when obscured like RenderTextLinux. Expand upon tests and enable on Windows; refactoring; etc. Fix and simplify TextfieldViewsModelTest.Clipboard. ( It incorrectly expected obscured text to support word-break cursor movement ) ( It was disabled on Linux Aura for long-fixed http://crbug.com/97845 ) BUG=97845,138222 TEST=Views examples and ftp auth --enable-views-textfield password textfields work, etc. R=xji@chromium.org,asvitkine@chromium.org TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10821079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159335 0039d316-1c4b-4281-b951-d872f2087c98
* Add RenderText::SetFont() function to simplify some call sites.asvitkine@chromium.org2012-09-181-0/+1
| | | | | | | | | BUG=none TEST=existing unit tests Review URL: https://chromiumcodereview.appspot.com/10933129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157365 0039d316-1c4b-4281-b951-d872f2087c98
* roll skia to 4991reed@google.com2012-08-071-0/+1
| | | | | | Review URL: https://chromiumcodereview.appspot.com/10834210 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150439 0039d316-1c4b-4281-b951-d872f2087c98
* Add RenderText DirectionalityMode enum and support; etc.msw@chromium.org2012-08-011-19/+11
| | | | | | | | | | | | | | | | | | | 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
* Add and specify Views::Textfield::SelectAll |reversed| flag, etc.msw@chromium.org2012-07-131-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove the rest of #pragma once in one big CL.ajwong@chromium.org2012-07-111-1/+0
| | | | | | | | | For context see this thread: https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/chromium-dev/RMcVNGjB4II TBR=thakis,pkasting,jam git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146163 0039d316-1c4b-4281-b951-d872f2087c98
* Rename RenderText::CreateRenderText() to RenderText::CreateInstance().asvitkine@chromium.org2012-07-091-1/+1
| | | | | | | | | | | 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
* RenderText: Expose a flag to disable clipping to workaround a Skia bug in ↵asvitkine@chromium.org2012-06-221-0/+9
| | | | | | | | | | | | | the PDF path. (See bug for context.) BUG=133548 TEST=Verify that the clipping problem is solved with (currently unlanded) RenderTextMac code in print preview. Review URL: https://chromiumcodereview.appspot.com/10638015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143726 0039d316-1c4b-4281-b951-d872f2087c98
* Expose GetBaseline() method on RenderText.asvitkine@chromium.org2012-06-221-1/+5
| | | | | | | | | | | | | 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
* Use pango underline metrics in RenderTextLinux.asvitkine@chromium.org2012-06-121-1/+7
| | | | | | | | | | | Also, changes type of SkiaTextRenderer::SetTextSize() to SkScalar to match the underlying Skia type, which is needed for future RenderTextMac implementation. BUG=126506, 125664, 105550 TEST=Eyeball underlined text in views_examples' text style example. Review URL: https://chromiumcodereview.appspot.com/10520017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141772 0039d316-1c4b-4281-b951-d872f2087c98
* Update std::vector<ShadowValue> to ShadowValues.xiyuan@chromium.org2012-05-291-3/+3
| | | | | | | | | | | This is a follow-up clean up for http://crrev.com/139162. BUG=none. TEST=none. Review URL: https://chromiumcodereview.appspot.com/10453057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139412 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite RenderText::IndexOfAdjacentGrapheme() in terms of ↵asvitkine@chromium.org2012-05-161-2/+2
| | | | | | | | | | | | | | | | | 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
* Remove RenderText's dependency on NativeTheme.asvitkine@chromium.org2012-05-141-0/+26
| | | | | | | | | | | | This is a first step towards implementing RenderTextMac. There's no NativeTheme class in the Mac build. BUG=125664 TEST=No change in visual appearance. Review URL: https://chromiumcodereview.appspot.com/10387029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136973 0039d316-1c4b-4281-b951-d872f2087c98
* Add a RenderText test that checks that matching parentheses use the same font.asvitkine@chromium.org2012-05-121-0/+8
| | | | | | | | | | | | 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
* Coverity: Fix an uninitialized member variable.jhawkins@chromium.org2012-05-101-0/+5
| | | | | | | | | | | | | | | | Also fix a ton of style issues while I'm here. CID_COUNT=1 CID=103945 BUG=none TEST=none R=groby TBR=msw Review URL: https://chromiumcodereview.appspot.com/10387049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136231 0039d316-1c4b-4281-b951-d872f2087c98
* Fix ugly non-ClearType text rendering in tab strip.asvitkine@chromium.org2012-05-021-1/+4
| | | | | | | | | | | | | | | | | | Draw the text to a layer and restore it faded by drawing a rect in kDstIn_Mode mode. Workaround for: http://code.google.com/p/skia/issues/detail?id=590 BUG=122743, 105550 TEST=Turn off ClearType in Windows setting. Open Chrome to a tab where its title doesn't fit in the tab and must get faded. Observe that the title text looks okay. Review URL: http://codereview.chromium.org/10266017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134922 0039d316-1c4b-4281-b951-d872f2087c98
* ash: Better and faster text shadows.xiyuan@chromium.org2012-04-111-0/+13
| | | | | | | | | | | | | | | - Add a DrawStringWithShadows that draws text with shadows to canvas skia and RenderText; - Use DrawStringWithShadows in DropShadowLabel for better and faster text shadows; BUG=121694 TEST=Verify fix for issue 121694. Review URL: http://codereview.chromium.org/10008027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131696 0039d316-1c4b-4281-b951-d872f2087c98
* 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