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

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

Issue 2430253003: Get rid of createVisibleSelection() to take EphemeralRange (Closed)
Patch Set: 2016-10-20T14:03:19 Created 4 years, 2 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 831 }
832 832
833 static void prepareDataTransferForImageDrag(LocalFrame* source, 833 static void prepareDataTransferForImageDrag(LocalFrame* source,
834 DataTransfer* dataTransfer, 834 DataTransfer* dataTransfer,
835 Element* node, 835 Element* node,
836 const KURL& linkURL, 836 const KURL& linkURL,
837 const KURL& imageURL, 837 const KURL& imageURL,
838 const String& label) { 838 const String& label) {
839 node->document().updateStyleAndLayoutTree(); 839 node->document().updateStyleAndLayoutTree();
840 if (hasRichlyEditableStyle(*node)) { 840 if (hasRichlyEditableStyle(*node)) {
841 // TODO(editing-dev): We should use |EphemeralRange| instead of |Range|.
841 Range* range = source->document()->createRange(); 842 Range* range = source->document()->createRange();
842 range->selectNode(node, ASSERT_NO_EXCEPTION); 843 range->selectNode(node, ASSERT_NO_EXCEPTION);
843 source->selection().setSelection( 844 source->selection().setSelection(
844 createVisibleSelection(EphemeralRange(range))); 845 SelectionInDOMTree::Builder()
846 .setBaseAndExtent(EphemeralRange(range))
847 .build());
845 } 848 }
846 dataTransfer->declareAndWriteDragImage( 849 dataTransfer->declareAndWriteDragImage(
847 node, !linkURL.isEmpty() ? linkURL : imageURL, label); 850 node, !linkURL.isEmpty() ? linkURL : imageURL, label);
848 } 851 }
849 852
850 bool DragController::populateDragDataTransfer(LocalFrame* src, 853 bool DragController::populateDragDataTransfer(LocalFrame* src,
851 const DragState& state, 854 const DragState& state,
852 const IntPoint& dragOrigin) { 855 const IntPoint& dragOrigin) {
853 #if DCHECK_IS_ON() 856 #if DCHECK_IS_ON()
854 DCHECK(dragTypeIsValid(state.m_dragType)); 857 DCHECK(dragTypeIsValid(state.m_dragType));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 } 1190 }
1188 1191
1189 DEFINE_TRACE(DragController) { 1192 DEFINE_TRACE(DragController) {
1190 visitor->trace(m_page); 1193 visitor->trace(m_page);
1191 visitor->trace(m_documentUnderMouse); 1194 visitor->trace(m_documentUnderMouse);
1192 visitor->trace(m_dragInitiator); 1195 visitor->trace(m_dragInitiator);
1193 visitor->trace(m_fileInputElementUnderMouse); 1196 visitor->trace(m_fileInputElementUnderMouse);
1194 } 1197 }
1195 1198
1196 } // namespace blink 1199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698