| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_harfbuzz.h" | 5 #include "ui/gfx/render_text_harfbuzz.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/i18n/bidi_line_iterator.h" | 10 #include "base/i18n/bidi_line_iterator.h" |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 // Odd BiDi embedding levels correspond to RTL runs. | 1308 // Odd BiDi embedding levels correspond to RTL runs. |
| 1309 run->is_rtl = (run->level % 2) == 1; | 1309 run->is_rtl = (run->level % 2) == 1; |
| 1310 // Find the length and script of this script run. | 1310 // Find the length and script of this script run. |
| 1311 script_item_break = ScriptInterval(text, run_break, | 1311 script_item_break = ScriptInterval(text, run_break, |
| 1312 script_item_break - run_break, &run->script) + run_break; | 1312 script_item_break - run_break, &run->script) + run_break; |
| 1313 | 1313 |
| 1314 // Find the next break and advance the iterators as needed. | 1314 // Find the next break and advance the iterators as needed. |
| 1315 const size_t new_run_break = std::min( | 1315 const size_t new_run_break = std::min( |
| 1316 static_cast<size_t>(script_item_break), | 1316 static_cast<size_t>(script_item_break), |
| 1317 TextIndexToGivenTextIndex(text, style.GetRange().end())); | 1317 TextIndexToGivenTextIndex(text, style.GetRange().end())); |
| 1318 CHECK_GT(new_run_break, run_break) | 1318 // It must proceed! |text| |run_break| |
| 1319 << "It must proceed! " << text << " " << run_break; | 1319 CHECK_GT(new_run_break, run_break); |
| 1320 run_break = new_run_break; | 1320 run_break = new_run_break; |
| 1321 | 1321 |
| 1322 // Break runs at certain characters that need to be rendered separately to | 1322 // Break runs at certain characters that need to be rendered separately to |
| 1323 // prevent either an unusual character from forcing a fallback font on the | 1323 // prevent either an unusual character from forcing a fallback font on the |
| 1324 // entire run, or brackets from being affected by a fallback font. | 1324 // entire run, or brackets from being affected by a fallback font. |
| 1325 // http://crbug.com/278913, http://crbug.com/396776 | 1325 // http://crbug.com/278913, http://crbug.com/396776 |
| 1326 if (run_break > run->range.start()) | 1326 if (run_break > run->range.start()) |
| 1327 run_break = FindRunBreakingCharacter(text, run->range.start(), run_break); | 1327 run_break = FindRunBreakingCharacter(text, run->range.start(), run_break); |
| 1328 | 1328 |
| 1329 DCHECK(IsValidCodePointIndex(text, run_break)); | 1329 DCHECK(IsValidCodePointIndex(text, run_break)); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 | 1626 |
| 1627 attribute.strike = run.strike; | 1627 attribute.strike = run.strike; |
| 1628 attribute.diagonal_strike = run.diagonal_strike; | 1628 attribute.diagonal_strike = run.diagonal_strike; |
| 1629 decorated_text->attributes.push_back(attribute); | 1629 decorated_text->attributes.push_back(attribute); |
| 1630 } | 1630 } |
| 1631 } | 1631 } |
| 1632 return true; | 1632 return true; |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 } // namespace gfx | 1635 } // namespace gfx |
| OLD | NEW |