OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/render_text_win.h" | 5 #include "ui/gfx/render_text_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/break_iterator.h" | 9 #include "base/i18n/break_iterator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 | 110 |
111 } // namespace internal | 111 } // namespace internal |
112 | 112 |
113 RenderTextWin::RenderTextWin() | 113 RenderTextWin::RenderTextWin() |
114 : RenderText(), | 114 : RenderText(), |
115 script_control_(), | 115 script_control_(), |
116 script_state_(), | 116 script_state_(), |
117 string_width_(0), | 117 string_width_(0), |
118 needs_layout_(false) { | 118 needs_layout_(false) { |
119 // Omitting default constructors for script_* would leave POD uninitialized. | 119 // Omitting default constructors for script_* would leave POD uninitialized. |
120 HRESULT hr = 0; | 120 HRESULT hr = S_OK; |
121 | 121 |
122 // TODO(msw): Call ScriptRecordDigitSubstitution on WM_SETTINGCHANGE message. | 122 // TODO(msw): Call ScriptRecordDigitSubstitution on WM_SETTINGCHANGE message. |
123 // TODO(msw): Use Chrome/profile locale/language settings? | 123 // TODO(msw): Use Chrome/profile locale/language settings? |
124 hr = ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &digit_substitute_); | 124 hr = ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &digit_substitute_); |
125 DCHECK(SUCCEEDED(hr)); | 125 if (FAILED(hr)) { |
126 LOG(WARNING) << "ScriptRecordDigitSubstitution failed " << hr | |
vandebo (ex-Chrome)
2012/02/03 18:36:45
Is it because of the sandbox? Does that mean this
| |
127 << ", possibly because of sandbox."; | |
128 } | |
126 | 129 |
127 hr = ScriptApplyDigitSubstitution(&digit_substitute_, | 130 if (SUCCEEDED(hr)) { |
128 &script_control_, | 131 hr = ScriptApplyDigitSubstitution(&digit_substitute_, |
vandebo (ex-Chrome)
2012/02/03 18:36:45
Why is is ok to not so this in the sandbox?
| |
129 &script_state_); | 132 &script_control_, |
130 DCHECK(SUCCEEDED(hr)); | 133 &script_state_); |
131 script_control_.fMergeNeutralItems = true; | 134 DCHECK(SUCCEEDED(hr)); |
135 script_control_.fMergeNeutralItems = true; | |
136 } | |
132 | 137 |
133 MoveCursorTo(EdgeSelectionModel(CURSOR_LEFT)); | 138 MoveCursorTo(EdgeSelectionModel(CURSOR_LEFT)); |
134 } | 139 } |
135 | 140 |
136 RenderTextWin::~RenderTextWin() { | 141 RenderTextWin::~RenderTextWin() { |
137 STLDeleteContainerPointers(runs_.begin(), runs_.end()); | 142 STLDeleteContainerPointers(runs_.begin(), runs_.end()); |
138 } | 143 } |
139 | 144 |
140 base::i18n::TextDirection RenderTextWin::GetTextDirection() { | 145 base::i18n::TextDirection RenderTextWin::GetTextDirection() { |
141 // TODO(benrg): Code moved from RenderText::GetTextDirection. Needs to be | 146 // TODO(benrg): Code moved from RenderText::GetTextDirection. Needs to be |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
735 internal::TextRun* run) { | 740 internal::TextRun* run) { |
736 size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD); | 741 size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD); |
737 return SelectionModel(caret, caret, SelectionModel::LEADING); | 742 return SelectionModel(caret, caret, SelectionModel::LEADING); |
738 } | 743 } |
739 | 744 |
740 RenderText* RenderText::CreateRenderText() { | 745 RenderText* RenderText::CreateRenderText() { |
741 return new RenderTextWin; | 746 return new RenderTextWin; |
742 } | 747 } |
743 | 748 |
744 } // namespace gfx | 749 } // namespace gfx |
OLD | NEW |