OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 pos = n; | 1281 pos = n; |
1282 } while (inSameParagraph(p, pos)); | 1282 } while (inSameParagraph(p, pos)); |
1283 return pos; | 1283 return pos; |
1284 } | 1284 } |
1285 | 1285 |
1286 // --------- | 1286 // --------- |
1287 | 1287 |
1288 VisiblePosition startOfBlock(const VisiblePosition& visiblePosition, EditingBoun
daryCrossingRule rule) | 1288 VisiblePosition startOfBlock(const VisiblePosition& visiblePosition, EditingBoun
daryCrossingRule rule) |
1289 { | 1289 { |
1290 Position position = visiblePosition.deepEquivalent(); | 1290 Position position = visiblePosition.deepEquivalent(); |
1291 Node* startBlock; | 1291 Node* startBlock = position.containerNode() ? enclosingBlock(position.contai
nerNode(), rule) : 0; |
1292 if (!position.containerNode() || !(startBlock = enclosingBlock(position.cont
ainerNode(), rule))) | 1292 return startBlock ? VisiblePosition(firstPositionInNode(startBlock)) : Visib
lePosition(); |
1293 return VisiblePosition(); | |
1294 return VisiblePosition(firstPositionInNode(startBlock)); | |
1295 } | 1293 } |
1296 | 1294 |
1297 VisiblePosition endOfBlock(const VisiblePosition& visiblePosition, EditingBounda
ryCrossingRule rule) | 1295 VisiblePosition endOfBlock(const VisiblePosition& visiblePosition, EditingBounda
ryCrossingRule rule) |
1298 { | 1296 { |
1299 Position position = visiblePosition.deepEquivalent(); | 1297 Position position = visiblePosition.deepEquivalent(); |
1300 Node* endBlock; | 1298 Node* endBlock = position.containerNode() ? enclosingBlock(position.containe
rNode(), rule) : 0; |
1301 if (!position.containerNode() || !(endBlock = enclosingBlock(position.contai
nerNode(), rule))) | 1299 return endBlock ? VisiblePosition(lastPositionInNode(endBlock)) : VisiblePos
ition(); |
1302 return VisiblePosition(); | |
1303 return VisiblePosition(lastPositionInNode(endBlock)); | |
1304 } | 1300 } |
1305 | 1301 |
1306 bool inSameBlock(const VisiblePosition &a, const VisiblePosition &b) | 1302 bool inSameBlock(const VisiblePosition &a, const VisiblePosition &b) |
1307 { | 1303 { |
1308 return !a.isNull() && enclosingBlock(a.deepEquivalent().containerNode()) ==
enclosingBlock(b.deepEquivalent().containerNode()); | 1304 return !a.isNull() && enclosingBlock(a.deepEquivalent().containerNode()) ==
enclosingBlock(b.deepEquivalent().containerNode()); |
1309 } | 1305 } |
1310 | 1306 |
1311 bool isStartOfBlock(const VisiblePosition &pos) | 1307 bool isStartOfBlock(const VisiblePosition &pos) |
1312 { | 1308 { |
1313 return pos.isNotNull() && pos == startOfBlock(pos, CanCrossEditingBoundary); | 1309 return pos.isNotNull() && pos == startOfBlock(pos, CanCrossEditingBoundary); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 { | 1382 { |
1387 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); | 1383 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); |
1388 } | 1384 } |
1389 | 1385 |
1390 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) | 1386 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire
ction) |
1391 { | 1387 { |
1392 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); | 1388 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); |
1393 } | 1389 } |
1394 | 1390 |
1395 } | 1391 } |
OLD | NEW |