OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r
eserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r
eserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 { | 444 { |
445 bool inEndOfLine = m_current == end || m_current.atEnd() || (inIsolate() &&
m_current.object() == end.object()); | 445 bool inEndOfLine = m_current == end || m_current.atEnd() || (inIsolate() &&
m_current.object() == end.object()); |
446 if (inIsolate() && inEndOfLine) { | 446 if (inIsolate() && inEndOfLine) { |
447 m_current.moveTo(m_current.object(), end.offset(), m_current.nextBreakab
lePosition()); | 447 m_current.moveTo(m_current.object(), end.offset(), m_current.nextBreakab
lePosition()); |
448 m_last = m_current; | 448 m_last = m_current; |
449 updateStatusLastFromCurrentDirection(WTF::Unicode::OtherNeutral); | 449 updateStatusLastFromCurrentDirection(WTF::Unicode::OtherNeutral); |
450 } | 450 } |
451 return inEndOfLine; | 451 return inEndOfLine; |
452 } | 452 } |
453 | 453 |
| 454 static inline bool isCollapsibleSpace(UChar character, RenderText* renderer) |
| 455 { |
| 456 if (character == ' ' || character == '\t' || character == softHyphen) |
| 457 return true; |
| 458 if (character == '\n') |
| 459 return !renderer->style()->preserveNewline(); |
| 460 return false; |
| 461 } |
| 462 |
| 463 template <typename CharacterType> |
| 464 static inline int findFirstTrailingSpace(RenderText* lastText, const CharacterTy
pe* characters, int start, int stop) |
| 465 { |
| 466 int firstSpace = stop; |
| 467 while (firstSpace > start) { |
| 468 UChar current = characters[firstSpace - 1]; |
| 469 if (!isCollapsibleSpace(current, lastText)) |
| 470 break; |
| 471 firstSpace--; |
| 472 } |
| 473 |
| 474 return firstSpace; |
| 475 } |
| 476 |
| 477 template <> |
| 478 inline int InlineBidiResolver::findFirstTrailingSpaceAtRun(BidiRun* run) |
| 479 { |
| 480 ASSERT(run); |
| 481 RenderObject* lastObject = run->m_object; |
| 482 if (!lastObject->isText()) |
| 483 return run->m_stop; |
| 484 |
| 485 RenderText* lastText = toRenderText(lastObject); |
| 486 int firstSpace; |
| 487 if (lastText->is8Bit()) |
| 488 firstSpace = findFirstTrailingSpace(lastText, lastText->characters8(), r
un->start(), run->stop()); |
| 489 else |
| 490 firstSpace = findFirstTrailingSpace(lastText, lastText->characters16(),
run->start(), run->stop()); |
| 491 return firstSpace; |
| 492 } |
| 493 |
| 494 template <> |
| 495 inline BidiRun* InlineBidiResolver::addTrailingRun(int start, int stop, BidiRun*
run, BidiContext* context, TextDirection direction) |
| 496 { |
| 497 BidiRun* newTrailingRun = new BidiRun(start, stop, run->m_object, context, W
TF::Unicode::OtherNeutral); |
| 498 if (direction == LTR) |
| 499 m_runs.addRun(newTrailingRun); |
| 500 else |
| 501 m_runs.prependRun(newTrailingRun); |
| 502 |
| 503 return newTrailingRun; |
| 504 } |
| 505 |
| 506 template <> |
| 507 inline bool InlineBidiResolver::needsToApplyL1Rule() |
| 508 { |
| 509 if (!m_runs.logicallyLastRun()->m_object->style()->breakOnlyAfterWhiteSpace(
) |
| 510 || !m_runs.logicallyLastRun()->m_object->style()->autoWrap()) |
| 511 return false; |
| 512 return true; |
| 513 } |
| 514 |
454 static inline bool isIsolatedInline(RenderObject* object) | 515 static inline bool isIsolatedInline(RenderObject* object) |
455 { | 516 { |
456 ASSERT(object); | 517 ASSERT(object); |
457 return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()
); | 518 return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()
); |
458 } | 519 } |
459 | 520 |
460 static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject* obj
ect, RenderObject* root) | 521 static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject* obj
ect, RenderObject* root) |
461 { | 522 { |
462 ASSERT(object); | 523 ASSERT(object); |
463 RenderObject* containingIsolateObj = 0; | 524 RenderObject* containingIsolateObj = 0; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 m_sor = m_eor; | 718 m_sor = m_eor; |
658 } | 719 } |
659 | 720 |
660 m_direction = WTF::Unicode::OtherNeutral; | 721 m_direction = WTF::Unicode::OtherNeutral; |
661 m_status.eor = WTF::Unicode::OtherNeutral; | 722 m_status.eor = WTF::Unicode::OtherNeutral; |
662 } | 723 } |
663 | 724 |
664 } | 725 } |
665 | 726 |
666 #endif // InlineIterator_h | 727 #endif // InlineIterator_h |
OLD | NEW |