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

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

Issue 302433015: Use correct offset when attribute auto is present (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to latest master Created 6 years, 6 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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 } 1253 }
1254 } else { 1254 } else {
1255 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak(); 1255 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak();
1256 if (!nextBox || nextBox->bidiLevel() < level) { 1256 if (!nextBox || nextBox->bidiLevel() < level) {
1257 // Right edge of a secondary run. Set to the left edge of the entire run. 1257 // Right edge of a secondary run. Set to the left edge of the entire run.
1258 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea k()) { 1258 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea k()) {
1259 if (prevBox->bidiLevel() < level) 1259 if (prevBox->bidiLevel() < level)
1260 break; 1260 break;
1261 inlineBox = prevBox; 1261 inlineBox = prevBox;
1262 } 1262 }
1263 caretOffset = inlineBox->caretLeftmostOffset(); 1263 // A special scenario when attribute auto is set. if the direction i s changed use right offset
leviw_travelin_and_unemployed 2014/05/28 17:42:31 It's not just "attribute auto," but dirAuto. Inst
Habib Virji 2014/05/29 07:58:26 Ok thanks will update accordingly.
Habib Virji 2014/05/29 11:31:51 Done.
1264 bool isAuto = false;
1265 if (deprecatedNode()->document().focusedElement())
leviw_travelin_and_unemployed 2014/05/28 17:42:31 Why the check for a focused element?
Habib Virji 2014/05/29 07:58:26 I need a way to access directionality function and
1266 toHTMLElement(deprecatedNode()->document().focusedElement())->di rectionalityIfhasDirAutoAttribute(isAuto);
leviw_travelin_and_unemployed 2014/05/28 17:42:31 directionalityIfhasDirAutoAttributre returns the d
Habib Virji 2014/05/29 07:58:26 directionalityIfhasDirAutoAttribute takes bool arg
Habib Virji 2014/05/29 11:31:51 Done.
1267 if (isAuto)
1268 caretOffset = (inlineBox->bidiLevel() < level) ? inlineBox->care tLeftmostOffset() : inlineBox->caretRightmostOffset();
1269 else
1270 caretOffset = inlineBox->caretLeftmostOffset();
1264 } else if (nextBox->bidiLevel() > level) { 1271 } else if (nextBox->bidiLevel() > level) {
1265 // Left edge of a "tertiary" run. Set to the right edge of that run. 1272 // Left edge of a "tertiary" run. Set to the right edge of that run.
1266 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine Break()) { 1273 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine Break()) {
1267 if (tertiaryBox->bidiLevel() <= level) 1274 if (tertiaryBox->bidiLevel() <= level)
1268 break; 1275 break;
1269 inlineBox = tertiaryBox; 1276 inlineBox = tertiaryBox;
1270 } 1277 }
1271 caretOffset = inlineBox->caretRightmostOffset(); 1278 caretOffset = inlineBox->caretRightmostOffset();
1272 } 1279 }
1273 } 1280 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 pos.showTreeForThis(); 1367 pos.showTreeForThis();
1361 } 1368 }
1362 1369
1363 void showTree(const WebCore::Position* pos) 1370 void showTree(const WebCore::Position* pos)
1364 { 1371 {
1365 if (pos) 1372 if (pos)
1366 pos->showTreeForThis(); 1373 pos->showTreeForThis();
1367 } 1374 }
1368 1375
1369 #endif 1376 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698