OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 TextDirection primary_direction) { | 886 TextDirection primary_direction) { |
887 unsigned char level = inline_box->BidiLevel(); | 887 unsigned char level = inline_box->BidiLevel(); |
888 | 888 |
889 if (inline_box->Direction() == primary_direction) { | 889 if (inline_box->Direction() == primary_direction) { |
890 if (caret_offset == inline_box->CaretRightmostOffset()) { | 890 if (caret_offset == inline_box->CaretRightmostOffset()) { |
891 InlineBox* next_box = inline_box->NextLeafChild(); | 891 InlineBox* next_box = inline_box->NextLeafChild(); |
892 if (!next_box || next_box->BidiLevel() >= level) | 892 if (!next_box || next_box->BidiLevel() >= level) |
893 return InlineBoxPosition(inline_box, caret_offset); | 893 return InlineBoxPosition(inline_box, caret_offset); |
894 | 894 |
895 level = next_box->BidiLevel(); | 895 level = next_box->BidiLevel(); |
896 InlineBox* prev_box = inline_box; | 896 InlineBox* const prev_box = |
897 do { | 897 InlineBoxTraversal::FindLeftBidiRun(*inline_box, level); |
898 prev_box = prev_box->PrevLeafChild(); | |
899 } while (prev_box && prev_box->BidiLevel() > level); | |
900 | 898 |
901 // For example, abc FED 123 ^ CBA | 899 // For example, abc FED 123 ^ CBA |
902 if (prev_box && prev_box->BidiLevel() == level) | 900 if (prev_box && prev_box->BidiLevel() == level) |
903 return InlineBoxPosition(inline_box, caret_offset); | 901 return InlineBoxPosition(inline_box, caret_offset); |
904 | 902 |
905 // For example, abc 123 ^ CBA | 903 // For example, abc 123 ^ CBA |
906 inline_box = InlineBoxTraversal::FindRightBoundaryOfEntireBidiRun( | 904 inline_box = InlineBoxTraversal::FindRightBoundaryOfEntireBidiRun( |
907 *inline_box, level); | 905 *inline_box, level); |
908 return InlineBoxPosition(inline_box, inline_box->CaretRightmostOffset()); | 906 return InlineBoxPosition(inline_box, inline_box->CaretRightmostOffset()); |
909 } | 907 } |
910 | 908 |
911 if (IsStartOfDifferentDirection(inline_box)) | 909 if (IsStartOfDifferentDirection(inline_box)) |
912 return InlineBoxPosition(inline_box, caret_offset); | 910 return InlineBoxPosition(inline_box, caret_offset); |
913 | 911 |
914 level = inline_box->PrevLeafChild()->BidiLevel(); | 912 level = inline_box->PrevLeafChild()->BidiLevel(); |
915 InlineBox* next_box = inline_box; | 913 InlineBox* const next_box = |
916 do { | 914 InlineBoxTraversal::FindRightBidiRun(*inline_box, level); |
917 next_box = next_box->NextLeafChild(); | |
918 } while (next_box && next_box->BidiLevel() > level); | |
919 | 915 |
920 if (next_box && next_box->BidiLevel() == level) | 916 if (next_box && next_box->BidiLevel() == level) |
921 return InlineBoxPosition(inline_box, caret_offset); | 917 return InlineBoxPosition(inline_box, caret_offset); |
922 | 918 |
923 inline_box = | 919 inline_box = |
924 InlineBoxTraversal::FindLeftBoundaryOfEntireBidiRun(*inline_box, level); | 920 InlineBoxTraversal::FindLeftBoundaryOfEntireBidiRun(*inline_box, level); |
925 return InlineBoxPosition(inline_box, inline_box->CaretLeftmostOffset()); | 921 return InlineBoxPosition(inline_box, inline_box->CaretLeftmostOffset()); |
926 } | 922 } |
927 | 923 |
928 if (caret_offset == inline_box->CaretLeftmostOffset()) { | 924 if (caret_offset == inline_box->CaretLeftmostOffset()) { |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 | 2077 |
2082 IntRect ComputeTextRect(const EphemeralRangeInFlatTree& range) { | 2078 IntRect ComputeTextRect(const EphemeralRangeInFlatTree& range) { |
2083 return EnclosingIntRect(ComputeTextRectTemplate(range)); | 2079 return EnclosingIntRect(ComputeTextRectTemplate(range)); |
2084 } | 2080 } |
2085 | 2081 |
2086 FloatRect ComputeTextFloatRect(const EphemeralRange& range) { | 2082 FloatRect ComputeTextFloatRect(const EphemeralRange& range) { |
2087 return ComputeTextRectTemplate(range); | 2083 return ComputeTextRectTemplate(range); |
2088 } | 2084 } |
2089 | 2085 |
2090 } // namespace blink | 2086 } // namespace blink |
OLD | NEW |