OLD | NEW |
---|---|
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 if (!renderer) | 72 if (!renderer) |
73 continue; | 73 continue; |
74 if (!node->rendererIsEditable()) | 74 if (!node->rendererIsEditable()) |
75 continue; | 75 continue; |
76 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox())) | 76 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox())) |
77 return node; | 77 return node; |
78 } | 78 } |
79 return 0; | 79 return 0; |
80 } | 80 } |
81 | 81 |
82 static bool hasDirectionAutoAttribute(Node* node) | |
83 { | |
84 bool isAuto = node->selfOrAncestorHasDirAutoAttribute(); | |
85 if (node->isInShadowTree()) | |
86 isAuto = equalIgnoringCase(node->shadowHost()->fastGetAttribute(dirAttr) , "auto"); | |
leviw_travelin_and_unemployed
2014/06/02 18:00:29
This seems specific to TextArea. If you're inside
esprehn
2014/06/02 18:06:13
I don't think this is correct, what if you're mult
Habib Virji
2014/06/03 16:35:57
@levi: If I get some assistance about how to find
Habib Virji
2014/06/03 16:35:57
@esprehn: i have upload a new patch which check mu
| |
87 return isAuto; | |
88 } | |
89 | |
82 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, LegacyEditingOffset offset) | 90 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, LegacyEditingOffset offset) |
83 : m_anchorNode(anchorNode) | 91 : m_anchorNode(anchorNode) |
84 , m_offset(offset.value()) | 92 , m_offset(offset.value()) |
85 , m_anchorType(anchorTypeForLegacyEditingPosition(m_anchorNode.get(), m_offs et)) | 93 , m_anchorType(anchorTypeForLegacyEditingPosition(m_anchorNode.get(), m_offs et)) |
86 , m_isLegacyEditingPosition(true) | 94 , m_isLegacyEditingPosition(true) |
87 { | 95 { |
88 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement()); | 96 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement()); |
89 } | 97 } |
90 | 98 |
91 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, AnchorType anchorTyp e) | 99 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, AnchorType anchorTyp e) |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1253 } | 1261 } |
1254 } else { | 1262 } else { |
1255 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak(); | 1263 InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak(); |
1256 if (!nextBox || nextBox->bidiLevel() < level) { | 1264 if (!nextBox || nextBox->bidiLevel() < level) { |
1257 // Right edge of a secondary run. Set to the left edge of the entire run. | 1265 // Right edge of a secondary run. Set to the left edge of the entire run. |
1258 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea k()) { | 1266 while (InlineBox* prevBox = inlineBox->prevLeafChildIgnoringLineBrea k()) { |
1259 if (prevBox->bidiLevel() < level) | 1267 if (prevBox->bidiLevel() < level) |
1260 break; | 1268 break; |
1261 inlineBox = prevBox; | 1269 inlineBox = prevBox; |
1262 } | 1270 } |
1263 caretOffset = inlineBox->caretLeftmostOffset(); | 1271 if (hasDirectionAutoAttribute(m_anchorNode.get())) |
1272 caretOffset = (inlineBox->bidiLevel() < level) ? inlineBox->care tLeftmostOffset() : inlineBox->caretRightmostOffset(); | |
1273 else | |
1274 caretOffset = inlineBox->caretLeftmostOffset(); | |
1264 } else if (nextBox->bidiLevel() > level) { | 1275 } else if (nextBox->bidiLevel() > level) { |
1265 // Left edge of a "tertiary" run. Set to the right edge of that run. | 1276 // Left edge of a "tertiary" run. Set to the right edge of that run. |
1266 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine Break()) { | 1277 while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLine Break()) { |
1267 if (tertiaryBox->bidiLevel() <= level) | 1278 if (tertiaryBox->bidiLevel() <= level) |
1268 break; | 1279 break; |
1269 inlineBox = tertiaryBox; | 1280 inlineBox = tertiaryBox; |
1270 } | 1281 } |
1271 caretOffset = inlineBox->caretRightmostOffset(); | 1282 caretOffset = inlineBox->caretRightmostOffset(); |
1272 } | 1283 } |
1273 } | 1284 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1364 pos.showTreeForThis(); | 1375 pos.showTreeForThis(); |
1365 } | 1376 } |
1366 | 1377 |
1367 void showTree(const WebCore::Position* pos) | 1378 void showTree(const WebCore::Position* pos) |
1368 { | 1379 { |
1369 if (pos) | 1380 if (pos) |
1370 pos->showTreeForThis(); | 1381 pos->showTreeForThis(); |
1371 } | 1382 } |
1372 | 1383 |
1373 #endif | 1384 #endif |
OLD | NEW |