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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 { | 686 { |
| 687 return RuntimeEnabledFeatures::userSelectAllEnabled() && node && node->layou tObject() && node->layoutObject()->style()->userSelect() == SELECT_ALL; | 687 return RuntimeEnabledFeatures::userSelectAllEnabled() && node && node->layou tObject() && node->layoutObject()->style()->userSelect() == SELECT_ALL; |
| 688 | 688 |
| 689 } | 689 } |
| 690 | 690 |
| 691 bool nodeIsUserSelectNone(Node* node) | 691 bool nodeIsUserSelectNone(Node* node) |
| 692 { | 692 { |
| 693 return node && node->layoutObject() && !node->layoutObject()->isSelectable() ; | 693 return node && node->layoutObject() && !node->layoutObject()->isSelectable() ; |
| 694 } | 694 } |
| 695 | 695 |
| 696 TextDirection directionOfEnclosingBlock(const Position& position) | 696 template <typename Strategy> |
| 697 TextDirection directionOfEnclosingBlockAlgorithm(const PositionAlgorithm<Strateg y>& position) | |
| 697 { | 698 { |
| 698 Element* enclosingBlockElement = enclosingBlock(position.computeContainerNod e()); | 699 Element* enclosingBlockElement = enclosingBlock(PositionAlgorithm<Strategy>: :firstPositionInOrBeforeNode(position.computeContainerNode()), CannotCrossEditin gBoundary); |
|
yoichio
2015/08/28 05:55:23
enclosingBlock has DOM/InComposition overrides so
yosin_UTC9
2015/08/28 06:22:58
PS#1 does |enclosingBlock(position)|, however as y
| |
| 699 if (!enclosingBlockElement) | 700 if (!enclosingBlockElement) |
| 700 return LTR; | 701 return LTR; |
| 701 LayoutObject* layoutObject = enclosingBlockElement->layoutObject(); | 702 LayoutObject* layoutObject = enclosingBlockElement->layoutObject(); |
| 702 return layoutObject ? layoutObject->style()->direction() : LTR; | 703 return layoutObject ? layoutObject->style()->direction() : LTR; |
| 703 } | 704 } |
| 704 | 705 |
| 706 TextDirection directionOfEnclosingBlock(const Position& position) | |
| 707 { | |
| 708 return directionOfEnclosingBlockAlgorithm<EditingStrategy>(position); | |
| 709 } | |
| 710 | |
| 711 TextDirection directionOfEnclosingBlock(const PositionInComposedTree& position) | |
| 712 { | |
| 713 return directionOfEnclosingBlockAlgorithm<EditingInComposedTreeStrategy>(pos ition); | |
| 714 } | |
| 715 | |
| 705 TextDirection primaryDirectionOf(const Node& node) | 716 TextDirection primaryDirectionOf(const Node& node) |
| 706 { | 717 { |
| 707 TextDirection primaryDirection = LTR; | 718 TextDirection primaryDirection = LTR; |
| 708 for (const LayoutObject* r = node.layoutObject(); r; r = r->parent()) { | 719 for (const LayoutObject* r = node.layoutObject(); r; r = r->parent()) { |
| 709 if (r->isLayoutBlockFlow()) { | 720 if (r->isLayoutBlockFlow()) { |
| 710 primaryDirection = r->style()->direction(); | 721 primaryDirection = r->style()->direction(); |
| 711 break; | 722 break; |
| 712 } | 723 } |
| 713 } | 724 } |
| 714 | 725 |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1596 // if the selection starts just before a paragraph break, skip over it | 1607 // if the selection starts just before a paragraph break, skip over it |
| 1597 if (isEndOfParagraph(visiblePosition)) | 1608 if (isEndOfParagraph(visiblePosition)) |
| 1598 return mostForwardCaretPosition(visiblePosition.next().deepEquivalent()) ; | 1609 return mostForwardCaretPosition(visiblePosition.next().deepEquivalent()) ; |
| 1599 | 1610 |
| 1600 // otherwise, make sure to be at the start of the first selected node, | 1611 // otherwise, make sure to be at the start of the first selected node, |
| 1601 // instead of possibly at the end of the last node before the selection | 1612 // instead of possibly at the end of the last node before the selection |
| 1602 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1613 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
| 1603 } | 1614 } |
| 1604 | 1615 |
| 1605 } // namespace blink | 1616 } // namespace blink |
| OLD | NEW |