Chromium Code Reviews| 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 if (root) { | 851 if (root) { |
| 852 selectStartTarget = root->shadowHost(); | 852 selectStartTarget = root->shadowHost(); |
| 853 } else { | 853 } else { |
| 854 root = document->documentElement(); | 854 root = document->documentElement(); |
| 855 selectStartTarget = document->body(); | 855 selectStartTarget = document->body(); |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 if (!root || editingIgnoresContent(root.get())) | 858 if (!root || editingIgnoresContent(root.get())) |
| 859 return; | 859 return; |
| 860 | 860 |
| 861 if (selectStartTarget && selectStartTarget->dispatchEvent(Event::createCance lableBubble(EventTypeNames::selectstart)) != DispatchEventResult::NotCanceled) | 861 if (selectStartTarget) { |
| 862 return; | 862 if (selectStartTarget->dispatchEvent(Event::createCancelableBubble(Event TypeNames::selectstart)) != DispatchEventResult::NotCanceled) |
| 863 return; | |
| 864 // |root| may be detached due to selectstart event. | |
| 865 if (!root->inDocument()) | |
|
yosin_UTC9
2016/03/04 06:06:48
One more thing, we should check |root| still in sa
Xiaocheng
2016/03/04 06:30:35
Done.
| |
| 866 return; | |
| 867 } | |
| 863 | 868 |
| 864 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode( root.get())); | 869 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode( root.get())); |
| 865 setSelection(newSelection); | 870 setSelection(newSelection); |
| 866 selectFrameElementInParentIfFullySelected(); | 871 selectFrameElementInParentIfFullySelected(); |
| 867 notifyLayoutObjectOfSelectionChange(UserTriggered); | 872 notifyLayoutObjectOfSelectionChange(UserTriggered); |
| 868 } | 873 } |
| 869 | 874 |
| 870 bool FrameSelection::setSelectedRange(Range* range, TextAffinity affinity, Selec tionDirectionalMode directional, SetSelectionOptions options) | 875 bool FrameSelection::setSelectedRange(Range* range, TextAffinity affinity, Selec tionDirectionalMode directional, SetSelectionOptions options) |
| 871 { | 876 { |
| 872 if (!range || !range->inDocument()) | 877 if (!range || !range->inDocument()) |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1410 | 1415 |
| 1411 void showTree(const blink::FrameSelection* sel) | 1416 void showTree(const blink::FrameSelection* sel) |
| 1412 { | 1417 { |
| 1413 if (sel) | 1418 if (sel) |
| 1414 sel->showTreeForThis(); | 1419 sel->showTreeForThis(); |
| 1415 else | 1420 else |
| 1416 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 1421 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
| 1417 } | 1422 } |
| 1418 | 1423 |
| 1419 #endif | 1424 #endif |
| OLD | NEW |