| 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, 2009, 2010 Apple Inc. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 Apple Inc. |
| 4 * All right reserved. | 4 * All right 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 // The BidiContext stack must be immutable -- they're re-used for re-layout | 100 // The BidiContext stack must be immutable -- they're re-used for re-layout |
| 101 // after DOM modification/editing -- so we copy all the non-unicode contexts, | 101 // after DOM modification/editing -- so we copy all the non-unicode contexts, |
| 102 // and recalculate their levels. | 102 // and recalculate their levels. |
| 103 PassRefPtr<BidiContext> | 103 PassRefPtr<BidiContext> |
| 104 BidiContext::copyStackRemovingUnicodeEmbeddingContexts() { | 104 BidiContext::copyStackRemovingUnicodeEmbeddingContexts() { |
| 105 Vector<BidiContext*, 64> contexts; | 105 Vector<BidiContext*, 64> contexts; |
| 106 for (BidiContext* iter = this; iter; iter = iter->parent()) { | 106 for (BidiContext* iter = this; iter; iter = iter->parent()) { |
| 107 if (iter->source() != FromUnicode) | 107 if (iter->source() != FromUnicode) |
| 108 contexts.append(iter); | 108 contexts.push_back(iter); |
| 109 } | 109 } |
| 110 ASSERT(contexts.size()); | 110 ASSERT(contexts.size()); |
| 111 | 111 |
| 112 RefPtr<BidiContext> topContext = | 112 RefPtr<BidiContext> topContext = |
| 113 copyContextAndRebaselineLevel(contexts.back(), 0); | 113 copyContextAndRebaselineLevel(contexts.back(), 0); |
| 114 for (int i = contexts.size() - 1; i > 0; --i) | 114 for (int i = contexts.size() - 1; i > 0; --i) |
| 115 topContext = | 115 topContext = |
| 116 copyContextAndRebaselineLevel(contexts[i - 1], topContext.get()); | 116 copyContextAndRebaselineLevel(contexts[i - 1], topContext.get()); |
| 117 | 117 |
| 118 return topContext.release(); | 118 return topContext.release(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool operator==(const BidiContext& c1, const BidiContext& c2) { | 121 bool operator==(const BidiContext& c1, const BidiContext& c2) { |
| 122 if (&c1 == &c2) | 122 if (&c1 == &c2) |
| 123 return true; | 123 return true; |
| 124 if (c1.level() != c2.level() || c1.override() != c2.override() || | 124 if (c1.level() != c2.level() || c1.override() != c2.override() || |
| 125 c1.dir() != c2.dir() || c1.source() != c2.source()) | 125 c1.dir() != c2.dir() || c1.source() != c2.source()) |
| 126 return false; | 126 return false; |
| 127 if (!c1.parent()) | 127 if (!c1.parent()) |
| 128 return !c2.parent(); | 128 return !c2.parent(); |
| 129 return c2.parent() && *c1.parent() == *c2.parent(); | 129 return c2.parent() && *c1.parent() == *c2.parent(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace blink | 132 } // namespace blink |
| OLD | NEW |