WebCore:
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2008 18:51:16 +0000 (18:51 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2008 18:51:16 +0000 (18:51 +0000)
        Reviewed by Mitz.

        Make the code that sets the image title cross platform.

        * WebCore.xcodeproj/project.pbxproj:
        Remove ImageDocumentMac.

        * loader/ImageDocument.cpp:
        (WebCore::ImageTokenizer::finish):

        * loader/mac/ImageDocumentMac.h: Removed.
        * loader/mac/ImageDocumentMac.mm: Removed.

        * page/mac/WebCoreFrameBridge.h:
        * page/mac/WebCoreViewFactory.h:
        Move imageTitleForFilename:size from the bridge to
        the view factory.

        * platform/LocalizedStrings.h:
        Add imageTitle.

        * platform/mac/LocalizedStringsMac.mm:
        (WebCore::imageTitle):
        Have imageTitle call the view factory.

        * platform/qt/Localizations.cpp:
        (WebCore::imageTitle):
        * platform/wx/LocalizedStringsWx.cpp:
        (WebCore::imageTitle):
        * platform/gtk/LocalizedStringsGtk.cpp:
        (WebCore::imageTitle):
        Add stubs.

WebKit/mac:

        Reviewed by Mitz.

        * WebCoreSupport/WebFrameBridge.mm:
        * WebCoreSupport/WebViewFactory.mm:
        (-[WebViewFactory imageTitleForFilename:size:]):
        Move implementatino from WebFrameBridge to WebViewFactory.

WebKit/win:

        Reviewed by Mitz.

        * WebCoreLocalizedStrings.cpp:
        (WebCore::imageTitle):
        Add stub.

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

17 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/loader/ImageDocument.cpp
WebCore/loader/mac/ImageDocumentMac.h [deleted file]
WebCore/loader/mac/ImageDocumentMac.mm [deleted file]
WebCore/page/mac/WebCoreFrameBridge.h
WebCore/page/mac/WebCoreViewFactory.h
WebCore/platform/LocalizedStrings.h
WebCore/platform/gtk/LocalizedStringsGtk.cpp
WebCore/platform/mac/LocalizedStringsMac.mm
WebCore/platform/qt/Localizations.cpp
WebCore/platform/wx/LocalizedStringsWx.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebFrameBridge.mm
WebKit/mac/WebCoreSupport/WebViewFactory.mm
WebKit/win/ChangeLog
WebKit/win/WebCoreLocalizedStrings.cpp

index ed6d1f4..649eb3e 100644 (file)
@@ -1,3 +1,38 @@
+2008-02-12  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Mitz.
+
+        Make the code that sets the image title cross platform.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Remove ImageDocumentMac.
+        
+        * loader/ImageDocument.cpp:
+        (WebCore::ImageTokenizer::finish):
+
+        * loader/mac/ImageDocumentMac.h: Removed.
+        * loader/mac/ImageDocumentMac.mm: Removed.
+        
+        * page/mac/WebCoreFrameBridge.h:
+        * page/mac/WebCoreViewFactory.h:
+        Move imageTitleForFilename:size from the bridge to
+        the view factory.
+        
+        * platform/LocalizedStrings.h:
+        Add imageTitle.
+        
+        * platform/mac/LocalizedStringsMac.mm:
+        (WebCore::imageTitle):
+        Have imageTitle call the view factory.
+        
+        * platform/qt/Localizations.cpp:
+        (WebCore::imageTitle):
+        * platform/wx/LocalizedStringsWx.cpp:
+        (WebCore::imageTitle):
+        * platform/gtk/LocalizedStringsGtk.cpp:
+        (WebCore::imageTitle):
+        Add stubs.
+        
 2008-02-12  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by NOBODY (Build fix).
index b6f7b9f..0e2c43f 100644 (file)
                939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939885C108B7E3D100E707C4 /* EventNames.cpp */; };
                939885C408B7E3D100E707C4 /* EventNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 939885C208B7E3D100E707C4 /* EventNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
                939B3E4E0D3C1E8400B4A92B /* StringBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 939B3E4D0D3C1E8400B4A92B /* StringBuffer.h */; };
