summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 21:25:51 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 21:25:51 +0000
commit3e43abd431ea6358a6637f09ba0659a4eb946633 (patch)
tree1b4fb4112c19a33fdbb80b379014ffc30082ff8f
parenta3b006eeabf17338e01dee885e9dfd19ec514c92 (diff)
downloadchromium_src-3e43abd431ea6358a6637f09ba0659a4eb946633.zip
chromium_src-3e43abd431ea6358a6637f09ba0659a4eb946633.tar.gz
chromium_src-3e43abd431ea6358a6637f09ba0659a4eb946633.tar.bz2
More fixes for port. Don't build GKURLMac since we hopefully won't need
NSURL<->GKURL conversions any longer. Make a couple changes to DragData just to get it to build, since we don't care about drag and drop right now. Provide key codes for the Mac based on Apple's 1992 docs on the subject. Review URL: http://codereview.chromium.org/8070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3769 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/port/platform/GKURLMac.mm68
-rw-r--r--webkit/port/platform/chromium/DragDataChromium.cpp5
-rw-r--r--webkit/port/platform/chromium/PopupMenuChromium.cpp5
-rw-r--r--webkit/port/platform/mac/KeyboardCodes.h61
-rw-r--r--webkit/webkit.xcodeproj/project.pbxproj4
5 files changed, 71 insertions, 72 deletions
diff --git a/webkit/port/platform/GKURLMac.mm b/webkit/port/platform/GKURLMac.mm
deleted file mode 100644
index a911387..0000000
--- a/webkit/port/platform/GKURLMac.mm
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "KURL.h"
-#include "FoundationExtras.h"
-
-// TODO(playmobil): Write unit tests for this file.
-
-#ifdef USE_GOOGLE_URL_LIBRARY
-
-namespace WebCore {
-
-CFURLRef KURL::createCFURL() const {
- const CString &utf8_url = m_url.utf8String();
- // NOTE: We use UTF-8 here since this encoding is used when computing strings
- // when returning URL components (e.g calls to NSURL -path). However, this
- // function is not tolerant of illegal UTF-8 sequences, which could either be
- // a malformed string or bytes in a different encoding, like Shift-JIS, so we
- // fall back onto using ISO Latin-1 in those cases.
- CFURLRef result = CFURLCreateAbsoluteURLWithBytes(
- 0,
- reinterpret_cast<const UInt8*>(utf8_url.data()),
- utf8_url.length(),
- kCFStringEncodingUTF8,
- 0,
- true);
- if (!result)
- result = CFURLCreateAbsoluteURLWithBytes(0,
- reinterpret_cast<const UInt8*>(
- utf8_url.data()),
- utf8_url.length(),
- kCFStringEncodingISOLatin1,
- 0,
- true);
- return result;
-}
-
-
-// TODO(playmobil): also implement the KURL::KURL(CFURLRef) version.
-KURL::KURL(NSURL *url) {
- if (!url) {
- init(KURL(), String(), NULL);
- } else {
- CFIndex bytesLength = CFURLGetBytes(reinterpret_cast<CFURLRef>(url), 0, 0);
- Vector<char, 512> buffer(bytesLength + 1); // 1 for null character to end C string
- char* bytes = &buffer[0];
- CFURLGetBytes(reinterpret_cast<CFURLRef>(url), reinterpret_cast<UInt8*>(bytes), bytesLength);
- bytes[bytesLength] = '\0';
- init(KURL(), String(bytes, bytesLength), 0);
- }
-}
-
-KURL::operator NSURL* () const {
- if (!m_isValid)
- return nil;
-
- // CFURL can't hold an empty URL, unlike NSURL.
- if (isEmpty())
- return [NSURL URLWithString:@""];
-
- return HardAutorelease(createCFURL());
-}
-
-} // namespace WebCore
-
-#endif // USE_GOOGLE_URL_LIBRARY
diff --git a/webkit/port/platform/chromium/DragDataChromium.cpp b/webkit/port/platform/chromium/DragDataChromium.cpp
index 9ac0d5f..06ba4de 100644
--- a/webkit/port/platform/chromium/DragDataChromium.cpp
+++ b/webkit/port/platform/chromium/DragDataChromium.cpp
@@ -33,6 +33,8 @@
#include "ClipboardWin.h"
#include "ClipboardUtilitiesWin.h"
#include "WCDataObject.h"
+#else
+#include "Clipboard.h" // This and ClipboardWin.h should be ClipboardChromium.h
#endif
#include "DocumentFragment.h"
@@ -157,11 +159,14 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const
// if (PassRefPtr<DocumentFragment> fragment = fragmentFromFilenames(doc, m_platformDragData))
// return fragment;
+#if PLATFORM(WIN_OS)
+ // fragmentFromCF_HTML comes from ClipboardUtilitiesWin.
if (!m_platformDragData->cf_html.empty()) {
RefPtr<DocumentFragment> fragment = fragmentFromCF_HTML(doc,
webkit_glue::StdWStringToString(m_platformDragData->cf_html));
return fragment;
}
+#endif
if (!m_platformDragData->text_html.empty()) {
String url;
diff --git a/webkit/port/platform/chromium/PopupMenuChromium.cpp b/webkit/port/platform/chromium/PopupMenuChromium.cpp
index 75ea7a9..42e5d68 100644
--- a/webkit/port/platform/chromium/PopupMenuChromium.cpp
+++ b/webkit/port/platform/chromium/PopupMenuChromium.cpp
@@ -53,6 +53,11 @@
#include "RenderTheme.h"
#include "Widget.h"
#include "WidgetClientChromium.h"
+
+#if !PLATFORM(WIN_OS)
+#include "KeyboardCodes.h"
+#endif
+
#pragma warning(pop)
using namespace WTF;
diff --git a/webkit/port/platform/mac/KeyboardCodes.h b/webkit/port/platform/mac/KeyboardCodes.h
new file mode 100644
index 0000000..f080de0
--- /dev/null
+++ b/webkit/port/platform/mac/KeyboardCodes.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2008, Google 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:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * 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.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "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 THE COPYRIGHT
+// OWNER 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.
+
+#ifndef KeyboardCodes_h
+#define KeyboardCodes_h
+
+// Virtual key codes on the Mac haven't been documented since the good old
+// days. Seriously. The most recent documentation is from 1992, in the
+// Classic Mac OS days. Fortunately, the "extended keyboard" key codes
+// published then are the same virtual key codes used by Mac OS X today.
+//
+// Source: Inside Macintosh: Macintosh Toolbox Essentials (IM:Tb)
+// Chapter 2 - Event Manager: Using the Event Manager: Handling Low-Level
+// Events: Responding to Keyboard Events
+// Figure 2-10: Virtual key codes for the Apple Extended Keyboard II
+// HTML (with a low-ish-resolution image):
+// http://developer.apple.com/documentation/mac/Toolbox/Toolbox-40.html#MARKER-9-184
+// PDF (with a legible vector image, page 2-43):
+// http://developer.apple.com/documentation/mac/pdf/MacintoshToolboxEssentials.pdf
+
+// TODO(port): Don't reuse the names used by Windows. Pick new names and use
+// them here, and provide a Windows version of KeyboardCodes.h that defines
+// the new constants in terms of the VK_* names.
+enum {
+ VK_RETURN = 0x24,
+ VK_ESCAPE = 0x35,
+ VK_HOME = 0x73,
+ VK_PRIOR = 0x74, // Page Up
+ VK_END = 0x77,
+ VK_NEXT = 0x79, // Page Down
+ VK_DOWN = 0x7D,
+ VK_UP = 0x7E,
+};
+
+#endif // KeyboardCodes_h
diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj
index 36b23ee..92f7b29 100644
--- a/webkit/webkit.xcodeproj/project.pbxproj
+++ b/webkit/webkit.xcodeproj/project.pbxproj
@@ -423,7 +423,6 @@
AB8FE8A50E9BCD3E0051E7B4 /* GKURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8FE8A40E9BCD3E0051E7B4 /* GKURL.cpp */; };
B507F51C0E9BE98B00D16D77 /* PluginStubsMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B507F51B0E9BE98B00D16D77 /* PluginStubsMac.cpp */; };
B507F54E0E9BECC300D16D77 /* HTMLPlugInImageElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B507F54D0E9BECC300D16D77 /* HTMLPlugInImageElement.cpp */; };
- B507F6E90E9C06FD00D16D77 /* GKURLMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B507F6E70E9C06F400D16D77 /* GKURLMac.mm */; };
B50F5BE00E96D3F800AD71A6 /* WebCoreObjCExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = B50F5BDF0E96D3F800AD71A6 /* WebCoreObjCExtras.mm */; };
B51C76C00E9BC7A400D9DFC4 /* GradientCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B51C76BF0E9BC7A400D9DFC4 /* GradientCG.cpp */; };
B51C76CF0E9BC8D100D9DFC4 /* RenderMarquee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B51C76CE0E9BC8D100D9DFC4 /* RenderMarquee.cpp */; };
@@ -3831,7 +3830,6 @@
ABA23E6B0E9FC43700C96905 /* Navigator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Navigator.cpp; sourceTree = "<group>"; };
B507F51B0E9BE98B00D16D77 /* PluginStubsMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginStubsMac.cpp; sourceTree = "<group>"; };
B507F54D0E9BECC300D16D77 /* HTMLPlugInImageElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInImageElement.cpp; sourceTree = "<group>"; };
- B507F6E70E9C06F400D16D77 /* GKURLMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GKURLMac.mm; sourceTree = "<group>"; };
B50F5BDF0E96D3F800AD71A6 /* WebCoreObjCExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebCoreObjCExtras.mm; path = pending/WebCoreObjCExtras.mm; sourceTree = SOURCE_ROOT; };
B51C76BF0E9BC7A400D9DFC4 /* GradientCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GradientCG.cpp; sourceTree = "<group>"; };
B51C76CD0E9BC8D100D9DFC4 /* RenderMarquee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMarquee.h; sourceTree = "<group>"; };
@@ -6896,7 +6894,6 @@
E45628270E269688005E4685 /* network */,
E4D08FDA0EAE7A5F0022CE54 /* EditorMac.mm */,
AB8FE8A40E9BCD3E0051E7B4 /* GKURL.cpp */,
- B507F6E70E9C06F400D16D77 /* GKURLMac.mm */,
B507F51B0E9BE98B00D16D77 /* PluginStubsMac.cpp */,
E473F66D0EAE012D006C2098 /* SSLKeyGeneratorChromium.cpp */,
E473F66F0EAE016A006C2098 /* SystemTimeChromium.cpp */,
@@ -8698,7 +8695,6 @@
7B2B0A5F0E3143EC00D4C6B7 /* GIFImageDecoder.cpp in Sources */,
7B2B0A610E3143EC00D4C6B7 /* GIFImageReader.cpp in Sources */,
AB8FE8A50E9BCD3E0051E7B4 /* GKURL.cpp in Sources */,
- B507F6E90E9C06FD00D16D77 /* GKURLMac.mm in Sources */,
4D7B071F0E9DAE56009A6919 /* GraphicsContextStub.cpp in Sources */,
E45627EB0E2694B8005E4685 /* ICOImageDecoder.cpp in Sources */,
E4E4C94A0E797648009A687C /* ImageSourceCG.cpp in Sources */,