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

Side by Side Diff: Source/core/dom/Position.cpp

Issue 541823003: Move caret to correct position when dir=auto (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Compile fix for Windows Created 6 years, 3 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 caretOffset = inlineBox->caretRightmostOffset(); 1181 caretOffset = inlineBox->caretRightmostOffset();
1182 } else if (prevBox->bidiLevel() > level) { 1182 } else if (prevBox->bidiLevel() > level) {
1183 // Right edge of a "tertiary" run. Set to the left edge of that run. 1183 // Right edge of a "tertiary" run. Set to the left edge of that run.
1184 while (InlineBox* tertiaryBox = inlineBox->prevLeafChildIgnoringLine Break()) { 1184 while (InlineBox* tertiaryBox = inlineBox->prevLeafChildIgnoringLine Break()) {
1185 if (tertiaryBox->bidiLevel() <= level) 1185 if (tertiaryBox->bidiLevel() <= level)
1186 break; 1186 break;
1187 inlineBox = tertiaryBox; 1187 inlineBox = tertiaryBox;
1188 } 1188 }
1189 caretOffset = inlineBox->caretLeftmostOffset(); 1189 caretOffset = inlineBox->caretLeftmostOffset();
1190 } 1190 }
1191 } else if (m_anchorNode->selfOrAncestorHasDirAutoAttribute()) {
1192 if (inlineBox->bidiLevel() < level)
1193 caretOffset = inlineBox->caretLeftmostOffset();
1194 else
1195 caretOffset = inlineBox->caretRightmostOffset();
1191 } else { 1196 } else {
1192 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak(); 1197 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak();
1193 if (!nextBox || nextBox->bidiLevel() < level) { 1198 if (!nextBox || nextBox->bidiLevel() < level) {
1194 // Right edge of a secondary run. Set to the left edge of the entire run. 1199 // Right edge of a secondary run. Set to the left edge of the entire run.
1195 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea k()) { 1200 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea k()) {
1196 if (prevBox->bidiLevel() < level) 1201 if (prevBox->bidiLevel() < level)
1197 break; 1202 break;
1198 inlineBox = prevBox; 1203 inlineBox = prevBox;
1199 } 1204 }
1200 if (m_anchorNode->selfOrAncestorHasDirAutoAttribute()) 1205 caretOffset = inlineBox->caretLeftmostOffset();
1201 caretOffset = inlineBox->bidiLevel() < level ? inlineBox->caretL eftmostOffset() : inlineBox->caretRightmostOffset();
1202 else
1203 caretOffset = inlineBox->caretLeftmostOffset();
1204 } else if (nextBox->bidiLevel() > level) { 1206 } else if (nextBox->bidiLevel() > level) {
1205 // Left edge of a "tertiary" run. Set to the right edge of that run. 1207 // Left edge of a "tertiary" run. Set to the right edge of that run.
1206 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine Break()) { 1208 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine Break()) {
1207 if (tertiaryBox->bidiLevel() <= level) 1209 if (tertiaryBox->bidiLevel() <= level)
1208 break; 1210 break;
1209 inlineBox = tertiaryBox; 1211 inlineBox = tertiaryBox;
1210 } 1212 }
1211 caretOffset = inlineBox->caretRightmostOffset(); 1213 caretOffset = inlineBox->caretRightmostOffset();
1212 } 1214 }
1213 } 1215 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 pos.showTreeForThis(); 1306 pos.showTreeForThis();
1305 } 1307 }
1306 1308
1307 void showTree(const blink::Position* pos) 1309 void showTree(const blink::Position* pos)
1308 { 1310 {
1309 if (pos) 1311 if (pos)
1310 pos->showTreeForThis(); 1312 pos->showTreeForThis();
1311 } 1313 }
1312 1314
1313 #endif 1315 #endif
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/caret-in-textarea-auto-expected.txt ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698