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

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

Issue 2121313003: [Editing][DOM][CodeHealth] Make Node::isContentEditable and Node::isRichEditable global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 static Image* getImage(Element* element) 711 static Image* getImage(Element* element)
712 { 712 {
713 ASSERT(element); 713 ASSERT(element);
714 ImageResource* cachedImage = getImageResource(element); 714 ImageResource* cachedImage = getImageResource(element);
715 return (cachedImage && !cachedImage->errorOccurred()) ? 715 return (cachedImage && !cachedImage->errorOccurred()) ?
716 cachedImage->getImage() : nullptr; 716 cachedImage->getImage() : nullptr;
717 } 717 }
718 718
719 static void prepareDataTransferForImageDrag(LocalFrame* source, DataTransfer* da taTransfer, Element* node, const KURL& linkURL, const KURL& imageURL, const Stri ng& label) 719 static void prepareDataTransferForImageDrag(LocalFrame* source, DataTransfer* da taTransfer, Element* node, const KURL& linkURL, const KURL& imageURL, const Stri ng& label)
720 { 720 {
721 if (node->isContentRichlyEditable()) { 721 if (isContentRichlyEditable(*node)) {
722 Range* range = source->document()->createRange(); 722 Range* range = source->document()->createRange();
723 range->selectNode(node, ASSERT_NO_EXCEPTION); 723 range->selectNode(node, ASSERT_NO_EXCEPTION);
724 source->selection().setSelection(VisibleSelection(EphemeralRange(range)) ); 724 source->selection().setSelection(VisibleSelection(EphemeralRange(range)) );
725 } 725 }
726 dataTransfer->declareAndWriteDragImage(node, !linkURL.isEmpty() ? linkURL : imageURL, label); 726 dataTransfer->declareAndWriteDragImage(node, !linkURL.isEmpty() ? linkURL : imageURL, label);
727 } 727 }
728 728
729 bool DragController::populateDragDataTransfer(LocalFrame* src, const DragState& state, const IntPoint& dragOrigin) 729 bool DragController::populateDragDataTransfer(LocalFrame* src, const DragState& state, const IntPoint& dragOrigin)
730 { 730 {
731 ASSERT(dragTypeIsValid(state.m_dragType)); 731 ASSERT(dragTypeIsValid(state.m_dragType));
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 996
997 DEFINE_TRACE(DragController) 997 DEFINE_TRACE(DragController)
998 { 998 {
999 visitor->trace(m_page); 999 visitor->trace(m_page);
1000 visitor->trace(m_documentUnderMouse); 1000 visitor->trace(m_documentUnderMouse);
1001 visitor->trace(m_dragInitiator); 1001 visitor->trace(m_dragInitiator);
1002 visitor->trace(m_fileInputElementUnderMouse); 1002 visitor->trace(m_fileInputElementUnderMouse);
1003 } 1003 }
1004 1004
1005 } // namespace blink 1005 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698