| 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, 2009, 2010, 2011 Apple Inc. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 4 * All right reserved. | 4 * All right reserved. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 void constructBidiRunsForLine(InlineBidiResolver& topResolver, | 104 void constructBidiRunsForLine(InlineBidiResolver& topResolver, |
| 105 BidiRunList<BidiRun>& bidiRuns, | 105 BidiRunList<BidiRun>& bidiRuns, |
| 106 const InlineIterator& endOfLine, | 106 const InlineIterator& endOfLine, |
| 107 VisualDirectionOverride override, | 107 VisualDirectionOverride override, |
| 108 bool previousLineBrokeCleanly, | 108 bool previousLineBrokeCleanly, |
| 109 bool isNewUBAParagraph) { | 109 bool isNewUBAParagraph) { |
| 110 // FIXME: We should pass a BidiRunList into createBidiRunsForLine instead | 110 // FIXME: We should pass a BidiRunList into createBidiRunsForLine instead |
| 111 // of the resolver owning the runs. | 111 // of the resolver owning the runs. |
| 112 ASSERT(&topResolver.runs() == &bidiRuns); | 112 DCHECK_EQ(&topResolver.runs(), &bidiRuns); |
| 113 ASSERT(topResolver.position() != endOfLine); | 113 DCHECK(topResolver.position() != endOfLine); |
| 114 LineLayoutItem currentRoot = topResolver.position().root(); | 114 LineLayoutItem currentRoot = topResolver.position().root(); |
| 115 topResolver.createBidiRunsForLine(endOfLine, override, | 115 topResolver.createBidiRunsForLine(endOfLine, override, |
| 116 previousLineBrokeCleanly); | 116 previousLineBrokeCleanly); |
| 117 | 117 |
| 118 while (!topResolver.isolatedRuns().isEmpty()) { | 118 while (!topResolver.isolatedRuns().isEmpty()) { |
| 119 // It does not matter which order we resolve the runs as long as we | 119 // It does not matter which order we resolve the runs as long as we |
| 120 // resolve them all. | 120 // resolve them all. |
| 121 BidiIsolatedRun isolatedRun = topResolver.isolatedRuns().back(); | 121 BidiIsolatedRun isolatedRun = topResolver.isolatedRuns().back(); |
| 122 topResolver.isolatedRuns().pop_back(); | 122 topResolver.isolatedRuns().pop_back(); |
| 123 currentRoot = isolatedRun.root; | 123 currentRoot = isolatedRun.root; |
| 124 | 124 |
| 125 LineLayoutItem startObj = isolatedRun.object; | 125 LineLayoutItem startObj = isolatedRun.object; |
| 126 | 126 |
| 127 // Only inlines make sense with unicode-bidi: isolate (blocks are | 127 // Only inlines make sense with unicode-bidi: isolate (blocks are |
| 128 // already isolated). | 128 // already isolated). |
| 129 // FIXME: Because enterIsolate is not passed a LayoutObject, we have to | 129 // FIXME: Because enterIsolate is not passed a LayoutObject, we have to |
| 130 // crawl up the tree to see which parent inline is the isolate. We could | 130 // crawl up the tree to see which parent inline is the isolate. We could |
| 131 // change enterIsolate to take a LayoutObject and do this logic there, | 131 // change enterIsolate to take a LayoutObject and do this logic there, |
| 132 // but that would be a layering violation for BidiResolver (which knows | 132 // but that would be a layering violation for BidiResolver (which knows |
| 133 // nothing about LayoutObject). | 133 // nothing about LayoutObject). |
| 134 LineLayoutItem isolatedInline = | 134 LineLayoutItem isolatedInline = |
| 135 highestContainingIsolateWithinRoot(startObj, currentRoot); | 135 highestContainingIsolateWithinRoot(startObj, currentRoot); |
| 136 ASSERT(isolatedInline); | 136 DCHECK(isolatedInline); |
| 137 | 137 |
| 138 InlineBidiResolver isolatedResolver; | 138 InlineBidiResolver isolatedResolver; |
| 139 LineMidpointState& isolatedLineMidpointState = | 139 LineMidpointState& isolatedLineMidpointState = |
| 140 isolatedResolver.midpointState(); | 140 isolatedResolver.midpointState(); |
| 141 isolatedLineMidpointState = | 141 isolatedLineMidpointState = |
| 142 topResolver.midpointStateForIsolatedRun(isolatedRun.runToReplace); | 142 topResolver.midpointStateForIsolatedRun(isolatedRun.runToReplace); |
| 143 UnicodeBidi unicodeBidi = isolatedInline.style()->getUnicodeBidi(); | 143 UnicodeBidi unicodeBidi = isolatedInline.style()->getUnicodeBidi(); |
| 144 TextDirection direction; | 144 TextDirection direction; |
| 145 if (unicodeBidi == UnicodeBidi::kPlaintext) { | 145 if (unicodeBidi == UnicodeBidi::kPlaintext) { |
| 146 direction = determinePlaintextDirectionality( | 146 direction = determinePlaintextDirectionality( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 164 isolatedRun.position); | 164 isolatedRun.position); |
| 165 isolatedResolver.setPositionIgnoringNestedIsolates(iter); | 165 isolatedResolver.setPositionIgnoringNestedIsolates(iter); |
| 166 // We stop at the next end of line; we may re-enter this isolate in the | 166 // We stop at the next end of line; we may re-enter this isolate in the |
| 167 // next call to constructBidiRuns(). | 167 // next call to constructBidiRuns(). |
| 168 // FIXME: What should end and previousLineBrokeCleanly be? | 168 // FIXME: What should end and previousLineBrokeCleanly be? |
| 169 // rniwa says previousLineBrokeCleanly is just a WinIE hack and could | 169 // rniwa says previousLineBrokeCleanly is just a WinIE hack and could |
| 170 // always be false here? | 170 // always be false here? |
| 171 isolatedResolver.createBidiRunsForLine(endOfLine, NoVisualOverride, | 171 isolatedResolver.createBidiRunsForLine(endOfLine, NoVisualOverride, |
| 172 previousLineBrokeCleanly); | 172 previousLineBrokeCleanly); |
| 173 | 173 |
| 174 ASSERT(isolatedResolver.runs().runCount()); | 174 DCHECK(isolatedResolver.runs().runCount()); |
| 175 if (isolatedResolver.runs().runCount()) | 175 if (isolatedResolver.runs().runCount()) |
| 176 bidiRuns.replaceRunWithRuns(&isolatedRun.runToReplace, | 176 bidiRuns.replaceRunWithRuns(&isolatedRun.runToReplace, |
| 177 isolatedResolver.runs()); | 177 isolatedResolver.runs()); |
| 178 | 178 |
| 179 // If we encountered any nested isolate runs, save them for later | 179 // If we encountered any nested isolate runs, save them for later |
| 180 // processing. | 180 // processing. |
| 181 while (!isolatedResolver.isolatedRuns().isEmpty()) { | 181 while (!isolatedResolver.isolatedRuns().isEmpty()) { |
| 182 BidiIsolatedRun runWithContext = isolatedResolver.isolatedRuns().back(); | 182 BidiIsolatedRun runWithContext = isolatedResolver.isolatedRuns().back(); |
| 183 isolatedResolver.isolatedRuns().pop_back(); | 183 isolatedResolver.isolatedRuns().pop_back(); |
| 184 topResolver.setMidpointStateForIsolatedRun( | 184 topResolver.setMidpointStateForIsolatedRun( |
| 185 runWithContext.runToReplace, | 185 runWithContext.runToReplace, |
| 186 isolatedResolver.midpointStateForIsolatedRun( | 186 isolatedResolver.midpointStateForIsolatedRun( |
| 187 runWithContext.runToReplace)); | 187 runWithContext.runToReplace)); |
| 188 topResolver.isolatedRuns().push_back(runWithContext); | 188 topResolver.isolatedRuns().push_back(runWithContext); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |