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

Side by Side Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-08T18:08:39 Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Google Inc. 3 * Copyright (C) 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 return fileInput->receiveDroppedFiles(dragData); 484 return fileInput->receiveDroppedFiles(dragData);
485 } 485 }
486 486
487 if (!m_page->dragController().canProcessDrag(dragData)) { 487 if (!m_page->dragController().canProcessDrag(dragData)) {
488 m_page->dragCaretController().clear(); 488 m_page->dragCaretController().clear();
489 return false; 489 return false;
490 } 490 }
491 491
492 VisibleSelection dragCaret(m_page->dragCaretController().caretPosition()); 492 VisibleSelection dragCaret(m_page->dragCaretController().caretPosition());
493 m_page->dragCaretController().clear(); 493 m_page->dragCaretController().clear();
494 // |innerFrame| can be removed by event handler called by
495 // |dispatchTextInputEventFor()|.
496 if (!innerFrame->selection().isAvailable()) {
497 // "editing/pasteboard/drop-text-events-sideeffect-crash.html" reaches
498 // here.
499 return false;
500 }
494 Range* range = createRange(dragCaret.toNormalizedEphemeralRange()); 501 Range* range = createRange(dragCaret.toNormalizedEphemeralRange());
495 Element* rootEditableElement = innerFrame->selection().rootEditableElement() ; 502 Element* rootEditableElement = innerFrame->selection().rootEditableElement() ;
496 503
497 // For range to be null a WebKit client must have done something bad while 504 // For range to be null a WebKit client must have done something bad while
498 // manually controlling drag behaviour 505 // manually controlling drag behaviour
499 if (!range) 506 if (!range)
500 return false; 507 return false;
501 ResourceFetcher* fetcher = range->ownerDocument().fetcher(); 508 ResourceFetcher* fetcher = range->ownerDocument().fetcher();
502 ResourceCacheValidationSuppressor validationSuppressor(fetcher); 509 ResourceCacheValidationSuppressor validationSuppressor(fetcher);
503 if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRich lyEditable()) { 510 if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRich lyEditable()) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 999
993 DEFINE_TRACE(DragController) 1000 DEFINE_TRACE(DragController)
994 { 1001 {
995 visitor->trace(m_page); 1002 visitor->trace(m_page);
996 visitor->trace(m_documentUnderMouse); 1003 visitor->trace(m_documentUnderMouse);
997 visitor->trace(m_dragInitiator); 1004 visitor->trace(m_dragInitiator);
998 visitor->trace(m_fileInputElementUnderMouse); 1005 visitor->trace(m_fileInputElementUnderMouse);
999 } 1006 }
1000 1007
1001 } // namespace blink 1008 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698