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

Side by Side Diff: Source/platform/text/BidiContext.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 | « no previous file | Source/platform/text/BidiResolver.h » ('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, 2009, 2010 Apple Inc. All right reserve d. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 Apple Inc. All right reserve d.
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 30 matching lines...) Expand all
41 public: 41 public:
42 static PassRefPtr<BidiContext> create(unsigned char level, WTF::Unicode::Dir ection, bool override = false, BidiEmbeddingSource = FromStyleOrDOM, BidiContext * parent = 0); 42 static PassRefPtr<BidiContext> create(unsigned char level, WTF::Unicode::Dir ection, bool override = false, BidiEmbeddingSource = FromStyleOrDOM, BidiContext * parent = 0);
43 43
44 BidiContext* parent() const { return m_parent.get(); } 44 BidiContext* parent() const { return m_parent.get(); }
45 unsigned char level() const { return m_level; } 45 unsigned char level() const { return m_level; }
46 WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direc tion>(m_direction); } 46 WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direc tion>(m_direction); }
47 bool override() const { return m_override; } 47 bool override() const { return m_override; }
48 BidiEmbeddingSource source() const { return static_cast<BidiEmbeddingSource> (m_source); } 48 BidiEmbeddingSource source() const { return static_cast<BidiEmbeddingSource> (m_source); }
49 49
50 PassRefPtr<BidiContext> copyStackRemovingUnicodeEmbeddingContexts(); 50 PassRefPtr<BidiContext> copyStackRemovingUnicodeEmbeddingContexts();
51
52 // http://www.unicode.org/reports/tr9/#Modifications
53 // 6.3 raised the limit from 61 to 125.
54 // http://unicode.org/reports/tr9/#BD2
55 static const unsigned char kMaxLevel = 125;
56
51 private: 57 private:
52 BidiContext(unsigned char level, WTF::Unicode::Direction direction, bool ove rride, BidiEmbeddingSource source, BidiContext* parent) 58 BidiContext(unsigned char level, WTF::Unicode::Direction direction, bool ove rride, BidiEmbeddingSource source, BidiContext* parent)
53 : m_level(level) 59 : m_level(level)
54 , m_direction(direction) 60 , m_direction(direction)
55 , m_override(override) 61 , m_override(override)
56 , m_source(source) 62 , m_source(source)
57 , m_parent(parent) 63 , m_parent(parent)
58 { 64 {
65 ASSERT(level <= kMaxLevel);
59 } 66 }
60 67
61 static PassRefPtr<BidiContext> createUncached(unsigned char level, WTF::Unic ode::Direction, bool override, BidiEmbeddingSource, BidiContext* parent); 68 static PassRefPtr<BidiContext> createUncached(unsigned char level, WTF::Unic ode::Direction, bool override, BidiEmbeddingSource, BidiContext* parent);
62 69
63 unsigned m_level : 6; // The maximium bidi level is 62: http://unicode.org/r eports/tr9/#Explicit_Levels_and_Directions 70 unsigned m_level : 7; // The maximium bidi level is 125: http://unicode.org/ reports/tr9/#Explicit_Levels_and_Directions
64 unsigned m_direction : 5; // Direction 71 unsigned m_direction : 5; // Direction
65 unsigned m_override : 1; 72 unsigned m_override : 1;
66 unsigned m_source : 1; // BidiEmbeddingSource 73 unsigned m_source : 1; // BidiEmbeddingSource
67 RefPtr<BidiContext> m_parent; 74 RefPtr<BidiContext> m_parent;
68 }; 75 };
69 76
70 inline unsigned char nextGreaterOddLevel(unsigned char level) 77 inline unsigned char nextGreaterOddLevel(unsigned char level)
71 { 78 {
72 return (level + 1) | 1; 79 return (level + 1) | 1;
73 } 80 }
74 81
75 inline unsigned char nextGreaterEvenLevel(unsigned char level) 82 inline unsigned char nextGreaterEvenLevel(unsigned char level)
76 { 83 {
77 return (level + 2) & ~1; 84 return (level + 2) & ~1;
78 } 85 }
79 86
80 PLATFORM_EXPORT bool operator==(const BidiContext&, const BidiContext&); 87 PLATFORM_EXPORT bool operator==(const BidiContext&, const BidiContext&);
81 88
82 } // namespace WebCore 89 } // namespace WebCore
83 90
84 #endif // BidiContext_h 91 #endif // BidiContext_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/text/BidiResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698