Changeset 174314 in webkit
- Timestamp:
- Oct 4, 2014 1:37:57 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r174313 r174314 1 2014-10-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Move DragController::createFragmentFromDragData implementation to the editor 4 https://bugs.webkit.org/show_bug.cgi?id=136819 5 6 Reviewed by Darin Adler. 7 8 Make Editor::webContentFromPasteboard() common to all ports and 9 add a implementation for every port. 10 11 * PlatformWin.cmake: Add new files to compilation. 12 * WebCore.vcxproj/WebCore.vcxproj: Ditto. 13 * editing/Editor.cpp: 14 (WebCore::Editor::pasteWithPasteboard): Move to EditorWin.cpp 15 since this is only used by windows port. 16 * editing/Editor.h: 17 * editing/efl/EditorEfl.cpp: 18 (WebCore::Editor::webContentFromPasteboard): 19 * editing/gtk/EditorGtk.cpp: 20 (WebCore::Editor::webContentFromPasteboard): 21 * editing/win/EditorWin.cpp: Added. 22 (WebCore::Editor::pasteWithPasteboard): 23 (WebCore::Editor::webContentFromPasteboard): 24 * page/DragController.cpp: 25 (WebCore::documentFragmentFromDragData): Use the editor instead of 26 createFragmentFromDragData() that has been removed. Also made this 27 method a static funtion again. 28 * page/DragController.h: 29 * page/efl/DragControllerEfl.cpp: Remove createFragmentFromDragData(). 30 * page/gtk/DragControllerGtk.cpp: Ditto. 31 * page/mac/DragControllerMac.mm: Ditto. 32 * page/win/DragControllerWin.cpp: Ditto. 33 * platform/Pasteboard.h: 34 (WebCore::Pasteboard::dragDataMap): Add a getter for m_dragDataMap 35 as required by Editor::webContentFromPasteboard for windows. 36 1 37 2014-10-04 Christophe Dumez <cdumez@apple.com> 2 38 -
trunk/Source/WebCore/PlatformWin.cmake
r172499 r174314 10 10 list(APPEND WebCore_SOURCES 11 11 accessibility/win/AccessibilityObjectWin.cpp 12 13 editing/win/EditorWin.cpp 12 14 13 15 html/HTMLSelectElementWin.cpp -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r174278 r174314 14929 14929 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild> 14930 14930 </ClCompile> 14931 <ClCompile Include="..\editing\win\EditorWin.cpp"/> 14931 14932 <ClCompile Include="..\fileapi\AsyncFileStream.cpp" /> 14932 14933 <ClCompile Include="..\html\BaseButtonInputType.cpp" /> -
trunk/Source/WebCore/editing/Editor.cpp
r174225 r174314 561 561 #endif 562 562 563 #if !PLATFORM(COCOA) && !PLATFORM(EFL) && !PLATFORM(GTK)564 void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, MailBlockquoteHandling mailBlockquoteHandling)565 {566 RefPtr<Range> range = selectedRange();567 if (!range)568 return;569 570 bool chosePlainText;571 RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, *range, allowPlainText, chosePlainText);572 if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))573 pasteAsFragment(fragment, canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, mailBlockquoteHandling);574 }575 #endif576 577 563 bool Editor::canSmartReplaceWithPasteboard(Pasteboard& pasteboard) 578 564 { -
trunk/Source/WebCore/editing/Editor.h
r173687 r174314 427 427 #endif 428 428 429 PassRefPtr<DocumentFragment> webContentFromPasteboard(Pasteboard&, Range& context, bool allowPlainText, bool& chosePlainText); 430 429 431 #if PLATFORM(COCOA) 430 432 WEBCORE_EXPORT static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove); … … 434 436 WEBCORE_EXPORT String stringSelectionForPasteboard(); 435 437 String stringSelectionForPasteboardWithImageAltText(); 436 PassRefPtr<DocumentFragment> webContentFromPasteboard(Pasteboard&, Range& context, bool allowPlainText, bool& chosePlainText);437 438 #if !PLATFORM(IOS) 438 439 bool canCopyExcludingStandaloneImages(); -
trunk/Source/WebCore/editing/efl/EditorEfl.cpp
r168650 r174314 28 28 #include "Editor.h" 29 29 30 #include "DocumentFragment.h" 30 31 #include "NotImplemented.h" 31 32 #include "Pasteboard.h" 33 #include <wtf/PassRefPtr.h> 32 34 33 35 namespace WebCore { … … 48 50 } 49 51 52 PassRefPtr<DocumentFragment> Editor::webContentFromPasteboard(Pasteboard&, Range&, bool /*allowPlainText*/, bool& /*chosePlainText*/) 53 { 54 return nullptr; 55 } 56 50 57 } // namespace WebCore -
trunk/Source/WebCore/editing/gtk/EditorGtk.cpp
r173932 r174314 130 130 } 131 131 132 PassRefPtr<DocumentFragment> Editor::webContentFromPasteboard(Pasteboard& pasteboard, Range& context, bool allowPlainText, bool& chosePlainText) 133 { 134 return createFragmentFromPasteboardData(pasteboard, m_frame, context, allowPlainText, chosePlainText); 135 } 136 132 137 } // namespace WebCore -
trunk/Source/WebCore/page/DragController.cpp
r174225 r174314 115 115 } 116 116 117 PassRefPtr<DocumentFragment> DragController::documentFragmentFromDragData(DragData& dragData, Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText)117 static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData& dragData, Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText) 118 118 { 119 119 chosePlainText = false; … … 121 121 Document& document = context.ownerDocument(); 122 122 if (dragData.containsCompatibleContent()) { 123 if (PassRefPtr<DocumentFragment> fragment = createFragmentFromDragData(dragData, frame, context, allowPlainText, chosePlainText))123 if (PassRefPtr<DocumentFragment> fragment = frame.editor().webContentFromPasteboard(*Pasteboard::createForDragAndDrop(dragData), context, allowPlainText, chosePlainText)) 124 124 return fragment; 125 125 -
trunk/Source/WebCore/page/DragController.h
r173686 r174314 116 116 void declareAndWriteDragImage(DataTransfer&, Element&, const URL&, const String& label); 117 117 118 // FIXME: Move createFragmentFromDragData implementation to the Editor and make documentFragmentFromDragData a static function again.119 static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData&, Frame&, Range&, bool allowPlainText, bool& chosePlainText);120 static PassRefPtr<DocumentFragment> createFragmentFromDragData(DragData&, Frame&, Range&, bool allowPlainText, bool& chosePlainText);121 122 118 Page& m_page; 123 119 DragClient& m_client; -
trunk/Source/WebCore/page/efl/DragControllerEfl.cpp
r173686 r174314 74 74 } 75 75 76 PassRefPtr<DocumentFragment> DragController::createFragmentFromDragData(DragData&, Frame&, Range&, bool /*allowPlainText*/, bool& /*chosePlainText*/)77 {78 return nullptr;79 76 } 80 81 } -
trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp
r173687 r174314 82 82 } 83 83 84 PassRefPtr<DocumentFragment> DragController::createFragmentFromDragData(DragData& dragData, Frame& frame, Range&, bool /*allowPlainText*/, bool& /*chosePlainText*/)85 {86 if (!dragData.platformData()->hasMarkup() || !frame.document())87 return nullptr;88 89 return createFragmentFromMarkup(*frame.document(), dragData.platformData()->markup(), "");90 84 } 91 92 } -
trunk/Source/WebCore/page/mac/DragControllerMac.mm
r173686 r174314 93 93 } 94 94 95 PassRefPtr<DocumentFragment> DragController::createFragmentFromDragData(DragData& dragData, Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText)96 {97 Pasteboard pasteboard(dragData.pasteboardName());98 return frame.editor().webContentFromPasteboard(pasteboard, context, allowPlainText, chosePlainText);99 }100 101 95 } // namespace WebCore 102 96 -
trunk/Source/WebCore/page/win/DragControllerWin.cpp
r173686 r174314 27 27 #include "DragController.h" 28 28 29 #include "ClipboardUtilitiesWin.h"30 29 #include "DataTransfer.h" 31 30 #include "Document.h" 32 #include "DocumentFragment.h"33 31 #include "DragData.h" 34 32 #include "Element.h" 35 #include "Frame.h"36 #include "FrameSelection.h"37 33 #include "Pasteboard.h" 38 34 #include "markup.h" … … 88 84 } 89 85 90 template <typename PlatformDragData>91 static PassRefPtr<DocumentFragment> createFragmentFromPlatformData(PlatformDragData* platformDragData, Frame& frame)92 {93 if (containsFilenames(platformDragData)) {94 if (PassRefPtr<DocumentFragment> fragment = fragmentFromFilenames(frame.document(), platformDragData))95 return fragment;96 }97 98 if (containsHTML(platformDragData)) {99 if (PassRefPtr<DocumentFragment> fragment = fragmentFromHTML(frame.document(), platformDragData))100 return fragment;101 }102 return nullptr;103 86 } 104 105 PassRefPtr<DocumentFragment> DragController::createFragmentFromDragData(DragData& dragData, Frame& frame, Range&, bool /*allowPlainText*/, bool& /*chosePlainText*/)106 {107 if (DragDataRef platformDragData = dragData.platformData())108 return createFragmentFromPlatformData(platformDragData, frame);109 110 return createFragmentFromPlatformData(&dragData.dragDataMap(), frame);111 }112 113 } -
trunk/Source/WebCore/platform/Pasteboard.h
r173687 r174314 203 203 COMPtr<IDataObject> dataObject() const { return m_dataObject; } 204 204 void setExternalDataObject(IDataObject*); 205 const DragDataMap& dragDataMap() const { return m_dragDataMap; } 205 206 void writeURLToWritableDataObject(const URL&, const String&); 206 207 COMPtr<WCDataObject> writableDataObject() const { return m_writableDataObject; }
Note: See TracChangeset
for help on using the changeset viewer.