[EFL] Get rid of layering violations in PasteboardEfl.cpp
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2013 19:23:15 +0000 (19:23 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2013 19:23:15 +0000 (19:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121241

Patch by Christophe Dumez <ch.dumez@sisa.samsung.com> on 2013-09-12
Reviewed by Darin Adler.

Get rid of layering violations in PasteboardEfl.cpp. For now, just mimic
the Mac port to avoid divergences and leave port-specific functions
unimplemented as the EFL port does not support the pasteboard functionality
yet.

No new tests, no behavior change.

* PlatformEfl.cmake:
* editing/Editor.cpp:
(WebCore::Editor::pasteAsPlainTextWithPasteboard):
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::copyURL):
(WebCore::Editor::copyImage):
* editing/Editor.h:
* editing/efl/EditorEfl.cpp: Added.
(WebCore::Editor::writeSelectionToPasteboard):
(WebCore::Editor::writeURLToPasteboard):
(WebCore::Editor::writeImageToPasteboard):
(WebCore::Editor::readPlainTextFromPasteboard):
(WebCore::Editor::pasteWithPasteboard):
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* platform/Pasteboard.h:
* platform/efl/PasteboardEfl.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155638 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/PlatformEfl.cmake
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/efl/EditorEfl.cpp [new file with mode: 0644]
Source/WebCore/page/DragController.cpp
Source/WebCore/platform/Pasteboard.h
Source/WebCore/platform/efl/PasteboardEfl.cpp

index cc7f922..eefe939 100644 (file)
@@ -1,3 +1,36 @@
+2013-09-12  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        [EFL] Get rid of layering violations in PasteboardEfl.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=121241
+
+        Reviewed by Darin Adler.
+
+        Get rid of layering violations in PasteboardEfl.cpp. For now, just mimic
+        the Mac port to avoid divergences and leave port-specific functions
+        unimplemented as the EFL port does not support the pasteboard functionality
+        yet.
+
+        No new tests, no behavior change.
+
+        * PlatformEfl.cmake:
+        * editing/Editor.cpp:
+        (WebCore::Editor::pasteAsPlainTextWithPasteboard):
+        (WebCore::Editor::cut):
+        (WebCore::Editor::copy):
+        (WebCore::Editor::copyURL):
+        (WebCore::Editor::copyImage):
+        * editing/Editor.h:
+        * editing/efl/EditorEfl.cpp: Added.
+        (WebCore::Editor::writeSelectionToPasteboard):
+        (WebCore::Editor::writeURLToPasteboard):
+        (WebCore::Editor::writeImageToPasteboard):
+        (WebCore::Editor::readPlainTextFromPasteboard):
+        (WebCore::Editor::pasteWithPasteboard):
+        * page/DragController.cpp:
+        (WebCore::DragController::startDrag):
+        * platform/Pasteboard.h:
+        * platform/efl/PasteboardEfl.cpp:
+
 2013-09-12  Alberto Garcia  <berto@igalia.com>
 
         [GTK] Unreviewed build fix after r155635.
index 2549c92..c1ad7b5 100644 (file)
@@ -37,6 +37,8 @@ list(APPEND WebCore_SOURCES
 
     editing/atk/FrameSelectionAtk.cpp
 
+    editing/efl/EditorEfl.cpp
+
     loader/soup/CachedRawResourceSoup.cpp
     loader/soup/SubresourceLoaderSoup.cpp
 
index c12c7a6..052b809 100644 (file)
@@ -417,7 +417,7 @@ void Editor::pasteAsPlainTextBypassingDHTML()
 
 void Editor::pasteAsPlainTextWithPasteboard(Pasteboard& pasteboard)
 {
-#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL)
     String text = readPlainTextFromPasteboard(pasteboard);
 #else
     String text = pasteboard.plainText(&m_frame);
@@ -426,7 +426,7 @@ void Editor::pasteAsPlainTextWithPasteboard(Pasteboard& pasteboard)
         pasteAsPlainText(text, canSmartReplaceWithPasteboard(&pasteboard));
 }
 
-#if !PLATFORM(MAC)
+#if !PLATFORM(MAC) && !PLATFORM(EFL)
 void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText)
 {
     RefPtr<Range> range = selectedRange();
@@ -1052,7 +1052,7 @@ void Editor::cut()
         if (enclosingTextFormControl(m_frame.selection().start()))
             Pasteboard::createForCopyAndPaste()->writePlainText(selectedTextForClipboard(), canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
         else {
-#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL)
             writeSelectionToPasteboard(*Pasteboard::createForCopyAndPaste());
 #else
             // FIXME: Convert all other platforms to match Mac and delete this.
@@ -1080,13 +1080,13 @@ void Editor::copy()
     } else {
         Document* document = m_frame.document();
         if (HTMLImageElement* imageElement = imageElementFromImageDocument(document)) {
-#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL)
             writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *imageElement, document->url(), document->title());
 #else
             Pasteboard::createForCopyAndPaste()->writeImage(imageElement, document->url(), document->title());
 #endif
         } else {
-#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL)
             writeSelectionToPasteboard(*Pasteboard::createForCopyAndPaste());
 #else
             // FIXME: Convert all other platforms to match Mac and delete this.
@@ -1169,7 +1169,7 @@ void Editor::copyURL(const KURL& url, const String& title)
 
 void Editor::copyURL(const KURL& url, const String& title, Pasteboard& pasteboard)
 {
-#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL)
     writeURLToPasteboard(pasteboard, url, title);
 #else
     pasteboard.writeURL(url, title, &m_frame);
@@ -1186,7 +1186,7 @@ void Editor::copyImage(const HitTestResult& result)
     if (url.isEmpty())
         url = result.absoluteImageURL();
 
-#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if (PLATFORM(MAC) && !PLATFORM(IOS)) || PLATFORM(EFL)
     writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *element, url, result.altDisplayString());
 #else
     Pasteboard::createForCopyAndPaste()->writeImage(element, url, result.altDisplayString());
index fb155d1..1a65bc6 100644 (file)
@@ -397,11 +397,14 @@ public:
     NSDictionary* fontAttributesForSelectionStart() const;
     bool canCopyExcludingStandaloneImages();
     void takeFindStringFromSelection();
-    void writeSelectionToPasteboard(Pasteboard&);
     void readSelectionFromPasteboard(const String& pasteboardName);
     String stringSelectionForPasteboard();
     String stringSelectionForPasteboardWithImageAltText();
     PassRefPtr<SharedBuffer> dataSelectionForPasteboard(const String& pasteboardName);
+#endif
+
+#if PLATFORM(MAC) || PLATFORM(EFL)
+    void writeSelectionToPasteboard(Pasteboard&);
     void writeURLToPasteboard(Pasteboard&, const KURL&, const String& title);
     void writeImageToPasteboard(Pasteboard&, Element& imageElement, const KURL&, const String& title);
     String readPlainTextFromPasteboard(Pasteboard&);
diff --git a/Source/WebCore/editing/efl/EditorEfl.cpp b/Source/WebCore/editing/efl/EditorEfl.cpp
new file mode 100644 (file)
index 0000000..060057c
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Editor.h"
+
+#include "NotImplemented.h"
+#include "Pasteboard.h"
+
+namespace WebCore {
+
+void Editor::writeSelectionToPasteboard(Pasteboard&)
+{
+    notImplemented();
+}
+
+void Editor::writeURLToPasteboard(Pasteboard&, const KURL&, const String&)
+{
+    notImplemented();
+}
+
+void Editor::writeImageToPasteboard(Pasteboard&, Element&, const KURL&, const String&)
+{
+    notImplemented();
+}
+
+String Editor::readPlainTextFromPasteboard(Pasteboard&)
+{
+    notImplemented();
+    return String();
+}
+
+void Editor::pasteWithPasteboard(Pasteboard*, bool)
+{
+    notImplemented();
+}
+
+} // namespace WebCore
index 4a9fd0f..ae770ec 100644 (file)
@@ -793,7 +793,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
             if (enclosingTextFormControl(src->selection().start()))
                 clipboard->pasteboard().writePlainText(src->editor().selectedTextForClipboard(), Pasteboard::CannotSmartReplace);
             else {
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(EFL)
                 src->editor().writeSelectionToPasteboard(clipboard->pasteboard());
 #else
                 // FIXME: Convert all other platforms to match Mac and delete this.
@@ -835,7 +835,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
         if (!clipboard->pasteboard().hasData())
             // Simplify whitespace so the title put on the clipboard resembles what the user sees
             // on the web page. This includes replacing newlines with spaces.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(EFL)
             src->editor().writeURLToPasteboard(clipboard->pasteboard(), linkURL, hitTestResult.textContent().simplifyWhiteSpace());
 #else
             clipboard->pasteboard().writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), src);
index ee11576..5dc445d 100644 (file)
@@ -142,14 +142,16 @@ public:
     void setDragImage(DragImageRef, const IntPoint& hotSpot);
 #endif
 
+#if PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(WIN)
     PassRefPtr<DocumentFragment> documentFragment(Frame*, PassRefPtr<Range>, bool allowPlainText, bool& chosePlainText); // FIXME: Layering violation.
+#endif
 
-#if PLATFORM(EFL) || PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(QT) || PLATFORM(WIN)
+#if PLATFORM(GTK) || PLATFORM(IOS) || PLATFORM(QT) || PLATFORM(WIN)
     String plainText(Frame* = 0); // FIXME: Layering violation.
     void writeSelection(Range*, bool canSmartCopyOrDelete, Frame*, ShouldSerializeSelectedTextForClipboard = DefaultSelectedTextType); // FIXME: Layering violation.
 #endif
 
-#if PLATFORM(EFL) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WIN)
+#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WIN)
     void writeURL(const KURL&, const String&, Frame* = 0); // FIXME: Layering violation.
     void writeImage(Node*, const KURL&, const String& title); // FIXME: Layering violation.
 #endif
index bb834c9..f40dab7 100644 (file)
@@ -23,9 +23,7 @@
 #include "config.h"
 #include "Pasteboard.h"
 
-#include "DocumentFragment.h"
 #include "NotImplemented.h"
-#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
@@ -38,21 +36,6 @@ void Pasteboard::writePlainText(const String&, SmartReplaceOption)
     notImplemented();
 }
 
-void Pasteboard::writeSelection(Range*, bool, Frame*, ShouldSerializeSelectedTextForClipboard)
-{
-    notImplemented();
-}
-
-void Pasteboard::writeURL(const KURL&, const String&, Frame*)
-{
-    notImplemented();
-}
-
-void Pasteboard::writeImage(Node*, const KURL&, const String&)
-{
-    notImplemented();
-}
-
 void Pasteboard::clear()
 {
     notImplemented();
@@ -64,18 +47,6 @@ bool Pasteboard::canSmartReplace()
     return false;
 }
 
-PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame*, PassRefPtr<Range>, bool, bool&)
-{
-    notImplemented();
-    return 0;
-}
-
-String Pasteboard::plainText(Frame*)
-{
-    notImplemented();
-    return String();
-}
-
 PassOwnPtr<Pasteboard> Pasteboard::createForCopyAndPaste()
 {
     return adoptPtr(new Pasteboard);