Add a function to set empty clients to a PageClients
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 02:27:01 +0000 (02:27 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 02:27:01 +0000 (02:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83555

Reviewed by Adam Barth.

No new tests because of no behavior change.

* CMakeLists.txt: Add EmptyClients.cpp.
* GNUmakefile.list.am: ditto.
* Target.pri: ditto.
* WebCore.gypi: ditto.
* WebCore.vcproj/WebCore.vcproj: ditto.
* WebCore.xcodeproj/project.pbxproj: ditto.

* loader/EmptyClients.cpp: Added.
(WebCore::fillWithEmptyClients): Some code was moved from SVGImage::dataChanged().
* loader/EmptyClients.h: Add the declaration of fillWithEmptyClients().
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged): Moved some code to fillWithEmptyClients().

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

Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.cpp [new file with mode: 0644]
Source/WebCore/loader/EmptyClients.h
Source/WebCore/svg/graphics/SVGImage.cpp

index 2c5d455..10c185f 100644 (file)
@@ -960,6 +960,7 @@ SET(WebCore_SOURCES
     loader/DocumentLoader.cpp
     loader/DocumentThreadableLoader.cpp
     loader/DocumentWriter.cpp
+    loader/EmptyClients.cpp
     loader/FTPDirectoryParser.cpp
     loader/FormState.cpp
     loader/FormSubmission.cpp
index a08d40f..eaeac40 100644 (file)
@@ -1,3 +1,25 @@
+2012-04-10  Kent Tamura  <tkent@chromium.org>
+
+        Add a function to set empty clients to a PageClients
+        https://bugs.webkit.org/show_bug.cgi?id=83555
+
+        Reviewed by Adam Barth.
+
+        No new tests because of no behavior change.
+
+        * CMakeLists.txt: Add EmptyClients.cpp.
+        * GNUmakefile.list.am: ditto.
+        * Target.pri: ditto.
+        * WebCore.gypi: ditto.
+        * WebCore.vcproj/WebCore.vcproj: ditto.
+        * WebCore.xcodeproj/project.pbxproj: ditto.
+
+        * loader/EmptyClients.cpp: Added.
+        (WebCore::fillWithEmptyClients): Some code was moved from SVGImage::dataChanged().
+        * loader/EmptyClients.h: Add the declaration of fillWithEmptyClients().
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::dataChanged): Moved some code to fillWithEmptyClients().
+
 2012-04-10  James Robinson  <jamesr@chromium.org>
 
         [chromium] Fold LayerChromium::updateCompositorResources into main update
index d367348..0884715 100644 (file)
@@ -2773,6 +2773,7 @@ webcore_sources += \
        Source/WebCore/loader/DocumentThreadableLoaderClient.h \
        Source/WebCore/loader/DocumentWriter.cpp \
        Source/WebCore/loader/DocumentWriter.h \
+       Source/WebCore/loader/EmptyClients.cpp \
        Source/WebCore/loader/EmptyClients.h \
        Source/WebCore/loader/FormState.cpp \
        Source/WebCore/loader/FormState.h \
index 7819521..9e6ab93 100644 (file)
@@ -952,6 +952,7 @@ SOURCES += \
     loader/DocumentLoader.cpp \
     loader/DocumentThreadableLoader.cpp \
     loader/DocumentWriter.cpp \
+    loader/EmptyClients.cpp \
     loader/FormState.cpp \
     loader/FormSubmission.cpp \
     loader/FrameLoader.cpp \
index f0a91e1..f19d0cf 100644 (file)
             'loader/DocumentThreadableLoader.h',
             'loader/DocumentThreadableLoaderClient.h',
             'loader/DocumentWriter.cpp',
+            'loader/EmptyClients.cpp',
             'loader/EmptyClients.h',
             'loader/FTPDirectoryParser.cpp',
             'loader/FTPDirectoryParser.h',
index 2176437..0edd165 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\loader\EmptyClients.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\loader\EmptyClients.h"
                                >
                        </File>
index 7239fd6..b975bff 100644 (file)
                F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */; };
                F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */; };
                F5142C69123F12B000F5BD4C /* LocalizedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = F5142C68123F12B000F5BD4C /* LocalizedNumber.h */; };
