| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // TODO(editing-dev): Should we pass in user_triggered? | 717 // TODO(editing-dev): Should we pass in user_triggered? |
| 718 SetSelection(SelectionInDOMTree::Builder() | 718 SetSelection(SelectionInDOMTree::Builder() |
| 719 .SelectAllChildren(*root) | 719 .SelectAllChildren(*root) |
| 720 .SetIsHandleVisible(IsHandleVisible()) | 720 .SetIsHandleVisible(IsHandleVisible()) |
| 721 .Build()); | 721 .Build()); |
| 722 SelectFrameElementInParentIfFullySelected(); | 722 SelectFrameElementInParentIfFullySelected(); |
| 723 // TODO(editing-dev): Should we pass in user_triggered? | 723 // TODO(editing-dev): Should we pass in user_triggered? |
| 724 NotifyTextControlOfSelectionChange(kUserTriggered); | 724 NotifyTextControlOfSelectionChange(kUserTriggered); |
| 725 } | 725 } |
| 726 | 726 |
| 727 bool FrameSelection::SetSelectedRange(const EphemeralRange& range, | |
| 728 TextAffinity affinity, | |
| 729 SelectionDirectionalMode directional, | |
| 730 SetSelectionOptions options) { | |
| 731 if (range.IsNull()) | |
| 732 return false; | |
| 733 SetSelection(SelectionInDOMTree::Builder() | |
| 734 .SetBaseAndExtent(range) | |
| 735 .SetAffinity(affinity) | |
| 736 .SetIsDirectional(directional == | |
| 737 SelectionDirectionalMode::kDirectional) | |
| 738 .Build(), | |
| 739 options); | |
| 740 return true; | |
| 741 } | |
| 742 | |
| 743 void FrameSelection::NotifyAccessibilityForSelectionChange() { | 727 void FrameSelection::NotifyAccessibilityForSelectionChange() { |
| 744 if (GetSelectionInDOMTree().IsNone()) | 728 if (GetSelectionInDOMTree().IsNone()) |
| 745 return; | 729 return; |
| 746 AXObjectCache* cache = GetDocument().ExistingAXObjectCache(); | 730 AXObjectCache* cache = GetDocument().ExistingAXObjectCache(); |
| 747 if (!cache) | 731 if (!cache) |
| 748 return; | 732 return; |
| 749 const Position& start = GetSelectionInDOMTree().ComputeStartPosition(); | 733 const Position& start = GetSelectionInDOMTree().ComputeStartPosition(); |
| 750 cache->SelectionChanged(start.ComputeContainerNode()); | 734 cache->SelectionChanged(start.ComputeContainerNode()); |
| 751 } | 735 } |
| 752 | 736 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 } | 1174 } |
| 1191 | 1175 |
| 1192 void showTree(const blink::FrameSelection* sel) { | 1176 void showTree(const blink::FrameSelection* sel) { |
| 1193 if (sel) | 1177 if (sel) |
| 1194 sel->ShowTreeForThis(); | 1178 sel->ShowTreeForThis(); |
| 1195 else | 1179 else |
| 1196 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1180 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1197 } | 1181 } |
| 1198 | 1182 |
| 1199 #endif | 1183 #endif |
| OLD | NEW |