Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: third_party/WebKit/Source/platform/text/TextBreakIterator.cpp

Issue 2865903002: [LayoutNG] Inline margin/border/padding, inter-item breaking, and tests (Closed)
Patch Set: TestExpectations Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
ikilpatrick 2017/05/30 16:05:26 Can just be IsBreakable(offset) ?
kojii 2017/05/30 17:56:18 I need to return next_break (this is reference) he
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698