-               93A1EAA00A5634C9006960A0 /* ImageDocumentMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */; };
-               93A1EAA80A563508006960A0 /* ImageDocumentMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 93A1EAA70A563508006960A0 /* ImageDocumentMac.h */; };
                93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93A38B4A0D0E5808006872C2 /* EditorCommand.cpp */; };
                93B6A0E60B0BCA5C00F5027A /* ContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93B6A0E80B0BCA6700F5027A /* ContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */; };
                939885C108B7E3D100E707C4 /* EventNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventNames.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                939885C208B7E3D100E707C4 /* EventNames.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = EventNames.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                939B3E4D0D3C1E8400B4A92B /* StringBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuffer.h; sourceTree = "<group>"; };
-               93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageDocumentMac.mm; sourceTree = "<group>"; };
-               93A1EAA70A563508006960A0 /* ImageDocumentMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDocumentMac.h; sourceTree = "<group>"; };
                93A38B4A0D0E5808006872C2 /* EditorCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditorCommand.cpp; sourceTree = "<group>"; };
                93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenu.h; sourceTree = "<group>"; };
                93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ContextMenu.cpp; sourceTree = "<group>"; };
                93A1EAA20A5634D8006960A0 /* mac */ = {
                        isa = PBXGroup;
                        children = (
-                               93A1EAA70A563508006960A0 /* ImageDocumentMac.h */,
-                               93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */,
                                656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */,
                                656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.m */,
                                51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */,
                                B27535700B053814002CE64F /* Image.h in Headers */,
                                B2A10B920B3818BD00099AA4 /* ImageBuffer.h in Headers */,
                                1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */,
-                               93A1EAA80A563508006960A0 /* ImageDocumentMac.h in Headers */,
                                BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */,
                                B27535710B053814002CE64F /* ImageSource.h in Headers */,
                                DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
                                B2A10B940B3818D700099AA4 /* ImageBufferCG.cpp in Sources */,
                                B275355E0B053814002CE64F /* ImageCG.cpp in Sources */,
                                1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */,
-                               93A1EAA00A5634C9006960A0 /* ImageDocumentMac.mm in Sources */,
                                B275357B0B053814002CE64F /* ImageMac.mm in Sources */,
                                B275355F0B053814002CE64F /* ImageSourceCG.cpp in Sources */,
                                DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
index f622a52..819d6c5 100644 (file)
@@ -35,6 +35,7 @@
 #include "FrameView.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
+#include "LocalizedStrings.h"
 #include "MouseEvent.h"
 #include "Page.h"
 #include "SegmentedString.h"
@@ -120,11 +121,11 @@ void ImageTokenizer::finish()
         cachedImage->finish();
 
         cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());
-        
-        // FIXME: Need code to set the title for platforms other than Mac OS X.
-#if PLATFORM(MAC)
-        finishImageLoad(m_doc, cachedImage);
-#endif
+
+        IntSize size = cachedImage->imageSize();
+        if (size.width())
+            m_doc->setTitle(imageTitle(cachedImage->response().suggestedFilename(), size));
+
         m_doc->imageChanged();
     }
 
diff --git a/WebCore/loader/mac/ImageDocumentMac.h b/WebCore/loader/mac/ImageDocumentMac.h
deleted file mode 100644 (file)
index 3c7c509..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  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,
- * 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. 
- */
-
-#ifndef ImageDocumentMac_h
-#define ImageDocumentMac_h
-
-namespace WebCore {
-
-    class CachedImage;
-    class Document;
-
-    void finishImageLoad(Document*, CachedImage*);
-
-}
-
-#endif
diff --git a/WebCore/loader/mac/ImageDocumentMac.mm b/WebCore/loader/mac/ImageDocumentMac.mm
deleted file mode 100644 (file)
index 755f448..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  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,
- * 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. 
- */
-
-#import "config.h"
-#import "ImageDocumentMac.h"
-
-#include "CachedImage.h"
-#include "Document.h"
-#include "FrameLoader.h"
-#include "Frame.h"
-#include "WebCoreFrameBridge.h"
-#include "DocumentLoader.h"
-
-namespace WebCore {
-    
-void finishImageLoad(Document* document, CachedImage* image)
-{
-    Frame* frame = document->frame();
-    const ResourceResponse& response = frame->loader()->documentLoader()->response();
-
-    IntSize size = image->imageSize();
-    if (size.width())
-        document->setTitle([frame->bridge() imageTitleForFilename:response.suggestedFilename() size:size]);
-}
-    
-}
index a67f1b3..76315f7 100644 (file)
@@ -238,8 +238,6 @@ enum WebScrollGranularity {
 
 - (WebCore::KeyboardUIMode)keyboardUIMode;
 
-- (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size;
-
 @end
 
 // This interface definition allows those who hold a WebCoreFrameBridge * to call all the methods
index 55514ed..4cf21e3 100644 (file)
@@ -98,6 +98,8 @@
 
 - (NSString *)defaultLanguageCode;
 
+- (NSString *)imageTitleForFilename:(NSString *)filename size:(NSSize)size;
+
 - (BOOL)objectIsTextMarker:(id)object;
 - (BOOL)objectIsTextMarkerRange:(id)object;
 
index a61f3ce..f640c78 100644 (file)
@@ -29,7 +29,8 @@
 namespace WebCore {
 
     class String;
-
+    class IntSize;
+    
     String inputElementAltText();
     String resetButtonDefaultLabel();
     String searchableIndexIntroduction();
@@ -105,6 +106,8 @@ namespace WebCore {
     String uploadFileText();
     String allFilesText();
 #endif
+
+    String imageTitle(const String& filename, const IntSize& size);
 }
 
 #endif
index 041cd83..4be5ba1 100644 (file)
@@ -290,4 +290,9 @@ String unknownFileSizeText()
     return String::fromUTF8(_("Unknown"));
 }
 
+String imageTitle(const String& filename, const IntSize& size)
+{
+    return String();
+}
+
 }
index f5b208d..d4af7cd 100644 (file)
@@ -27,6 +27,7 @@
 #import "LocalizedStrings.h"
 
 #import "BlockExceptions.h"
+#import "IntSize.h"
 #import "PlatformString.h"
 #import "WebCoreViewFactory.h"
 
@@ -504,4 +505,12 @@ String unknownFileSizeText()
     return String();
 }
 
