OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
6 * Copyright (C) 2011 Google Inc. All rights reserved. | 6 * Copyright (C) 2011 Google Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 int LazyLineBreakIterator::NextBreakablePositionKeepAll(int pos) const { | 385 int LazyLineBreakIterator::NextBreakablePositionKeepAll(int pos) const { |
386 if (string_.Is8Bit()) | 386 if (string_.Is8Bit()) |
387 return NextBreakablePosition<LChar, LineBreakType::kNormal>( | 387 return NextBreakablePosition<LChar, LineBreakType::kNormal>( |
388 *this, string_.Characters8(), string_.length(), pos); | 388 *this, string_.Characters8(), string_.length(), pos); |
389 return NextBreakablePositionKeepAllInternal(*this, string_.Characters16(), | 389 return NextBreakablePositionKeepAllInternal(*this, string_.Characters16(), |
390 string_.length(), pos); | 390 string_.length(), pos); |
391 } | 391 } |
392 | 392 |
393 unsigned LazyLineBreakIterator::NextBreakOpportunity(unsigned offset) const { | 393 unsigned LazyLineBreakIterator::NextBreakOpportunity(unsigned offset) const { |
394 int next_break = 0; | 394 int next_break = -1; |
395 IsBreakable(offset, next_break); | 395 IsBreakable(offset, next_break); |
396 return next_break; | 396 return next_break; |
397 } | 397 } |
398 | 398 |
399 unsigned LazyLineBreakIterator::PreviousBreakOpportunity(unsigned offset, | 399 unsigned LazyLineBreakIterator::PreviousBreakOpportunity(unsigned offset, |
400 unsigned min) const { | 400 unsigned min) const { |
401 unsigned pos = std::min(offset, string_.length()); | 401 unsigned pos = std::min(offset, string_.length()); |
402 for (; pos > min; pos--) { | 402 for (; pos > min; pos--) { |
403 int next_break = 0; | 403 if (IsBreakable(pos)) |
404 if (IsBreakable(pos, next_break)) | |
405 return pos; | 404 return pos; |
406 } | 405 } |
407 return min; | 406 return min; |
408 } | 407 } |
409 | 408 |
410 } // namespace blink | 409 } // namespace blink |
OLD | NEW |