Changeset 82297 in webkit
- Timestamp:
- Mar 29, 2011 12:00:21 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r82296 r82297 1 2011-03-29 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Ryosuke Niwa. 4 5 Start to clean up BidiResolver::createBidiRunsForLine so that mere mortals can understand it 6 https://bugs.webkit.org/show_bug.cgi?id=57338 7 8 I'm attempting to break createBidiRunsForLine into understandable pieces 9 so that we can tell what it's actually doing. Our implementation of the 10 unicode bidi algorithm is slightly different from the spec in that we 11 run it per-line (instead of over the entire paragraph at once). This is 12 great for performance (our implementation is resumable), but it makes 13 things a bit tricky to understand. Splitting createBidiRunsForLine into 14 pieces should help make our UBA implementation more readable. 15 16 * platform/text/BidiResolver.h: 17 (WebCore::::updateStatusLastFromCurrentDirection): 18 (WebCore::::createBidiRunsForLine): 19 1 20 2011-03-29 Mario Sanchez Prada <msanchez@igalia.com> 2 21 -
trunk/Source/WebCore/platform/text/BidiResolver.h
r78491 r82297 211 211 void checkDirectionInLowerRaiseEmbeddingLevel(); 212 212 213 void updateStatusLastFromCurrentDirection(WTF::Unicode::Direction); 214 213 215 Vector<WTF::Unicode::Direction, 8> m_currentExplicitEmbeddingSequence; 214 216 }; … … 518 520 if (!afterEnd) 519 521 m_lastRun = startRun; 522 } 523 524 template <class Iterator, class Run> 525 inline void BidiResolver<Iterator, Run>::updateStatusLastFromCurrentDirection(WTF::Unicode::Direction dirCurrent) 526 { 527 using namespace WTF::Unicode; 528 switch (dirCurrent) { 529 case EuropeanNumberTerminator: 530 if (m_status.last != EuropeanNumber) 531 m_status.last = EuropeanNumberTerminator; 532 break; 533 case EuropeanNumberSeparator: 534 case CommonNumberSeparator: 535 case SegmentSeparator: 536 case WhiteSpaceNeutral: 537 case OtherNeutral: 538 switch (m_status.last) { 539 case LeftToRight: 540 case RightToLeft: 541 case RightToLeftArabic: 542 case EuropeanNumber: 543 case ArabicNumber: 544 m_status.last = dirCurrent; 545 break; 546 default: 547 m_status.last = OtherNeutral; 548 } 549 break; 550 case NonSpacingMark: 551 case BoundaryNeutral: 552 case RightToLeftEmbedding: 553 case LeftToRightEmbedding: 554 case RightToLeftOverride: 555 case LeftToRightOverride: 556 case PopDirectionalFormat: 557 // ignore these 558 break; 559 case EuropeanNumber: 560 // fall through 561 default: 562 m_status.last = dirCurrent; 563 } 520 564 } 521 565 … … 859 903 } 860 904 861 // set m_status.last as needed. 862 switch (dirCurrent) { 863 case EuropeanNumberTerminator: 864 if (m_status.last != EuropeanNumber) 865 m_status.last = EuropeanNumberTerminator; 866 break; 867 case EuropeanNumberSeparator: 868 case CommonNumberSeparator: 869 case SegmentSeparator: 870 case WhiteSpaceNeutral: 871 case OtherNeutral: 872 switch(m_status.last) { 873 case LeftToRight: 874 case RightToLeft: 875 case RightToLeftArabic: 876 case EuropeanNumber: 877 case ArabicNumber: 878 m_status.last = dirCurrent; 879 break; 880 default: 881 m_status.last = OtherNeutral; 882 } 883 break; 884 case NonSpacingMark: 885 case BoundaryNeutral: 886 case RightToLeftEmbedding: 887 case LeftToRightEmbedding: 888 case RightToLeftOverride: 889 case LeftToRightOverride: 890 case PopDirectionalFormat: 891 // ignore these 892 break; 893 case EuropeanNumber: 894 // fall through 895 default: 896 m_status.last = dirCurrent; 897 } 898 905 updateStatusLastFromCurrentDirection(dirCurrent); 899 906 last = current; 900 907 … … 942 949 unsigned char levelLow = 128; 943 950 unsigned char levelHigh = 0; 944 Run* r = firstRun(); 945 while (r) { 946 if (r->m_level > levelHigh) 947 levelHigh = r->m_level; 948 if (r->m_level < levelLow) 949 levelLow = r->m_level; 950 r = r->next(); 951 for (Run* r = firstRun(); r; r = r->next()) { 952 levelHigh = max(r->m_level, levelHigh); 953 levelLow = min(r->m_level, levelLow); 951 954 } 952 955
Note: See TracChangeset
for help on using the changeset viewer.