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. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // This copies BidiStatus and may churn the ref on BidiContext. I doubt it m
atters. | 942 // This copies BidiStatus and may churn the ref on BidiContext. I doubt it m
atters. |
943 return BidiStatus(direction, direction, direction, context.release()); | 943 return BidiStatus(direction, direction, direction, context.release()); |
944 } | 944 } |
945 | 945 |
946 // FIXME: BidiResolver should have this logic. | 946 // FIXME: BidiResolver should have this logic. |
947 static inline void constructBidiRuns(InlineBidiResolver& topResolver, BidiRunLis
t<BidiRun>& bidiRuns, const InlineIterator& endOfLine, VisualDirectionOverride o
verride, bool previousLineBrokeCleanly) | 947 static inline void constructBidiRuns(InlineBidiResolver& topResolver, BidiRunLis
t<BidiRun>& bidiRuns, const InlineIterator& endOfLine, VisualDirectionOverride o
verride, bool previousLineBrokeCleanly) |
948 { | 948 { |
949 // FIXME: We should pass a BidiRunList into createBidiRunsForLine instead | 949 // FIXME: We should pass a BidiRunList into createBidiRunsForLine instead |
950 // of the resolver owning the runs. | 950 // of the resolver owning the runs. |
951 ASSERT(&topResolver.runs() == &bidiRuns); | 951 ASSERT(&topResolver.runs() == &bidiRuns); |
| 952 RenderObject* currentRoot = topResolver.position().root(); |
952 topResolver.createBidiRunsForLine(endOfLine, override, previousLineBrokeClea
nly); | 953 topResolver.createBidiRunsForLine(endOfLine, override, previousLineBrokeClea
nly); |
953 | 954 |
954 while (!topResolver.isolatedRuns().isEmpty()) { | 955 while (!topResolver.isolatedRuns().isEmpty()) { |
955 // It does not matter which order we resolve the runs as long as we reso
lve them all. | 956 // It does not matter which order we resolve the runs as long as we reso
lve them all. |
956 BidiRun* isolatedRun = topResolver.isolatedRuns().last(); | 957 BidiRun* isolatedRun = topResolver.isolatedRuns().last(); |
957 topResolver.isolatedRuns().removeLast(); | 958 topResolver.isolatedRuns().removeLast(); |
958 | 959 |
| 960 RenderObject* startObj = isolatedRun->object(); |
| 961 |
959 // Only inlines make sense with unicode-bidi: isolate (blocks are alread
y isolated). | 962 // Only inlines make sense with unicode-bidi: isolate (blocks are alread
y isolated). |
960 RenderInline* isolatedSpan = toRenderInline(isolatedRun->object()); | 963 // FIXME: Because enterIsolate is not passed a RenderObject, we have to
crawl up the |
| 964 // tree to see which parent inline is the isolate. We could change enter
Isolate |
| 965 // to take a RenderObject and do this logic there, but that would be a l
ayering |
| 966 // violation for BidiResolver (which knows nothing about RenderObject). |
| 967 RenderInline* isolatedSpan = toRenderInline(containingIsolate(startObj,
currentRoot)); |
961 InlineBidiResolver isolatedResolver; | 968 InlineBidiResolver isolatedResolver; |
962 isolatedResolver.setStatus(statusWithDirection(isolatedSpan->style()->di
rection())); | 969 isolatedResolver.setStatus(statusWithDirection(isolatedSpan->style()->di
rection())); |
963 | 970 |
964 // FIXME: The fact that we have to construct an Iterator here | 971 // FIXME: The fact that we have to construct an Iterator here |
965 // currently prevents this code from moving into BidiResolver. | 972 // currently prevents this code from moving into BidiResolver. |
966 RenderObject* startObj = bidiFirstSkippingEmptyInlines(isolatedSpan, &is
olatedResolver); | 973 if (!bidiFirstSkippingEmptyInlines(isolatedSpan, &isolatedResolver)) |
967 if (!startObj) | |
968 continue; | 974 continue; |
969 isolatedResolver.setPositionIgnoringNestedIsolates(InlineIterator(isolat
edSpan, startObj, 0)); | 975 // The starting position is the beginning of the first run within the is
olate that was identified |
| 976 // during the earlier call to createBidiRunsForLine. This can be but is
not necessarily the |
| 977 // first run within the isolate. |
| 978 InlineIterator iter = InlineIterator(isolatedSpan, startObj, isolatedRun
->m_start); |
| 979 isolatedResolver.setPositionIgnoringNestedIsolates(iter); |
970 | 980 |
971 // FIXME: isolatedEnd should probably equal end or the last char in isol
atedSpan. | 981 // We stop at the next end of line; we may re-enter this isolate in the
next call to constructBidiRuns(). |
972 InlineIterator isolatedEnd = endOfLine; | |
973 // FIXME: What should end and previousLineBrokeCleanly be? | 982 // FIXME: What should end and previousLineBrokeCleanly be? |
974 // rniwa says previousLineBrokeCleanly is just a WinIE hack and could al
ways be false here? | 983 // rniwa says previousLineBrokeCleanly is just a WinIE hack and could al
ways be false here? |
975 isolatedResolver.createBidiRunsForLine(isolatedEnd, NoVisualOverride, pr
eviousLineBrokeCleanly); | 984 isolatedResolver.createBidiRunsForLine(endOfLine, NoVisualOverride, prev
iousLineBrokeCleanly); |
976 // Note that we do not delete the runs from the resolver. | 985 // Note that we do not delete the runs from the resolver. |
977 bidiRuns.replaceRunWithRuns(isolatedRun, isolatedResolver.runs()); | 986 bidiRuns.replaceRunWithRuns(isolatedRun, isolatedResolver.runs()); |
978 | 987 |
979 // If we encountered any nested isolate runs, just move them | 988 // If we encountered any nested isolate runs, just move them |
980 // to the top resolver's list for later processing. | 989 // to the top resolver's list for later processing. |
981 if (!isolatedResolver.isolatedRuns().isEmpty()) { | 990 if (!isolatedResolver.isolatedRuns().isEmpty()) { |
982 topResolver.isolatedRuns().append(isolatedResolver.isolatedRuns()); | 991 topResolver.isolatedRuns().append(isolatedResolver.isolatedRuns()); |
983 isolatedResolver.isolatedRuns().clear(); | 992 isolatedResolver.isolatedRuns().clear(); |
984 } | 993 } |
985 } | 994 } |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) -
logicalLeft; | 2731 availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) -
logicalLeft; |
2723 float totalLogicalWidth = logicalWidthForChild(child); | 2732 float totalLogicalWidth = logicalWidthForChild(child); |
2724 updateLogicalWidthForAlignment(textAlign, 0l, logicalLeft, totalLogicalWidth
, availableLogicalWidth, 0); | 2733 updateLogicalWidthForAlignment(textAlign, 0l, logicalLeft, totalLogicalWidth
, availableLogicalWidth, 0); |
2725 | 2734 |
2726 if (!style()->isLeftToRightDirection()) | 2735 if (!style()->isLeftToRightDirection()) |
2727 return logicalWidth() - (logicalLeft + totalLogicalWidth); | 2736 return logicalWidth() - (logicalLeft + totalLogicalWidth); |
2728 return logicalLeft; | 2737 return logicalLeft; |
2729 } | 2738 } |
2730 | 2739 |
2731 } | 2740 } |
OLD | NEW |