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

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

Issue 2848993002: Make FrameSelection::SelectAll bail if 'selectstart' detaches frame (Closed)
Patch Set: Created 3 years, 7 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 | « third_party/WebKit/LayoutTests/editing/selection/selectstart_detaches_frame.html ('k') | 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 } 651 }
652 } 652 }
653 if (!root || EditingIgnoresContent(*root)) 653 if (!root || EditingIgnoresContent(*root))
654 return; 654 return;
655 655
656 if (select_start_target) { 656 if (select_start_target) {
657 const Document& expected_document = GetDocument(); 657 const Document& expected_document = GetDocument();
658 if (select_start_target->DispatchEvent(Event::CreateCancelableBubble( 658 if (select_start_target->DispatchEvent(Event::CreateCancelableBubble(
659 EventTypeNames::selectstart)) != DispatchEventResult::kNotCanceled) 659 EventTypeNames::selectstart)) != DispatchEventResult::kNotCanceled)
660 return; 660 return;
661 // The frame may be detached due to selectstart event.
662 if (!IsAvailable()) {
663 // Reached by editing/selection/selectstart_detach_frame.html
664 return;
665 }
661 // |root| may be detached due to selectstart event. 666 // |root| may be detached due to selectstart event.
662 if (!root->isConnected() || expected_document != root->GetDocument()) 667 if (!root->isConnected() || expected_document != root->GetDocument())
663 return; 668 return;
664 } 669 }
665 670
666 SetSelection(SelectionInDOMTree::Builder() 671 SetSelection(SelectionInDOMTree::Builder()
667 .SelectAllChildren(*root) 672 .SelectAllChildren(*root)
668 .SetIsHandleVisible(IsHandleVisible()) 673 .SetIsHandleVisible(IsHandleVisible())
669 .Build()); 674 .Build());
670 SelectFrameElementInParentIfFullySelected(); 675 SelectFrameElementInParentIfFullySelected();
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 } 1185 }
1181 1186
1182 void showTree(const blink::FrameSelection* sel) { 1187 void showTree(const blink::FrameSelection* sel) {
1183 if (sel) 1188 if (sel)
1184 sel->ShowTreeForThis(); 1189 sel->ShowTreeForThis();
1185 else 1190 else
1186 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1191 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1187 } 1192 }
1188 1193
1189 #endif 1194 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/selectstart_detaches_frame.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698