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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 bool isInline(const Node* node) | 304 bool isInline(const Node* node) |
305 { | 305 { |
306 return node && node->renderer() && node->renderer()->isInline(); | 306 return node && node->renderer() && node->renderer()->isInline(); |
307 } | 307 } |
308 | 308 |
309 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlo
ckFlowOrTableElement are used. | 309 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlo
ckFlowOrTableElement are used. |
310 // FIXME: Pass a position to this function. The enclosing block of [table, x] f
or example, should be the | 310 // FIXME: Pass a position to this function. The enclosing block of [table, x] f
or example, should be the |
311 // block that contains the table and not the table, and this function should be
the only one responsible for | 311 // block that contains the table and not the table, and this function should be
the only one responsible for |
312 // knowing about these kinds of special cases. | 312 // knowing about these kinds of special cases. |
313 Node* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule) | 313 Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule) |
314 { | 314 { |
315 return static_cast<Element*>(enclosingNodeOfType(firstPositionInOrBeforeNode
(node), isBlock, rule)); | 315 Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node),
isBlock, rule); |
| 316 return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosing
Node) : 0; |
316 } | 317 } |
317 | 318 |
318 TextDirection directionOfEnclosingBlock(const Position& position) | 319 TextDirection directionOfEnclosingBlock(const Position& position) |
319 { | 320 { |
320 Node* enclosingBlockNode = enclosingBlock(position.containerNode()); | 321 Node* enclosingBlockNode = enclosingBlock(position.containerNode()); |
321 if (!enclosingBlockNode) | 322 if (!enclosingBlockNode) |
322 return LTR; | 323 return LTR; |
323 RenderObject* renderer = enclosingBlockNode->renderer(); | 324 RenderObject* renderer = enclosingBlockNode->renderer(); |
324 return renderer ? renderer->style()->direction() : LTR; | 325 return renderer ? renderer->style()->direction() : LTR; |
325 } | 326 } |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 // if the selection starts just before a paragraph break, skip over it | 1254 // if the selection starts just before a paragraph break, skip over it |
1254 if (isEndOfParagraph(visiblePosition)) | 1255 if (isEndOfParagraph(visiblePosition)) |
1255 return visiblePosition.next().deepEquivalent().downstream(); | 1256 return visiblePosition.next().deepEquivalent().downstream(); |
1256 | 1257 |
1257 // otherwise, make sure to be at the start of the first selected node, | 1258 // otherwise, make sure to be at the start of the first selected node, |
1258 // instead of possibly at the end of the last node before the selection | 1259 // instead of possibly at the end of the last node before the selection |
1259 return visiblePosition.deepEquivalent().downstream(); | 1260 return visiblePosition.deepEquivalent().downstream(); |
1260 } | 1261 } |
1261 | 1262 |
1262 } // namespace WebCore | 1263 } // namespace WebCore |
OLD | NEW |