+String imageTitle(const String& filename, const IntSize& size)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    return [[WebCoreViewFactory sharedFactory] imageTitleForFilename:filename size:size];
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return String();
+}
+
 }
index 67bba22..04ff37e 100644 (file)
@@ -297,5 +297,10 @@ String unknownFileSizeText()
     return QCoreApplication::translate("QWebPage", "Unknown", "Unknown filesize FTP directory listing item");
 }
 
+String imageTitle(const String& filename, const IntSize& size)
+{
+    return String();
+}
+
 }
 // vim: ts=4 sw=4 et
index 368f938..6b01363 100644 (file)
@@ -264,4 +264,9 @@ String unknownFileSizeText()
     return String("Unknown");
 }
 
+String imageTitle(const String& filename, const IntSize& size)
+{
+    return String();
+}
+
 } // namespace WebCore
index cd77c5e..aca117b 100644 (file)
@@ -1,3 +1,12 @@
+2008-02-12  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Mitz.
+
+        * WebCoreSupport/WebFrameBridge.mm:
+        * WebCoreSupport/WebViewFactory.mm:
+        (-[WebViewFactory imageTitleForFilename:size:]):
+        Move implementatino from WebFrameBridge to WebViewFactory.
+
 2008-02-11  Darin Adler  <darin@apple.com>
 
         Reviewed by Mitz.
index 9440f2d..8e0ba51 100644 (file)
@@ -738,9 +738,4 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
         [highlighter paintHighlightForBox:boxRect onLine:lineRect behindText:text entireLine:line];
 }
 
-- (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size
-{
-    return [NSString stringWithFormat:UI_STRING("%@ %.0f×%.0f pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename, size.width, size.height];
-}
-
 @end
index e7174fe..c524b4b 100644 (file)
     return UI_STRING("Unknown", "Unknown filesize FTP directory listing item");
 }
 
+- (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size
+{
+    return [NSString stringWithFormat:UI_STRING("%@ %.0f×%.0f pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename, size.width, size.height];
+}
+
 @end
index 0785589..5eb2205 100644 (file)
@@ -1,3 +1,11 @@
+2008-02-12  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Mitz.
+
+        * WebCoreLocalizedStrings.cpp:
+        (WebCore::imageTitle):
+        Add stub.
+        
 2008-02-07  Ada Chan  <adachan@apple.com>
 
         <rdar://problem/5292433> certificate authentication support broken in Safari 3.0
index 0447e5b..44ef0e0 100644 (file)
@@ -83,3 +83,4 @@ String WebCore::AXHeadingText() { return String(LPCTSTR_UI_STRING("heading", "ac
 String WebCore::unknownFileSizeText() { return String(LPCTSTR_UI_STRING("Unknown", "Unknown filesize FTP directory listing item")); }
 String WebCore::uploadFileText() { return String(LPCTSTR_UI_STRING("Upload file", "(Windows) Form submit file upload dialog title")); }
 String WebCore::allFilesText() { return String(LPCTSTR_UI_STRING("All Files", "(Windows) Form submit file upload all files pop-up")); }
+String WebCore::imageTitle(const String& filename, const IntSize& size) { return String(); }