Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 1768483002: FrameSelection::selectAll() should not call selectionFromContentsOfNode() with detached node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() || root->document() != document)
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698