| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool IsNodeFullyContained(const EphemeralRange& range, Node& node) { | 326 bool IsNodeFullyContained(const EphemeralRange& range, Node& node) { |
| 327 if (range.IsNull()) | 327 if (range.IsNull()) |
| 328 return false; | 328 return false; |
| 329 | 329 |
| 330 if (!NodeTraversal::CommonAncestor(*range.StartPosition().AnchorNode(), node)) | 330 if (!NodeTraversal::CommonAncestor(*range.StartPosition().AnchorNode(), node)) |
| 331 return false; | 331 return false; |
| 332 | 332 |
| 333 return range.StartPosition() <= Position::BeforeNode(node) && | 333 return range.StartPosition() <= Position::BeforeNode(node) && |
| 334 Position::AfterNode(&node) <= range.EndPosition(); | 334 Position::AfterNode(node) <= range.EndPosition(); |
| 335 } | 335 } |
| 336 | 336 |
| 337 // TODO(editing-dev): We should implement real version which refers | 337 // TODO(editing-dev): We should implement real version which refers |
| 338 // "user-select" CSS property. | 338 // "user-select" CSS property. |
| 339 // TODO(editing-dev): We should make |SelectionAdjuster| to use this funciton | 339 // TODO(editing-dev): We should make |SelectionAdjuster| to use this funciton |
| 340 // instead of |isSelectionBondary()|. | 340 // instead of |isSelectionBondary()|. |
| 341 bool IsUserSelectContain(const Node& node) { | 341 bool IsUserSelectContain(const Node& node) { |
| 342 return isHTMLTextAreaElement(node) || isHTMLInputElement(node) || | 342 return isHTMLTextAreaElement(node) || isHTMLInputElement(node) || |
| 343 isHTMLSelectElement(node); | 343 isHTMLSelectElement(node); |
| 344 } | 344 } |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 return PositionTemplate<Strategy>::FirstPositionInNode(&highest_root); | 660 return PositionTemplate<Strategy>::FirstPositionInNode(&highest_root); |
| 661 | 661 |
| 662 PositionTemplate<Strategy> editable_position = position; | 662 PositionTemplate<Strategy> editable_position = position; |
| 663 | 663 |
| 664 if (position.AnchorNode()->GetTreeScope() != highest_root.GetTreeScope()) { | 664 if (position.AnchorNode()->GetTreeScope() != highest_root.GetTreeScope()) { |
| 665 Node* shadow_ancestor = highest_root.GetTreeScope().AncestorInThisScope( | 665 Node* shadow_ancestor = highest_root.GetTreeScope().AncestorInThisScope( |
| 666 editable_position.AnchorNode()); | 666 editable_position.AnchorNode()); |
| 667 if (!shadow_ancestor) | 667 if (!shadow_ancestor) |
| 668 return PositionTemplate<Strategy>(); | 668 return PositionTemplate<Strategy>(); |
| 669 | 669 |
| 670 editable_position = PositionTemplate<Strategy>::AfterNode(shadow_ancestor); | 670 editable_position = PositionTemplate<Strategy>::AfterNode(*shadow_ancestor); |
| 671 } | 671 } |
| 672 | 672 |
| 673 Node* non_editable_node = nullptr; | 673 Node* non_editable_node = nullptr; |
| 674 while (editable_position.AnchorNode() && | 674 while (editable_position.AnchorNode() && |
| 675 !IsEditablePosition(editable_position) && | 675 !IsEditablePosition(editable_position) && |
| 676 editable_position.AnchorNode()->IsDescendantOf(&highest_root)) { | 676 editable_position.AnchorNode()->IsDescendantOf(&highest_root)) { |
| 677 non_editable_node = editable_position.AnchorNode(); | 677 non_editable_node = editable_position.AnchorNode(); |
| 678 editable_position = IsAtomicNode(editable_position.AnchorNode()) | 678 editable_position = IsAtomicNode(editable_position.AnchorNode()) |
| 679 ? PositionTemplate<Strategy>::InParentAfterNode( | 679 ? PositionTemplate<Strategy>::InParentAfterNode( |
| 680 *editable_position.AnchorNode()) | 680 *editable_position.AnchorNode()) |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 return InputType::kDeleteSoftLineBackward; | 2179 return InputType::kDeleteSoftLineBackward; |
| 2180 if (granularity == kParagraphBoundary) | 2180 if (granularity == kParagraphBoundary) |
| 2181 return InputType::kDeleteHardLineBackward; | 2181 return InputType::kDeleteHardLineBackward; |
| 2182 return InputType::kDeleteContentBackward; | 2182 return InputType::kDeleteContentBackward; |
| 2183 default: | 2183 default: |
| 2184 return InputType::kNone; | 2184 return InputType::kNone; |
| 2185 } | 2185 } |
| 2186 } | 2186 } |
| 2187 | 2187 |
| 2188 } // namespace blink | 2188 } // namespace blink |
| OLD | NEW |