| 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 Apple Inc. All right reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc. All right reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 template <class Iterator, class Run> | 541 template <class Iterator, class Run> |
| 542 TextDirection BidiResolver<Iterator, Run>::determineParagraphDirectionality(bool
* hasStrongDirectionality) | 542 TextDirection BidiResolver<Iterator, Run>::determineParagraphDirectionality(bool
* hasStrongDirectionality) |
| 543 { | 543 { |
| 544 while (!m_current.atEnd()) { | 544 while (!m_current.atEnd()) { |
| 545 if (inIsolate()) { | 545 if (inIsolate()) { |
| 546 increment(); | 546 increment(); |
| 547 continue; | 547 continue; |
| 548 } | 548 } |
| 549 if (m_current.atParagraphSeparator()) | 549 if (m_current.atParagraphSeparator()) |
| 550 break; | 550 break; |
| 551 if (UChar current = m_current.current()) { | 551 UChar32 current = m_current.current(); |
| 552 WTF::Unicode::Direction charDirection = WTF::Unicode::direction(curr
ent); | 552 if (UNLIKELY(U16_IS_SURROGATE(current))) { |
| 553 if (charDirection == WTF::Unicode::LeftToRight) { | 553 increment(); |
| 554 if (hasStrongDirectionality) | 554 // If this not the high part of the surrogate pair, then drop it and
move to the next. |
| 555 *hasStrongDirectionality = true; | 555 if (!U16_IS_SURROGATE_LEAD(current)) |
| 556 return LTR; | 556 continue; |
| 557 } | 557 UChar high = static_cast<UChar>(current); |
| 558 if (charDirection == WTF::Unicode::RightToLeft || charDirection == W
TF::Unicode::RightToLeftArabic) { | 558 if (m_current.atEnd()) |
| 559 if (hasStrongDirectionality) | 559 continue; |
| 560 *hasStrongDirectionality = true; | 560 UChar low = m_current.current(); |
| 561 return RTL; | 561 // Verify the low part. If invalid, then assume an invalid surrogate
pair and retry. |
| 562 } | 562 if (!U16_IS_TRAIL(low)) |
| 563 continue; |
| 564 current = U16_GET_SUPPLEMENTARY(high, low); |
| 565 } |
| 566 WTF::Unicode::Direction charDirection = WTF::Unicode::direction(current)
; |
| 567 if (charDirection == WTF::Unicode::LeftToRight) { |
| 568 if (hasStrongDirectionality) |
| 569 *hasStrongDirectionality = true; |
| 570 return LTR; |
| 571 } |
| 572 if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::
Unicode::RightToLeftArabic) { |
| 573 if (hasStrongDirectionality) |
| 574 *hasStrongDirectionality = true; |
| 575 return RTL; |
| 563 } | 576 } |
| 564 increment(); | 577 increment(); |
| 565 } | 578 } |
| 566 if (hasStrongDirectionality) | 579 if (hasStrongDirectionality) |
| 567 *hasStrongDirectionality = false; | 580 *hasStrongDirectionality = false; |
| 568 return LTR; | 581 return LTR; |
| 569 } | 582 } |
| 570 | 583 |
| 571 template <class Iterator, class Run> | 584 template <class Iterator, class Run> |
| 572 void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis
ualDirectionOverride override, bool hardLineBreak) | 585 void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis
ualDirectionOverride override, bool hardLineBreak) |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 template<class Iterator, class Run> | 994 template<class Iterator, class Run> |
| 982 MidpointState<Iterator> BidiResolver<Iterator, Run>::midpointStateForIsolatedRun
(Run* run) | 995 MidpointState<Iterator> BidiResolver<Iterator, Run>::midpointStateForIsolatedRun
(Run* run) |
| 983 { | 996 { |
| 984 return m_midpointStateForIsolatedRun.take(run); | 997 return m_midpointStateForIsolatedRun.take(run); |
| 985 } | 998 } |
| 986 | 999 |
| 987 | 1000 |
| 988 } // namespace WebCore | 1001 } // namespace WebCore |
| 989 | 1002 |
| 990 #endif // BidiResolver_h | 1003 #endif // BidiResolver_h |
| OLD | NEW |