+               F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; };
                F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; };
                F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */; };
                F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */; };
                F523D27902DE43D7018635CA /* TextResourceDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextResourceDecoder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F523D30302DE4476018635CA /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Range.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmptyClients.cpp; sourceTree = "<group>"; };
                F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTextInputType.cpp; sourceTree = "<group>"; };
                F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTextInputType.h; sourceTree = "<group>"; };
                F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonInputType.cpp; sourceTree = "<group>"; };
                                0B9056160F2578BE0095FF6A /* DocumentThreadableLoader.h */,
                                9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */,
                                9738899F116EA9DC00ADF313 /* DocumentWriter.h */,
+                               F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */,
                                B255990D0D00D8B900BB825C /* EmptyClients.h */,
                                656D37230ADBA5DE00A4554D /* FormState.cpp */,
                                656D37220ADBA5DE00A4554D /* FormState.h */,
                                2CF6878814D32EB500340F39 /* ElementAttributeData.cpp in Sources */,
                                A8CFF6CB0A1561CD000A4234 /* EllipsisBox.cpp in Sources */,
                                F55B3DBB1251F12D003EF269 /* EmailInputType.cpp in Sources */,
+                               F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */,
                                A8EA7EC10A1945D000A8EF5F /* EntityReference.cpp in Sources */,
                                8987855B122CA064003AABDA /* Entry.cpp in Sources */,
                                8987855D122CA064003AABDA /* EntryArray.cpp in Sources */,
diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp
new file mode 100644 (file)
index 0000000..480882e
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. 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 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 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 "EmptyClients.h"
+
+#if ENABLE(SVG) || ENABLE(PAGE_POPUP)
+#include "FileChooser.h"
+#include "FormState.h"
+#include "HTMLFormElement.h"
+
+namespace WebCore {
+
+void fillWithEmptyClients(Page::PageClients& pageClients)
+{
+#if ENABLE(CONTEXT_MENUS)
+    static ContextMenuClient* dummyContextMenuClient = adoptPtr(new EmptyContextMenuClient).leakPtr();
+    pageClients.contextMenuClient = dummyContextMenuClient;
+#endif
+
+#if ENABLE(DRAG_SUPPORT)
+    static DragClient* dummyDragClient = adoptPtr(new EmptyDragClient).leakPtr();
+    pageClients.dragClient = dummyDragClient;
+#endif
+
+    static EditorClient* dummyEditorClient = adoptPtr(new EmptyEditorClient).leakPtr();
+    pageClients.editorClient = dummyEditorClient;
+
+    static InspectorClient* dummyInspectorClient = adoptPtr(new EmptyInspectorClient).leakPtr();
+    pageClients.inspectorClient = dummyInspectorClient;
+}
+
+}
+#endif
index 2e94ce2..744a516 100644 (file)
@@ -42,6 +42,7 @@
 #include "FrameLoaderClient.h"
 #include "FrameNetworkingContext.h"
 #include "InspectorClient.h"
+#include "Page.h"
 #include "PopupMenu.h"
 #include "ResourceError.h"
 #include "SearchPopupMenu.h"
@@ -615,6 +616,8 @@ public:
     virtual void deviceOrientationControllerDestroyed() { }
 };
 
+void fillWithEmptyClients(Page::PageClients&);
+
 }
 
 #endif // EmptyClients_h
index d35028a..1e611b4 100644 (file)
@@ -326,20 +326,9 @@ bool SVGImage::dataChanged(bool allDataReceived)
         static FrameLoaderClient* dummyFrameLoaderClient =  new EmptyFrameLoaderClient;
 
         Page::PageClients pageClients;
+        fillWithEmptyClients(pageClients);
         m_chromeClient = adoptPtr(new SVGImageChromeClient(this));
         pageClients.chromeClient = m_chromeClient.get();
-#if ENABLE(CONTEXT_MENUS)
-        static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient;
-        pageClients.contextMenuClient = dummyContextMenuClient;
-#endif
-        static EditorClient* dummyEditorClient = new EmptyEditorClient;
-        pageClients.editorClient = dummyEditorClient;
-#if ENABLE(DRAG_SUPPORT)
-        static DragClient* dummyDragClient = new EmptyDragClient;
-        pageClients.dragClient = dummyDragClient;
-#endif
-        static InspectorClient* dummyInspectorClient = new EmptyInspectorClient;
-        pageClients.inspectorClient = dummyInspectorClient;
 
         // FIXME: If this SVG ends up loading itself, we might leak the world.
         // The Cache code does not know about CachedImages holding Frames and