| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated
Node()->isDescendantOf(highestRoot)) | 302 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated
Node()->isDescendantOf(highestRoot)) |
| 303 return VisiblePosition(); | 303 return VisiblePosition(); |
| 304 | 304 |
| 305 return VisiblePosition(p); | 305 return VisiblePosition(p); |
| 306 } | 306 } |
| 307 | 307 |
| 308 // FIXME: The method name, comment, and code say three different things here! | 308 // FIXME: The method name, comment, and code say three different things here! |
| 309 // Whether or not content before and after this node will collapse onto the same
line as it. | 309 // Whether or not content before and after this node will collapse onto the same
line as it. |
| 310 bool isBlock(const Node* node) | 310 bool isBlock(const Node* node) |
| 311 { | 311 { |
| 312 return node && node->isElementNode() && node->renderer() && !node->renderer(
)->isInline() && !node->renderer()->isRubyText(); | 312 return node && node->renderer() && !node->renderer()->isInline() && !node->r
enderer()->isRubyText(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 bool isInline(const Node* node) | 315 bool isInline(const Node* node) |
| 316 { | 316 { |
| 317 return node && node->isElementNode() && node->renderer() && node->renderer()
->isInline(); | 317 return node && node->renderer() && node->renderer()->isInline(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlo
ckFlowOrTableElement are used. | 320 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlo
ckFlowOrTableElement are used. |
| 321 // FIXME: Pass a position to this function. The enclosing block of [table, x] fo
r example, should be the | 321 // FIXME: Pass a position to this function. The enclosing block of [table, x] fo
r example, should be the |
| 322 // block that contains the table and not the table, and this function should be
the only one responsible for | 322 // block that contains the table and not the table, and this function should be
the only one responsible for |
| 323 // knowing about these kinds of special cases. | 323 // knowing about these kinds of special cases. |
| 324 Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule) | 324 Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule) |
| 325 { | 325 { |
| 326 Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node),
isBlock, rule); | 326 Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node),
isBlock, rule); |
| 327 return toElement(enclosingNode); | 327 return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosing
Node) : 0; |
| 328 } | 328 } |
| 329 | 329 |
| 330 TextDirection directionOfEnclosingBlock(const Position& position) | 330 TextDirection directionOfEnclosingBlock(const Position& position) |
| 331 { | 331 { |
| 332 Node* enclosingBlockNode = enclosingBlock(position.containerNode()); | 332 Node* enclosingBlockNode = enclosingBlock(position.containerNode()); |
| 333 if (!enclosingBlockNode) | 333 if (!enclosingBlockNode) |
| 334 return LTR; | 334 return LTR; |
| 335 RenderObject* renderer = enclosingBlockNode->renderer(); | 335 RenderObject* renderer = enclosingBlockNode->renderer(); |
| 336 return renderer ? renderer->style()->direction() : LTR; | 336 return renderer ? renderer->style()->direction() : LTR; |
| 337 } | 337 } |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 // if the selection starts just before a paragraph break, skip over it | 1118 // if the selection starts just before a paragraph break, skip over it |
| 1119 if (isEndOfParagraph(visiblePosition)) | 1119 if (isEndOfParagraph(visiblePosition)) |
| 1120 return visiblePosition.next().deepEquivalent().downstream(); | 1120 return visiblePosition.next().deepEquivalent().downstream(); |
| 1121 | 1121 |
| 1122 // otherwise, make sure to be at the start of the first selected node, | 1122 // otherwise, make sure to be at the start of the first selected node, |
| 1123 // instead of possibly at the end of the last node before the selection | 1123 // instead of possibly at the end of the last node before the selection |
| 1124 return visiblePosition.deepEquivalent().downstream(); | 1124 return visiblePosition.deepEquivalent().downstream(); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 } // namespace WebCore | 1127 } // namespace WebCore |
| OLD | NEW |