| 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/i18n/char_iterator.h" | 10 #include "base/i18n/char_iterator.h" |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 for (size_t i = 0; i < runs_.size(); ++i) { | 1002 for (size_t i = 0; i < runs_.size(); ++i) { |
| 1003 internal::TextRun* run = runs_[i]; | 1003 internal::TextRun* run = runs_[i]; |
| 1004 LayoutTextRun(run); | 1004 LayoutTextRun(run); |
| 1005 | 1005 |
| 1006 ascent = std::max(ascent, run->font.GetBaseline()); | 1006 ascent = std::max(ascent, run->font.GetBaseline()); |
| 1007 descent = std::max(descent, | 1007 descent = std::max(descent, |
| 1008 run->font.GetHeight() - run->font.GetBaseline()); | 1008 run->font.GetHeight() - run->font.GetBaseline()); |
| 1009 | 1009 |
| 1010 if (run->glyph_count > 0) { | 1010 if (run->glyph_count > 0) { |
| 1011 run->advance_widths.reset(new int[run->glyph_count]); | 1011 run->advance_widths.reset(new int[run->glyph_count]); |
| 1012 // TODO(asvitkine): Temporary instrumentation to debug a double-free | |
| 1013 // crash where we're seeing these two being equal inexplicably. Hitting | |
| 1014 // this implies that the malloc book-keeping is corrupt and it returned | |
| 1015 // the same pointer for two different allocs, which we can debug further. | |
| 1016 // http://crbug.com/348103 | |
| 1017 CHECK_NE(static_cast<void*>(run->logical_clusters.get()), | |
| 1018 static_cast<void*>(run->advance_widths.get())); | |
| 1019 run->offsets.reset(new GOFFSET[run->glyph_count]); | 1012 run->offsets.reset(new GOFFSET[run->glyph_count]); |
| 1020 hr = ScriptPlace(cached_hdc_, | 1013 hr = ScriptPlace(cached_hdc_, |
| 1021 &run->script_cache, | 1014 &run->script_cache, |
| 1022 run->glyphs.get(), | 1015 run->glyphs.get(), |
| 1023 run->glyph_count, | 1016 run->glyph_count, |
| 1024 run->visible_attributes.get(), | 1017 run->visible_attributes.get(), |
| 1025 &(run->script_analysis), | 1018 &(run->script_analysis), |
| 1026 run->advance_widths.get(), | 1019 run->advance_widths.get(), |
| 1027 run->offsets.get(), | 1020 run->offsets.get(), |
| 1028 &(run->abc_widths)); | 1021 &(run->abc_widths)); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 size_t position = LayoutIndexToTextIndex(run->range.end()); | 1273 size_t position = LayoutIndexToTextIndex(run->range.end()); |
| 1281 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); | 1274 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); |
| 1282 return SelectionModel(position, CURSOR_FORWARD); | 1275 return SelectionModel(position, CURSOR_FORWARD); |
| 1283 } | 1276 } |
| 1284 | 1277 |
| 1285 RenderText* RenderText::CreateInstance() { | 1278 RenderText* RenderText::CreateInstance() { |
| 1286 return new RenderTextWin; | 1279 return new RenderTextWin; |
| 1287 } | 1280 } |
| 1288 | 1281 |
| 1289 } // namespace gfx | 1282 } // namespace gfx |
| OLD | NEW |