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