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

Side by Side Diff: Source/platform/text/BidiResolver.h

Issue 58383002: Update BidiResolver's max level depth to 125 per tr9r29 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated per leviw's review Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/text/BidiContext.h ('k') | Source/platform/text/BidiResolverTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (BidiContext* parentContext = toContext->parent()) 426 if (BidiContext* parentContext = toContext->parent())
427 toContext = parentContext; 427 toContext = parentContext;
428 } else { 428 } else {
429 Direction direction = (embedding.direction() == RightToLeftEmbedding || embedding.direction() == RightToLeftOverride) ? RightToLeft : LeftToRight; 429 Direction direction = (embedding.direction() == RightToLeftEmbedding || embedding.direction() == RightToLeftOverride) ? RightToLeft : LeftToRight;
430 bool override = embedding.direction() == LeftToRightOverride || embe dding.direction() == RightToLeftOverride; 430 bool override = embedding.direction() == LeftToRightOverride || embe dding.direction() == RightToLeftOverride;
431 unsigned char level = toContext->level(); 431 unsigned char level = toContext->level();
432 if (direction == RightToLeft) 432 if (direction == RightToLeft)
433 level = nextGreaterOddLevel(level); 433 level = nextGreaterOddLevel(level);
434 else 434 else
435 level = nextGreaterEvenLevel(level); 435 level = nextGreaterEvenLevel(level);
436 if (level < 61) 436 if (level < BidiContext::kMaxLevel)
437 toContext = BidiContext::create(level, direction, override, embe dding.source(), toContext.get()); 437 toContext = BidiContext::create(level, direction, override, embe dding.source(), toContext.get());
438 } 438 }
439 } 439 }
440 440
441 unsigned char toLevel = toContext->level(); 441 unsigned char toLevel = toContext->level();
442 442
443 if (toLevel > fromLevel) 443 if (toLevel > fromLevel)
444 raiseExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight, t oLevel % 2 ? RightToLeft : LeftToRight); 444 raiseExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight, t oLevel % 2 ? RightToLeft : LeftToRight);
445 else if (toLevel < fromLevel) 445 else if (toLevel < fromLevel)
446 lowerExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight); 446 lowerExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 case EuropeanNumber: 490 case EuropeanNumber:
491 // fall through 491 // fall through
492 default: 492 default:
493 m_status.last = dirCurrent; 493 m_status.last = dirCurrent;
494 } 494 }
495 } 495 }
496 496
497 template <class Iterator, class Run> 497 template <class Iterator, class Run>
498 inline void BidiResolver<Iterator, Run>::reorderRunsFromLevels() 498 inline void BidiResolver<Iterator, Run>::reorderRunsFromLevels()
499 { 499 {
500 unsigned char levelLow = 128; 500 unsigned char levelLow = BidiContext::kMaxLevel;
501 unsigned char levelHigh = 0; 501 unsigned char levelHigh = 0;
502 for (Run* run = m_runs.firstRun(); run; run = run->next()) { 502 for (Run* run = m_runs.firstRun(); run; run = run->next()) {
503 levelHigh = std::max(run->level(), levelHigh); 503 levelHigh = std::max(run->level(), levelHigh);
504 levelLow = std::min(run->level(), levelLow); 504 levelLow = std::min(run->level(), levelLow);
505 } 505 }
506 506
507 // This implements reordering of the line (L2 according to Bidi spec): 507 // This implements reordering of the line (L2 according to Bidi spec):
508 // http://unicode.org/reports/tr9/#L2 508 // http://unicode.org/reports/tr9/#L2
509 // L2. From the highest level found in the text to the lowest odd level on e ach line, 509 // L2. From the highest level found in the text to the lowest odd level on e ach line,
510 // reverse any contiguous sequence of characters that are at that level or h igher. 510 // reverse any contiguous sequence of characters that are at that level or h igher.
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 template<class Iterator, class Run> 972 template<class Iterator, class Run>
973 MidpointState<Iterator> BidiResolver<Iterator, Run>::midpointStateForIsolatedRun (Run* run) 973 MidpointState<Iterator> BidiResolver<Iterator, Run>::midpointStateForIsolatedRun (Run* run)
974 { 974 {
975 return m_midpointStateForIsolatedRun.take(run); 975 return m_midpointStateForIsolatedRun.take(run);
976 } 976 }
977 977
978 978
979 } // namespace WebCore 979 } // namespace WebCore
980 980
981 #endif // BidiResolver_h 981 #endif // BidiResolver_h
OLDNEW
« no previous file with comments | « Source/platform/text/BidiContext.h ('k') | Source/platform/text/BidiResolverTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698