Chromium Code Reviews| 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 Position nextPositionOf(const Position& position, PositionMoveType moveType) | 617 Position nextPositionOf(const Position& position, PositionMoveType moveType) |
| 618 { | 618 { |
| 619 return nextPositionOfAlgorithm<EditingStrategy>(position, moveType); | 619 return nextPositionOfAlgorithm<EditingStrategy>(position, moveType); |
| 620 } | 620 } |
| 621 | 621 |
| 622 PositionInComposedTree nextPositionOf(const PositionInComposedTree& position, Po sitionMoveType moveType) | 622 PositionInComposedTree nextPositionOf(const PositionInComposedTree& position, Po sitionMoveType moveType) |
| 623 { | 623 { |
| 624 return nextPositionOfAlgorithm<EditingInComposedTreeStrategy>(position, move Type); | 624 return nextPositionOfAlgorithm<EditingInComposedTreeStrategy>(position, move Type); |
| 625 } | 625 } |
| 626 | 626 |
| 627 // FIXME: The method name, comment, and code say three different things here! | 627 bool isEnclosingBlock(const Node* node) |
| 628 // Whether or not content before and after this node will collapse onto the same line as it. | |
| 629 bool isBlock(const Node* node) | |
| 630 { | 628 { |
| 631 return node && node->layoutObject() && !node->layoutObject()->isInline() && !node->layoutObject()->isRubyText(); | 629 return node && node->layoutObject() && !node->layoutObject()->isInline() && !node->layoutObject()->isRubyText(); |
| 632 } | 630 } |
| 633 | 631 |
| 634 bool isInline(const Node* node) | 632 bool isInline(const Node* node) |
| 635 { | 633 { |
| 636 return node && node->layoutObject() && node->layoutObject()->isInline(); | 634 return node && node->layoutObject() && node->layoutObject()->isInline(); |
| 637 } | 635 } |
| 638 | 636 |
| 639 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlo ckFlowOrTableElement are used. | 637 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlo ckFlowOrTableElement are used. |
| 640 // FIXME: Pass a position to this function. The enclosing block of [table, x] fo r example, should be the | 638 // FIXME: Pass a position to this function. The enclosing block of [table, x] fo r example, should be the |
| 641 // block that contains the table and not the table, and this function should be the only one responsible for | 639 // block that contains the table and not the table, and this function should be the only one responsible for |
| 642 // knowing about these kinds of special cases. | 640 // knowing about these kinds of special cases. |
| 643 Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule) | 641 Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule) |
| 644 { | 642 { |
| 645 Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node), isBlock, rule); | 643 Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node), isEnclosingBlock, rule); |
| 646 return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosing Node) : 0; | 644 return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosing Node) : 0; |
|
hajimehoshi
2015/08/26 07:21:48
nit: nullptr
yosin_UTC9
2015/08/26 07:35:53
Done.
| |
| 647 } | 645 } |
| 648 | 646 |
| 649 Element* enclosingBlockFlowElement(Node& node) | 647 Element* enclosingBlockFlowElement(Node& node) |
| 650 { | 648 { |
| 651 if (isBlockFlowElement(node)) | 649 if (isBlockFlowElement(node)) |
| 652 return &toElement(node); | 650 return &toElement(node); |
| 653 | 651 |
| 654 for (Node* n = node.parentNode(); n; n = n->parentNode()) { | 652 for (Node* n = node.parentNode(); n; n = n->parentNode()) { |
| 655 if (isBlockFlowElement(*n) || isHTMLBodyElement(*n)) | 653 if (isBlockFlowElement(*n) || isHTMLBodyElement(*n)) |
| 656 return toElement(n); | 654 return toElement(n); |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1577 // if the selection starts just before a paragraph break, skip over it | 1575 // if the selection starts just before a paragraph break, skip over it |
| 1578 if (isEndOfParagraph(visiblePosition)) | 1576 if (isEndOfParagraph(visiblePosition)) |
| 1579 return mostForwardCaretPosition(visiblePosition.next().deepEquivalent()) ; | 1577 return mostForwardCaretPosition(visiblePosition.next().deepEquivalent()) ; |
| 1580 | 1578 |
| 1581 // otherwise, make sure to be at the start of the first selected node, | 1579 // otherwise, make sure to be at the start of the first selected node, |
| 1582 // instead of possibly at the end of the last node before the selection | 1580 // instead of possibly at the end of the last node before the selection |
| 1583 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1581 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
| 1584 } | 1582 } |
| 1585 | 1583 |
| 1586 } // namespace blink | 1584 } // namespace blink |
| OLD | NEW |